Commit 33dbc019 authored by Jérome Perrin's avatar Jérome Perrin

as getResultValue only returns the first value, we can limit to the first

result


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@28353 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent df46566d
...@@ -724,6 +724,7 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject): ...@@ -724,6 +724,7 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject):
A method to factor common code used to search a single A method to factor common code used to search a single
object in the database. object in the database.
""" """
kw.setdefault('limit', 1)
result = self.searchResults(query=query, **kw) result = self.searchResults(query=query, **kw)
try: try:
return result[0].getObject() return result[0].getObject()
...@@ -737,6 +738,7 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject): ...@@ -737,6 +738,7 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject):
object in the database. Same as getResultValue but without object in the database. Same as getResultValue but without
taking into account security. taking into account security.
""" """
kw.setdefault('limit', 1)
result = self.unrestrictedSearchResults(query=query, **kw) result = self.unrestrictedSearchResults(query=query, **kw)
try: try:
return result[0].getObject() return result[0].getObject()
......
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