diff options
| author | 2011-11-27 13:19:23 +0100 | |
|---|---|---|
| committer | 2011-11-27 13:19:23 +0100 | |
| commit | cff42ae73425f54c4d941ad9968807859adaf1dd (patch) | |
| tree | 6bc1303acc28929fccc3387ca6d40dc0d5862aef /github3/handlers/base.py | |
| parent | Complete AuthUser handler test (diff) | |
| download | python-github3-cff42ae73425f54c4d941ad9968807859adaf1dd.tar.xz python-github3-cff42ae73425f54c4d941ad9968807859adaf1dd.zip | |
Inject handler hook
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('/') |
