mewlo.mpacks.core.reqresp.mresponse module

mresponse.py This file contains classes to support response to requests. For now, our MewloResponse class is just a thin wrapper over a werkzeug response.

class mewlo.mpacks.core.reqresp.mresponse.MewloResponse(request)[source]

Bases: object

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

add_errors_to_response()[source]

Helper funciton to add any pending accumulated errors to the response.

add_rendercontext(args)[source]

Shortcut to set some context settings.

add_rendercontext_defaults()[source]

Add some default context.

add_status_error(statuscode, errorstr)[source]
calc_wsgiref_status_string()[source]
dumps(indent=0)[source]

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

finalize_response()[source]

This function is invoked after the response is finished being built and is about to be sent as a reply. It is responsible for final error checking, and will do things like display an error if no response has been set.

get_mewlosite()[source]
get_rendercontext()[source]
make_werkzeugresponse()[source]

Create a werkzeug response object and attach it to us.

merge_pendingcookiedict()[source]

Because wresp response object may not be created at time of cookie setting, we may have deferred cookie values to set when we create the wresp.

render_from_template(template, args=None)[source]

Shortcut to render a template and set responsedata from it, passing response object to template as an extra arg.

render_from_template_file(templatefilepath, args=None)[source]

Shortcut to render a template and set responsedata from it, passing response object to template as an extra arg.

renderstr_from_template(template, args=None)[source]

Shortcut to return html for a template and set responsedata from it, passing response object to template as an extra arg.

renderstr_from_template_file(templatefilepath, args=None)[source]

Shortcut to return html for a template and set responsedata from it, passing response object to template as an extra arg.

run_beforeview()[source]

Do stuff before any views.

serve_file_bypath(filepath)[source]

Serve a file.

set_cookieval(cookiename, cookieval)[source]

Set cookie value.

set_direct_passthrough(direct_passthrough)[source]
set_headers(headers)[source]
set_isfinalized()[source]
set_mimetype(mimetype)[source]
set_rendercontext_val(keyname, keyval)[source]

Shortcut to set some context settings.

set_renderpageid(pageid)[source]

Shortcut to set some context settings.

set_renderpageid_ifnotset(pageid)[source]

Shortcut to set some context settings.

set_responsedata(responsedata, statuscode=200)[source]
set_status(statuscode)[source]
set_status_ok()[source]
start_and_make_wsgiref_response(wsgiref_start_response)[source]

This is invoked when we want to send a final response to the wsgi web server.

Table Of Contents

Previous topic

mewlo.mpacks.core.reqresp.mrequest module

Next topic

mewlo.mpacks.core.route package

This Page