Skip to content

Commit

Permalink
Fix module commands loading
Browse files Browse the repository at this point in the history
  • Loading branch information
Julien Richard-Foy authored and guillaumebort committed May 7, 2011
1 parent 0023725 commit 8e5ac58
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions framework/pym/play/cmdloader.py
Expand Up @@ -35,20 +35,21 @@ def load_play_module(self, modname):
self._load_cmd_from(mod)
except Exception, e:
print '~'
print '~ !! Error whileloading %s: %s' % (commands, e)
print '~ !! Error while loading %s: %s' % (commands, e)
print '~'
pass # No command to load in this module

def _load_cmd_from(self, mod):
try:
if 'COMMANDS' in dir(mod):
for name in mod.COMMANDS:
if name in self.commands:
print "~ Warning: conflict on command " + name
self.commands[name] = mod
if 'MODULE' in dir(mod):
self.modules[mod.MODULE] = mod
except Exception:
warnings.warn("Warning: error loading command " + name)
try:
if name in self.commands:
warnings.warn("Warning: conflict on command " + name)
self.commands[name] = mod
except Exception:
warnings.warn("Warning: error loading command " + name)
if 'MODULE' in dir(mod):
self.modules[mod.MODULE] = mod

def load_python_module(name, location):
mod_desc = imp.find_module(name, [location])
Expand Down

0 comments on commit 8e5ac58

Please sign in to comment.