Commit db017786 authored by Aurel's avatar Aurel

make indexation of document into syncml works even for data coming from integration modules

parent 54da4f63
...@@ -53,7 +53,6 @@ ...@@ -53,7 +53,6 @@
<value> <string>if not len(path_list):\n <value> <string>if not len(path_list):\n
return\n return\n
restrictedTraverse = context.getPortalObject().restrictedTraverse\n restrictedTraverse = context.getPortalObject().restrictedTraverse\n
argument_getter_dict = {}\n
if subscription_path:\n if subscription_path:\n
subscription = restrictedTraverse(subscription_path)\n subscription = restrictedTraverse(subscription_path)\n
getId = subscription.getGidFromObject\n getId = subscription.getGidFromObject\n
...@@ -63,10 +62,11 @@ else:\n ...@@ -63,10 +62,11 @@ else:\n
\n \n
method = context.z_catalog_syncml_document_list\n method = context.z_catalog_syncml_document_list\n
\n \n
parameter_append_list = []\n def generateParameterList():\n
append = parameter_append_list.append\n parameter_append_list = []\n
parameter_dict = {}\n append = parameter_append_list.append\n
for property in method.arguments_src.split():\n parameter_dict = {}\n
for property in method.arguments_src.split():\n
parameter_dict[property] = parameter_value_list = []\n parameter_dict[property] = parameter_value_list = []\n
if property == \'getData\':\n if property == \'getData\':\n
getter = getData\n getter = getData\n
...@@ -77,12 +77,22 @@ for property in method.arguments_src.split():\n ...@@ -77,12 +77,22 @@ for property in method.arguments_src.split():\n
if getter is None:\n if getter is None:\n
getter = lambda obj, property=property: getattr(obj, property)()\n getter = lambda obj, property=property: getattr(obj, property)()\n
append((parameter_value_list, getter))\n append((parameter_value_list, getter))\n
return parameter_dict, parameter_append_list\n
\n
MAX_PER_QUERY = 1000\n
\n \n
for path in path_list:\n for path in path_list:\n
obj = restrictedTraverse(path)\n obj = restrictedTraverse(path)\n
if obj.getPortalType() == "Integration Module":\n
object_list = obj()\n
else:\n
object_list = [obj,]\n
for x in xrange(0, len(object_list), MAX_PER_QUERY):\n
parameter_dict, parameter_append_list = generateParameterList()\n
for obj in object_list[x:x+MAX_PER_QUERY]:\n
for value_list, getter in parameter_append_list:\n for value_list, getter in parameter_append_list:\n
value_list.append(getter(obj))\n value_list.append(getter(obj))\n
method(**parameter_dict)\n method(**parameter_dict)\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
......
121 122
\ No newline at end of file \ 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