plugin XEP-0277: blog items data are now entirely serialised before going to bridge:
So far, and for historical reasons, blog items data where serialised using a unicode: unicode dict, which was causing trouble for many types of values (timestamps, booleans, lists). This patch changes it by serialising the whole items before going to bridge, and deserialising it when going back. This way, complex data can be used easily in items. This impact psEvent and serItemsData* methods which are renamed transItemsData* because there are not always serialising anymore (a new argument "serialise" allows to specify it). When editing a blog post in jp, metadata are now more easy to manipulate, specially lists like tags.
This commit is contained in:
parent
c89a771c06
commit
512ae0b91e
10 changed files with 188 additions and 184 deletions
|
|
@ -73,10 +73,8 @@ def parsePubSubMetadata(metadata, items):
|
|||
|
||||
class BlogItem(object):
|
||||
def __init__(self, mb_data, parent):
|
||||
self.mb_data = mb_data
|
||||
self.mb_data = data_format.deserialise(mb_data)
|
||||
self.parent = parent
|
||||
self._tags = None
|
||||
self._groups = None
|
||||
self._comments = None
|
||||
self._comments_items_list = None
|
||||
|
||||
|
|
@ -126,15 +124,11 @@ class BlogItem(object):
|
|||
|
||||
@property
|
||||
def tags(self):
|
||||
if self._tags is None:
|
||||
self._tags = list(data_format.dict2iter("tag", self.mb_data))
|
||||
return self._tags
|
||||
return self.mb_data.get(u'tags', [])
|
||||
|
||||
@property
|
||||
def groups(self):
|
||||
if self._groups is None:
|
||||
self._groups = list(data_format.dict2iter("group", self.mb_data))
|
||||
return self._groups
|
||||
return self.mb_data.get(u'groups', [])
|
||||
|
||||
@property
|
||||
def title(self):
|
||||
|
|
|
|||
Loading…
Reference in a new issue