projects
/
platform
/
upstream
/
python-requests.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d3b7863
)
Raise an error for unsupported hook event
author
Paul Matthews
<pmatthews@google.com>
Mon, 12 Aug 2013 13:20:25 +0000
(14:20 +0100)
committer
Paul Matthews
<pmatthews@google.com>
Mon, 12 Aug 2013 14:27:17 +0000
(15:27 +0100)
* Raises a ValueError for an unsupported hook event
requests/models.py
patch
|
blob
|
history
diff --git
a/requests/models.py
b/requests/models.py
index 6b4a2994428664eb01bed26232c69bd54e41ee26..007a9f1caa7cf5b0ffdb4c3ccded5fa5ac6fe38c 100644
(file)
--- a/
requests/models.py
+++ b/
requests/models.py
@@
-141,6
+141,9
@@
class RequestHooksMixin(object):
def register_hook(self, event, hook):
"""Properly register a hook."""
+ if event not in self.hooks:
+ raise ValueError('Unsupported event specified, with event name "%s"' % (event))
+
if isinstance(hook, collections.Callable):
self.hooks[event].append(hook)
elif hasattr(hook, '__iter__'):