[Jifty-commit] r5198 - in jifty/trunk: lib/Jifty
Jifty commits
jifty-commit at lists.jifty.org
Sun Mar 9 11:25:06 EDT 2008
Author: sterling
Date: Sun Mar 9 11:25:06 2008
New Revision: 5198
Modified:
jifty/trunk/ (props changed)
jifty/trunk/lib/Jifty/ClassLoader.pm
Log:
r15574 at dynpc145: andrew | 2008-03-09 10:21:29 -0500
* Jifty::Util->_require can muck up $1, $2 so save those before using it.
* Added an additional guard on actions to keep from short-circuiting record
actions built from plugins that are overridden.
Modified: jifty/trunk/lib/Jifty/ClassLoader.pm
==============================================================================
--- jifty/trunk/lib/Jifty/ClassLoader.pm (original)
+++ jifty/trunk/lib/Jifty/ClassLoader.pm Sun Mar 9 11:25:06 2008
@@ -220,19 +220,27 @@
elsif ( $module =~ /^(?:$base)::Action::
(Create|Update|Delete|Search)([^\.]+)$/x ) {
+ my $action = $1;
+ my $model = $2;
+
# Determine the model class and load it
- my $modelclass = $base . "::Model::" . $2;
+ my $modelclass = $base . "::Model::" . $model;
Jifty::Util->_require( module => $modelclass, quiet => 1);
# Don't generate the action unless it really is a model
if ( eval { $modelclass->isa('Jifty::Record') } ) {
- if ($modelclass->autogenerate_action($1)) {
- $AUTOGENERATED{$module} = 1;
- return $self->return_class(
- "package $module;\n"
- . "use base qw/$base\::Action::Record::$1/;\n"
- . "sub record_class { '$modelclass' };\n"
- );
+ if ($modelclass->autogenerate_action($action)) {
+
+ # Skip autogenerated models; that is, those that are overridden
+ # by plugins, the special case below should take care of it
+ if (!$self->autogenerated($modelclass)) {
+ $AUTOGENERATED{$module} = 1;
+ return $self->return_class(
+ "package $module;\n"
+ . "use base qw/$base\::Action::Record::$action/;\n"
+ . "sub record_class { '$modelclass' };\n"
+ );
+ }
}
}
More information about the Jifty-commit
mailing list