Skip to content
Browse files

raise AttributeError instead of returning callable for data model met…

…hods
  • Loading branch information...
1 parent f48ea18 commit 558c3f10c4f68ea3daf1dad78e2b2c67413ce4f6 @tjfontaine committed Feb 10, 2012
Showing with 4 additions and 0 deletions.
  1. +4 −0 linode/api.py
View
4 linode/api.py
@@ -206,6 +206,9 @@ def batchFlush(self):
def __getattr__(self, name):
"""Return a callable for any undefined attribute and assume it's an API call"""
+ if name.startswith('__'):
+ raise AttributeError()
+
def generic_request(*args, **kw):
request = LowerCaseDict(kw)
request['api_action'] = name.replace('_', '.')
@@ -215,6 +218,7 @@ def generic_request(*args, **kw):
logging.debug('Batched: %s', json.dumps(request))
else:
return self.__send_request(request)
+
generic_request.__name__ = name
return generic_request

0 comments on commit 558c3f1

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