[Jifty-commit] r2943 - in jifty/trunk: lib/Jifty
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Sun Mar 11 20:35:02 EDT 2007
Author: jesse
Date: Sun Mar 11 20:35:02 2007
New Revision: 2943
Modified:
jifty/trunk/ (props changed)
jifty/trunk/lib/Jifty/ClassLoader.pm
Log:
r53341 at pinglin: jesse | 2007-03-11 20:34:02 -0400
* Now we can inherit actions from plugins
Modified: jifty/trunk/lib/Jifty/ClassLoader.pm
==============================================================================
--- jifty/trunk/lib/Jifty/ClassLoader.pm (original)
+++ jifty/trunk/lib/Jifty/ClassLoader.pm Sun Mar 11 20:35:02 2007
@@ -164,7 +164,9 @@
Jifty::Util->require($modelclass);
- return undef unless eval { $modelclass->table };
+ local $@;
+ eval { $modelclass->table } ;
+ if(!$@) {
return $self->return_class(
"package $module;\n"
@@ -172,7 +174,32 @@
. "sub record_class { '$modelclass' };\n"
. "sub autogenerated { 1 };\n"
);
+ }
+
+ }
+
+ # This is if, not elsif because we might have $base::Action::Deleteblah
+ # that matches that last elsif clause but loses on the eval.
+ if ( $module =~ /^(?:$base)::Action::(.*)$/x and not grep {$_ eq $base} map {ref} Jifty->plugins ) {
+ my $action = $1;
+ # If we don't have the action in our own app, let's try the plugins
+ # the app has loaded.
+ foreach my $plugin (map {ref} Jifty->plugins) {
+ next if ($plugin eq $base);
+ my $class = $plugin."::Action::".$action;
+ if (Jifty::Util->try_to_require($class) ) {
+ return $self->return_class(
+ "package $module;\n"
+ . "use base qw/$class/;\n"
+ . "sub autogenerated { 1 };\n"
+ );
+
+
+ }
+ }
+
}
+ # Didn't find a match
return undef;
}
More information about the Jifty-commit
mailing list