musermanager Module

The helper manager for user model.

class mewlo.mpacks.core.user.musermanager.MewloUserManager(mewlosite, debugmode)[source]

Bases: mewlo.mpacks.core.manager.modelmanager.MewloModelManager

User model manager.

build_generic_user_verification(verification_type, user, request, fieldname, fieldval, extradict, is_shortcode, flag_invalidateprevious)[source]

Build a verification entry for a user field. return tuple (verification, failure)

build_userfield_verification(user, request, fieldname, fieldval, is_shortcode)[source]

Build a verification entry for a user field. return tuple (verification, failure)


Template path inside user account site addon.

calc_verificationurl_field(verification, fieldname)[source]

The url user must visit to verify field change/initialization.

cancel_userfield_verifications(user, request, fieldname, invalidreason)[source]

Delete any previous field verification.

check_uniquefield_notinuse(user, fieldname, fieldval)[source]

If fieldname is a field that must be unique to a user, make sure no other user has this field value.


Build some test rbac stuff for a user.

create_user(request, userdict, verifiedfields)[source]

Make a new user account. We take a userdict instead of explicit variables for username, email, password, so that we can eventually accomodate whatever initial user properties we have specified at time of registration. return tuple (userobject, errordict); if there are errors return them and userobject as None

description = 'Handles the user database model'

Return a dictionary of fieldname:error if the user exists, Otherwise return {}.


Simple shortcut.


Lookup user by a uniquely identifiable field in userdict (typically username or email). We use this general function so that we can expand to support looking up by phone numbers, etc. We have a list of fields that we know uniquely identify users and we check EACH of these in turn (not the combo of them all); when we find a match we return the user and the fieldname that matched. It is called during login (to identify the user logging in) and during registration (to check if the username or email, etc. is already in use). Return tupe of (user, matchingfieldname)


Just look up a user by their id.


Make a guest user object and return it. Ultimately I think that “making” a guest user object, should probably involve loading a specific guest user account from database. ATTN: unfinished.


Return a hashed and salted version of the password, suitable for database storage.


Make a new user account. return tuple (userobject, errordict) IMPORTANT: if there are errors return userobject as None (and set errordict)

send_field_verification_email(user, request, emailaddress)[source]

Send an email verification.

send_field_verification_email_given_verification(verification, fieldname, emailaddress)[source]

Send a verification email.

send_field_verifications(user, request, verifiedfields)[source]

This is generally called right after saving a new user who needs to be sent an email verification.

send_onefield_verification(user, request, fieldname, fieldval)[source]

Send user a field verification message. Typically this is for email. Return failure.


The user specified in the verification gets the new value, which is marked as verified.

set_userpassword_from_plaintext(user, password_plaintext)[source]

set hashed password.

startup_prep(stageid, eventlist)[source]

This is invoked by site strtup, for each stage specified in startup_stages_needed() above.

Table Of Contents

This Page