warning, not error, if a module named in toon.dc doesn't exist.

This commit is contained in:
David Rose 2003-07-02 04:10:49 +00:00
parent 3d916a1ff3
commit 34d313acb6
3 changed files with 7 additions and 2 deletions

View File

@ -21,8 +21,11 @@ class ClientDistClass:
exec("import " + self.name)
self.constructor = eval(self.name + "." + self.name)
except ImportError, e:
self.notify.warning("%s.py does not exist." % (self.name))
self.notify.warning("Unable to import %s.py: %s" % (self.name, e))
self.constructor = None
except (NameError, AttributeError), e:
self.notify.warning("%s.%s does not exist: %s" % (self.name, self.name, e))
self.constructor = None
return None
def parseFields(self, dcClass):

View File

@ -28,7 +28,7 @@ class ClientDistUpdate:
# Only catch name and attribute errors
# as all other errors are legit errors
except ImportError, e:
self.notify.warning("%s.py does not exist." % (cdc.name))
self.notify.warning("Unable to import %s.py: %s" % (cdc.name, e))
self.func = None
except (NameError, AttributeError), e:
#self.notify.warning(cdc.name + "." + self.name +

View File

@ -431,6 +431,8 @@ class ClientRepository(DirectObject.DirectObject):
# If it is not in the dictionary or the cache, then...
else:
# Construct a new one
if cdc.constructor == None:
self.notify.error("Could not create an undefined %s object." % (cdc.name))
distObj = cdc.constructor(self)
# Assign it an Id
distObj.doId = doId