3005: timezone string limited to 20 char whereas some timezones are greater than 20

nan****@gmai***** (Google Code) (Is this you? Claim this profile.)
June 22, 2013
What version are you running?
1.7.6 reviewboard server

What's the URL of the page containing the problem?

What steps will reproduce the problem?

1. change default timezone to America/Indiana/Indianapolis
2. no error reported but "America/Indiana/Indi" is saved in database
3. try to login and error 500 appears or try to change in admin section => 
Ensure this value has at most 20 characters (it has 28)

What is the expected output? What do you see instead?

saved value should not be stripped => "America/Indiana/Indianapolis"

What operating system are you using? What browser?

timezone evolution adds a string fixed to 20 chars

AddField('Profile', 'timezone', models.CharField, initial=u'UTC', max_length=20)

it is also limited to 20 chars in model

    # Allows per-user timezone settings
    timezone = models.CharField(choices=TIMEZONE_CHOICES, default='UTC',
#1 nan****@gmai***** (Google Code) (Is this you? Claim this profile.)
the biggest string length is 30 chars for America/Argentina/Buenos_Aires

>>> import pytz
>>> max=0
>>> for tz in pytz.common_timezones:
...     if len(tz) > max:
...             max=len(tz)
...             print "%d %s" % (len(tz), tz)
14 Africa/Abidjan
18 Africa/Addis_Ababa
20 Africa/Dar_es_Salaam
30 America/Argentina/Buenos_Aires
#2 nan****@gmai***** (Google Code) (Is this you? Claim this profile.)
I propose following change
#3 chipx86
Fixed on release-1.7.x (ee9b33d)
  • +Fixed
  • +Milestone-Release1.7.x
  • +chipx86