Skip to content
This repository
Browse code

raise AttributeError instead of returning callable for data model met…

…hods
  • Loading branch information...
commit 558c3f10c4f68ea3daf1dad78e2b2c67413ce4f6 1 parent f48ea18
Timothy J Fontaine authored

Showing 1 changed file with 4 additions and 0 deletions. Show diff stats Hide diff stats

  1. +4 0 linode/api.py
4 linode/api.py
@@ -206,6 +206,9 @@ def batchFlush(self):
206 206
207 207 def __getattr__(self, name):
208 208 """Return a callable for any undefined attribute and assume it's an API call"""
  209 + if name.startswith('__'):
  210 + raise AttributeError()
  211 +
209 212 def generic_request(*args, **kw):
210 213 request = LowerCaseDict(kw)
211 214 request['api_action'] = name.replace('_', '.')
@@ -215,6 +218,7 @@ def generic_request(*args, **kw):
215 218 logging.debug('Batched: %s', json.dumps(request))
216 219 else:
217 220 return self.__send_request(request)
  221 +
218 222 generic_request.__name__ = name
219 223 return generic_request
220 224

0 comments on commit 558c3f1

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