Skip to content
This repository has been archived by the owner on Dec 13, 2022. It is now read-only.

Commit

Permalink
Move code into try-else block
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmckinney committed Jul 21, 2020
1 parent 8b1eea3 commit fe9bb37
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion default/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,14 @@ def wrap(request, *args, **kwargs):
if published_date:
try:
parser.parse(published_date)
kwargs['published_date'] = published_date
except ValueError:
kwargs['warnings'] = [
_('An invalid published date was submitted, and therefore ignored: %(date)s') % {
'date': published_date,
},
]
else:
kwargs['published_date'] = published_date
return function(request, *args, **kwargs)

return wrap

0 comments on commit fe9bb37

Please sign in to comment.