Skip to content

Commit

Permalink
Merge pull request #115 from knobix/fix-use-with-factory-timezone
Browse files Browse the repository at this point in the history
backends/zoneinfo.py: Skip using the "Factory" timezone
  • Loading branch information
mfogel authored Oct 4, 2023
2 parents c1d46ab + c3c5343 commit 5f42663
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ poetry run pytest
#### `main` (unreleased!)

- Add support for django 5.0
- Fix issue with `Factory` timezone on some BSD systems ([#114](https://github.com/mfogel/django-timezone-field/issues/114))

#### 6.0.1 (2023-09-07)

Expand Down
4 changes: 4 additions & 0 deletions timezone_field/backends/zoneinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ class ZoneInfoBackend(TimeZoneBackend):
utc_tzobj = zoneinfo.ZoneInfo("UTC")
all_tzstrs = zoneinfo.available_timezones()
base_tzstrs = zoneinfo.available_timezones()
# Remove the "Factory" timezone as it can cause ValueError exceptions on
# some systems, e.g. FreeBSD, if the system zoneinfo database is used.
all_tzstrs.discard("Factory")
base_tzstrs.discard("Factory")

def is_tzobj(self, value):
return isinstance(value, zoneinfo.ZoneInfo)
Expand Down

0 comments on commit 5f42663

Please sign in to comment.