def expose(func):
func.exposed=True
return func
def is_exposed(func):
return getattr(func, 'exposed', False)
# copied from pydo
def _import_a_class(fqcn):
lastDot=fqcn.rfind('.')
if lastDot==0:
raise ValueError, "unable to import %s" %fqcn
if lastDot>0:
modName=fqcn[:lastDot]
className=fqcn[lastDot+1:]
try:
module=__import__(modName, globals(), locals(), [className])
return getattr(module, className)
except (ImportError, AttributeError):
raise ValueError, "impossible to import: %s" % fqcn
else:
raise ValueError, "impossible to import: %s" % fqcn
__all__=['expose', 'is_exposed']
|