coto / gae-boilerplate

Google App Engine Boilerplate
https://dev-dot-sandengine.appspot.com/
Other
685 stars 189 forks source link

Error while opening register page after disable i18n #282

Closed rstawiarski closed 10 years ago

rstawiarski commented 10 years ago

After disable i18n by set in config locales to emty list or None occure error:

Traceback (most recent call last): (...) File "C:\Program Files (x86)\Google\google_appengine\lib\jinja2-2.6\jinja2\environment.py", line 894, in render return self.environment.handle_exception(exc_info, True) File "boilerplate/templates\register.html", line 1, in top-level template code {% extends base_layout %} UndefinedError: 'form' is undefined

Error is in countries attribute of basehandler. Statement Locale.parse(self.locale) retrun empty list or None and these objects doesn't have attribute territories.

My current solution to fix this bug: @webapp2.cached_property def countries(self): if self.locale: return Locale.parse(self.locale).territories else: return None

@webapp2.cached_property def countries_tuple(self): if self.locale: countries = self.countries if "001" in countries: del (countries["001"]) countries = [(key, countries[key]) for key in countries] countries.append(("", "")) countries.sort(key=lambda tup: tup[1]) return countries else: return []

coto commented 10 years ago

There is a new version since today, please let us know if this error is still there.

rstawiarski commented 10 years ago

OK, I run new version today and error still occur.

coto commented 10 years ago

How do you disable i18n exactly ?

rstawiarski commented 10 years ago

I set locales in config file to empty list like that: 'locales': []

It can be override in my config file or change in bp config file.

Then if i go to http://address_of_server/register error occur.