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

Jifty commits jifty-commit at lists.jifty.org
Mon Mar 30 23:14:32 EDT 2009


Author: alexmv
Date: Mon Mar 30 23:14:32 2009
New Revision: 6715

Modified:
   jifty/trunk/lib/Jifty/Handler.pm
   jifty/trunk/lib/Jifty/View/Mason/Handler.pm

Log:
Move more mason-specific aspects out of Jifty::Handler

Update documentation to refect the fact that Jifty::Handler keeps
track of view handlers, but is no longer mason-specific.  Also, move
the mason-specific cache dirs into the mason view handler.

Modified: jifty/trunk/lib/Jifty/Handler.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Handler.pm	(original)
+++ jifty/trunk/lib/Jifty/Handler.pm	Mon Mar 30 23:14:32 2009
@@ -5,7 +5,7 @@
 
 =head1 NAME
 
-Jifty::Handler - Methods related to the Mason handler
+Jifty::Handler - Methods related to the finding and returning content
 
 =head1 SYNOPSIS
 
@@ -19,8 +19,9 @@
 
 =head1 DESCRIPTION
 
-L<Jifty::Handler> provides methods required to deal with Mason CGI
-handlers.  
+L<Jifty::Handler> provides methods required to find and return content
+to the browser.  L</handle_request>, for instance, is the main entry
+point for HTTP requests.
 
 =cut
 
@@ -51,20 +52,6 @@
 
 __PACKAGE__->mk_accessors(qw(dispatcher _view_handlers cgi apache stash buffer));
 
-=head2 mason
-
-
-Returns the Jifty c<HTML::Mason> handler. While this "should" be just another template handler,
-we still rely on it for little bits of Jifty infrastructure. Patches welcome.
-
-=cut
-
-sub mason {
-    my $self = shift;
-    return $self->view('Jifty::View::Mason::Handler');
-}
-
-
 =head2 new
 
 Create a new Jifty::Handler object. Generally, Jifty.pm does this only once at startup.
@@ -76,8 +63,6 @@
     my $self  = {};
     bless $self, $class;
 
-    $self->create_cache_directories();
-
     $self->dispatcher( Jifty->app_class( "Dispatcher" ) );
     Jifty::Util->require( $self->dispatcher );
     $self->dispatcher->import_plugins;
@@ -148,22 +133,6 @@
     return $self->_view_handlers->{$class};
 }
 
-
-=head2 create_cache_directories
-
-Attempts to create our app's mason cache directory.
-
-=cut
-
-sub create_cache_directories {
-    my $self = shift;
-
-    for ( Jifty->config->framework('Web')->{'DataDir'} ) {
-        Jifty::Util->make_path( Jifty::Util->absolute_path($_) );
-    }
-}
-
-
 =head2 cgi
 
 Returns the L<CGI> object for the current request, or C<undef> if

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	Mon Mar 30 23:14:32 2009
@@ -55,6 +55,8 @@
 sub new {
     my $package = shift;
 
+    $package->create_cache_directories;
+
     my %p = @_ || $package->config;
     my $self = $package->SUPER::new( request_class => 'Jifty::View::Mason::Request',
                                      out_method => sub {Carp::cluck("Mason output skipped Jifty's output stack!") if grep {defined and length} @_},
@@ -233,5 +235,18 @@
     return %{Jifty->web->request->arguments}, %{Jifty->web->request->template_arguments || {}};
 }
 
+
+=head2 create_cache_directories
+
+Attempts to create our app's mason cache directory.
+
+=cut
+
+sub create_cache_directories {
+    for ( Jifty->config->framework('Web')->{'DataDir'} ) {
+        Jifty::Util->make_path( Jifty::Util->absolute_path($_) );
+    }
+}
+
 1;
 


More information about the Jifty-commit mailing list