[Jifty-commit] r4059 - in jifty/trunk: lib lib/Jifty lib/Jifty/View/Mason

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Fri Sep 7 16:08:38 EDT 2007


Author: jesse
Date: Fri Sep  7 16:08:37 2007
New Revision: 4059

Modified:
   jifty/trunk/   (props changed)
   jifty/trunk/lib/Jifty.pm
   jifty/trunk/lib/Jifty/Handler.pm
   jifty/trunk/lib/Jifty/View/Mason/Handler.pm

Log:
 r67030 at pinglin:  jesse | 2007-09-07 16:07:47 -0400
 * Clean up Jifty::Web initialization a bit.


Modified: jifty/trunk/lib/Jifty.pm
==============================================================================
--- jifty/trunk/lib/Jifty.pm	(original)
+++ jifty/trunk/lib/Jifty.pm	Fri Sep  7 16:08:37 2007
@@ -100,7 +100,7 @@
 use base qw/Jifty::Object/;
 use Jifty::Everything;
 
-use vars qw/$HANDLE $CONFIG $LOGGER $HANDLER $API $CLASS_LOADER $PUB_SUB @PLUGINS/;
+use vars qw/$HANDLE $CONFIG $LOGGER $HANDLER $API $CLASS_LOADER $PUB_SUB $WEB @PLUGINS/;
 
 =head1 METHODS
 
@@ -340,8 +340,7 @@
 =cut
 
 sub web {
-    $HTML::Mason::Commands::JiftyWeb ||= Jifty::Web->new();
-    return $HTML::Mason::Commands::JiftyWeb;
+    return $Jifty::WEB ||= Jifty::Web->new();
 }
 
 =head2 subs

Modified: jifty/trunk/lib/Jifty/Handler.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Handler.pm	(original)
+++ jifty/trunk/lib/Jifty/Handler.pm	Fri Sep  7 16:08:37 2007
@@ -191,6 +191,10 @@
         @_
     );
 
+    # Build a new stash for the life of this request
+    $self->stash( {} );
+    local $Jifty::WEB = Jifty::Web->new();
+
     if ( Jifty->config->framework('DevelMode') ) {
         Module::Refresh->refresh;
         Jifty::I18N->refresh;
@@ -201,10 +205,6 @@
     $self->cgi( $args{cgi} );
     $self->apache( HTML::Mason::FakeApache->new( cgi => $self->cgi ) );
 
-    # Build a new stash for the life of this request
-    $self->stash( {} );
-    local $HTML::Mason::Commands::JiftyWeb = Jifty::Web->new();
-
     Jifty->web->request( Jifty::Request->new()->fill( $self->cgi ) );
     Jifty->web->response( Jifty::Response->new );
     Jifty->api->reset;

Modified: jifty/trunk/lib/Jifty/View/Mason/Handler.pm
==============================================================================
--- jifty/trunk/lib/Jifty/View/Mason/Handler.pm	(original)
+++ jifty/trunk/lib/Jifty/View/Mason/Handler.pm	Fri Sep  7 16:08:37 2007
@@ -98,13 +98,14 @@
         %{ Jifty->config->framework('Web')->{'MasonConfig'} },
     );
 
+    my $root_serial = 0;
     for my $plugin (Jifty->plugins) {
         my $comp_root = $plugin->template_root;
         unless  ( $comp_root and -d $comp_root) {
             next;
         }
         Jifty->log->debug( "Plugin @{[ref($plugin)]} mason component root added: (@{[$comp_root ||'']})");
-        push @{ $config{comp_root} }, [ ref($plugin)."-".Jifty->web->serial => $comp_root ];
+        push @{ $config{comp_root} }, [ ref($plugin)."-". $root_serial++ => $comp_root ];
     }
     push @{$config{comp_root}}, [jifty => Jifty->config->framework('Web')->{'DefaultTemplateRoot'}];
 


More information about the Jifty-commit mailing list