MCPcopy Create free account
hub / github.com/explorerhq/sql-explorer / SqlField

Class SqlField

explorer/forms.py:10–30  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8
9
10class SqlField(CharField):
11
12 def validate(self, value):
13 """
14 Ensure that the SQL passes the blacklist.
15
16 :param value: The SQL for this Query model.
17 """
18 super().validate(value)
19 query = Query(sql=value)
20
21 passes_blacklist, failing_words = query.passes_blacklist()
22
23 error = MSG_FAILED_BLACKLIST % ", ".join(
24 failing_words) if not passes_blacklist else None
25
26 if error:
27 raise ValidationError(
28 error,
29 code="InvalidSql"
30 )
31
32
33class QueryForm(ModelForm):

Callers 1

QueryFormClass · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected