[Jifty-commit] r2725 - Jifty-DBI/trunk/lib/Jifty/DBI

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Mon Jan 29 09:28:13 EST 2007


Author: audreyt
Date: Mon Jan 29 09:28:13 2007
New Revision: 2725

Modified:
   Jifty-DBI/trunk/lib/Jifty/DBI/Record.pm

Log:
* Add back the __create hook because that's the only semantically
  sane layer to add versioned-record behaviour.

Modified: Jifty-DBI/trunk/lib/Jifty/DBI/Record.pm
==============================================================================
--- Jifty-DBI/trunk/lib/Jifty/DBI/Record.pm	(original)
+++ Jifty-DBI/trunk/lib/Jifty/DBI/Record.pm	Mon Jan 29 09:28:13 2007
@@ -969,6 +969,21 @@
         return ($before_ret) unless ($before_ret);
     }
 
+    my $ret = $self->__create(%attribs);
+
+    $self->after_create( \$ret ) if $self->can('after_create');
+    if ($class) {
+        $self->load_by_cols(id => $ret);
+        return ($self);
+    }
+    else {
+     return ($ret);
+    }
+}
+
+sub __create {
+    my ($self, %attribs) = @_;
+
     foreach my $column_name ( keys %attribs ) {
         my $column = $self->column($column_name);
         unless ($column) {
@@ -1012,15 +1027,7 @@
         }
     }
 
-    my $ret = $self->_handle->insert( $self->table, %attribs );
-    $self->after_create( \$ret ) if $self->can('after_create');
-    if ($class) {
-        $self->load_by_cols(id => $ret);
-        return ($self);
-    }
-    else {
-     return ($ret);
-    }
+    return $self->_handle->insert( $self->table, %attribs );
 }
 
 =head2 delete


More information about the Jifty-commit mailing list