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
59cd7bb3
Commit
59cd7bb3
authored
Jul 30, 2014
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Catch only specific exceptions when possible
Signed-off-by:
Michal Čihař
<
michal@cihar.com
>
parent
10ada6cc
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
11 additions
and
10 deletions
+11
-10
weblate/trans/admin_views.py
weblate/trans/admin_views.py
+1
-1
weblate/trans/formats.py
weblate/trans/formats.py
+2
-2
weblate/trans/models/subproject.py
weblate/trans/models/subproject.py
+1
-1
weblate/trans/models/translation.py
weblate/trans/models/translation.py
+3
-2
weblate/trans/templatetags/translations.py
weblate/trans/templatetags/translations.py
+2
-2
weblate/trans/views/api.py
weblate/trans/views/api.py
+1
-1
weblate/trans/views/helper.py
weblate/trans/views/helper.py
+1
-1
No files found.
weblate/trans/admin_views.py
View file @
59cd7bb3
...
@@ -321,7 +321,7 @@ def ssh(request):
...
@@ -321,7 +321,7 @@ def ssh(request):
stderr
=
subprocess
.
STDOUT
,
stderr
=
subprocess
.
STDOUT
,
)
)
can_generate
=
(
ret
==
0
and
not
os
.
path
.
exists
(
RSA_KEY_FILE
))
can_generate
=
(
ret
==
0
and
not
os
.
path
.
exists
(
RSA_KEY_FILE
))
except
:
except
subprocess
.
CalledProcessError
:
can_generate
=
False
can_generate
=
False
# Grab action type
# Grab action type
...
...
weblate/trans/formats.py
View file @
59cd7bb3
...
@@ -671,7 +671,7 @@ class PoFormat(FileFormat):
...
@@ -671,7 +671,7 @@ class PoFormat(FileFormat):
stderr
=
subprocess
.
STDOUT
,
stderr
=
subprocess
.
STDOUT
,
)
)
cls
.
msginit_found
=
(
ret
==
0
)
cls
.
msginit_found
=
(
ret
==
0
)
except
:
except
subprocess
.
CalledProcessError
:
cls
.
msginit_found
=
False
cls
.
msginit_found
=
False
return
cls
.
msginit_found
return
cls
.
msginit_found
...
@@ -683,7 +683,7 @@ class PoFormat(FileFormat):
...
@@ -683,7 +683,7 @@ class PoFormat(FileFormat):
try
:
try
:
pofile
.
parsefile
(
base
)
pofile
.
parsefile
(
base
)
return
True
return
True
except
:
except
Exception
:
return
False
return
False
@
staticmethod
@
staticmethod
...
...
weblate/trans/models/subproject.py
View file @
59cd7bb3
...
@@ -389,7 +389,7 @@ class SubProject(models.Model, PercentMixin, URLMixin, PathMixin):
...
@@ -389,7 +389,7 @@ class SubProject(models.Model, PercentMixin, URLMixin, PathMixin):
path
=
self
.
get_path
()
path
=
self
.
get_path
()
try
:
try
:
self
.
_git_repo
=
git
.
Repo
(
path
)
self
.
_git_repo
=
git
.
Repo
(
path
)
except
:
except
Exception
:
# Fallback to initializing the repository
# Fallback to initializing the repository
self
.
_git_repo
=
git
.
Repo
.
init
(
path
)
self
.
_git_repo
=
git
.
Repo
.
init
(
path
)
...
...
weblate/trans/models/translation.py
View file @
59cd7bb3
...
@@ -30,6 +30,7 @@ from django.core.urlresolvers import reverse
...
@@ -30,6 +30,7 @@ from django.core.urlresolvers import reverse
import
os
import
os
import
git
import
git
import
traceback
import
traceback
import
ConfigParser
from
translate.storage
import
poheader
from
translate.storage
import
poheader
from
datetime
import
datetime
,
timedelta
from
datetime
import
datetime
,
timedelta
...
@@ -807,7 +808,7 @@ class Translation(models.Model, URLMixin, PercentMixin):
...
@@ -807,7 +808,7 @@ class Translation(models.Model, URLMixin, PercentMixin):
value
=
cnf
.
get
(
section
,
key
)
value
=
cnf
.
get
(
section
,
key
)
if
value
==
expected
:
if
value
==
expected
:
return
return
except
:
except
ConfigParser
.
Error
:
pass
pass
# Add section if it does not exist
# Add section if it does not exist
...
@@ -1217,7 +1218,7 @@ class Translation(models.Model, URLMixin, PercentMixin):
...
@@ -1217,7 +1218,7 @@ class Translation(models.Model, URLMixin, PercentMixin):
fileobj
,
fileobj
,
self
.
subproject
.
template_store
self
.
subproject
.
template_store
)
)
except
:
except
Exception
:
# Fallback to automatic detection
# Fallback to automatic detection
fileobj
.
seek
(
0
)
fileobj
.
seek
(
0
)
store
=
AutoFormat
(
fileobj
)
store
=
AutoFormat
(
fileobj
)
...
...
weblate/trans/templatetags/translations.py
View file @
59cd7bb3
...
@@ -189,7 +189,7 @@ def check_name(check):
...
@@ -189,7 +189,7 @@ def check_name(check):
'''
'''
try
:
try
:
return
CHECKS
[
check
].
name
return
CHECKS
[
check
].
name
except
:
except
KeyError
:
return
check
return
check
...
@@ -200,7 +200,7 @@ def check_description(check):
...
@@ -200,7 +200,7 @@ def check_description(check):
'''
'''
try
:
try
:
return
CHECKS
[
check
].
description
return
CHECKS
[
check
].
description
except
:
except
KeyError
:
return
check
return
check
...
...
weblate/trans/views/api.py
View file @
59cd7bb3
...
@@ -260,7 +260,7 @@ def export_stats(request, project, subproject):
...
@@ -260,7 +260,7 @@ def export_stats(request, project, subproject):
try
:
try
:
indent
=
int
(
request
.
GET
[
'indent'
])
indent
=
int
(
request
.
GET
[
'indent'
])
except
:
except
(
ValueError
,
KeyError
)
:
indent
=
None
indent
=
None
response
=
[]
response
=
[]
...
...
weblate/trans/views/helper.py
View file @
59cd7bb3
...
@@ -101,7 +101,7 @@ def try_set_language(lang):
...
@@ -101,7 +101,7 @@ def try_set_language(lang):
try
:
try
:
django
.
utils
.
translation
.
activate
(
lang
)
django
.
utils
.
translation
.
activate
(
lang
)
except
:
except
Exception
:
# Ignore failure on activating language
# Ignore failure on activating language
pass
pass
try
:
try
:
...
...
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