Stop using bare exceptions

This is frowned upon in newer versions of pep8, so fix it once and for
all.
This commit is contained in:
Magnus Hagander
2020-01-09 13:14:32 +01:00
parent a5d6fabe09
commit 69923c7190
8 changed files with 16 additions and 16 deletions

View File

@ -67,7 +67,7 @@ def docpage(request, version, filename):
# convert to Decimal for ease of manipulation
try:
release_version = Decimal(release_version)
except:
except Exception as e:
# If it's not a proper decimal, just return 404. This can happen from many
# broken links around the web.
raise Http404("Invalid version format")
@ -183,7 +183,7 @@ class _VersionPdfWrapper(object):
def _find_pdf(self, pagetype):
try:
return os.stat('%s/documentation/pdf/%s/postgresql-%s-%s.pdf' % (settings.STATIC_CHECKOUT, self.__version.numtree, self.__version.numtree, pagetype)).st_size
except:
except Exception as e:
return 0