[Jifty-commit] r2728 - in Jifty-DBI/branches/od: .
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Mon Jan 29 09:53:31 EST 2007
Author: audreyt
Date: Mon Jan 29 09:53:31 2007
New Revision: 2728
Modified:
Jifty-DBI/branches/od/ (props changed)
Jifty-DBI/branches/od/lib/Jifty/DBI/Record.pm
Log:
r26997 at 122-126-37-36 (orig r2725): audreyt | 2007-01-29 22:28:13 +0800
* Add back the __create hook because that's the only semantically
sane layer to add versioned-record behaviour.
Modified: Jifty-DBI/branches/od/lib/Jifty/DBI/Record.pm
==============================================================================
--- Jifty-DBI/branches/od/lib/Jifty/DBI/Record.pm (original)
+++ Jifty-DBI/branches/od/lib/Jifty/DBI/Record.pm Mon Jan 29 09:53:31 2007
@@ -968,6 +968,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) {
@@ -1011,15 +1026,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