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
e9c58a93
Commit
e9c58a93
authored
Mar 12, 2012
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add validation to repoweb field (issue #6)
parent
c06f3894
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
1 deletion
+10
-1
trans/models.py
trans/models.py
+10
-1
No files found.
trans/models.py
View file @
e9c58a93
...
...
@@ -7,6 +7,7 @@ from django.db.models import Sum
from
django.utils.translation
import
ugettext_lazy
,
ugettext
as
_
from
django.utils.safestring
import
mark_safe
from
django.core.mail
import
mail_admins
from
django.core.exceptions
import
ValidationError
from
glob
import
glob
import
os
import
os.path
...
...
@@ -23,6 +24,12 @@ from util import is_plural, split_plural, join_plural
logger
=
logging
.
getLogger
(
'weblate'
)
def
validate_repoweb
(
val
):
try
:
test
=
val
%
{
'file'
:
'file.po'
,
'line'
:
'9'
}
except
Exception
,
e
:
raise
ValidationError
(
_
(
'Bad format string (%s)'
)
%
str
(
e
))
class
Project
(
models
.
Model
):
name
=
models
.
CharField
(
max_length
=
100
)
slug
=
models
.
SlugField
(
db_index
=
True
)
...
...
@@ -65,7 +72,9 @@ class SubProject(models.Model):
slug
=
models
.
SlugField
(
db_index
=
True
,
help_text
=
_
(
'Name used in URLs'
))
project
=
models
.
ForeignKey
(
Project
)
repo
=
models
.
CharField
(
max_length
=
200
,
help_text
=
_
(
'URL of Git repository'
))
repoweb
=
models
.
URLField
(
help_text
=
_
(
'Link to repository browser, use %(file)s and %(line)s as filename and line placeholders'
))
repoweb
=
models
.
URLField
(
help_text
=
_
(
'Link to repository browser, use %(file)s and %(line)s as filename and line placeholders'
),
validators
=
[
validate_repoweb
])
branch
=
models
.
CharField
(
max_length
=
50
,
help_text
=
_
(
'Git branch to translate'
))
filemask
=
models
.
CharField
(
max_length
=
200
,
help_text
=
_
(
'Mask of files to translate, use * instead of language code'
))
...
...
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