mitsuhiko/flask-babel — pull request #39 by uniphil (2013-08-05 23:53:40+00:00)
Title: Fix delayed init_app for *selector decorators

The current package breaks if you try to wrap locale or timezone selector functions with the respective `Babel.selector` methods.

The issue is caused by [checking whether the functions are `None`](https://github.com/mitsuhiko/flask-babel/blob/master/flask_babel/__init__.py#L129) in the decorators. They are currently set to `None` in `init_app` and don't exist otherwise, so this fails with an `AttributeError` if the app has been instantiated, but not initialized (like `babel = Babel()`).

My pull pull request has a simple test that breaks with the current code, and a trivial fix to make it pass (move `self.*_selector = None` to `__init__` from `init_app`).