tools (common/data_objects): added a "deserialise" argument to BlogItem:
BlogItem is doing deserialisation itself, which is not clean (it should be done at bridge level), and which is causing trouble in jp which doesn't expect serialisation. As a workaround, the "deserialise" argument has been added for now (default to True), until deserialisation is properly managed in bridge.
This commit is contained in:
parent
ff1a025650
commit
2f30424c6f
1 changed files with 17 additions and 4 deletions
|
|
@ -72,8 +72,16 @@ def parsePubSubMetadata(metadata, items):
|
|||
|
||||
|
||||
class BlogItem(object):
|
||||
def __init__(self, mb_data, parent):
|
||||
self.mb_data = data_format.deserialise(mb_data)
|
||||
def __init__(self, mb_data, parent, deserialise=True):
|
||||
"""
|
||||
@param deserialise(bool): if True, mb_data is a serialised string which must
|
||||
be deserialised
|
||||
"""
|
||||
# FIXME: deserialise should not be done here, but before BlogItem is called
|
||||
if deserialise:
|
||||
self.mb_data = data_format.deserialise(mb_data)
|
||||
else:
|
||||
self.mb_data = mb_data
|
||||
self.parent = parent
|
||||
self._comments = None
|
||||
self._comments_items_list = None
|
||||
|
|
@ -180,8 +188,13 @@ class BlogItem(object):
|
|||
|
||||
|
||||
class BlogItems(object):
|
||||
def __init__(self, mb_data):
|
||||
self.items = [BlogItem(i, self) for i in mb_data[0]]
|
||||
def __init__(self, mb_data, deserialise=True):
|
||||
"""
|
||||
@param deserialise(bool): if True, mb_data is a serialised string which must
|
||||
be deserialised
|
||||
"""
|
||||
# FIXME: deserialise should not be done here, but before BlogItem is called
|
||||
self.items = [BlogItem(i, self, deserialise=deserialise) for i in mb_data[0]]
|
||||
self.metadata = parsePubSubMetadata(mb_data[1], self.items)
|
||||
|
||||
@property
|
||||
|
|
|
|||
Loading…
Reference in a new issue