src/pyams_catalog/query.py
changeset 3 7c6f10ffdda0
parent 1 5add0249012c
child 8 e31e81bcf6dd
equal deleted inserted replaced
2:959d098e49d9 3:7c6f10ffdda0
    36             query = query.execute()
    36             query = query.execute()
    37         if isinstance(query, tuple):
    37         if isinstance(query, tuple):
    38             query = query[1]
    38             query = query[1]
    39         for oid in query:
    39         for oid in query:
    40             yield self.intids.queryObject(oid)
    40             yield self.intids.queryObject(oid)
       
    41 
       
    42 
       
    43 def or_(source, added):
       
    44     """Combine two queries with 'or'"""
       
    45     if source is None:
       
    46         source = added
       
    47     else:
       
    48         source |= added
       
    49     return source
       
    50 
       
    51 
       
    52 def and_(source, added):
       
    53     """Combine two queries with 'and'"""
       
    54     if source is None:
       
    55         source = added
       
    56     else:
       
    57         source &= added
       
    58     return source