[Jifty-commit] r1069 - in jifty/trunk: lib/Jifty
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Mon May 15 17:28:46 EDT 2006
Author: alexmv
Date: Mon May 15 17:28:46 2006
New Revision: 1069
Modified:
jifty/trunk/ (props changed)
jifty/trunk/lib/Jifty/Web.pm
Log:
r13022 at zoq-fot-pik: chmrr | 2006-05-15 17:27:50 -0400
* Allow Jifty->web->region($region) to do the right thing; this
avoids having to do the tedious ->enter, ->render, ->exit
Modified: jifty/trunk/lib/Jifty/Web.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Web.pm (original)
+++ jifty/trunk/lib/Jifty/Web.pm Mon May 15 17:28:46 2006
@@ -909,11 +909,15 @@
return $self->{'regions'}{$name};
}
-=head3 region PARAMHASH,
+=head3 region (PARAMHASH or REGION)
-Creates and renders a L<Jifty::Web::PageRegion>; the C<PARAMHASH> is
-passed directly to its L<Jifty::Web::PageRegion/new> method. The
-region is then L<Jifty::Web::PageRegion/enter>ed, then
+If passed an even number of arguments as a C<PARAMHASH>, the PARAMHASH
+is used to created and renders a L<Jifty::Web::PageRegion>; the
+C<PARAMHASH> is passed directly to its L<Jifty::Web::PageRegion/new>
+method. Otherwise, it acts on the given C<REGION>.
+
+However it procures the region, it is
+L<Jifty::Web::PageRegion/enter>ed, then
L<Jifty::Web::PageRegion/render>ed, and finally
L<Jifty::Web::PageRegion/exit>ed.
@@ -922,8 +926,12 @@
sub region {
my $self = shift;
- # Add ourselves to the region stack
- my $region = Jifty::Web::PageRegion->new(@_) or return;
+ my $region;
+ if (@_ % 2) {
+ $region = shift;
+ } else {
+ $region = Jifty::Web::PageRegion->new(@_) or return;
+ }
# Enter the region
$region->enter;
More information about the Jifty-commit
mailing list