comparison mercurial/demandimport.py @ 5639:7dd5cf9d1e09

demandload: give better diagnostic for call of an unloaded module
author Matt Mackall <mpm@selenic.com>
date Mon, 10 Dec 2007 10:24:47 -0600
parents 0bbd86b847dd
children e160f2312815
comparison
equal deleted inserted replaced
5638:a9b7e425674f 5639:7dd5cf9d1e09
65 def __repr__(self): 65 def __repr__(self):
66 if self._module: 66 if self._module:
67 return "<proxied module '%s'>" % self._data[0] 67 return "<proxied module '%s'>" % self._data[0]
68 return "<unloaded module '%s'>" % self._data[0] 68 return "<unloaded module '%s'>" % self._data[0]
69 def __call__(self, *args, **kwargs): 69 def __call__(self, *args, **kwargs):
70 raise TypeError("'unloaded module' object is not callable") 70 raise TypeError("%s object is not callable" % repr(self))
71 def __getattribute__(self, attr): 71 def __getattribute__(self, attr):
72 if attr in ('_data', '_extend', '_load', '_module'): 72 if attr in ('_data', '_extend', '_load', '_module'):
73 return object.__getattribute__(self, attr) 73 return object.__getattribute__(self, attr)
74 self._load() 74 self._load()
75 return getattr(self._module, attr) 75 return getattr(self._module, attr)