748 restrvar, rtrel = _make_relation(self.select, filtered_variable, |
748 restrvar, rtrel = _make_relation(self.select, filtered_variable, |
749 self.rtype, self.role) |
749 self.rtype, self.role) |
750 self._and_restriction(rel, restrvar, value.pop()) |
750 self._and_restriction(rel, restrvar, value.pop()) |
751 |
751 |
752 def _and_restriction(self, rel, restrvar, value): |
752 def _and_restriction(self, rel, restrvar, value): |
753 rrel = nodes.make_constant_restriction(restrvar, self.restr_attr, |
753 if rel is None: |
754 value, self.restr_attr_type) |
754 self.select.add_constant_restriction(restrvar, self.restr_attr, |
755 rel.parent.replace(rel, nodes.And(rel, rrel)) |
755 value, self.restr_attr_type) |
|
756 else: |
|
757 rrel = nodes.make_constant_restriction(restrvar, self.restr_attr, |
|
758 value, self.restr_attr_type) |
|
759 rel.parent.replace(rel, nodes.And(rel, rrel)) |
756 |
760 |
757 |
761 |
758 @cached |
762 @cached |
759 def _search_card(self, cards): |
763 def _search_card(self, cards): |
760 for rdef in self._iter_rdefs(): |
764 for rdef in self._iter_rdefs(): |