Skip to content

Commit

Permalink
Fixes #2369: Corrected time zone validation on site API serializer
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremystretch committed Aug 20, 2018
1 parent c333af3 commit e1e41a7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ v2.4.4 (FUTURE)

* [#2355](https://github.com/digitalocean/netbox/issues/2355) - Added item count to inventory tab on device view
* [#2368](https://github.com/digitalocean/netbox/issues/2368) - Record change in device changelog when altering cluster assignment
* [#2369](https://github.com/digitalocean/netbox/issues/2369) - Corrected time zone validation on site API serializer
* [#2370](https://github.com/digitalocean/netbox/issues/2370) - Redirect to parent device after deleting device bays
* [#2374](https://github.com/digitalocean/netbox/issues/2374) - Fix toggling display of IP addresses in virtual machine interfaces list

Expand Down
7 changes: 3 additions & 4 deletions netbox/utilities/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,9 @@ def to_representation(self, obj):
def to_internal_value(self, data):
if not data:
return ""
try:
return pytz.timezone(str(data))
except pytz.exceptions.UnknownTimeZoneError:
raise ValidationError('Invalid time zone "{}"'.format(data))
if data not in pytz.common_timezones:
raise ValidationError('Unknown time zone "{}" (see pytz.common_timezones for all options)'.format(data))
return pytz.timezone(data)


class SerializedPKRelatedField(PrimaryKeyRelatedField):
Expand Down

0 comments on commit e1e41a7

Please sign in to comment.