[Jifty-commit] r5800 - in jifty/trunk: lib/Jifty/Subs
Jifty commits
jifty-commit at lists.jifty.org
Sat Sep 6 06:06:55 EDT 2008
Author: sartak
Date: Sat Sep 6 06:06:54 2008
New Revision: 5800
Modified:
jifty/trunk/ (props changed)
jifty/trunk/Makefile.PL
jifty/trunk/lib/Jifty/Subs/Render.pm
Log:
Modified: jifty/trunk/Makefile.PL
==============================================================================
--- jifty/trunk/Makefile.PL (original)
+++ jifty/trunk/Makefile.PL Sat Sep 6 06:06:54 2008
@@ -208,6 +208,7 @@
install_script('bin/jifty');
install_share;
+# ls plugins -> Authentication-CAS Multipage TabView
my @plugins = defined $ENV{JIFTY_PLUGINS} ? split(/ /, $ENV{JIFTY_PLUGINS}) : qw(TabView);
# Test all of our sub-dist tests too
@@ -218,7 +219,7 @@
die unless -d "plugins/$_";
# install_share("plugins/$_/share");
chdir("plugins/$_");
- system("$^X -I../../lib Makefile.PL");
+ system("$^X -I../../lib Makefile.PL INSTALLDIRS=".$ENV{INSTALLDIRS});
chdir('../..');
}
@@ -226,8 +227,13 @@
postamble(<<"END");
install ::
-@{[ join("\n", map { "\tcd plugins/$_; make install" } @plugins) ]}
+@{[ join("\n", map { "\tcd plugins/$_;".' $(MAKE) install DESTDIR=$(DESTDIR) PREFIX=$(PREFIX)' } @plugins) ]}
+distclean :: realclean
+@{[ "\t".'$(NOECHO) $(NOOP)']}
+
+realclean ::
+@{[ join("\n", map { "\tcd plugins/$_;".' $(MAKE) realclean' } @plugins) ]}
END
Modified: jifty/trunk/lib/Jifty/Subs/Render.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Subs/Render.pm (original)
+++ jifty/trunk/lib/Jifty/Subs/Render.pm Sat Sep 6 06:06:54 2008
@@ -56,6 +56,27 @@
# XXX - We don't yet use $timestamp here.
my ( $timestamp, $msg ) = @$rv;
+ for my $render_info (values %{$render->{$channel}}) {
+ if ($render_info->{coalesce} and $render_info->{mode} eq "Replace") {
+ my $hash = Digest::MD5::md5_hex( YAML::Dump([$render_info->{region}, $render_info->{render_with}] ) );
+ Jifty->log->debug("Coalesced duplicate region @{[$render_info->{region}]} with @{[$render_info->{render_with}]} from $channel event $msg") if exists $coalesce{$hash};
+ $coalesce{$hash} = [ $timestamp, $event_class, $msg, $render_info ] unless $coalesce{$hash} and $coalesce{$hash}[0] > $timestamp;
+ } else {
+ Jifty->log->debug("Rendering $channel event $msg in @{[$render_info->{region}]} with @{[$render_info->{render_with}]}");
+ render_single( $event_class, $msg, $render_info, $callback );
+ $sent++;
+ }
+ }
+ }
+ }
+
+ for my $c (values %coalesce) {
+ my (undef, $event_class, $msg, $render_info) = @{$c};
+ Jifty->log->debug("Rendering @{[$render_info->{region}]} with @{[$render_info->{render_with}]} for $event_class");
+ render_single( $event_class, $msg, $render_info, $callback );
+ $sent++;
+ }
+
return ($sent);
}
@@ -63,30 +84,33 @@
Renders a single region, based on the region information in C<INFO>.
- for my $render_info (values %{$render->{$channel}}) {
- my $region = Jifty::Web::PageRegion->new(
- name => $render_info->{region},
- path => $render_info->{render_with},
- );
- delete Jifty->web->{'regions'}{ $region->qualified_name };
-
- # Finally render the region. In addition to the user-supplied arguments
- # in $render_info, we always pass the target $region and the event object
- # into its %ARGS.
- my $region_content = '';
- my $event_object = $event_class->new($msg);
- $region->render_as_subrequest( \$region_content,
- { %{ $render_info->{arguments} || {} },
- event => $event_object,
- $event_object->render_arguments,
- }
- );
- $callback->( $render_info->{mode}, $region->qualified_name, $region_content);
- $sent++;
- }
- }
- }
- return ($sent);
+=cut
+
+sub render_single {
+ my ($class, $msg, $render_info, $callback) = @_;
+
+ my $region = Jifty::Web::PageRegion->new(
+ name => $render_info->{region},
+ path => $render_info->{render_with},
+ );
+ # So we don't warn about "duplicate region"s
+ delete Jifty->web->{'regions'}{ $region->qualified_name };
+
+ my $event_object = $class->new($msg);
+ # Region's arguments come from explicit arguments only
+ $region->arguments( $render_info->{arguments} );
+
+ my $region_content = '';
+ $region->enter;
+ # Also provide an 'event' argument, and fill in the render
+ # arguments. These don't show up in the region's arguments if
+ # inspected, but do show up in the request.
+ $region->render_as_subrequest(
+ \$region_content,
+ { %{$region->arguments}, event => $event_object, $event_object->render_arguments },
+ );
+ $callback->( $render_info->{mode}, $region->qualified_name, $region_content, $render_info->{attrs} );
+ $region->exit;
}
1;
More information about the Jifty-commit
mailing list