[Jifty-commit] r4664 - in jifty/trunk: lib/Jifty/Action/Record

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Wed Dec 12 20:24:16 EST 2007


Author: sartak
Date: Wed Dec 12 20:24:12 2007
New Revision: 4664

Modified:
   jifty/trunk/   (props changed)
   jifty/trunk/lib/Jifty/Action/Record/Update.pm

Log:
 r48930 at onn:  sartak | 2007-12-12 20:23:42 -0500
 ID is sometimes passed into Jifty::Action::Record::Update, we want to ignore it if it doesn't change, to avoid spurious permission errors. This codepath could use some more thought


Modified: jifty/trunk/lib/Jifty/Action/Record/Update.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Action/Record/Update.pm	(original)
+++ jifty/trunk/lib/Jifty/Action/Record/Update.pm	Wed Dec 12 20:24:12 2007
@@ -124,6 +124,17 @@
             $value = scalar <$value>;
         }
 
+        # Skip fields that have not changed
+        my $old = $self->record->$field;
+        # XXX TODO: This ignore "by" on columns
+        $old = $old->id if blessed($old) and $old->isa( 'Jifty::Record' );
+
+        # ID is sometimes passed in, we want to ignore it if it doesn't change
+        next if $field eq 'id'
+           and defined $old
+           and defined $value
+           and "$old" eq "$value";
+
         # Error on columns we can't update
         # <Sartak> ah ha. I think I know why passing due => undef reports
         #          action success
@@ -144,11 +155,6 @@
             next;
         }
 
-        # Skip fields that have not changed
-        my $old = $self->record->$field;
-        # XXX TODO: This ignore "by" on columns
-        $old = $old->id if blessed($old) and $old->isa( 'Jifty::Record' );
-    
         # if both the new and old values are defined and equal, we don't want to change em
         # XXX TODO "$old" is a cheap hack to scalarize datetime objects
         next if ( defined $old and defined $value and "$old" eq "$value" );


More information about the Jifty-commit mailing list