[Jifty-commit] r5195 - in jifty/trunk: lib/Jifty/View/Declare
Jifty commits
jifty-commit at lists.jifty.org
Fri Mar 7 17:57:27 EST 2008
Author: alexmv
Date: Fri Mar 7 17:57:25 2008
New Revision: 5195
Modified:
jifty/trunk/ (props changed)
jifty/trunk/lib/Jifty/View/Declare/Helpers.pm
Log:
r28365 at kohr-ah: chmrr | 2008-03-07 17:56:26 -0500
* Warn about template_argument change side-effects
Modified: jifty/trunk/lib/Jifty/View/Declare/Helpers.pm
==============================================================================
--- jifty/trunk/lib/Jifty/View/Declare/Helpers.pm (original)
+++ jifty/trunk/lib/Jifty/View/Declare/Helpers.pm Fri Mar 7 17:57:25 2008
@@ -228,16 +228,28 @@
If called in scalar context, pulls the first item in C<args> and returns it.
If called in list context, returns the values of all items in C<args>.
-
-
=cut
sub get {
if (wantarray) {
- map { request->template_argument($_) || request->argument($_) } @_;
+ map { _get_single($_) } @_;
} else {
- request->template_argument($_[0]) || request->argument( $_[0] );
+ _get_single($_[0]);
+ }
+}
+
+sub _get_single {
+ my $v = request->template_argument($_[0]) || request->argument( $_[0] );
+ return $v if defined $v;
+
+ if (request->top_request ne request() and $v = request->top_request->template_argument($_[0])) {
+ if (ref $v) {
+ warn "The template argument '$_[0]' was not explicitly passed to the current region, and thus will not work if the region is ever refreshed. Unfortunately, it is a reference, so it can't be passed explicitly either. You'll need to explicitly pass some stringification of what it is to the region.\n";
+ } else {
+ warn "The template argument '$_[0]' was not explicitly passed to the current region, and thus will not work if the region is ever refreshed. Try passing it explicitly?";
+ }
}
+ return undef;
}
@@ -245,7 +257,6 @@
Sets arguments for later grabbing with L<get>.
-
=cut
More information about the Jifty-commit
mailing list