def __getattribute__(self, name): dec_map = {'create':expose, 'read':expose.safe, 'update':expose.idempotent, 'delete':expose.idempotent} if name in dec_map: method = ExposedBase.__getattribute__(self, name) if not callable(method): msg = 'Attribute %s of %s should be callable' % (method, self) raise TypeError(msg) return dec_map[name](method) else: return ExposedBase.__getattribute__(self, name)
def _getMethodFilterFunc(self, decorator_class): #crate filter to accept automatically non decorated public methods as exposed basic_filter = ExposedBase._getMethodFilterFunc(self, decorator_class) def filterFunc(name, decorator): return not name.startswith('_') and decorator_class == expose \ and not isinstance(decorator, decorator_base) or \ basic_filter(name, decorator) return filterFunc