mewlo.mpacks.core.reqresp.mrequest module

mrequest.py This file contains classes to support web server requests. For now our requests are just lightly wrapped werkzeug requests.

class mewlo.mpacks.core.reqresp.mrequest.MewloRequest[source]

Bases: object

The MewloRequest class handles a web server request Note that our request class contains a reference to the response object.

add_pagemessage(messagedict)[source]

Add a message to current page context.

add_pagemessage_simple(msg, cls=None)[source]

Add a message to current page context.

add_sessionmessage(messagedict)[source]

Add a quick message to show (possibly anonymouse) visitor on their next page.

add_sessionmessage_simple(msg, cls=None)[source]

Add a message to current page context.

clearloggedinuser()[source]

Clear the loggedin user (performed on a logout).

clearusersession()[source]

Remove any session id for the user, so they will be a stranger on next request.

classmethod createrequest_from_pathstring(pathstr)[source]

Create a simulated web request from a path string, using werkzeug helper function.

classmethod createrequest_from_wsgiref_environ(wsgiref_environ)[source]

Helper function to create a simulated web request from a path string, using werkzeug helper function.

Return cookie from client browser request.

dumps(indent=0)[source]

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

get_cookieval(cookiename)[source]

Return cookie from client browser request.

get_environ()[source]

Get werkzeug environment for request. This is used when calling into some werkzeug functions (see wresp() function in mrespoonse.py).

get_fullurlpath_original()[source]

Get full true original url path of request, including any get arguements.

get_ispostmethod()[source]

Return True if request was submitting data with POST method.

get_pagemessages()[source]

Return the list of messages added to page context.

get_postdata()[source]

Get form post data (dictionary) return None if there is none.

get_remote_addr()[source]

Get ip of client in request.

get_rendercontext()[source]
get_route()[source]

Get the route that this request was matched against and processed by.

get_route_parsedarg(argname, defaultval=None)[source]

Accessor.

get_route_parsedargs()[source]

Get previously parsed args for the request.

get_session(flag_makesessionifnone)[source]

Lazy create or load session object.

get_sessionmessages(flag_consume=True)[source]

Return the list of session messages, consuming them from session by default.

get_sitecomp_usermanager()[source]
get_urlpath()[source]

Return the url path of the request. This value is cached, and represents the relative path within the ‘site’ configuration, excluding any site prefix path. This function is called after preprocessing a reqest and is the call you would use in almost all cases when examining path.

get_urlpath_original()[source]

Get full true original path of request, without any get arguements.

get_user()[source]

Lazy get the user object of the requesting user. This will trigger session creation, then session lookup of user if need be.

get_user_or_maketemporaryguest()[source]

Lazy get the user object of the requesting user. This will trigger session creation, then session lookup of user if need be.

logevent(event)[source]

Shortcut helper just sends the log message to the site to handle, after adding the request to the log function call being invoked.

make_werkzeugrequest(wsgiref_environ)[source]

Create a werkzeug request from the environment and attach it to us.

preprocess()[source]

Do any preprocessing of the request. Base class does nothing here.

preprocess_siteprefix(siteprefix)[source]

Check if request matches siteprefix, if so, set self.siteurlpath and return True, otherwise clear siteurlpath return False.

save_session_ifdirty()[source]

Lazy save session data IFF it needs it; this will also set client browser cookie for session.

set_matched(route, mewlosite)[source]

Set values to track which route this request matched and is being processed by.

set_route_parsedargs(parsedargs)[source]

Store parsed args for the request.

set_urlpath(val)[source]

Set the cached url parth ed url for this request, called after stripping off any site prefix part of the path.

set_user(userobject)[source]

Set the user object of the requesting user. This will trigger session creation if need be.

sitecomp_sessionmanager()[source]
sitecomp_verificationmanager()[source]

Table Of Contents

Previous topic

mewlo.mpacks.core.reqresp package

Next topic

mewlo.mpacks.core.reqresp.mresponse module

This Page