From 4d154c314f846e2cf43794d16f27a7074d3d49b4 Mon Sep 17 00:00:00 2001 From: Gaetan Delannay Date: Mon, 9 Mar 2015 13:36:48 +0100 Subject: [PATCH] [gen] Search: bugfix in filtered unnamed searches. --- gen/mail.py | 2 +- gen/mixins/ToolMixin.py | 10 +++++----- gen/wrappers/ToolWrapper.py | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/gen/mail.py b/gen/mail.py index bf4ba4b..08f3ac9 100644 --- a/gen/mail.py +++ b/gen/mail.py @@ -9,7 +9,7 @@ from appy.shared.utils import sequenceTypes # ------------------------------------------------------------------------------ class MailConfig: - '''Parameters for conneting to a SMTP server.''' + '''Parameters for conneting to a SMTP server''' def __init__(self, fromName=None, fromEmail='info@appyframework.org', server='localhost', port=25, login=None, password=None, enabled=True): diff --git a/gen/mixins/ToolMixin.py b/gen/mixins/ToolMixin.py index f1d2cc3..fd050d7 100644 --- a/gen/mixins/ToolMixin.py +++ b/gen/mixins/ToolMixin.py @@ -504,7 +504,7 @@ class ToolMixin(BaseMixin): If p_klass does not define this attr "creators", we will use a default list of roles as defined in the config.''' - # Get the value of attr "creators", or a default value if not present. + # Get the value of attr "creators", or a default value if not present if hasattr(klass, 'creators'): creators = klass.creators else: @@ -741,6 +741,9 @@ class ToolMixin(BaseMixin): # It is a custom search whose parameters are in the session fields = self.REQUEST.SESSION['searchCriteria'] res = Search('customSearch', **fields) + elif (name == 'allSearch') or not name: + # It is the search for every instance of p_className + res = Search('allSearch') elif '*' in name: # The search is defined in a Ref field with link=popup. Get the # search, the initiator object and the Ref field. @@ -748,7 +751,7 @@ class ToolMixin(BaseMixin): initiator = self.getObject(uid, appy=True) initiatorField = initiator.getField(ref) res = getattr(initiator.klass, ref).select - elif name: + else: appyClass = self.getAppyClass(className) # Search among static searches res = ClassDescriptor.getSearch(appyClass, name) @@ -758,9 +761,6 @@ class ToolMixin(BaseMixin): if search.name == name: res = search break - else: - # It is the search for every instance of p_className - res = Search('allSearch') # Return a UiSearch if required if ui: res = UiSearch(res, className, self) diff --git a/gen/wrappers/ToolWrapper.py b/gen/wrappers/ToolWrapper.py index 476ffc1..b965bde 100644 --- a/gen/wrappers/ToolWrapper.py +++ b/gen/wrappers/ToolWrapper.py @@ -484,12 +484,12 @@ class ToolWrapper(AbstractWrapper): app.config.reindex() except: failed.append(app.config) - # Then, refresh objects in the "data" folder. + # Then, refresh objects in the "data" folder for obj in app.data.objectValues(): subNb, subFailed = self.refreshCatalog(startObject=obj) nb += subNb failed += subFailed - # Re-try to index all objects for which reindexation has failed. + # Re-try to index all objects for which reindexation has failed for obj in failed: obj.reindex() if failed: failMsg = ' (%d retried)' % len(failed)