Skip to content
Browse files

tweak decorators to handle non-API methods

remove @needs_caller_key; fold into cbui_url()
  • Loading branch information...
1 parent 4bc81b5 commit b54a08a5d815fd957ec2f24bb42858797f54297c @disruptek disruptek committed
Showing with 2 additions and 12 deletions.
  1. +2 −12 boto/fps/connection.py
View
14 boto/fps/connection.py
@@ -63,7 +63,7 @@ def wrapper(*args, **kw):
if 1 != len(filter(hasgroup, groups)):
message = ' OR '.join(['+'.join(g) for g in groups])
message = "{0} requires {1} argument(s)" \
- "".format(func.action, message)
+ "".format(getattr(func, 'action', 'Method'), message)
raise KeyError(message)
return func(*args, **kw)
message = ' OR '.join(['+'.join(g) for g in groups])
@@ -83,16 +83,6 @@ def wrapper(*args, **kw):
return add_attrs_from(func, to=wrapper)
-def needs_caller_key(func):
-
- def wrapper(self, *args, **kw):
- kw.setdefault('callerKey', self.aws_access_key_id)
- return func(self, *args, **kw)
- wrapper.__doc__ = "{0}\nUses callerKey, defaults to your " \
- "AWS Access Key ID".format(func.__doc__)
- return add_attrs_from(func, to=wrapper)
-
-
def api_action(*api):
def decorator(func):
@@ -193,7 +183,6 @@ def install_payment_instruction(self, action, response, **kw):
"""
return self.get_object(action, kw, response)
- @needs_caller_key
@needs_caller_reference
@requires(['returnURL', 'pipelineName'])
def cbui_url(self, **kw):
@@ -211,6 +200,7 @@ def cbui_url(self, **kw):
'signatureMethod': 'HmacSHA256',
'signatureVersion': '2',
})
+ kw.setdefault('callerKey', self.aws_access_key_id)
safestr = lambda x: x is not None and str(x) or ''
safequote = lambda x: urllib.quote(safestr(x), safe='~')

0 comments on commit b54a08a

Please sign in to comment.
Something went wrong with that request. Please try again.