Commit 4cf247ca authored by Ayush Tiwari's avatar Ayush Tiwari

SQLCatalog: Add function for returning filter_dict

And simplify manage_exportProperties function accordingly
parent 4a56d264
...@@ -672,6 +672,9 @@ class Catalog(Folder, ...@@ -672,6 +672,9 @@ class Catalog(Folder,
def _clearCaches(self): def _clearCaches(self):
self._cache_sequence_number += 1 self._cache_sequence_number += 1
def _getFilterDict(self):
return self.filter_dict
security.declarePrivate('getSQLCatalogRoleKeysList') security.declarePrivate('getSQLCatalogRoleKeysList')
def getSQLCatalogRoleKeysList(self): def getSQLCatalogRoleKeysList(self):
""" """
...@@ -741,16 +744,9 @@ class Catalog(Folder, ...@@ -741,16 +744,9 @@ class Catalog(Folder,
f.write(' </property>\n') f.write(' </property>\n')
# XXX Although filters are not properties, output filters here. # XXX Although filters are not properties, output filters here.
# XXX Ideally, filters should be properties in Z SQL Methods, shouldn't they? # XXX Ideally, filters should be properties in Z SQL Methods, shouldn't they?
if hasattr(self, 'filter_dict'): filter_dict = self._getFilterDict()
filter_list = [] if filter_dict:
for filter_id in self.filter_dict.keys(): for filter_id, filter_def in sorted(filter_dict.iteritems()):
filter_definition = self.filter_dict[filter_id]
filter_list.append((filter_id, filter_definition))
# Sort for easy diff
filter_list.sort(key=lambda x: x[0])
for filter_item in filter_list:
filter_id = filter_item[0]
filter_def = filter_item[1]
if not filter_def['filtered']: if not filter_def['filtered']:
# If a filter is not activated, no need to output it. # If a filter is not activated, no need to output it.
continue continue
...@@ -1603,7 +1599,7 @@ class Catalog(Folder, ...@@ -1603,7 +1599,7 @@ class Catalog(Folder,
with (noReadOnlyTransactionCache if disable_cache else with (noReadOnlyTransactionCache if disable_cache else
readOnlyTransactionCache)(): readOnlyTransactionCache)():
filter_dict = self.filter_dict filter_dict = self._getFilterDict()
catalogged_object_list_cache = {} catalogged_object_list_cache = {}
for method_name in method_id_list: for method_name in method_id_list:
# We will check if there is an filter on this # We will check if there is an filter on this
......
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