Skip to content

Commit

Permalink
Additional try/except
Browse files Browse the repository at this point in the history
  • Loading branch information
folix-01 committed Nov 27, 2024
1 parent 3978347 commit f2b94b9
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions src/redturtle/prenotazioni/browser/bookings_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,14 +222,28 @@ def __call__(self):
)

if booking_creation_from:
self.booking_creation_from = datetime.datetime.fromisoformat(
booking_creation_from
)
try:
self.booking_creation_from = datetime.datetime.fromisoformat(
booking_creation_from
)
except ValueError:
raise BadRequest(
api.portal_translate(
_("Badly composed `booking_creation_from` value")
)
)

if booking_creation_to:
self.booking_creation_to = datetime.datetime.fromisoformat(
booking_creation_to
)
try:
self.booking_creation_to = datetime.datetime.fromisoformat(
booking_creation_to
)
except:
raise BadRequest(
api.portal_translate(
_("Badly composed `booking_creation_to` value")
)
)

self.setHeader(
"Content-Disposition", "attachment;filename=%s" % self.csv_filename
Expand Down

0 comments on commit f2b94b9

Please sign in to comment.