From 62fc5ad2e403d1e015f33ca4c12add55e07db078 Mon Sep 17 00:00:00 2001 From: Mike Druger Date: Fri, 7 Mar 2014 15:56:04 -0500 Subject: [PATCH] aweber_api: code standard update collection class code standard update for collection class. --- aweber_api/collection.py | 27 +-------------------------- 1 file changed, 1 insertion(+), 26 deletions(-) diff --git a/aweber_api/collection.py b/aweber_api/collection.py index 4d8176e..b176e69 100644 --- a/aweber_api/collection.py +++ b/aweber_api/collection.py @@ -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 @@ -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: @@ -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]