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
30965f31
Commit
30965f31
authored
Aug 21, 2015
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Share code for handling parse errors
Signed-off-by:
Michal Čihař
<
michal@cihar.com
>
parent
26e0afc2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
15 deletions
+12
-15
weblate/trans/models/subproject.py
weblate/trans/models/subproject.py
+10
-6
weblate/trans/models/translation.py
weblate/trans/models/translation.py
+2
-9
No files found.
weblate/trans/models/subproject.py
View file @
30965f31
...
...
@@ -856,6 +856,15 @@ class SubProject(models.Model, PercentMixin, URLMixin, PathMixin):
# Notify subscribed users about failure
notify_merge_failure
(
self
,
error
,
status
)
def
handle_parse_error
(
self
,
error
):
"""Handler for parse error."""
report_error
(
error
,
sys
.
exc_info
())
self
.
notify_merge_failure
(
str
(
error
),
u''
.
join
(
traceback
.
format_stack
()),
)
raise
ParseError
(
str
(
error
))
def
update_branch
(
self
,
request
=
None
,
method
=
None
):
'''
Updates current branch to match remote (if possible).
...
...
@@ -1407,12 +1416,7 @@ class SubProject(models.Model, PercentMixin, URLMixin, PathMixin):
try
:
self
.
_template_store
=
self
.
load_template_store
()
except
Exception
as
exc
:
report_error
(
exc
,
sys
.
exc_info
())
self
.
notify_merge_failure
(
str
(
exc
),
u''
.
join
(
traceback
.
format_stack
()),
)
raise
ParseError
(
str
(
exc
))
self
.
handle_parse_error
(
exc
)
return
self
.
_template_store
...
...
weblate/trans/models/translation.py
View file @
30965f31
...
...
@@ -28,8 +28,6 @@ from django.core.cache import cache
from
django.utils
import
timezone
from
django.core.urlresolvers
import
reverse
import
os
import
sys
import
traceback
import
codecs
from
translate.storage
import
poheader
from
datetime
import
datetime
,
timedelta
...
...
@@ -42,7 +40,7 @@ from weblate.trans.models.unit import Unit
from
weblate.trans.models.unitdata
import
Suggestion
from
weblate.trans.signals
import
vcs_pre_commit
,
vcs_post_commit
from
weblate.trans.util
import
(
get_site_url
,
translation_percent
,
split_plural
,
report_error
,
get_site_url
,
translation_percent
,
split_plural
,
)
from
weblate.accounts.avatar
import
get_user_display
from
weblate.trans.mixins
import
URLMixin
,
PercentMixin
,
LoggerMixin
...
...
@@ -448,12 +446,7 @@ class Translation(models.Model, URLMixin, PercentMixin, LoggerMixin):
except
ParseError
:
raise
except
Exception
as
exc
:
report_error
(
exc
,
sys
.
exc_info
())
self
.
subproject
.
notify_merge_failure
(
str
(
exc
),
u''
.
join
(
traceback
.
format_stack
()),
)
raise
ParseError
(
str
(
exc
))
self
.
handle_parse_error
(
exc
)
return
self
.
_store
def
check_sync
(
self
,
force
=
False
,
request
=
None
,
change
=
None
):
...
...
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