1. David Chambers
  2. Mango
Issue #10 resolved

pytz.timezone complains about Unicode data, expecting string

created an issue

I'm using Python 2.6.1, Django 1.2.5, and pytz 2011b on Mac OS X 10.6.6 -- I was following the "out of the box" instructions and using the built-in Django web server when I a Type error was thrown from line 388 in main.py. pytz.timezone was expecting a string instead of Unicode. For now I've fixed this by doing the following:

  1. Added the following line to main.py:

from django.utils.encoding import smart_str

see: http://docs.djangoproject.com/en/dev/ref/unicode/#conversion-functions

  1. Updated line 388 in main.py:

pytz.timezone(smart_str(canonicalize(self.meta['zone'], TIME_ZONES)))

I could fork mango, fix this and submit a pull request, but I wasn't 100% sure that my logic or issue was sane.

Comments (2)

  1. Log in to comment