Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
La Quadrature du Net
Respect My Net
Commits
32fc0f16
Commit
32fc0f16
authored
Apr 28, 2017
by
jc
Browse files
fixes Pokemon exception handling
parent
5f87e532
Changes
2
Show whitespace changes
Inline
Side-by-side
bt/templatetags/bt.py
View file @
32fc0f16
...
...
@@ -30,7 +30,7 @@ status_map = dict(STATUS)
def
status
(
code
):
try
:
return
status_map
[
code
]
except
:
except
Exception
:
return
code
...
...
@@ -41,7 +41,7 @@ type_map = dict(TYPES)
def
type
(
code
):
try
:
return
type_map
[
code
]
except
:
except
Exception
:
return
code
...
...
@@ -52,5 +52,5 @@ media_map = dict(MEDIA)
def
media
(
code
):
try
:
return
media_map
[
code
]
except
:
except
Exception
:
return
code
bt/views.py
View file @
32fc0f16
...
...
@@ -55,7 +55,7 @@ def sanitizeHtml(value, base_url=None):
def
activate
(
request
):
try
:
v
=
Violation
.
objects
.
get
(
activationid
=
request
.
GET
.
get
(
'key'
,
'asdf'
))
except
:
except
Exception
:
messages
.
add_message
(
request
,
messages
.
INFO
,
unicode
(
_
(
'Thank you, this key has been already activated'
)))
return
HttpResponseRedirect
(
'/'
)
# Redirect after POST
if
v
:
...
...
@@ -80,7 +80,7 @@ def activate(request):
def
moderate
(
request
):
try
:
v
=
Violation
.
objects
.
get
(
activationid
=
request
.
GET
.
get
(
'key'
,
'asdf'
))
except
:
except
Exception
:
messages
.
add_message
(
request
,
messages
.
INFO
,
unicode
(
_
(
'Thank you, this key has been already activated'
)))
return
HttpResponseRedirect
(
'/'
)
# Redirect after POST
if
not
v
:
...
...
@@ -101,7 +101,7 @@ def moderate(request):
try
:
settings
.
TWITTER_API
.
PostUpdate
(
"New #NetNeutrality violation reported for %s (%s) %s %s/%s"
%
(
v
.
operator
,
v
.
country
,
v
.
contract
,
settings
.
ROOT_URL
or
'http://localhost:8001/'
,
v
.
id
))
except
:
except
Exception
:
pass
v
.
activationid
=
''
v
.
save
()
...
...
@@ -127,14 +127,14 @@ def confirm(request, id, name=None):
actid
=
sendverifymail
(
'confirm/'
,
name
,
msg
)
try
:
c
=
Confirmation
(
key
=
actid
,
email
=
name
,
violation
=
violation
)
except
:
except
Exception
:
# should except IntegrityError properly
return
HttpResponse
(
unicode
(
_
(
'Thank you, this has been already confirmed'
)))
c
.
save
()
return
HttpResponse
(
unicode
(
_
(
'Thank you for your confirmation'
)))
try
:
c
=
get_object_or_404
(
Confirmation
,
key
=
id
)
except
:
except
Exception
:
messages
.
add_message
(
request
,
messages
.
INFO
,
unicode
(
_
(
"Thank you, this has been already confirmed"
)))
return
HttpResponseRedirect
(
'/'
)
# Redirect after POST
c
.
key
=
''
...
...
@@ -304,7 +304,7 @@ def get_attach(request, id):
response
=
HttpResponse
(
wrapper
,
content_type
=
f
.
type
)
response
[
'Content-Disposition'
]
=
'attachment; filename="%s"'
%
f
.
name
response
[
'Content-Length'
]
=
f
.
storage
.
size
except
:
except
Exception
:
response
=
HttpResponseNotFound
(
'<h1>Document not found.</h1>'
)
return
response
...
...
Write
Preview
Supports
Markdown
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