(self, *expressions, **extra)
| 28 | geom_param_pos = (0,) |
| 29 | |
| 30 | def __init__(self, *expressions, **extra): |
| 31 | super().__init__(*expressions, **extra) |
| 32 | |
| 33 | # Ensure that value expressions are geometric. |
| 34 | for pos in self.geom_param_pos: |
| 35 | expr = self.source_expressions[pos] |
| 36 | if not isinstance(expr, Value): |
| 37 | continue |
| 38 | try: |
| 39 | output_field = expr.output_field |
| 40 | except FieldError: |
| 41 | output_field = None |
| 42 | geom = expr.value |
| 43 | if ( |
| 44 | not isinstance(geom, GEOSGeometry) |
| 45 | or output_field |
| 46 | and not isinstance(output_field, GeometryField) |
| 47 | ): |
| 48 | raise TypeError( |
| 49 | "%s function requires a geometric argument in position %d." |
| 50 | % (self.name, pos + 1) |
| 51 | ) |
| 52 | if not geom.srid and not output_field: |
| 53 | raise ValueError("SRID is required for all geometries.") |
| 54 | if not output_field: |
| 55 | self.source_expressions[pos] = Value( |
| 56 | geom, output_field=GeometryField(srid=geom.srid) |
| 57 | ) |
| 58 | |
| 59 | @property |
| 60 | def name(self): |
nothing calls this directly
no test coverage detected