[Jifty-commit] r6728 - in jifty/trunk/lib: .

Jifty commits jifty-commit at lists.jifty.org
Wed Apr 8 14:05:05 EDT 2009

Author: alexmv
Date: Wed Apr  8 14:05:03 2009
New Revision: 6728


Remove no_views argument to Jifty->new, always delay View creation

The no_views argument was used almost purely as a way to not create
Mason cache directories as the wrong user.  Now that the creation
happens inside of Jifty::View::Mason::Handler, we can accomplish the
intent by delaying view handler classes as late as possible.  View
handler classes are now instantiated on the first request that
Jifty::Handler receives.
x# Please enter the commit message for your changes. Lines starting

Modified: jifty/trunk/lib/Jifty.pm
--- jifty/trunk/lib/Jifty.pm	(original)
+++ jifty/trunk/lib/Jifty.pm	Wed Apr  8 14:05:03 2009
@@ -132,15 +132,6 @@
 database or do something extreme like that; most of Jifty expects the
 handle to exist.  Defaults to false.
-=item no_views
-If this is set to true, does not initialize any of the view handling
-components of Jifty.  This is useful if you are running a command-line
-script, and not want the overhead associated with it.  This also
-prevents the mason cache files from being created, which may be the
-right thing if your script is running as a privileged user.  Defaults
-to false.
 =item logger_component
 The name that Jifty::Logger will log under.  If you don't specify anything
@@ -159,7 +150,6 @@
         no_handle        => 0,
         pre_init         => 0,
         logger_component => undef,
-        no_views         => 0,
@@ -234,7 +224,7 @@
     # Configure the request handler and action API handler
-    Jifty->handler(Jifty::Handler->new()) unless $args{no_views};
+    Jifty->handler(Jifty::Handler->new());
     # We can only require view classes once we have our models and actions set.

Modified: jifty/trunk/lib/Jifty/Handler.pm
--- jifty/trunk/lib/Jifty/Handler.pm	(original)
+++ jifty/trunk/lib/Jifty/Handler.pm	Wed Apr  8 14:05:03 2009
@@ -69,7 +69,6 @@
     eval { Jifty::Plugin::DumpDispatcher->dump_rules };
     $self->buffer(String::BufferStack->new( out_method => \&Jifty::View::out_method ));
-    $self->setup_view_handlers();
         my $buffer = $self->buffer;
         no warnings 'redefine';
@@ -168,6 +167,8 @@
+    $self->setup_view_handlers() unless $self->_view_handlers;
     $self->call_trigger('before_request', $args{cgi});
     # this is scoped deeper because we want to make sure everything is cleaned

More information about the Jifty-commit mailing list