Skip to content

Commit

Permalink
Merge pull request #2 from growthstreet/bugfixes
Browse files Browse the repository at this point in the history
Fixing locale bug - Thanks :-)
  • Loading branch information
cleder committed Feb 6, 2015
2 parents caaf9a6 + 5808c6a commit 588f22f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
duedil/secrets.py
*.pyc
*egg*
.coverage

21 changes: 14 additions & 7 deletions duedil/v3pro.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,9 @@ def service_addresses(self):
results = self._get('service-addresses')
address_list = []
for r in results['response']['data']:
r['locale'] = r.get('locale', self.locale)
address_list.append(
ServiceAddress(self.api_key,
locale=self.locale,
sandbox=self.sandbox,
**r)
)
Expand All @@ -218,8 +218,9 @@ def companies(self):
results = self._get('companies')
company_list = []
for r in results['response']['data']:
r['locale'] = r.get('locale', self.locale)
company_list.append(
Company(self.api_key, locale=self.locale,
Company(self.api_key,
sandbox=self.sandbox, **r)
)
self._companies = company_list
Expand All @@ -233,8 +234,10 @@ def directorships(self):
results = self._get('directorships')
directorships_list = []
for r in results['response']['data']:
if not r.get('locale'):
r['locale'] = self.locale
directorships_list.append(
DirectorShip(self.api_key, locale=self.locale,
DirectorShip(self.api_key,
sandbox=self.sandbox, **r)
)
self._directorships = directorships_list
Expand Down Expand Up @@ -271,8 +274,9 @@ def directors(self):
results = self._get('directors')
director_list = []
for r in results['response']['data']:
r['locale'] = r.get('locale', self.locale)
director_list.append(
Director(self.api_key, locale=self.locale,
Director(self.api_key,
sandbox=self.sandbox, **r)
)
self._directors = director_list
Expand Down Expand Up @@ -316,8 +320,9 @@ def directorships(self):
results = self._get('directorships')
directorships_list = []
for r in results['response']['data']:
r['locale'] = r.get('locale', self.locale)
directorships_list.append(
DirectorShip(self.api_key, locale=self.locale,
DirectorShip(self.api_key,
sandbox=self.sandbox, **r)
)
self._directorships = directorships_list
Expand All @@ -332,8 +337,9 @@ def subsidiaries(self):
try:
results = self._get('subsidiaries')
for r in results['response']['data']:
r['locale'] = r.get('locale', self.locale)
subsidiaries_list.append(
Company(self.api_key, locale=self.locale,
Company(self.api_key,
sandbox=self.sandbox, **r)
)
except HTTPError as e:
Expand All @@ -352,7 +358,8 @@ def parent(self):
try:
results = self._get('parent')
p_data = results['response']
self._parent = Company(self.api_key, locale=self.locale,
p_data['locale'] = p_data.get('locale', self.locale)
self._parent = Company(self.api_key,
sandbox=self.sandbox, **p_data)
self._has_parent = True
except HTTPError as e:
Expand Down

0 comments on commit 588f22f

Please sign in to comment.