From 08a55474768d5bd39afa8beed4a8d7d581b0fe0b Mon Sep 17 00:00:00 2001 From: Matt Colyer Date: Sat, 23 May 2009 17:06:21 -0700 Subject: [PATCH] Use iphone UUID for LUIDs. --- iPhoneModule.py | 11 ++++++----- 1 files changed, 6 insertions(+), 5 deletions(-) diff --git a/iPhoneModule.py b/iPhoneModule.py index 0c1bd9d..9f52240 100644 --- a/iPhoneModule.py +++ b/iPhoneModule.py @@ -92,11 +92,11 @@ class iPhoneBaseTwoWay(DataProvider.TwoWay): def _put_data(self, data): #FIXME implement put data i = 0 - return "%s@iphone" % i + return "%s@iphone-%s" % (i, self._phone_uuid) def _get_data(self, LUID): storage = self.data_class.get_storage_for_entity(self.storage_entity) - return storage[LUID.replace("@iphone","")] + return storage[LUID.split("@iphone")[0]] def _data_exists(self, LUID): if (None != _get_data(LUID)): @@ -110,6 +110,7 @@ class iPhoneBaseTwoWay(DataProvider.TwoWay): def _refresh(self): self.agent.set_data_storage(self.data_class); if self.agent.start_session(): + self._phone_uuid = self.agent._phone.serial_number() self.agent.synchronize() self.agent.finish_session() @@ -117,7 +118,7 @@ class iPhoneBaseTwoWay(DataProvider.TwoWay): res = [] storage = self.data_class.get_storage_for_entity(self.storage_entity) for k, i in storage.iteritems(): - res.append("%s@iphone" % i.id) + res.append("%s@iphone-%s" % (i.id, self._phone_uuid)) return res def put(self, data, overwrite, LUID=None): @@ -251,7 +252,7 @@ class iPhoneCalendarsTwoWay(iPhoneBaseTwoWay): events = self.data_class.get_children_of_record_by_type(self.calendar, self.storage_entity) for i in events: # FIXME: This should also include the UUID of the phone - res.append("%s@iphone" % i.id) + res.append("%s@iphone-%s" % (i.id, self._phone_uuid)) return res def get(self, LUID): @@ -285,7 +286,7 @@ class iPhoneCalendarsTwoWay(iPhoneBaseTwoWay): """ Returns the currently configured iPhoneCalendarRecordEntity """ - if not self._calendarNames: + if not hasattr(self, '_calendarNames'): self._refresh() calendars = self.data_class.get_storage_for_entity(iPhoneCalendarRecordEntity).values() -- 1.5.6.3