replace except: pass with suppress() context manager

This commit is contained in:
Laura Klünder 2017-05-31 02:38:59 +02:00
parent 23694b207b
commit 341c2f98e5
5 changed files with 12 additions and 22 deletions

View file

@ -1,3 +1,4 @@
from contextlib import suppress
from functools import wraps
from django.apps import apps
@ -107,12 +108,10 @@ def edit(request, pk=None, model=None, section=None, space=None, explicit_edit=F
'title': obj.title if obj else None,
}
try:
with suppress(FieldDoesNotExist):
ctx.update({
'geomtype': model._meta.get_field('geometry').geomtype,
})
except FieldDoesNotExist:
pass
if model == Section:
ctx.update({