[gen] Search: bugfix in filtered unnamed searches.

This commit is contained in:
Gaetan Delannay 2015-03-09 13:36:48 +01:00
parent 5c6952537e
commit 4d154c314f
3 changed files with 8 additions and 8 deletions

View file

@ -9,7 +9,7 @@ from appy.shared.utils import sequenceTypes
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
class MailConfig: 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', def __init__(self, fromName=None, fromEmail='info@appyframework.org',
server='localhost', port=25, login=None, password=None, server='localhost', port=25, login=None, password=None,
enabled=True): enabled=True):

View file

@ -504,7 +504,7 @@ class ToolMixin(BaseMixin):
If p_klass does not define this attr "creators", we will use a If p_klass does not define this attr "creators", we will use a
default list of roles as defined in the config.''' 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'): if hasattr(klass, 'creators'):
creators = klass.creators creators = klass.creators
else: else:
@ -741,6 +741,9 @@ class ToolMixin(BaseMixin):
# It is a custom search whose parameters are in the session # It is a custom search whose parameters are in the session
fields = self.REQUEST.SESSION['searchCriteria'] fields = self.REQUEST.SESSION['searchCriteria']
res = Search('customSearch', **fields) 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: elif '*' in name:
# The search is defined in a Ref field with link=popup. Get the # The search is defined in a Ref field with link=popup. Get the
# search, the initiator object and the Ref field. # search, the initiator object and the Ref field.
@ -748,7 +751,7 @@ class ToolMixin(BaseMixin):
initiator = self.getObject(uid, appy=True) initiator = self.getObject(uid, appy=True)
initiatorField = initiator.getField(ref) initiatorField = initiator.getField(ref)
res = getattr(initiator.klass, ref).select res = getattr(initiator.klass, ref).select
elif name: else:
appyClass = self.getAppyClass(className) appyClass = self.getAppyClass(className)
# Search among static searches # Search among static searches
res = ClassDescriptor.getSearch(appyClass, name) res = ClassDescriptor.getSearch(appyClass, name)
@ -758,9 +761,6 @@ class ToolMixin(BaseMixin):
if search.name == name: if search.name == name:
res = search res = search
break break
else:
# It is the search for every instance of p_className
res = Search('allSearch')
# Return a UiSearch if required # Return a UiSearch if required
if ui: if ui:
res = UiSearch(res, className, self) res = UiSearch(res, className, self)

View file

@ -484,12 +484,12 @@ class ToolWrapper(AbstractWrapper):
app.config.reindex() app.config.reindex()
except: except:
failed.append(app.config) failed.append(app.config)
# Then, refresh objects in the "data" folder. # Then, refresh objects in the "data" folder
for obj in app.data.objectValues(): for obj in app.data.objectValues():
subNb, subFailed = self.refreshCatalog(startObject=obj) subNb, subFailed = self.refreshCatalog(startObject=obj)
nb += subNb nb += subNb
failed += subFailed 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() for obj in failed: obj.reindex()
if failed: if failed:
failMsg = ' (%d retried)' % len(failed) failMsg = ' (%d retried)' % len(failed)