Commits

Jan-Jaap Driessen  committed 2d1910c

The last change was not such a good idea.

  • Participants
  • Parent commits 231d436
  • Branches compilers-n-minifiers2

Comments (0)

Files changed (1)

File fanstatic/core.py

                         # Calculate the supersedes information in minified mode.
                         minified_resource = self.mode_clone(MINIFIED, source=minified)
                     else:
+                        # The dependencies of a mode resource should be the same 
+                        # as the dependencies this mode replaces.
+                        mode_depends = set([resource.mode(MINIFIED) for resource in self.depends])
+                        if minified.depends != mode_depends:
+                            raise ModeResourceDependencyError
                         minified_resource = minified 
                         minified_resource._mode = MINIFIED
                 else:
                     # The supersedes in this mode.
                     debug_resource = self.mode_clone(DEBUG, source=debug)
                 else:
+                    # The dependencies of a mode resource should be the same 
+                    # as the dependencies this mode replaces.
+                    mode_depends = set([resource.mode(DEBUG) for resource in self.depends])
+                    if debug.depends != mode_depends:
+                        raise ModeResourceDependencyError('%s is not %s' % (debug.depends, mode_depends))
                     debug_resource = debug
             elif self.compiler and self.compiler.debug:
                 debug_resource = self.mode_clone(DEBUG)
         supersedes_in_mode = [resource.mode(mode) for resource in self.supersedes]
         depends_in_mode = [resource.mode(mode) for resource in self.depends]
 
-        source = source or self.source
-
-        # The dependencies of a mode resource should be the same 
-        # as the dependencies this mode replaces.
-        mode_depends = set([resource.mode(DEBUG) for resource in self.depends])
-        if source.depends != mode_depends:
-            raise ModeResourceDependencyError('%s is not %s' % (source.depends, mode_depends))
-
-        return self.__class__(self.library, source,
+        return self.__class__(self.library, source or self.source,
                               _mode=mode,
                               depends=depends_in_mode,
                               supersedes=supersedes_in_mode,