Changeset 594

Show
Ignore:
Timestamp:
06/28/03 12:34:58 (5 years ago)
Author:
sholloway
Message:

Added reload(module) on import attribute error

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/RBFoundation/RBFoundation/XMLClassBuilder.py

    r568 r594  
    6262 
    6363    class BaseImport(object): 
     64        retryimport = True 
     65 
    6466        def __init__(self, PyPathRoot=''): 
    6567            self.PyPathRoot = PyPathRoot 
     
    7274                PyPath = self.PyPathRoot 
    7375            module = __import__(PyPath, globals(), {}, Name) 
    74             result = getattr(module, Name) 
    75             return result 
     76            try: 
     77                return getattr(module, Name) 
     78            except AttributeError: 
     79                if self.retryimport: 
     80                    module = reload(module) 
     81                    return getattr(module, Name) 
     82                raise 
    7683 
    7784        def __call__(self, owner, parent, node, attributes, namespacemap):