Skip to content

Commit

Permalink
- Typos and formatting improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
afabiani committed Mar 9, 2020
1 parent d557ce1 commit b91e105
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion mapstore2_adapter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def fixup_map(map_id):
_mm, _created = MapStoreResource.objects.get_or_create(id=_m.id, user_id=_u.id)
if _created:
_mm.save()
except BaseException as e:
except Exception as e:
logger.exception(e)


Expand Down
2 changes: 1 addition & 1 deletion mapstore2_adapter/api/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class MapStoreResource(models.Model):
related_name="data",
null=True,
blank=True,
on_delete="CASCASE")
on_delete=models.CASCADE)
attributes = models.ManyToManyField(
"MapStoreAttribute",
related_name="attributes",
Expand Down
2 changes: 1 addition & 1 deletion mapstore2_adapter/api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def to_representation(self, value):
return value.blob
# try:
# return json.loads(value)
except BaseException:
except Exception:
return value


Expand Down
22 changes: 11 additions & 11 deletions mapstore2_adapter/plugins/geonode.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def convert(self, viewer, request):
if 'id' in viewer_obj and viewer_obj['id']:
try:
map_id = int(viewer_obj['id'])
except BaseException:
except Exception:
pass

data = {}
Expand Down Expand Up @@ -144,7 +144,7 @@ def convert(self, viewer, request):
'base.delete_resourcebase',
_PERMISSION_MSG_DELETE):
info['canDelete'] = True
except BaseException:
except Exception:
tb = traceback.format_exc()
logger.debug(tb)
else:
Expand Down Expand Up @@ -176,7 +176,7 @@ def convert(self, viewer, request):
'base.delete_resourcebase',
_PERMISSION_MSG_DELETE):
info['canDelete'] = True
except BaseException:
except Exception:
tb = traceback.format_exc()
logger.debug(tb)

Expand All @@ -185,7 +185,7 @@ def convert(self, viewer, request):
ms2_map['layers'].append(overlay)

data['map'] = ms2_map
except BaseException:
except Exception:
# traceback.print_exc()
tb = traceback.format_exc()
logger.debug(tb)
Expand All @@ -196,7 +196,7 @@ def convert(self, viewer, request):
ms2_catalogue['selectedService'] = CATALOGUE_SELECTED_SERVICE
ms2_catalogue['services'] = CATALOGUE_SERVICES
data['catalogServices'] = ms2_catalogue
except BaseException:
except Exception:
# traceback.print_exc()
tb = traceback.format_exc()
logger.debug(tb)
Expand All @@ -214,7 +214,7 @@ def convert(self, viewer, request):
if 'map' in ms2_map_data:
del ms2_map_data['map']
data.update(ms2_map_data)
except BaseException:
except Exception:
# traceback.print_exc()
tb = traceback.format_exc()
logger.debug(tb)
Expand Down Expand Up @@ -255,7 +255,7 @@ def getBackgrounds(self, viewer, defaults):
break
else:
backgrounds = copy.deepcopy(defaults)
except BaseException:
except Exception:
# traceback.print_exc()
backgrounds = copy.copy(defaults)
tb = traceback.format_exc()
Expand Down Expand Up @@ -372,7 +372,7 @@ def get_overlays(self, viewer, request=None):
alternate=overlay['name'])
if _gn_layer.srid:
overlay['nativeCrs'] = _gn_layer.srid
except BaseException:
except Exception:
tb = traceback.format_exc()
logger.debug(tb)

Expand Down Expand Up @@ -427,7 +427,7 @@ def get_overlays(self, viewer, request=None):
overlays.append(overlay)
if not selected or ('selected' in layer and layer['selected']):
selected = overlay
except BaseException:
except Exception:
tb = traceback.format_exc()
logger.debug(tb)

