Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
2bc2dd94
Commit
2bc2dd94
authored
Dec 03, 2014
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Perform flags validation on save
Issue #540 Signed-off-by:
Michal Čihař
<
michal@cihar.com
>
parent
9ab7a6a5
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
0 deletions
+14
-0
weblate/trans/forms.py
weblate/trans/forms.py
+12
-0
weblate/trans/validators.py
weblate/trans/validators.py
+2
-0
No files found.
weblate/trans/forms.py
View file @
2bc2dd94
...
...
@@ -32,6 +32,7 @@ from weblate.trans.models import Unit
from
weblate.trans.models.source
import
PRIORITY_CHOICES
from
weblate.trans.checks
import
CHECKS
from
weblate.trans.specialchars
import
get_special_chars
from
weblate.trans.validators
import
validate_check_flags
from
weblate.accounts.forms
import
sort_choices
from
urllib
import
urlencode
import
weblate
...
...
@@ -742,6 +743,17 @@ class CheckFlagsForm(forms.Form):
)
)
def
clean_flags
(
self
):
"""
Be a little bit more tolerant on whitespaces.
"""
flags
=
[
x
.
strip
()
for
x
in
self
.
cleaned_data
[
'flags'
].
strip
().
split
(
','
)
]
flags
=
','
.
join
([
x
for
x
in
flags
if
x
])
validate_check_flags
(
flags
)
return
flags
class
AddUserForm
(
forms
.
Form
):
name
=
forms
.
CharField
(
...
...
weblate/trans/validators.py
View file @
2bc2dd94
...
...
@@ -96,6 +96,8 @@ def validate_check_flags(val):
'''
Validates check influencing flags.
'''
if
not
val
:
return
for
flag
in
val
.
split
(
','
):
if
flag
in
VALID_FLAGS
:
continue
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment