summaryrefslogtreecommitdiff
path: root/alembic/script/base.py
diff options
context:
space:
mode:
authorNils Philippsen <nils@redhat.com>2017-08-09 09:34:45 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2017-08-09 09:44:05 -0400
commitd1a8ff99e7c7a138d7da8e4456609f2f92ceb7a9 (patch)
tree4f4571c5cc7686d45730944d4603de4254a7ff6d /alembic/script/base.py
parent98f5ad64063265e88c51ac0507779d2c26ba4210 (diff)
downloadalembic-d1a8ff99e7c7a138d7da8e4456609f2f92ceb7a9.tar.gz
fix using tzdata-compliant time zone names
Previously, time zone names were capitalized indiscriminately, making it impossible to use names containing lowercase characters with Alembic. https://en.wikipedia.org/wiki/Tz_database#Names_of_time_zones Change-Id: I89288447f91e98dc106d82a1ee233f2f3de30c78 Pull-request: https://bitbucket.org/zzzeek/alembic/pull-requests/69
Diffstat (limited to 'alembic/script/base.py')
-rw-r--r--alembic/script/base.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/alembic/script/base.py b/alembic/script/base.py
index d296a0f..d1760e5 100644
--- a/alembic/script/base.py
+++ b/alembic/script/base.py
@@ -451,7 +451,11 @@ class ScriptDirectory(object):
def _generate_create_date(self):
if self.timezone is not None:
- tzinfo = tz.gettz(self.timezone.upper())
+ # First, assume correct capitalization
+ tzinfo = tz.gettz(self.timezone)
+ if tzinfo is None:
+ # Fall back to uppercase
+ tzinfo = tz.gettz(self.timezone.upper())
if tzinfo is None:
raise util.CommandError(
"Can't locate timezone: %s" % self.timezone)