Skip to content

Commit

Permalink
didn't handle /a/:b/c correctly when /a existed
Browse files Browse the repository at this point in the history
  • Loading branch information
mahtin committed May 4, 2016
1 parent 9f61cbc commit 297ade8
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions CloudFlare/api_extras.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ def api_extras(self, extras=None):
extra = re.sub(r"^.*/client/v4/", '/', extra)
extra = re.sub(r"^.*/v4/", '/', extra)
extra = re.sub(r"^/", '', extra)
current = self

# build parts of the extra command
parts = []
Expand All @@ -25,11 +24,15 @@ def api_extras(self, extras=None):

# insert extra command into class
element_path = []
current = self
for element in parts[0]:
element_path.append(element)
try:
current = getattr(current, element)
# exists
m = getattr(current, element)
# exists - but still add it there's a second part
if element == parts[0][-1] and len(parts) > 1:
setattr(m, parts[1][0], self._client_with_auth(self.base, '/'.join(element_path), '/'.join(parts[1])))
current = m
continue
except:
pass
Expand Down

0 comments on commit 297ade8

Please sign in to comment.