|
|
@@ -502,14 +502,14 @@ class ApiWrapper(object):
|
|
|
self.api = _get_api(request, snippet)
|
|
|
|
|
|
def __getattr__(self, name):
|
|
|
- from notebook import tasks as ntasks
|
|
|
- if TASK_SERVER.ENABLED.get() and hasattr(ntasks, name):
|
|
|
- attr = object.__getattribute__(ntasks, name)
|
|
|
- def _method(*args, **kwargs):
|
|
|
- return attr(*args, **dict(kwargs, postdict=self.request.POST, user_id=self.request.user.id))
|
|
|
- return _method
|
|
|
- else:
|
|
|
- return object.__getattribute__(self.api, name)
|
|
|
+ if TASK_SERVER.ENABLED.get():
|
|
|
+ from notebook import tasks as ntasks
|
|
|
+ if hasattr(ntasks, name):
|
|
|
+ attr = object.__getattribute__(ntasks, name)
|
|
|
+ def _method(*args, **kwargs):
|
|
|
+ return attr(*args, **dict(kwargs, postdict=self.request.POST, user_id=self.request.user.id))
|
|
|
+ return _method
|
|
|
+ return object.__getattribute__(self.api, name)
|
|
|
|
|
|
|
|
|
def get_api(request, snippet):
|