[Jifty-commit] r5196 - in jifty/trunk: lib/Jifty lib/Jifty/View/Declare

Jifty commits jifty-commit at lists.jifty.org
Fri Mar 7 19:25:38 EST 2008


Author: alexmv
Date: Fri Mar  7 19:25:36 2008
New Revision: 5196

Modified:
   jifty/trunk/   (props changed)
   jifty/trunk/lib/Jifty/Action.pm
   jifty/trunk/lib/Jifty/View/Declare/CRUD.pm
   jifty/trunk/lib/Jifty/View/Declare/Helpers.pm

Log:
 r28369 at kohr-ah:  chmrr | 2008-03-07 19:25:02 -0500
  * _current_collection shouldn't ever be able to get an object passed
    as search_collection
  * new_item doesn't use an id -- don't try to get() it
  * Warnings avoidance for undef valid_values in actions


Modified: jifty/trunk/lib/Jifty/Action.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Action.pm	(original)
+++ jifty/trunk/lib/Jifty/Action.pm	Fri Mar  7 19:25:36 2008
@@ -957,7 +957,7 @@
     if ( $value && $field_info->{valid_values} ) {
 
         # If you're not on the list, you can't come to the party
-        unless ( grep $_->{'value'} eq $value,
+        unless ( grep {defined $_->{'value'} and $_->{'value'} eq $value}
             @{ $self->valid_values($field) } ) {
 
             return $self->validation_error(

Modified: jifty/trunk/lib/Jifty/View/Declare/CRUD.pm
==============================================================================
--- jifty/trunk/lib/Jifty/View/Declare/CRUD.pm	(original)
+++ jifty/trunk/lib/Jifty/View/Declare/CRUD.pm	Fri Mar  7 19:25:36 2008
@@ -462,7 +462,7 @@
 template 'list' => sub {
     my $self = shift;
 
-    my ( $page ) = get(qw(page ));
+    my ( $page ) = get('page');
     my $item_path = get('item_path') || $self->fragment_for("view");
     my $collection =  $self->_current_collection();
     div { {class is 'crud-'.$self->object_type}; 
@@ -489,9 +489,9 @@
 # unlimited collection if there is no current search.
 sub _current_collection {
     my $self = shift; 
-    my ( $page, $search_collection ) = get(qw(page  search_collection));
+    my ( $page ) = get('page');
     my $collection_class = $self->record_class->collection_class;
-    my $search = $search_collection || ( Jifty->web->response->result('search') ? Jifty->web->response->result('search')->content('search') : undef );
+    my $search = ( Jifty->web->response->result('search') ? Jifty->web->response->result('search')->content('search') : undef );
     my $collection;
     if ( $search ) {
         $collection = $search;
@@ -700,7 +700,7 @@
 
 template 'new_item' => sub {
     my $self = shift;
-    my ( $object_type, $id ) = ( $self->object_type, get('id') );
+    my ( $object_type ) = ( $self->object_type );
 
     my $record_class = $self->record_class;
     my $create = $record_class->as_create_action;

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 19:25:36 2008
@@ -244,9 +244,9 @@
 
     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";
+            warn("The template argument '$_[0]' was not explicitly passed to the current region ('@{[request->path]}'), 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.".Carp::longmess);
         } 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?";
+            warn("The template argument '$_[0]' was not explicitly passed to the the current region ('@{[request->path]}'), and thus will not work if the region is ever refreshed.  Try passing it explicitly?");
         }
     }
     return undef;


More information about the Jifty-commit mailing list