Skip to content

Commit cff42ae

Browse files
committed
Inject handler hook
1 parent 3579857 commit cff42ae

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

github3/handlers/base.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ def __init__(self, gh):
1111
self._gh = gh
1212
super(Handler, self).__init__()
1313

14+
def _inject_handler(self, handler, prefix=''):
15+
import inspect
16+
for method, callback in inspect.getmembers(handler):
17+
if method.startswith(prefix) and inspect.ismethod(callback):
18+
setattr(self, method, callback)
19+
1420
def _prefix_resource(self, resource):
1521
prefix = getattr(self, 'prefix', '')
1622
return '/'.join((prefix, str(resource))).strip('/')

github3/handlers/users.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def get_repos(self, user=None, limit=None):
7878
limit=limit)
7979

8080
def get_watched(self, user=None, limit=None):
81-
""" Return repositories that user whatch
81+
""" Return repositories that user watch
8282
8383
:param `user`: User model or username string
8484

0 commit comments

Comments
 (0)