Esempio n. 1
0
 def load(self, store):
     self.title = store.value("Title", None)
     self.author = store.value("Author", None)
     self.updated = store.value("Updated", None)
     self.url = store.value("Url", None)
     self.homepage = store.value("Homepage", None)
     self.deleted_entry_ids = store.value("DeletedEntryIds", [])
     # This seems to be a PyQt quirk during storage, the QSettings store @Invalid in the file
     # when self.deleted_entry_ids is an empty list. So if its set to None, lets re-set to an
     # empty list since we don't want None there
     if self.deleted_entry_ids is None:
         self.deleted_entry_ids = []
     for group in store.childGroups():
         store.beginGroup(group)
         entry = Entry()
         entry.load(store)
         self.entries.append(entry)
         store.endGroup()
Esempio n. 2
0
 def testLoad(self):
     import time
     store = StoreMock()
     store.setValue("Title", "MyTitle")
     store.setValue("Content", "MyContent")
     updated = time.gmtime(time.time())
     store.setValue("Updated", updated)
     store.setValue("Url", "MyUrl")
     store.setValue("Id", "MyId")
     store.setValue("Author", "MyAuthor")
     store.setValue("Read", True)
     store.setValue("Important", True)
     entry = Entry()
     entry.load(store)
     self.assertEqual(entry.title, "MyTitle")
     self.assertEqual(entry.author, "MyAuthor")
     self.assertEqual(entry.url, "MyUrl")
     self.assertEqual(entry.identity, "MyId")
     self.assertEqual(entry.updated, updated)
     self.assertEqual(entry.content, "MyContent")
     self.assertEqual(entry.read, True)
     self.assertEqual(entry.important, True)