Skip to content
This repository has been archived by the owner on Aug 29, 2019. It is now read-only.

Commit

Permalink
aweber_api: code std update for entry class
Browse files Browse the repository at this point in the history
code std update for entry class
  • Loading branch information
Mike Druger committed Mar 7, 2014
1 parent 62fc5ad commit 90a2798
Showing 1 changed file with 1 addition and 25 deletions.
26 changes: 1 addition & 25 deletions aweber_api/entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,35 +142,11 @@ def get_parent_entry(self):
if url_parts is None:
return None

url = self._remove_collection_id_from_url(url_parts)
url = self._construct_parent_url(url_parts, 2)

data = self.adapter.request('GET', url)
return AWeberEntry(url, data, self.adapter)

def _partition_url(self):
"""Partition the url into segments."""
try:
url_parts = self.url.split('/')
#If top of tree - no parent entry
if len(url_parts) <= 3:
return None

except Exception:
return None

return url_parts

def _remove_collection_id_from_url(self, url_parts):
"""Remove collection id and slash from end of url."""
url = ''
# construct the url string from the url_parts list
for i in range(len(url_parts) - 2):
url = '{0}{1}/'.format(url, url_parts[i])
# remove the trailing slash
url = url[:len(url) - 1]

return url

def get_web_forms(self):
self._method_for('account')
data = self.adapter.request(
Expand Down

0 comments on commit 90a2798

Please sign in to comment.