Skip to content

Commit

Permalink
Allow adding domains to an app that does not have domains yet.
Browse files Browse the repository at this point in the history
  • Loading branch information
ojii committed Apr 11, 2012
1 parent 9b2bf11 commit f1605ad
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions heroku/api.py
Expand Up @@ -120,6 +120,7 @@ def _get_resources(self, resource, obj, params=None, map=None, **kwargs):
list_resource = map(items=items)
list_resource._h = self
list_resource._obj = obj
list_resource._kwargs = kwargs

return list_resource

Expand Down
8 changes: 6 additions & 2 deletions heroku/structures.py
Expand Up @@ -17,6 +17,7 @@ def __init__(self, items=None):
self._h = None
self._items = items or list()
self._obj = None
self._kwargs = {}

def __repr__(self):
return repr(self._items)
Expand All @@ -40,14 +41,17 @@ def __getitem__(self, key):
return v

def add(self, *args, **kwargs):
full_kwargs = {}
full_kwargs.update(self._kwargs)
full_kwargs.update(kwargs)

try:
return self[0].new(*args, **kwargs)
return self[0].new(*args, **full_kwargs)
except IndexError:
o = self._obj()
o._h = self._h

return o.new(*args, **kwargs)
return o.new(*args, **full_kwargs)


def remove(self, key):
Expand Down

0 comments on commit f1605ad

Please sign in to comment.