Skip to content

Commit

Permalink
fix flake8
Browse files Browse the repository at this point in the history
  • Loading branch information
hisham waleed karam committed Feb 1, 2019
1 parent 25241fb commit 6125d2f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
15 changes: 9 additions & 6 deletions geonode/layers/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,13 @@

DEFAULT_SEARCH_BATCH_SIZE = 10
MAX_SEARCH_BATCH_SIZE = 25
GENERIC_UPLOAD_ERROR = _("There was an error while attempting to upload your data. \
GENERIC_UPLOAD_ERROR = _(
"There was an error while attempting to upload your data. \
Please try again, or contact and administrator if the problem continues.")

METADATA_UPLOADED_PRESERVE_ERROR = _("Note: this layer's orginal metadata was \
populated and preserved by importing a metadata XML file. This metadata cannot be edited.")
populated and preserved by importing a metadata XML file. This metadata cannot be edited."
)

_PERMISSION_MSG_DELETE = _("You are not permitted to delete this layer")
_PERMISSION_MSG_GENERIC = _('You do not have permissions for this layer.')
Expand Down Expand Up @@ -292,7 +294,7 @@ def layer_upload(request, template='upload/layer_upload.html'):
if _k in out:
if isinstance(out[_k], unicode) or isinstance(
out[_k], str):
out[_k] = out[_k].decode(saved_layer.charset).encode("utf-8")
out[_k] = out[_k].decode(saved_layer.charset).encode("utf-8")
elif isinstance(out[_k], dict):
for key, value in out[_k].iteritems():
out[_k][key] = out[_k][key].decode(saved_layer.charset).encode("utf-8")
Expand Down Expand Up @@ -1388,7 +1390,8 @@ def layer_granule_remove(
else:
return HttpResponse("Not allowed", status=403)

@require_http_methods(["POST",])

@require_http_methods(["POST"])
def layer_thumbnail(request, layername):
layer_obj = _resolve_layer(request, layername)

Expand All @@ -1405,8 +1408,8 @@ def layer_thumbnail(request, layername):
else:
image = None
try:
image = _prepare_thumbnail_body_from_opts(request.body,
request=request)
image = _prepare_thumbnail_body_from_opts(
request.body, request=request)
except BaseException:
image = _render_thumbnail(request.body)

Expand Down
9 changes: 4 additions & 5 deletions geonode/maps/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@
from django.db.models import F
from django.views.decorators.clickjacking import (xframe_options_exempt,
xframe_options_sameorigin)
from django.views.decorators.http import require_http_methods

from geonode.layers.models import Layer
from geonode.maps.models import Map, MapLayer, MapSnapshot
from geonode.layers.views import _resolve_layer
Expand Down Expand Up @@ -1359,14 +1357,15 @@ def ajax_url_lookup(request):
content_type='text/plain'
)

@require_http_methods(["POST",])

@require_http_methods(["POST"])
def map_thumbnail(request, mapid):
map_obj = _resolve_map(request, mapid)
try:
image = None
try:
image = _prepare_thumbnail_body_from_opts(request.body,
request=request)
image = _prepare_thumbnail_body_from_opts(
request.body, request=request)
except BaseException:
image = _render_thumbnail(request.body)

Expand Down

0 comments on commit 6125d2f

Please sign in to comment.