Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Respect My Net
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
15
Issues
15
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
La Quadrature du Net
Respect My Net
Commits
32fc0f16
Commit
32fc0f16
authored
Apr 28, 2017
by
jc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixes Pokemon exception handling
parent
5f87e532
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
9 deletions
+9
-9
bt/templatetags/bt.py
bt/templatetags/bt.py
+3
-3
bt/views.py
bt/views.py
+6
-6
No files found.
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
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