New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Re-enable localisation of flash messages after migration to Flask 0.10+ #132
Conversation
Add ability to override user id method name
Fire `user_loaded_from_cookie` even if token loader provided
Since Flask upgraded to 0.10, it's no longer possible to use `lazy_gettext` to set `LoginManager.login_message`. Add an optional `localization_function` argument/attribute to be called with flash messages if the method is present.
Since Flask upgraded to 0.10, it's no longer possible to use `lazy_gettext` to set `LoginManager.login_message`. Add an optional `localizer` function as an argument/attribute to be called on messages before they're "flashed".
Add shitty documentation of `localizer` argument/function.
Looks like it needs tests. |
Change to `localize_callback` attribute to match other callbacks. Add corresponding tests to maintain 100% coverage. Update documentation to reflect changes.
Passes all tests and has 100% test coverage now. No errors reported by |
@@ -339,52 +349,52 @@ This documentation is automatically generated from Flask-Login's source code. | |||
Configuring Login | |||
----------------- | |||
.. autoclass:: LoginManager | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this intentional?
Sorry, I don't quite understand the question. I'm not particularly familiar with Github and ReST. Did I delete an empty line? |
@deanishe it looks like lines were deleted from the documentation. I'm not sure if you meant to do that though? |
My editor deleted trailing spaces. I don't believe I actually deleted any lines. Do the spaces need to be there for any reason (the docs compiled just dandy for me)? |
No it's fine if the spaces are removed I think. It just adds noise to commit is all. |
Yeah, sorry about that. Can I compress all my changes/commits into one commit? |
Yes, please. And if you could rebase off master that would be great. |
Err, that wasn't so much asking permission as asking how to … Afraid I also don't know what you mean by "rebase off master", though I'll do it if you could point me in the right direction. |
If you add this repo as a remote called
|
Since Flask upgraded to 0.10, it's no longer possible to use `lazy_gettext` to set `LoginManager.login_message`. Add an optional `localization_function` argument/attribute to be called with flash messages if the method is present.
Since Flask upgraded to 0.10, it's no longer possible to use `lazy_gettext` to set `LoginManager.login_message`. Add an optional `localizer` function as an argument/attribute to be called on messages before they're "flashed".
Add shitty documentation of `localizer` argument/function.
Change to `localize_callback` attribute to match other callbacks. Add corresponding tests to maintain 100% coverage. Update documentation to reflect changes.
Rebased as requested (I think). |
Btw you can compress commits by using the "fixup" option in an interactive rebase.
You should see a list of the commits with the word "pick" to the left of the commit. If you change "pick" to "f' for all by the commit you want to keep as the final commit, that should do what you want. |
I think I've made a pig's ear of the commit log :( I'll re-fork and re-apply the edits. |
Flask 0.10+ makes it impossible to use
login_manager.login_message = lazy_gettext('Please log in')
(no more pickle), thus buggering localisation offlask-login
's flash messages.Add a
localize_callback
attribute toLoginManager
that, if present, will be called withlogin_message
andneeds_refresh_message
and whose return value will be sentflash
.