[Jifty-commit] jifty branch, master, updated. 4678e73c3ae20cc275d5fc32ceccd02d444d8f9d
Jifty commits
jifty-commit at lists.jifty.org
Thu May 20 16:01:29 EDT 2010
The branch, master has been updated
via 4678e73c3ae20cc275d5fc32ceccd02d444d8f9d (commit)
from e59e393aa4ed258973b761caf636c8301d77d0ea (commit)
Summary of changes:
lib/Jifty/Web/Session.pm | 10 ++++++++++
lib/Jifty/Web/Session/ApacheSession.pm | 14 ++++++++++++++
lib/Jifty/Web/Session/ClientSide.pm | 17 +++++++++++++++++
lib/Jifty/Web/Session/JDBI.pm | 13 +++++++++++++
lib/Jifty/Web/Session/None.pm | 8 ++++++++
5 files changed, 62 insertions(+), 0 deletions(-)
- Log -----------------------------------------------------------------
commit 4678e73c3ae20cc275d5fc32ceccd02d444d8f9d
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Thu May 20 16:01:36 2010 -0400
Add a way to create a new session, explicitly
diff --git a/lib/Jifty/Web/Session.pm b/lib/Jifty/Web/Session.pm
index 0a1668e..3fa583f 100644
--- a/lib/Jifty/Web/Session.pm
+++ b/lib/Jifty/Web/Session.pm
@@ -43,6 +43,16 @@ sub id {
die "Subclass must implement 'id'";
}
+=head2 create
+
+Assign a new ID, and store it server-side if necessary.
+
+=cut
+
+sub create {
+ die "Subclass must implement 'create'";
+}
+
=head2 load [ID]
Load up the current session from the given C<ID>, or the appropriate
diff --git a/lib/Jifty/Web/Session/ApacheSession.pm b/lib/Jifty/Web/Session/ApacheSession.pm
index 15c3646..d397555 100644
--- a/lib/Jifty/Web/Session/ApacheSession.pm
+++ b/lib/Jifty/Web/Session/ApacheSession.pm
@@ -59,6 +59,20 @@ sub id {
return $self->loaded ? $self->_session->{_session_id} : undef;
}
+=head2 create
+
+Creates a new session.
+
+=cut
+
+sub create {
+ my $self = shift;
+ my %session;
+ my $options = Jifty->config->framework('Web')->{'SessionOptions'};
+ tie %session => $self->{_backend_class}, undef, $options;
+ $self->{_session} = \%session;
+}
+
=head2 load [ID]
Load up the current session from the given C<ID>, or the appropriate
diff --git a/lib/Jifty/Web/Session/ClientSide.pm b/lib/Jifty/Web/Session/ClientSide.pm
index dc6d986..ff46c0b 100644
--- a/lib/Jifty/Web/Session/ClientSide.pm
+++ b/lib/Jifty/Web/Session/ClientSide.pm
@@ -71,6 +71,23 @@ sub id {
return $self->loaded ? $self->_session->{session_id} : undef;
}
+=head2 create
+
+Since there is no server-side storage, this simply clears the object's
+local state.
+
+=cut
+
+sub create {
+ my $self = shift;
+ $self->_session({
+ session_id => Jifty::Model::Session->new_session_id,
+ continuation => {},
+ metadata => {},
+ key => {},
+ });
+}
+
=head2 load [ID]
Load up the current session from the given C<ID>, or the appropriate
diff --git a/lib/Jifty/Web/Session/JDBI.pm b/lib/Jifty/Web/Session/JDBI.pm
index f07d432..3c3b374 100644
--- a/lib/Jifty/Web/Session/JDBI.pm
+++ b/lib/Jifty/Web/Session/JDBI.pm
@@ -45,6 +45,19 @@ sub id {
return $self->loaded ? $self->_session->session_id : undef;
}
+=head2 create
+
+Creates a new row in the L<Jifty::Model::Session> table.
+
+=cut
+
+sub create {
+ my $self = shift;
+ my $session = Jifty::Model::Session->new;
+ $session->create( key_type => "session" );
+ $self->_session($session);
+}
+
=head2 load [ID]
Load up the current session from the given C<ID>, or the appropriate
diff --git a/lib/Jifty/Web/Session/None.pm b/lib/Jifty/Web/Session/None.pm
index ed323b1..58e1c53 100644
--- a/lib/Jifty/Web/Session/None.pm
+++ b/lib/Jifty/Web/Session/None.pm
@@ -56,6 +56,14 @@ Returns false.
sub id {return undef }
+=head2 create
+
+Returns true.
+
+=cut
+
+sub create { return 1}
+
=head2 load
Returns true.
-----------------------------------------------------------------------
More information about the Jifty-commit
mailing list