Properly manipulate contents of messagelist for folder

Create initializer function that puts default values to all fields
of message list item.  Fix all code that directly assigns some hash
to the elements of messagelist: for direct assignments only initializer
is now permitted, all other modification are done in-place.

Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
This commit is contained in:
Eygene Ryabinkin
2014-08-03 16:47:26 +04:00
parent 73e2c95acd
commit 7df765cfdb
7 changed files with 75 additions and 8 deletions

View File

@ -236,6 +236,17 @@ class BaseFolder(object):
You must call cachemessagelist() before calling this function!"""
raise NotImplementedError
def msglist_item_initializer(self, uid):
"""
Returns value for empty messagelist element with given UID.
This function must initialize all fields of messagelist item
and must be called every time when one creates new messagelist
entry to ensure that all fields that must be present are present.
"""
raise NotImplementedError
def uidexists(self, uid):
"""Returns True if uid exists"""
return uid in self.getmessagelist()