I am currently using EndpointsModel to create a RESTful API for all my models on AppEngine. Since it is RESTful, these api have a lot of repeat code which I want to avoid.>
In our case I solved this by subclassing functools.partial:
class WrappablePartial(functools.partial):
@property
def __module__(self):
return self.func.__module__
@property
def __name__(self):
return "functools.partial({}, *{}, **{})".format(
self.func.__name__,
self.args,
self.keywords
)
@property
def __doc__(self):
return self.func.__doc__
NB you could also make use of __getattr__ to redirect queries, but I figured that was actually less readable (and makes it more difficult to insert any useful meta-data as with __name__)