[Jifty-commit] r4039 - jifty/trunk/lib/Jifty

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Mon Sep 3 16:55:55 EDT 2007


Author: ruz
Date: Mon Sep  3 16:55:55 2007
New Revision: 4039

Modified:
   jifty/trunk/lib/Jifty/ClassLoader.pm

Log:
* collection generator may be called when we're loading models
  and not all models have been loaded to the moment, so we have
  to try to require the model before testing if it esists.

Modified: jifty/trunk/lib/Jifty/ClassLoader.pm
==============================================================================
--- jifty/trunk/lib/Jifty/ClassLoader.pm	(original)
+++ jifty/trunk/lib/Jifty/ClassLoader.pm	Mon Sep  3 16:55:55 2007
@@ -181,10 +181,12 @@
     # Autogenerate the Collection class for a Model
     elsif ( $module =~ /^(?:$base)::Model::([^\.]+)Collection$/ ) {
         my $modelclass = $base .'::Model::'. $1;
-        unless ( $modelclass->isa('Jifty::Record') ) {
-            warn "There is no model for $module";
+        Jifty::Util->require($modelclass);
+        unless ( eval { $modelclass->isa('Jifty::Record') } ) {
+            warn "There is no model for collection $module";
             return undef;
         }
+
         return $self->return_class(
                   "package $module;\n"
                 . "use base qw/@{[$base]}::Collection/;\n"


More information about the Jifty-commit mailing list