Commit 0641cb0e authored by Titouan Soulard's avatar Titouan Soulard

erp5_jio_connector: add Portal Type filter for jIO Connector

parent 59738f9c
...@@ -87,11 +87,30 @@ class JioApiConnector(XMLObject): ...@@ -87,11 +87,30 @@ class JioApiConnector(XMLObject):
def allDocsFromApi(self, request_dict): def allDocsFromApi(self, request_dict):
return self._sendToApi("/allDocs", request_dict) return self._sendToApi("/allDocs", request_dict)
def getMatchingTesterList(self): def getMatchingTesterList(self, portal_type=None):
"""
Returns list of matching providers for a given Portal Type.
Contrary to the other methods, this one can take no Portal Type.
This is simply for convenience since usually only one matching
is used, the same for all Portal Types.
"""
if portal_type:
return [tester for tester in self.objectValues(portal_type="jIO API Equality Tester") \
if tester.isMatchingProvider() and portal_type in tester.getPortalTypeFilterList()]
else:
return [tester for tester in self.objectValues(portal_type="jIO API Equality Tester") if tester.isMatchingProvider()] return [tester for tester in self.objectValues(portal_type="jIO API Equality Tester") if tester.isMatchingProvider()]
def getCheckingTesterList(self): def getCheckingTesterList(self, portal_type):
return [tester for tester in self.objectValues(portal_type="jIO API Equality Tester") if tester.isCheckingProvider()] """
Returns list of checking providers for a given Portal Type.
def getUpdatingTesterList(self): """
return [tester for tester in self.objectValues(portal_type="jIO API Equality Tester") if tester.isUpdatingProvider()] return [tester for tester in self.objectValues(portal_type="jIO API Equality Tester") \
if tester.isCheckingProvider() and portal_type in tester.getPortalTypeFilterList()]
def getUpdatingTesterList(self, portal_type):
"""
Returns list of updating providers for a given Portal Type.
"""
return [tester for tester in self.objectValues(portal_type="jIO API Equality Tester") \
if tester.isUpdatingProvider() and portal_type in tester.getPortalTypeFilterList()]
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Standard Property" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>elementary_type/object</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>portal_type_filter_list_property</string> </value>
</item>
<item>
<key> <string>property_default</string> </key>
<value>
<none/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -79,6 +79,7 @@ ...@@ -79,6 +79,7 @@
<string>my_reference</string> <string>my_reference</string>
<string>my_local_reference</string> <string>my_local_reference</string>
<string>my_remote_reference</string> <string>my_remote_reference</string>
<string>my_portal_type_filter_list</string>
</list> </list>
</value> </value>
</item> </item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>items</string>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_portal_type_filter_list</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>items</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_parallel_list_field</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>items</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Portal Type Filter</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: [(x.getId(), x.getId()) for x in here.getPortalObject().portal_types.objectValues()]</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
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