Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
GraceDB Server
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Michael William Coughlin
GraceDB Server
Commits
4b4f1df9
Commit
4b4f1df9
authored
15 years ago
by
Brian Moe
Browse files
Options
Downloads
Patches
Plain Diff
Query error a little more visible and less fugly.
parent
939e717d
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
gracedb/forms.py
+12
-1
12 additions, 1 deletion
gracedb/forms.py
with
12 additions
and
1 deletion
gracedb/forms.py
+
12
−
1
View file @
4b4f1df9
from
django
import
forms
from
django.utils.safestring
import
mark_safe
from
django.utils.html
import
escape
from
models
import
Event
,
User
,
Group
,
Label
from
query
import
parseQuery
,
ParseException
htmlEntityStar
=
"
★
"
htmlEntityRightPointingHand
=
"
☞
"
htmlEntitySkullAndCrossbones
=
"
☠
"
htmlEntityTriangularBuller
=
"
‣
"
htmlEntityRightArrow
=
"
→
"
errorMarker
=
'
<span style=
"
color:red;
"
>
'
+
htmlEntityStar
+
'
</span>
'
class
GraceQueryField
(
forms
.
CharField
):
def
clean
(
self
,
queryString
):
from
django.db.models
import
Q
...
...
@@ -11,7 +21,8 @@ class GraceQueryField(forms.CharField):
try
:
return
parseQuery
(
queryString
)
except
ParseException
,
e
:
raise
forms
.
ValidationError
(
"
Error near (*):
"
+
e
.
markInputline
(
"
(*)
"
))
err
=
"
Error:
"
+
escape
(
e
.
pstr
[:
e
.
loc
])
+
errorMarker
+
escape
(
e
.
pstr
[
e
.
loc
:])
raise
forms
.
ValidationError
(
mark_safe
(
err
))
except
Exception
,
e
:
# What could this be and how can we handle it better? XXX
raise
forms
.
ValidationError
(
str
(
e
))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment