--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_catalog/query.py Thu Mar 19 15:18:24 2015 +0100
@@ -0,0 +1,40 @@
+#
+# Copyright (c) 2008-2015 Thierry Florac <tflorac AT ulthar.net>
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+
+__docformat__ = 'restructuredtext'
+
+
+# import standard library
+
+# import interfaces
+from zope.intid.interfaces import IIntIds
+
+# import packages
+from hypatia.query import Query
+from pyams_utils.registry import query_utility
+
+
+class CatalogResultSet(object):
+ """Catalog query result set wrapper"""
+
+ def __init__(self, query):
+ self.query = query
+ self.intids = query_utility(IIntIds)
+
+ def __iter__(self):
+ query = self.query
+ if isinstance(query, Query):
+ query = query.execute()
+ if isinstance(query, tuple):
+ query = query[1]
+ for oid in query:
+ yield self.intids.queryObject(oid)