Commit 7859a03f authored by Jérome Perrin's avatar Jérome Perrin

accounting: review AccountModule_getAvailableGapList

* Remove include_empty_item: We always want an empty item in dialogs
* Remove include_gap_in_path: This was always true

simplify code a little bit.
parent d1bd710e
...@@ -3,18 +3,14 @@ ...@@ -3,18 +3,14 @@
# gap / country / gap_name # gap / country / gap_name
# so we always use as "root" the category of depth 2. # so we always use as "root" the category of depth 2.
results = [] item_list = [('', '')]
countries = context.portal_categories.gap.objectValues() countries = context.portal_categories.gap.objectValues()
for country in countries : for country in countries :
for gap in country.objectValues() : for gap in country.objectValues() :
title = gap.getParentValue().getTranslatedTitle() + '/'+ gap.getTranslatedTitle() title = country.getTranslatedTitle() + '/'+ gap.getTranslatedTitle()
path = gap.getRelativeUrl() path = gap.getRelativeUrl()
if not include_gap_in_path : item_list.append(
path = path.replace('gap/', '') ((country.getTranslatedTitle() + '/'+ gap.getTranslatedTitle()),
path))
results += [(title, path)] return item_list
if include_empty_item == 1:
results = [('', '')] + results
return results
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>include_gap_in_path=1, include_empty_item=0</string> </value> <value> <string></string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
...@@ -284,7 +284,7 @@ ...@@ -284,7 +284,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string>python:here.AccountModule_getAvailableGapList(include_gap_in_path=1, include_empty_item=1)</string> </value> <value> <string>python:here.AccountModule_getAvailableGapList()</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -299,7 +299,7 @@ ...@@ -299,7 +299,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string>python:here.AccountModule_getAvailableGapList(include_gap_in_path=1, include_empty_item=1)</string> </value> <value> <string>python:here.AccountModule_getAvailableGapList()</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -275,7 +275,7 @@ ...@@ -275,7 +275,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string>python:here.AccountModule_getAvailableGapList(include_gap_in_path=1, include_empty_item=1)</string> </value> <value> <string>python:here.AccountModule_getAvailableGapList()</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
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