langdev.web.user — User web pages

flask.g.current_user

The global variable that stores the currently signed User object.

langdev.web.user.user = <flask.blueprints.Blueprint object at 0x36a1a10>

User web pages blueprint.

langdev.web.user.define_current_user()

Sets the g.current_user global variable before every request.

langdev.web.user.inject_current_user()

Injects the current_user for templates.

{% if current_user %}
  <p>You are {{ current_user }}.</p>
{% else %}
  <p>Who are you?</p>
{% endif %}
langdev.web.user.set_current_user(user)

Sets the g.current_user. user can be None also.

Parameters:user (User, types.NoneType) – the user to set. signs out if it is None
langdev.web.user.ensure_signin(user=None)

Raises a 403 Forbidden error if not signed in or g.current_user is not user (only if a parameter has passed).

Parameters:user (User) – an optional user. if present, it checks signed user’s identity also
Returns:a signed user
Return type:User
langdev.web.user.forbidden(error)

403 forbidden page.

langdev.web.user.signout()

Signs out.

langdev.web.user.get_user(login, *options)

Gets a user by its login name.

langdev.web.user.profile(user_login, form=None)

User profile page.

langdev.web.user.edit(user_login)

Edit the profile.

langdev.web.user.posts(user_login)

Posts a user wrote.

langdev.web.user.hide_email(email)

Hides an email address.

>>> hide_email('hong.qigong@gaibang.org.cn')
'h***.******@*******.***.*n'
>>> hide_email('amaterasu+ladios.sopp@akd.gov')
'a********+******.****@***.**v'
>>> hide_email('ab@cd.co.kr')
'a*@**.**.*r'
Parameters:email (basestring) – an email address to hide
Returns:a hidden email address
Return type:basestring

Project Versions

Previous topic

langdev.web.home — Website home

Next topic

langdev.web.forum — Forum pages

This Page