Commit 81b844a6 authored by Michal Čihař's avatar Michal Čihař

Add docs

parent 1072d9a2
...@@ -21,6 +21,10 @@ from django.core.exceptions import ValidationError ...@@ -21,6 +21,10 @@ from django.core.exceptions import ValidationError
def validate_repoweb(val): def validate_repoweb(val):
'''
Validates whether URL for repository browser is valid and
can be filled in using format string.
'''
try: try:
val % {'file': 'file.po', 'line': '9', 'branch': 'master'} val % {'file': 'file.po', 'line': '9', 'branch': 'master'}
except Exception as e: except Exception as e:
...@@ -28,6 +32,9 @@ def validate_repoweb(val): ...@@ -28,6 +32,9 @@ def validate_repoweb(val):
def validate_commit_message(val): def validate_commit_message(val):
'''
Validates that commit message is a valid format string.
'''
try: try:
val % { val % {
'language': 'cs', 'language': 'cs',
...@@ -45,6 +52,9 @@ def validate_commit_message(val): ...@@ -45,6 +52,9 @@ def validate_commit_message(val):
def validate_filemask(val): def validate_filemask(val):
'''
Validates file mask that it contains *.
'''
if not '*' in val: if not '*' in val:
raise ValidationError( raise ValidationError(
_('File mask does not contain * as a language placeholder!') _('File mask does not contain * as a language placeholder!')
...@@ -52,6 +62,9 @@ def validate_filemask(val): ...@@ -52,6 +62,9 @@ def validate_filemask(val):
def validate_repo(val): def validate_repo(val):
'''
Validates Git URL, and special weblate:// links.
'''
try: try:
repo = get_linked_repo(val) repo = get_linked_repo(val)
if repo is not None and repo.is_repo_link(): if repo is not None and repo.is_repo_link():
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment