[Jifty-commit] r2300 - jifty/branches/template-declare/lib/Jifty/View/Declare

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Sun Dec 3 10:28:56 EST 2006


Author: audreyt
Date: Sun Dec  3 10:28:56 2006
New Revision: 2300

Modified:
   jifty/branches/template-declare/lib/Jifty/View/Declare/Base.pm

Log:
* J::V::Declare::Base - The fake $m is no more.

Modified: jifty/branches/template-declare/lib/Jifty/View/Declare/Base.pm
==============================================================================
--- jifty/branches/template-declare/lib/Jifty/View/Declare/Base.pm	(original)
+++ jifty/branches/template-declare/lib/Jifty/View/Declare/Base.pm	Sun Dec  3 10:28:56 2006
@@ -2,7 +2,7 @@
 
 use strict;
 use warnings;
-use vars qw( $r $m );
+use vars qw( $r );
 use base qw/Jifty::View::Declare::Templates/;
 use Scalar::Defer;
 use Template::Declare::Tags;
@@ -11,17 +11,17 @@
 our @EXPORT = (
     @Jifty::View::Declare::Templates::EXPORT,
     @Template::Declare::Tags::EXPORT,
-    qw( $r $m page ),
+    qw( $r page ),
 );
-our $r = defer { Jifty->handler->apache };
-our $m = defer { Jifty->web->mason };
+our $r;
 
 {
     no warnings 'redefine';
 
     sub show {
-
         # Handle relative path here!
+        $r = Jifty->handler->apache;
+
         my $path = shift;
         $path =~ s{^/}{};
         Jifty::View::Declare::Templates->can('show')->( $path, @_ );
@@ -59,6 +59,8 @@
 
 sub render_header {
     my ($self, $title) = @_;
+    outs('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'
+            . '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">' );
     with( title => $title ), show('/_elements/header');
     div {
         { id is 'headers' }
@@ -76,10 +78,6 @@
 
     my ($title) = get_current_attr(qw(title));
 
-    print STDOUT (
-'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'
-          . '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">' );
-
     my $done_header;
     my $render_header = sub {
         no warnings qw( uninitialized redefine once );
@@ -93,6 +91,7 @@
 
         $done_header = $Template::Declare::Tags::BUFFER;
 
+
         '';
     };
 
@@ -235,8 +234,8 @@
         $begin =~ s/<body>$/$whitespace/s;
     }
 
-    $m->print($begin);
-    $m->flush_buffer;
+    outs($begin);
+    # $m->flush_buffer;
     $writer->startTag("body");
 
     while (1) {
@@ -279,7 +278,8 @@
 };
 
 template '__jifty/admin/action/dhandler' => sub {
-    my $action_class = Jifty->api->qualify( $m->dhandler_arg );
+    # XXX move to dispatcher
+    my $action_class = Jifty->api->qualify( die('$m->dhandler_arg') );
 
     my $action = new_action(
         class   => $action_class,
@@ -616,7 +616,8 @@
 };
 
 template '__jifty/admin/model/dhandler' => sub {
-    my $object_type = $m->dhandler_arg;
+    # XXX move to dispatcher
+    my $object_type = die('$m->dhandler_arg');
 
     my $collection_class =
       Jifty->app_class( "Model", $object_type . "Collection" );
@@ -675,11 +676,12 @@
 };
 
 template '__jifty/css/dhandler' => sub {
-    if ( $m->dhandler_arg !~ /^[0-9a-f]{32}\.css$/ ) {
+    # XXX move to dispatcher
+    if ( die('$m->dhandler_arg') !~ /^[0-9a-f]{32}\.css$/ ) {
 
         # This doesn't look like a real request for squished CSS,
         # so redirect to a more failsafe place
-        Jifty->web->redirect( "/static/css/" . $m->dhandler_arg );
+        Jifty->web->redirect( "/static/css/" . die('$m->dhandler_arg') );
     }
 
     Jifty->web->generate_css;
@@ -687,7 +689,7 @@
     use HTTP::Date ();
 
     if ( Jifty->handler->cgi->http('If-Modified-Since')
-        and $m->dhandler_arg eq Jifty->web->cached_css_digest . '.css' )
+        and die('$m->dhandler_arg') eq Jifty->web->cached_css_digest . '.css' )
     {
         Jifty->log->debug("Returning 304 for cached css");
         $r->header_out( Status => 304 );


More information about the Jifty-commit mailing list