Commit 566c4bb6 authored by Vincent Pelletier's avatar Vincent Pelletier

ERP5Catalog.CatalogTool: range can generate decreasing sequences directly.

Also, use xrange as it's faster than range even for short sequences.
parent 4dac92dd
......@@ -897,7 +897,7 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject):
splitted_key = key.split('_')
# look from the end of the key from the beginning if we
# can find 'title', or 'portal_type'...
for i in range(1,len(splitted_key))[::-1]:
for i in xrange(len(splitted_key) - 1, 0, -1):
expected_base_cat_id = '_'.join(splitted_key[0:i])
if expected_base_cat_id != 'parent' and \
expected_base_cat_id in base_cat_id_list:
......
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