pytz.timezone complains about Unicode data, expecting string

soypunk avatarsoypunk 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

2. 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
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.