[Jifty-commit] r1226 - in jifty/trunk: lib/Jifty

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Thu Jun 8 18:22:32 EDT 2006


Author: trs
Date: Thu Jun  8 18:22:24 2006
New Revision: 1226

Modified:
   jifty/trunk/   (props changed)
   jifty/trunk/Makefile.PL
   jifty/trunk/lib/Jifty/Web.pm

Log:
 r12801 at zot:  tom | 2006-06-08 18:20:41 -0400
 CSS is now cached in Jifty::Web across requests until the app is restarted


Modified: jifty/trunk/Makefile.PL
==============================================================================
--- jifty/trunk/Makefile.PL	(original)
+++ jifty/trunk/Makefile.PL	Thu Jun  8 18:22:24 2006
@@ -8,6 +8,7 @@
 requires('Calendar::Simple');
 requires('Class::Accessor'); # Class::Accessor::Fast
 requires('Class::Container');
+requires('Class::Data::Inheritable');
 requires('Clone');
 requires('Compress::Zlib');
 requires('CSS::Squish' => 0.01 );

Modified: jifty/trunk/lib/Jifty/Web.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Web.pm	(original)
+++ jifty/trunk/lib/Jifty/Web.pm	Thu Jun  8 18:22:24 2006
@@ -16,15 +16,17 @@
 use XML::Writer;
 use CSS::Squish;
 use Digest::MD5 qw(md5_hex);
-use base qw/Class::Accessor::Fast Jifty::Object/;
+use base qw/Class::Accessor::Fast Class::Data::Inheritable Jifty::Object/;
 
 use vars qw/$SERIAL/;
 
 __PACKAGE__->mk_accessors(
-    qw(next_page request response session temporary_current_user
-       cached_css cached_css_digest cached_css_mtime)
+    qw(next_page request response session temporary_current_user)
 );
 
+__PACKAGE__->mk_classdata($_)
+    for qw(cached_css cached_css_digest cached_css_mtime);
+
 =head1 METHODS
 
 =head3 new
@@ -982,10 +984,10 @@
 =cut
 
 sub include_css {
-    my $self      = shift;
+    my $self = shift;
     
     if ( Jifty->config->framework('DevelMode') ) {
-        Jifty->web->out(
+        $self->out(
             '<link rel="stylesheet" type="text/css" '
             . 'href="/static/css/main.css" />'
         );
@@ -993,9 +995,9 @@
     else {
         $self->generate_css;
     
-        Jifty->web->out(
+        $self->out(
             '<link rel="stylesheet" type="text/css" href="/__jifty/css/'
-            . $self->cached_css_digest . '.css" />'
+            . __PACKAGE__->cached_css_digest . '.css" />'
         );
     }
     
@@ -1012,7 +1014,7 @@
 sub generate_css {
     my $self = shift;
     
-    if (not defined $self->cached_css_digest
+    if (not defined __PACKAGE__->cached_css_digest
             or Jifty->config->framework('DevelMode'))
     {
         Jifty->log->debug("Generating CSS...");
@@ -1022,9 +1024,9 @@
                             . '/css/main.css'
                   );
         
-        $self->cached_css( $css );
-        $self->cached_css_digest( md5_hex( $css ) );
-        $self->cached_css_mtime( time );
+        __PACKAGE__->cached_css( $css );
+        __PACKAGE__->cached_css_digest( md5_hex( $css ) );
+        __PACKAGE__->cached_css_mtime( time );
     }
 }
 


More information about the Jifty-commit mailing list