Commit 31376a6c authored by Ivan Tyagov's avatar Ivan Tyagov

Extend API and set default to None for an array.

Add a new property of type array.
parent e9e24e46
...@@ -58,6 +58,12 @@ class DataArray(BigFile): ...@@ -58,6 +58,12 @@ class DataArray(BigFile):
array = ZBigArray(shape, dtype) array = ZBigArray(shape, dtype)
self._setArray(array) self._setArray(array)
def getArray(self, default=None):
"""
Get numpy array value.
"""
return getattr(self, 'array', None)
def _setArray(self, value): def _setArray(self, value):
""" """
Set numpy array to this ERP5 Data Array. Set numpy array to this ERP5 Data Array.
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Category" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Add_portal_folders_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Copy_or_Move_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Delete_objects_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>elementary_type/array</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>array</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Category</string> </value>
</item>
<item>
<key> <string>short_title</string> </key>
<value> <string>Array</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>array</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
<key> <string>categories</string> </key> <key> <string>categories</string> </key>
<value> <value>
<tuple> <tuple>
<string>elementary_type/data</string> <string>elementary_type/array</string>
</tuple> </tuple>
</value> </value>
</item> </item>
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
</item> </item>
<item> <item>
<key> <string>property_default</string> </key> <key> <string>property_default</string> </key>
<value> <string>python: \'\'</string> </value> <value> <string>python: None</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -118,6 +118,7 @@ class Test(ERP5TypeTestCase): ...@@ -118,6 +118,7 @@ class Test(ERP5TypeTestCase):
data_array = self.portal.data_array_module.newContent( \ data_array = self.portal.data_array_module.newContent( \
portal_type = 'Data Array') portal_type = 'Data Array')
self.assertEqual(None, data_array.getArray())
data_array.initArray((3, 3), np.uint8) data_array.initArray((3, 3), np.uint8)
self.tic() self.tic()
......
portal_categories/elementary_type/array
\ No newline at end of file
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