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 standard update collection class
Browse files Browse the repository at this point in the history
code standard update for collection class.
  • Loading branch information
Mike Druger committed Mar 7, 2014
1 parent 0efc133 commit 62fc5ad
Showing 1 changed file with 1 addition and 26 deletions.
27 changes: 1 addition & 26 deletions aweber_api/collection.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from math import floor
from urlparse import parse_qs
from urllib import urlencode
import collections

from aweber_api.base import API_BASE
from aweber_api.entry import AWeberEntry
Expand Down Expand Up @@ -100,7 +99,7 @@ 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, 1)

data = self.adapter.request('GET', url)
try:
Expand All @@ -111,30 +110,6 @@ def get_parent_entry(self):

return entry

def _partition_url(self):
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 from the url_parts list
for i in range(len(url_parts)-1):
url = '{0}{1}/'.format(url, url_parts[i])

# remove the trailing slash
url = url[:len(url)-1]

return url

def _create_entry(self, offset):
"""Add an entry to the collection"""
data = self._entry_data[offset]
Expand Down

0 comments on commit 62fc5ad

Please sign in to comment.