Expand Down Expand Up @@ -498,12 +498,12 @@ def project_to_WGS84(self, ov_bbox, ov_crs, center=None):
"crs": "EPSG:4326"
}
zoom = GoogleZoom().get_zoom(poly) + 1
except BaseException:
except Exception:
center = (0, 0)
zoom = 0
tb = traceback.format_exc()
logger.debug(tb)
except BaseException:
except Exception:
tb = traceback.format_exc()
logger.debug(tb)

Expand Down
12 changes: 6 additions & 6 deletions mapstore2_adapter/plugins/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def get_queryset(self, caller, queryset):
_PERMISSION_MSG_VIEW)
if map_obj:
allowed_map_ids.append(mapid)
except BaseException:
except Exception:
tb = traceback.format_exc()
logger.debug(tb)

Expand All @@ -100,7 +100,7 @@ def get_geonode_map(self, caller, serializer):
'base.change_resourcebase',
_PERMISSION_MSG_SAVE)
return map_obj
except BaseException:
except Exception:
tb = traceback.format_exc()
logger.debug(tb)
raise APIException(_PERMISSION_MSG_SAVE)
Expand Down Expand Up @@ -168,12 +168,12 @@ def decode_base64(data):
_url = urlparse(_lyr['catalogURL'])
_lyr_store = Layer.objects.get(
uuid=parse_qs(_url.query)['id'][0]).store
except BaseException:
except Exception:
try:
_lyr_store = Layer.objects.get(
alternate=_lyr['name'],
remote_service__base_url=_lyr['url']).store
except BaseException:
except Exception:
_lyr_store = None

_lyr_name = "%s:%s" % (_lyr_store, _lyr['name']) if _lyr_store else _lyr['name']
Expand All @@ -195,7 +195,7 @@ def decode_base64(data):
except Http404:
tb = traceback.format_exc()
logger.debug(tb)
except BaseException:
except Exception:
raise
# Store ms2 layer idq
if "id" in _lyr and _lyr["id"]:
Expand Down Expand Up @@ -286,7 +286,7 @@ def decode_base64(data):

serializer.validated_data['id'] = map_obj.id
serializer.save(user=caller.request.user)
except BaseException:
except Exception:
tb = traceback.format_exc()
logger.error(tb)
raise APIException(tb)
Expand Down
4 changes: 2 additions & 2 deletions mapstore2_adapter/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@

try:
settings.TEMPLATES[0]['OPTIONS']['context_processors'] += ['mapstore2_adapter.context_processors.resource_urls',]
except BaseException:
except Exception:
pass

try:
settings.LOGGING["loggers"]["mapstore2_adapter"] = {"handlers": ["console"], "level": "INFO", }
except BaseException:
except Exception:
pass

settings.MAPSTORE2_ADAPTER_SERIALIZER = "mapstore2_adapter.plugins.serializers.GeoNodeSerializer"
Expand Down
8 changes: 4 additions & 4 deletions mapstore2_adapter/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

try:
from urlparse import urljoin
except BaseException:
except Exception:
# Python 3+
from urllib.parse import urljoin

Expand All @@ -29,7 +29,7 @@
from django.utils.six.moves import range
try:
from django.urls import reverse
except BaseException:
except Exception:
# Django 2.0
from django.urls import reverse
from django.contrib.gis.geos import GEOSGeometry, LinearRing, Point, Polygon
Expand Down Expand Up @@ -211,15 +211,15 @@ def get_wfs_endpoint(request):
wfs_url = urljoin(settings.SITEURL, reverse('ows_endpoint'))
else:
wfs_url = urljoin(settings.SITEURL, reverse('ows_endpoint'))
except BaseException:
except Exception:
wfs_url = urljoin(settings.SITEURL, reverse('ows_endpoint'))
return wfs_url


def get_valid_number(number, default=None, complementar=False):
try:
x = float(number)
except BaseException:
except Exception:
x = float('nan')
is_nan = isnan(x)
is_inf = isinf(x)
Expand Down

0 comments on commit b91e105

Please sign in to comment.