Lines 37-47
Link Here
|
37 |
import time |
37 |
import time |
38 |
import xml.etree.ElementTree as ET |
38 |
import xml.etree.ElementTree as ET |
39 |
|
39 |
|
40 |
from hcs_utils.storage import Storage |
40 |
from hcs_utils.storage import Storage, storageify, unstorageify |
41 |
|
41 |
|
42 |
log = logging.getLogger(__name__) |
42 |
log = logging.getLogger(__name__) |
43 |
|
43 |
|
44 |
CACHE_FORMAT_VERSION = '3.2' |
44 |
CACHE_FORMAT_VERSION = '4.0' |
45 |
G_MAX_SRESULTS = 9999 # Maximum number of entries to ask google for. |
45 |
G_MAX_SRESULTS = 9999 # Maximum number of entries to ask google for. |
46 |
GDATA_VERSION = '3' |
46 |
GDATA_VERSION = '3' |
47 |
ATOM_NS = '{http://www.w3.org/2005/Atom}' |
47 |
ATOM_NS = '{http://www.w3.org/2005/Atom}' |
Lines 243-250
Link Here
|
243 |
log.info('Failed to read the cache file: %s', err) |
243 |
log.info('Failed to read the cache file: %s', err) |
244 |
raise |
244 |
raise |
245 |
if cache: |
245 |
if cache: |
246 |
self.contacts = cache.get('contacts') |
246 |
self.contacts = storageify(cache.get('contacts')) |
247 |
self.groups = cache.get('groups') |
247 |
self.groups = storageify(cache.get('groups')) |
248 |
else: |
248 |
else: |
249 |
self.update() |
249 |
self.update() |
250 |
if not self.contacts: |
250 |
if not self.contacts: |
Lines 262-268
Link Here
|
262 |
|
262 |
|
263 |
""" |
263 |
""" |
264 |
if self.contacts: # never write a empty addressbook |
264 |
if self.contacts: # never write a empty addressbook |
265 |
cache = {'contacts': self.contacts, 'groups': self.groups, 'goobook_cache': CACHE_FORMAT_VERSION} |
265 |
cache = {'contacts': unstorageify(self.contacts), 'groups': unstorageify(self.groups), 'goobook_cache': CACHE_FORMAT_VERSION} |
266 |
pickle.dump(cache, open(self.__config.cache_filename, 'wb')) |
266 |
pickle.dump(cache, open(self.__config.cache_filename, 'wb')) |
267 |
|
267 |
|
268 |
def get_group(self, id_): |
268 |
def get_group(self, id_): |