mverificationmanager Module

mverificationmanager.py Helper for verifications data

class mewlo.mpacks.core.verification.mverificationmanager.MewloVerificationManager(mewlosite, debugmode)[source]

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

The MewloVerificationManager class helps verification management.

basic_validation(verification, verification_code, request, verification_type_expected, is_shortcode_expected, verification_varname)[source]

Perform basic validation (check for expiration, etc.). Return failure if it fails.

build_whereclause_verifications_by_type_and_request(verification_type, request, fieldname, user_id, flag_onlyvalid)[source]

Build whereclause to select the verifications. We want to identify all verifications that match: verification_type AND (EITHER the sessionid or userid)

create_verification(verification_type)[source]

Generic creation of a new verification entry.

dumps(indent=0)[source]

Return a string (with newlines and indents) that displays some debugging useful information about the object.

find_bylongcode(verification_code)[source]

Find a verification entry by long code. We don’t check for expiration or anything like that here, we just find the matching code. ATTN: TODO - this is only useful for LONG codes – we need something more to choose short codes, such as requiring additional info

find_byshortcode(verification_type, request, fieldname)[source]

Find a verification entry by type and request session/user info. We don’t check for expiration or anything like that here, we just find the matching code. IMPORTANT: Note that we don’t look it up by code!! That’s because there can only be one short code per type+user/session; that is how we ensure that they can’t try all possible codes. On basic validation we will check actual code.

find_valid_by_type_and_request(verification_type, request, fieldname)[source]

Find verification and return it, but only if it’s also valid!

find_valid_by_type_and_userid(verification_type, user_id, fieldname)[source]

Find verification and return it, but only if it’s also valid!

get_user_from_verification(verification)[source]

Return user object from user_id.

invalidate_previousverifications(verification_type, request, fieldname, invalidreason)[source]

We often want to invalidate previous verification entries from a user of a specific type, before creating a new one of the same type, so that there is only one pending verification usable at a time.

Table Of Contents

This Page