Skip to content

Commit

Permalink
Fixed a bug that was not loading correctly the Actions.
Browse files Browse the repository at this point in the history
  • Loading branch information
koalalorenzo committed Aug 14, 2014
1 parent 80004a2 commit 8879ade
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
9 changes: 8 additions & 1 deletion digitalocean/Action.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,18 @@ def __init__(self, *args, **kwargs):
self.resource_id = None
self.resource_type = None
self.region = None
# Custom, not provided by the json object.
self.droplet_id = None

super(Action, self).__init__(*args, **kwargs)

def load(self):
action = self.get_data("actions/%s" % self.id)
action = self.get_data(
"droplets/%s/actions/%s" % (
self.droplet_id,
self.id
)
)
if action:
action = action[u'action']
# Loading attributes
Expand Down
4 changes: 3 additions & 1 deletion digitalocean/Droplet.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,10 @@ def get_actions(self):
"""
actions = []
for action_id in self.action_ids:
action = Action(action_id)
action = Action()
action.id = action_id
action.token = self.token
action.droplet_id = self.id
action.load()
actions.append(action)
return actions
Expand Down

0 comments on commit 8879ade

Please sign in to comment.