diff options
Diffstat (limited to 'github3/handlers/base.py')
-rw-r--r-- | github3/handlers/base.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/github3/handlers/base.py b/github3/handlers/base.py index 4e9198f..a85ce20 100644 --- a/github3/handlers/base.py +++ b/github3/handlers/base.py @@ -11,6 +11,12 @@ class Handler(object): self._gh = gh super(Handler, self).__init__() + def _inject_handler(self, handler, prefix=''): + import inspect + for method, callback in inspect.getmembers(handler): + if method.startswith(prefix) and inspect.ismethod(callback): + setattr(self, method, callback) + def _prefix_resource(self, resource): prefix = getattr(self, 'prefix', '') return '/'.join((prefix, str(resource))).strip('/') |