Schema query class that I{blindly} searches for a reference in the specified schema. It may be used to find Elements and Types but will match on an Element first. This query will also find builtins.
| 87 | |
| 88 | |
| 89 | class BlindQuery(Query): |
| 90 | """ |
| 91 | Schema query class that I{blindly} searches for a reference in |
| 92 | the specified schema. It may be used to find Elements and Types but |
| 93 | will match on an Element first. This query will also find builtins. |
| 94 | """ |
| 95 | |
| 96 | def execute(self, schema): |
| 97 | if schema.builtin(self.ref): |
| 98 | name = self.ref[0] |
| 99 | b = Factory.create(schema, name) |
| 100 | log.debug('%s, found builtin (%s)', self.id, name) |
| 101 | return b |
| 102 | result = None |
| 103 | for d in (schema.elements, schema.types): |
| 104 | result = d.get(self.ref) |
| 105 | if self.filter(result): |
| 106 | result = None |
| 107 | else: |
| 108 | break |
| 109 | if result is None: |
| 110 | eq = ElementQuery(self.ref) |
| 111 | eq.history = self.history |
| 112 | result = eq.execute(schema) |
| 113 | return self.result(result) |
| 114 | |
| 115 | |
| 116 | class TypeQuery(Query): |