Commit 849534d5 authored by Aurel's avatar Aurel

when exporting catalog method, if is_filter no set, do not export

filter parameter


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@7476 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent eafdb45b
...@@ -1479,14 +1479,15 @@ class CatalogMethodTemplateItem(ObjectTemplateItem): ...@@ -1479,14 +1479,15 @@ class CatalogMethodTemplateItem(ObjectTemplateItem):
catalog, method_id) catalog, method_id)
self._is_filtered_archive[method_id] = 0 self._is_filtered_archive[method_id] = 0
if catalog.filter_dict.has_key(method_id): if catalog.filter_dict.has_key(method_id):
self._is_filtered_archive[method_id] = \ if catalog.filter_dict[method_id]['filtered']:
catalog.filter_dict[method_id]['filtered'] self._is_filtered_archive[method_id] = \
self._filter_expression_archive[method_id] = \ catalog.filter_dict[method_id]['filtered']
catalog.filter_dict[method_id]['expression'] self._filter_expression_archive[method_id] = \
self._filter_expression_instance_archive[method_id] = \ catalog.filter_dict[method_id]['expression']
catalog.filter_dict[method_id]['expression_instance'] self._filter_expression_instance_archive[method_id] = \
self._filter_type_archive[method_id] = \ catalog.filter_dict[method_id]['expression_instance']
catalog.filter_dict[method_id]['type'] self._filter_type_archive[method_id] = \
catalog.filter_dict[method_id]['type']
def export(self, context, bta, **kw): def export(self, context, bta, **kw):
if len(self._objects.keys()) == 0: if len(self._objects.keys()) == 0:
...@@ -1516,21 +1517,22 @@ class CatalogMethodTemplateItem(ObjectTemplateItem): ...@@ -1516,21 +1517,22 @@ class CatalogMethodTemplateItem(ObjectTemplateItem):
xml_data += os.linesep+' </item>' xml_data += os.linesep+' </item>'
if catalog.filter_dict.has_key(method_id): if catalog.filter_dict.has_key(method_id):
xml_data += os.linesep+' <item key="_is_filtered_archive" type="int">' if catalog.filter_dict[method_id]['filtered']:
xml_data += os.linesep+' <value>1</value>' xml_data += os.linesep+' <item key="_is_filtered_archive" type="int">'
xml_data += os.linesep+' </item>' xml_data += os.linesep+' <value>1</value>'
for method in catalog_method_filter_list: xml_data += os.linesep+' </item>'
value = getattr(self, method, '')[method_id] for method in catalog_method_filter_list:
if method != '_filter_expression_instance_archive': value = getattr(self, method, '')[method_id]
if type(value) in (type(''), type(u'')): if method != '_filter_expression_instance_archive':
xml_data += os.linesep+' <item key="%s" type="str">' %(method,) if type(value) in (type(''), type(u'')):
xml_data += os.linesep+' <value>%s</value>' %(str(value)) xml_data += os.linesep+' <item key="%s" type="str">' %(method,)
xml_data += os.linesep+' </item>' xml_data += os.linesep+' <value>%s</value>' %(str(value))
elif type(value) in (type(()), type([])): xml_data += os.linesep+' </item>'
xml_data += os.linesep+' <item key="%s" type="tuple">'%(method) elif type(value) in (type(()), type([])):
for item in value: xml_data += os.linesep+' <item key="%s" type="tuple">'%(method)
xml_data += os.linesep+' <value>%s</value>' %(str(item)) for item in value:
xml_data += os.linesep+' </item>' xml_data += os.linesep+' <value>%s</value>' %(str(item))
xml_data += os.linesep+' </item>'
xml_data += os.linesep+'</catalog_method>' xml_data += os.linesep+'</catalog_method>'
f.write(xml_data) f.write(xml_data)
f.close() f.close()
......
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