Commit 72b3dc97 authored by Levin Zimmermann's avatar Levin Zimmermann

erp5_wendelin: Fix consistency checks on Data Bucket Stream

This fixes the following error:

  >>> data_bucket_stream = context.data_stream_module.newContent(
  >>>   portal_type = "Data Bucket Stream"
  >>> )
  >>> data_bucket_stream.insertBucket(1, 'testBucket')
  >>> data_bucket_stream.Base_getConsistencyList()

  # Error Type: AttributeError
  # Error Value: 'NoneType' object has no attribute 'getPortalType'

The returned empty lists are valid return values as it can be seen in the Folder class methods:

https://lab.nexedi.com/nexedi/erp5/blob/a17bb910/product/ERP5Type/Core/Folder.py#L1530
https://lab.nexedi.com/nexedi/erp5/blob/a17bb910/product/ERP5Type/Core/Folder.py#L1026
parent 13800642
Pipeline #22391 failed with stage
...@@ -139,6 +139,16 @@ class DataBucketStream(Document): ...@@ -139,6 +139,16 @@ class DataBucketStream(Document):
def __len__(self): def __len__(self):
return len(self._tree) return len(self._tree)
# XXX: Workaround to fix errors during consistency checks.
# We should rename the "_tree" attribute add a migration
# script for existing instances. Then we can remove
# the following two methods.
def objectValues(self, *args, **kw):
return []
def objectIds(self, *args, **kw):
return []
def initBucketTree(self): def initBucketTree(self):
""" """
Initialize the Bucket Tree Initialize the Bucket Tree
...@@ -190,7 +200,6 @@ class DataBucketStream(Document): ...@@ -190,7 +200,6 @@ class DataBucketStream(Document):
def _getOb(self, id, *args, **kw): def _getOb(self, id, *args, **kw):
return None return None
def getBucketByKey(self, key=None): def getBucketByKey(self, key=None):
""" """
Get one bucket Get one bucket
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment