[Jifty-commit] r515 - in jifty/trunk: . lib/Jifty lib/Jifty/Manual
lib/Jifty/Web share/web/templates
t/Continuations/web/templates t/Mapper/web/templates
t/TestApp t/TestApp/bin t/TestApp/t
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Tue Jan 17 21:24:12 EST 2006
Author: alexmv
Date: Tue Jan 17 21:24:09 2006
New Revision: 515
Removed:
jifty/trunk/lib/Jifty/MasonInterp.pm
jifty/trunk/t/TestApp/Makefile.PL
jifty/trunk/t/TestApp/etc/
Modified:
jifty/trunk/ (props changed)
jifty/trunk/META.yml
jifty/trunk/lib/Jifty/Continuation.pm
jifty/trunk/lib/Jifty/Dispatcher.pm
jifty/trunk/lib/Jifty/Everything.pm
jifty/trunk/lib/Jifty/Handler.pm
jifty/trunk/lib/Jifty/Manual/Tutorial.pod
jifty/trunk/lib/Jifty/Request.pm
jifty/trunk/lib/Jifty/Response.pm
jifty/trunk/lib/Jifty/Server.pm
jifty/trunk/lib/Jifty/Web.pm
jifty/trunk/lib/Jifty/Web/Session.pm
jifty/trunk/share/web/templates/autohandler
jifty/trunk/t/Continuations/web/templates/autohandler
jifty/trunk/t/Mapper/web/templates/autohandler
jifty/trunk/t/TestApp/bin/jifty
jifty/trunk/t/TestApp/t/16-images.t
Log:
r8670 at zoq-fot-pik: chmrr | 2006-01-17 21:23:28 -0500
* Dispatcher calls Jifty::Web and Mason, not the other way around
* Do away with setup_actions
* Stop using mason notes
Modified: jifty/trunk/META.yml
==============================================================================
--- jifty/trunk/META.yml (original)
+++ jifty/trunk/META.yml Tue Jan 17 21:24:09 2006
@@ -41,7 +41,6 @@
HTTP::Server::Simple::Recorder: 0
Hash::Merge: 0
Hook::LexWrap: 0
- JSON: 0
Jifty::DBI: 0.06
Locale::Maketext::Simple: 0
Log::Log4perl: 0
@@ -67,7 +66,6 @@
WWW::Mechanize: 1.12
XML::Writer: 0
XML::XPath: 0
- YAML: 0
perl: 5.8.3
version: 0
tests: t/*.t t/*/t/*.t
Modified: jifty/trunk/lib/Jifty/Continuation.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Continuation.pm (original)
+++ jifty/trunk/lib/Jifty/Continuation.pm Tue Jan 17 21:24:09 2006
@@ -14,10 +14,9 @@
re-visit that context later by providing the continuation again.
Continuations are stored on the user's session.
-Continuations store a L<Jifty::Request> object, the contents of the
-mason C<notes> hash, and the L<Jifty::Response> object for the
-request. They can also store arbitrary code to be run when the
-continuation is called.
+Continuations store a L<Jifty::Request> object and the
+L<Jifty::Response> object for the request. They can also store
+arbitrary code to be run when the continuation is called.
Continuations can also be arbitrarily nested. This means that
returning from one continuation will drop you into the continuation
@@ -43,7 +42,7 @@
use base qw/Class::Accessor/;
__PACKAGE__->mk_accessors(qw(id parent
- request notes response code
+ request response code
));
=head2 new PARAMHASH
@@ -75,11 +74,6 @@
of the previous request into the continuation as well. Defaults to an
empty L<Jifty::Response> object.
-=item notes
-
-An anonymous hash of the contents of the
-L<HTML::Mason::Request/notes>.
-
=item code
An optional subroutine reference to evaluate when the continuation is
@@ -98,13 +92,12 @@
sub new {
my $class = shift;
- my $self = bless { notes => {}}, $class;
+ my $self = bless { }, $class;
my %args = (
parent => Jifty->web->request->continuation,
request => Jifty::Request->new(),
response => Jifty::Response->new(),
- notes => Jifty->web->mason->notes,
code => undef,
clone => undef,
@_
@@ -158,7 +151,6 @@
my $self = shift;
if (defined $self->request->path and $ENV{REQUEST_URI} ne $self->request->path . "?J:CALL=" . $self->id) {
-
# Clone our request
my $request = Clone::clone($self->request);
@@ -179,14 +171,13 @@
my $next = Jifty::Continuation->new(parent => $self->parent,
request => $request,
response => $response,
- notes => $self->notes,
code => $self->code,
);
$next->request->continuation(Jifty->web->session->get_continuation($next->parent))
if defined $next->parent;
# Redirect to right page if we're not there already
- Jifty->web->mason->redirect($next->request->path . "?J:CALL=" . $next->id);
+ Jifty->web->_redirect($next->request->path . "?J:CALL=" . $next->id);
} else {
# Pull state information out of the continuation and set it
# up; we use clone so that the continuation itself is
@@ -194,7 +185,6 @@
# TODO: maybe not use clone? Use something happier?
Jifty->web->response( Clone::clone($self->response) ) if $self->response;
- %{Jifty->web->mason->notes} = %{$self->notes};
$self->code->(Jifty->web->request)
if $self->code;
Jifty->web->_internal_request( Clone::clone($self->request) );
Modified: jifty/trunk/lib/Jifty/Dispatcher.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Dispatcher.pm (original)
+++ jifty/trunk/lib/Jifty/Dispatcher.pm Tue Jan 17 21:24:09 2006
@@ -57,10 +57,11 @@
the page the user requested or whatever else the system has decided to
display instead.
-Generally, this is B<not> the place to be performing model and user specific
-access control checks or updating your database based on what the user has sent
-in. You want to do that in your model classes. (Well, I<we> want you to do
-that, but you're free to ignore our advice).
+Generally, this is B<not> the place to be performing model and user
+specific access control checks or updating your database based on what
+the user has sent in. You want to do that in your model
+classes. (Well, I<we> want you to do that, but you're free to ignore
+our advice).
The Dispatcher runs rules in several stages:
@@ -68,42 +69,43 @@
=item before
-B<before> rules are run before Jifty evaluates actions. They're the perfect
-place to enable or disable L<Jifty::Action>s using L<Jifty::Web/allow_actions>
-and L<Jifty::Web/deny_actions> or to completely disallow user access to private
-I<component> templates such as the F<_elements> directory in a default Jifty
-application. They're also the right way to enable L<Jifty::LetMe> actions.
+B<before> rules are run before Jifty evaluates actions. They're the
+perfect place to enable or disable L<Jifty::Action>s using
+L<Jifty::Web/allow_actions> and L<Jifty::Web/deny_actions> or to
+completely disallow user access to private I<component> templates such
+as the F<_elements> directory in a default Jifty application. They're
+also the right way to enable L<Jifty::LetMe> actions.
-If you want to block Jifty from doing any updates on a C<GET> request, this
-is the place.
-
-You can entirely stop processing with the C<redirect> and C<abort> directives.
+You can entirely stop processing with the C<redirect> and C<abort>
+directives.
=item on
-B<on> rules are run after Jifty evaluates actions, so they have full access
-to the results actions users have performed. They're the right place
-to set up view-specific objects or load up values for your templates.
+L<on> rules are run after Jifty evaluates actions, so they have full
+access to the results actions users have performed. They're the right
+place to set up view-specific objects or load up values for your
+templates.
Dispatcher directives are evaluated in order until we get to either a
C<show>, C<redirect> or an C<abort>.
=item after
-B<after> rules let you clean up after rendering your page. Delete your cache
-files, write your transaction logs, whatever.
+L<after> rules let you clean up after rendering your page. Delete your
+cache files, write your transaction logs, whatever.
-At this point, it's too late to C<show>, C<redirect> or C<abort> page display.
+At this point, it's too late to C<show>, C<redirect> or C<abort> page
+display.
=back
-C<Jifty::Dispatcher> is intended to replace all the
-F<autohandler>, F<dhandler> and C<index.html> boilerplate code commonly
-found in Mason applications, but there's nothing stopping you from using
-those features in your application when they're more convenient.
+C<Jifty::Dispatcher> is intended to replace all the F<autohandler>,
+F<dhandler> and C<index.html> boilerplate code commonly found in Mason
+applications, but there's nothing stopping you from using those
+features in your application when they're more convenient.
-Each directive's code block runs in its own scope, but all share a common
-C<$Dispatcher> object.
+Each directive's code block runs in its own scope, but all share a
+common C<$Dispatcher> object.
=cut
@@ -244,7 +246,7 @@
sub default ($$@) { _ret @_ } # set parameter if it's not yet set
sub set ($$@) { _ret @_ } # set parameter
sub del ($@) { _ret @_ } # remove parameter
-sub get ($) { $Dispatcher->{args}{ $_[0] } }
+sub get ($) { $Dispatcher->{cgi}->param( $_[0] ) }
sub _qualify ($@);
sub GET ($) { _qualify method => @_ }
@@ -393,18 +395,15 @@
sub handle_request {
my $self = shift;
+ my ($cgi, $handler) = @_;
- my $m = Jifty->web->mason;
- my $path = $m->request_comp->path;
+ my $path = $cgi->path_info;
$path =~ s{/index\.html$}{};
- if ( $path =~ s{/dhandler$}{} ) {
- $path = join( '/', $path, $m->dhandler_arg );
- }
local $Dispatcher = $self->new(
- mason => Jifty->web->mason,
- args => { $m->request_args },
+ handler => $handler,
+ cgi => $cgi,
);
HANDLER: {
@@ -584,8 +583,7 @@
sub _do_redirect {
my ( $self, $path ) = @_;
- eval {Jifty->web->redirect($path);};
- die $@ if ( $@ and not UNIVERSAL::isa $@, 'HTML::Mason::Exception::Abort' ) ;
+ Jifty->web->redirect($path);
last_rule;
}
@@ -599,8 +597,6 @@
sub _do_abort {
my $self = shift;
- eval {Jifty->web->mason->abort(@_)};
- die $@ if ( $@ and not UNIVERSAL::isa $@, 'HTML::Mason::Exception::Abort' ) ;
last_rule;
}
@@ -617,14 +613,13 @@
my $self = shift;
my $path;
$path = shift if (@_);
+ $path ||= $self->{cgi}->path_info;
+ $path = "$self->{cwd}/$path" unless $path =~ m{^/};
+ $path .= "index.html" if $path =~ m{/$};
+
+ $self->{cgi}->path_info($path);
eval {
- if ( !defined $path )
- {
- Jifty->web->mason->call_next( %{ $self->{args} } );
- } else {
- $path = "$self->{cwd}/$path" unless $path =~ m{^/};
- Jifty->web->mason->comp( $path, %{ $self->{args} } );
- }
+ $self->{handler}->handle_cgi_object($self->{cgi});
};
die $@ if ( $@ and not UNIVERSAL::isa $@, 'HTML::Mason::Exception::Abort' ) ;
last_rule;
@@ -633,18 +628,18 @@
sub _do_set {
my ( $self, $key, $value ) = @_;
- $self->{args}{$key} = $value;
+ $self->{cgi}->param($key, $value);
}
sub _do_del {
my ( $self, $key ) = @_;
- delete $self->{args}{$key};
+ $self->{cgi}->delete($key);
}
sub _do_default {
my ( $self, $key, $value ) = @_;
- $self->{args}{$key} = $value
- unless defined $self->{args}{$key};
+ $self->{cgi}->param($key, $value)
+ unless defined $self->{cgi}->param($key);
}
=head2 _do_dispatch [PATH]
@@ -668,11 +663,11 @@
# Normalize the path.
$self->{path} =~ s{/+}{/}g;
$self->{path} =~ s{/$}{};
+
eval {
HANDLER: {
$self->_handle_rules( [ $self->rules('SETUP') ] );
- eval {Jifty->web->handle_request();};
- die $@ if ( $@ and not UNIVERSAL::isa $@, 'HTML::Mason::Exception::Abort' ) ;
+ Jifty->web->handle_request($self->{cgi});
$self->_handle_rules( [ $self->rules('RUN'), 'show' ] );
$self->_handle_rules( [ $self->rules('CLEANUP') ] );
}
@@ -760,7 +755,7 @@
sub _match_method {
my ( $self, $method ) = @_;
- lc( $self->{mason}->cgi_request->method ) eq lc($method);
+ lc( $self->{cgi}->method ) eq lc($method);
}
=head2 _compile_condition CONDITION
Modified: jifty/trunk/lib/Jifty/Everything.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Everything.pm (original)
+++ jifty/trunk/lib/Jifty/Everything.pm Tue Jan 17 21:24:09 2006
@@ -33,8 +33,6 @@
use Jifty::Logger ();
use Jifty::Handler ();
-use Jifty::MasonInterp ();
-
use Jifty::Model::Schema ();
Modified: jifty/trunk/lib/Jifty/Handler.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Handler.pm (original)
+++ jifty/trunk/lib/Jifty/Handler.pm Tue Jan 17 21:24:09 2006
@@ -39,8 +39,7 @@
=head2 mason_config
-Returns our Mason config. We use C<Jifty::MasonInterp> as our Mason
-interpreter, and have a component root as specified in the
+Returns our Mason config. We use the component root specified in the
C<Web/TemplateRoot> framework configuration variable (or C<html> by
default). Additionally, we set up a C<jifty> component root, as
specified by the C<Web/DefaultTemplateRoot> configuration. All
@@ -52,7 +51,6 @@
sub mason_config {
return (
allow_globals => [qw[$JiftyWeb]],
- interp_class => 'Jifty::MasonInterp',
comp_root => [
[application => Jifty::Util->absolute_path( Jifty->config->framework('Web')->{'TemplateRoot'} || "html")],
[jifty => Jifty->config->framework('Web')->{'DefaultTemplateRoot'}
@@ -98,16 +96,14 @@
my $handler = $args{'mason_handler'};
my $cgi = $args{'cgi'};
- if ( ( !$handler->interp->comp_exists( $cgi->path_info ) )
- && ($handler->interp->comp_exists( $cgi->path_info . "/index.html" ) )
- )
- {
- $cgi->path_info( $cgi->path_info . "/index.html" );
- }
Module::Refresh->refresh;
local $HTML::Mason::Commands::JiftyWeb = Jifty::Web->new();
- eval { $handler->handle_cgi_object($cgi); };
+ my $dispatcher = Jifty->config->framework('ApplicationClass')."::Dispatcher";
+ $dispatcher->require;
+
+ $dispatcher->handle_request($cgi, $handler);
+
$self->cleanup_request();
}
Modified: jifty/trunk/lib/Jifty/Manual/Tutorial.pod
==============================================================================
--- jifty/trunk/lib/Jifty/Manual/Tutorial.pod (original)
+++ jifty/trunk/lib/Jifty/Manual/Tutorial.pod Tue Jan 17 21:24:09 2006
@@ -393,7 +393,7 @@
Please join us on the C<jifty-devel> mailing list to talk about how you're
using Jifty or what you find difficult or hard to use about it.
- /=head1 GETTING HELP
+=head1 GETTING HELP
=head2 Joining the mailing list
Modified: jifty/trunk/lib/Jifty/Request.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Request.pm (original)
+++ jifty/trunk/lib/Jifty/Request.pm Tue Jan 17 21:24:09 2006
@@ -91,21 +91,22 @@
=head2 fill
Attempt to fill in the request from any number of various methods --
-YAML, JSON, etc. Falls back to query parameters.
+YAML, JSON, etc. Falls back to query parameters. Takes a CGI object.
=cut
sub fill {
my $self = shift;
+ my ($cgi) = @_;
# If this is a subrequest, we need to pull from the mason args in
# order to avoid infinite looping
- $self->from_mason_args
- if Jifty->web->mason->is_subrequest;
+ $self->from_cgi($cgi)
+ if Jifty->web->mason and Jifty->web->mason->is_subrequest;
# Grab content type and posted data, if any
- my $ct = Jifty->web->mason->cgi_request->header_in("Content-Type");
- my $data = Jifty->web->mason->request_args->{POSTDATA};
+ my $ct = $ENV{"CONTENT_TYPE"};
+ my $data = $cgi->param('POSTDATA');
# Check it for something appropriate
if ($data) {
@@ -117,7 +118,7 @@
}
# Fall back on using the mason args
- return $self->from_mason_args;
+ return $self->from_cgi($cgi);
}
=head2 from_data_structure
@@ -167,31 +168,43 @@
return $self;
}
-=head2 from_mason_args
+=head2 from_cgi CGI
-Calls C<from_webform> with the current mason request's args.
+Calls C<from_webform> with the CGI's parameters.
Returns itself.
=cut
-sub from_mason_args {
+sub from_cgi {
my $self = shift;
-
- my $path = $ENV{REQUEST_URI};
+ my ($cgi) = @_;
+
+ my $path = $cgi->path_info;
$path =~ s/\?.*//;
$self->path( $path );
- return $self->from_webform(%{ Jifty->web->mason->request_args });
+ use HTML::Mason::Utils;
+ my %args = HTML::Mason::Utils::cgi_request_args( $cgi, $cgi->request_method );
+
+ my @splittable_names = grep /=|\|/, keys %args;
+ for my $splittable (@splittable_names) {
+ delete $args{$splittable};
+ for my $newarg (split /\|/, $splittable) {
+ # If there are multiple =s, you just lose.
+ my ($k, $v) = split /=/, $newarg;
+ $args{$k} = $args{$k} ? (ref $args{$k} ? [@{$args{$k}},$v] : [$args{$k}, $v] ) : $v;
+ }
+ }
+ return $self->from_webform( %args );
}
=head2 from_webform %QUERY_ARGS
Parses web form arguments into the Jifty::Request data structure.
-Takes in the query arguments, as parsed by Mason (thus, repeated
-arguments have already been turned into array refs). See
-L</SERIALIZATION> for details of how query parameters are parsed.
+Takes in the query arguments. See L</SERIALIZATION> for details of how
+query parameters are parsed.
Returns itself.
@@ -231,9 +244,6 @@
my ($key, $value) = @_;
$self->arguments->{$key} = $value;
- my $args = Jifty->web->mason->{'request_args'};
- push @$args, $key => $value;
-
if ($key =~ /^J:A-(?:(\d+)-)?(.+)/s) {
$self->add_action(moniker => $2, class => $value, order => $1, arguments => {}, active => 1);
} elsif ($key =~ /^J:A:F-(\w+)-(.+)/s and $self->action($2)) {
@@ -658,8 +668,18 @@
The primary source of Jifty requests through the website are CGI query
parameters. These are requests submitted using CGI GET or POST
-requests to your Jifty application. See L<Jifty::MasonInterp> for
-details of the CGI parsing.
+requests to your Jifty application.
+
+=head2 argument munging
+
+In addition to standard Mason argument munging, Jifty also takes
+arguments with a B<name> of
+
+ bla=bap|beep=bop|foo=bar
+
+and an arbitrary value, and makes them appear as if they were actually
+separate arguments. The purpose is to allow submit buttons to act as
+if they'd sent multiple values, without using JavaScript.
=head2 actions
Modified: jifty/trunk/lib/Jifty/Response.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Response.pm (original)
+++ jifty/trunk/lib/Jifty/Response.pm Tue Jan 17 21:24:09 2006
@@ -25,7 +25,17 @@
sub new {
my $class = shift;
- bless {results => {}}, $class;
+ bless {results => {}, headers => []}, $class;
+}
+
+sub add_header {
+ my $self = shift;
+ push @{$self->{headers}}, [@_];
+}
+
+sub headers {
+ my $self = shift;
+ return @{$self->{headers}};
}
=head2 result MONIKER [RESULT]
Modified: jifty/trunk/lib/Jifty/Server.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Server.pm (original)
+++ jifty/trunk/lib/Jifty/Server.pm Tue Jan 17 21:24:09 2006
@@ -41,7 +41,6 @@
my $class = shift;
my $self = {};
bless $self, $class;
-
$self->setup_jifty(@_);
$self->recording_on if $ENV{'JIFTY_RECORD'};
@@ -104,7 +103,7 @@
my $self = shift;
my %args = (
port => undef,
- @_
+ @_
);
Jifty->config->framework('Web')->{'Port'} = $args{port} if $args{port};
@@ -125,6 +124,12 @@
my $self = shift;
my $cgi = shift;
+ use Hook::LexWrap;
+ wrap 'HTML::Mason::FakeApache::send_http_header', pre => sub {
+ my $r = shift;
+ $r->header_out( @{$_} ) for Jifty->web->response->headers;
+ };
+
Jifty->handler->handle_request( mason_handler => $self->mason_handler,
cgi => $cgi);
Modified: jifty/trunk/lib/Jifty/Web.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Web.pm (original)
+++ jifty/trunk/lib/Jifty/Web.pm Tue Jan 17 21:24:09 2006
@@ -47,6 +47,7 @@
=cut
sub mason {
+ use HTML::Mason::Request;
return HTML::Mason::Request->instance;
}
@@ -209,7 +210,6 @@
sub handle_request {
my $self = shift;
- #$self->log->debug( "Handling " . $ENV{'REQUEST_URI'} );
$self->setup_session;
$self->response( Jifty::Response->new ) unless $self->response;
@@ -220,10 +220,12 @@
# components have access to the outermost request
if ($self->request) {
local $self->{request};
- $self->_internal_request( Jifty::Request->new->fill );
+ $self->_internal_request( Jifty::Request->new->fill(@_) );
} else {
- $self->_internal_request( Jifty::Request->new->fill );
+ $self->_internal_request( Jifty::Request->new->fill(@_) );
}
+
+ REQUEST_ABORT:
}
# Called when continuations get run, as well as by handle_request;
@@ -233,7 +235,6 @@
my ($request) = @_;
$self->request($request);
- $self->setup_page_actions;
my @valid_actions;
for my $request_action ( $self->request->actions ) {
next unless $request_action->active;
@@ -264,7 +265,7 @@
}
}
}
- $self->session->set_cookie;
+ $self->session->set_cookie();
$self->request->call_continuation
if $self->response->success;
@@ -276,21 +277,6 @@
$self->serve_fragments if $self->request->fragments;
}
-=head3 setup_page_actions
-
-Probe the page the current user has requested to see if it has any
-special actions it wants to run, if it wants to massage the existing
-actions, etc.
-
-=cut
-
-sub setup_page_actions {
- my $self = shift;
- if ( $self->mason->base_comp->method_exists('setup_actions') ) {
- $self->mason->base_comp->call_method('setup_actions');
- }
-}
-
=head3 request [VALUE]
Gets or sets the current L<Jifty::Request> object.
@@ -305,8 +291,7 @@
Gets the actions that have been created with this framework with
C<new_action> (whether automatically via a L<Jifty::Request>, or in
-Mason code), as L<Jifty::Action> objects. (These are actually stored
-in the mason notes, so that they are magically saved over redirects.)
+Mason code), as L<Jifty::Action> objects.
=cut
@@ -579,7 +564,7 @@
my $self = shift;
if ($self->next_page
- and ( ( $self->next_page ne $self->mason->request_comp->path )
+ and ( ( $self->next_page ne $self->request->path )
or $self->request->state_variables )
)
{
@@ -604,8 +589,7 @@
my $page = shift || $self->next_page;
if ( $self->response->results
- or $self->request->state_variables
- or %{ $self->mason->notes } )
+ or $self->request->state_variables )
{
my $request = Jifty::Request->new();
$request->path($page);
@@ -614,12 +598,27 @@
my $cont = Jifty::Continuation->new(
request => $request,
response => $self->response,
- notes => $self->mason->notes,
parent => $self->request->continuation,
);
- $self->mason->redirect( $page . "?J:CALL=" . $cont->id );
- } else {
+ $page = $page . "?J:CALL=" . $cont->id;
+ }
+ $self->_redirect($page);
+}
+
+sub _redirect {
+ my $self = shift;
+ my ($page) = @_;
+
+ if ($self->mason) {
$self->mason->redirect($page);
+ } else {
+ # This is designed to work under CGI or FastCGI; will need an
+ # abstraction for mod_perl
+ my $apache = HTML::Mason::FakeApache->new();
+ $apache->header_out( Location => $page );
+ $apache->header_out( Status => 302 );
+ $apache->send_http_header();
+ goto REQUEST_ABORT;
}
}
@@ -644,7 +643,6 @@
my $c = Jifty::Continuation->new(
request => $self->request,
response => $self->response,
- notes => $self->mason->notes,
parent => $self->request->continuation,
clone => $clone,
);
@@ -656,12 +654,12 @@
{
# We don't get to redirect to the new page; redirect to the same page, new cont
- Jifty->web->mason->redirect(
+ $self->_redirect(
$self->request->path . "?J:C=" . $c->id );
} else {
# Set us up with the new continuation
- Jifty->web->mason->redirect( $args{'J:PATH'}
+ $self->_redirect( Jifty::Web->url . $args{'J:PATH'}
. ( $args{'J:PATH'} =~ /\?/ ? "&" : "?" ) . "J:C="
. $c->id );
}
@@ -831,8 +829,7 @@
=head3 render_request_debug_info
-Outputs the request arguments and any Mason notes in a <div
-id="debug"> tag.
+Outputs the request arguments.
=cut
@@ -843,9 +840,6 @@
$m->out('<div class="debug">');
$m->out('<hr /><h1>Request args</h1><pre>');
$m->out( YAML::Dump( { $m->request_args } ) );
- $m->out('</pre>');
- $m->out('<hr /><h1>$m->notes</h1><pre>');
- $m->out( YAML::Dump( $m->notes ) );
$m->out('</pre></div>');
return '';
Modified: jifty/trunk/lib/Jifty/Web/Session.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Web/Session.pm (original)
+++ jifty/trunk/lib/Jifty/Web/Session.pm Tue Jan 17 21:24:09 2006
@@ -63,7 +63,7 @@
my $cookiename = $self->cookie_name;
$session_id = $cookies{$cookiename} ? $cookies{$cookiename}->value() : undef;
}
-
+
$Storable::Deparse = 1;
$Storable::Eval = 1;
my %session;
@@ -85,6 +85,7 @@
$self->_session( tied(%session) );
$session{_session_id} = $session{_session_id} || $session_id;
+
}
=head2 unload
@@ -223,7 +224,6 @@
sub set_cookie {
my $self = shift;
- my $m = Jifty->web->mason;
my $cookie_name = $self->cookie_name;
my %cookies = CGI::Cookie->fetch();
@@ -239,8 +239,7 @@
if ( not $cookies{$cookie_name}
or ( $cookies{$cookie_name} ne $cookie->as_string ) )
{
- $m->cgi_request->headers_out->{'Set-Cookie'} = $cookie->as_string
- if ($m);
+ Jifty->web->response->add_header( 'Set-Cookie' => $cookie->as_string );
}
}
Modified: jifty/trunk/share/web/templates/autohandler
==============================================================================
--- jifty/trunk/share/web/templates/autohandler (original)
+++ jifty/trunk/share/web/templates/autohandler Tue Jan 17 21:24:09 2006
@@ -1,14 +1,9 @@
<%init>
$r->content_type('text/html; charset=utf-8');
-Jifty->web->handle_request();
if ($m->base_comp->path =~ m|/_elements/|) {
# Requesting an internal component by hand -- naughty
$m->redirect("/errors/requested_private_component");
-#} elsif (not Jifty->web->current_user->id and $m->request_comp->path !~ m{^/(?:welcome|dhandler|css|js|images|validator\.xml)} ) {
-# # Not logged in, trying to access a protected page
-# $m->notes->{'login-nextpage'} = $m->{top_path};
-# Jifty->web->redirect('/welcome/');
}
$m->comp('/_elements/nav');
$m->call_next();
Modified: jifty/trunk/t/Continuations/web/templates/autohandler
==============================================================================
--- jifty/trunk/t/Continuations/web/templates/autohandler (original)
+++ jifty/trunk/t/Continuations/web/templates/autohandler Tue Jan 17 21:24:09 2006
@@ -1,6 +1,3 @@
-<%init>
-Jifty->web->handle_request();
-</%init>
<% Jifty->web->render_messages %>
<% $m->call_next %>
Modified: jifty/trunk/t/Mapper/web/templates/autohandler
==============================================================================
--- jifty/trunk/t/Mapper/web/templates/autohandler (original)
+++ jifty/trunk/t/Mapper/web/templates/autohandler Tue Jan 17 21:24:09 2006
@@ -1,6 +1,3 @@
-<%init>
-Jifty->web->handle_request();
-</%init>
<% Jifty->web->render_messages %>
<% $m->call_next %>
Modified: jifty/trunk/t/TestApp/bin/jifty
==============================================================================
--- jifty/trunk/t/TestApp/bin/jifty (original)
+++ jifty/trunk/t/TestApp/bin/jifty Tue Jan 17 21:24:09 2006
@@ -1,19 +0,0 @@
-#!/sw/bin/perl5.8.6
-
-eval 'exec /sw/bin/perl5.8.6 -S $0 ${1+"$@"}'
- if 0; # not running under some shell
-use warnings;
-use strict;
-use File::Basename qw(dirname);
-
-BEGIN {
- eval {
- require Jifty::Util;
- my $root = Jifty::Util->app_root;
- unshift @INC, "$root/lib" if ($root);
- }
-
-}
-
-use Jifty::Script;
-Jifty::Script->dispatch();
Modified: jifty/trunk/t/TestApp/t/16-images.t
==============================================================================
--- jifty/trunk/t/TestApp/t/16-images.t (original)
+++ jifty/trunk/t/TestApp/t/16-images.t Tue Jan 17 21:24:09 2006
@@ -2,6 +2,8 @@
use warnings;
use strict;
+BEGIN {chdir "t/TestApp"}
+use lib '../../lib';
use Jifty::Test tests => 5;
use Jifty::Test::WWW::Mechanize;
More information about the Jifty-commit
mailing list