Commit ccf5b2ff authored by Ayush Tiwari's avatar Ayush Tiwari Committed by Ayush Tiwari

[prep-commit] Products.ZSQLCatalog.SQLCatalog: Prefere using in instead of has_key

parent ee6475c1
...@@ -804,7 +804,7 @@ class Catalog(Folder, ...@@ -804,7 +804,7 @@ class Catalog(Folder,
for filt in root.getElementsByTagName("filter"): for filt in root.getElementsByTagName("filter"):
id = str(filt.getAttribute("id")) id = str(filt.getAttribute("id"))
expression = filt.getAttribute("expression") expression = filt.getAttribute("expression")
if not self.filter_dict.has_key(id): if id not in self.filter_dict.keys():
self.filter_dict[id] = PersistentMapping() self.filter_dict[id] = PersistentMapping()
self.filter_dict[id]['filtered'] = 1 self.filter_dict[id]['filtered'] = 1
self.filter_dict[id]['type'] = [] self.filter_dict[id]['type'] = []
...@@ -2646,7 +2646,7 @@ class Catalog(Folder, ...@@ -2646,7 +2646,7 @@ class Catalog(Folder,
for id in method_id_list: for id in method_id_list:
# We will first look if the filter is activated # We will first look if the filter is activated
if not self.filter_dict.has_key(id): if id not in self.filter_dict.keys():
self.filter_dict[id] = PersistentMapping() self.filter_dict[id] = PersistentMapping()
if REQUEST.has_key('%s_box' % id): if REQUEST.has_key('%s_box' % id):
......
  • Remove .keys(), it's not needed either (dict also implements __contains__, and it saves a full dict key copy and list creation). Once done, can be pushed to master without waiting for the merge request.

    Also, please prefix your commits with the "big component" they apply to (Product name, Business Template name, Tool name...) and remove [prep-commit].

    Edited by Vincent Pelletier
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