Module reahl.web.interfaces

The interfaces for persisted classes that are needed by the core Reahl framework. Different implementations of the framework can be provided by implementing these.

WebUserSessionProtocol

UserInputProtocol

class reahl.web.interfaces.UserInputProtocol

User input, typed as strings on a form is persisted using this class, for the current user’s session for use in a subsequent request. Used via web.persisted_userinput_class.

classmethod get_previously_entered_for_form(form, input_name)

Returns the user input associated with the given reahl.web.ui.Form, as previously saved using input_name as name.

classmethod save_input_value_for_form(form, input_name, value)

Persists value as the value of the user input associated with the given reahl.web.ui.Form, using input_name as name.

PersistedExceptionProtocol

class reahl.web.interfaces.PersistedExceptionProtocol

When a reahl.component.exceptions.DomainException happens during Form submission, the exception is persisted using this class, for the current user’s session for use in a subsequent request. Used via web.persisted_exception_class.

classmethod get_exception_for_form(form)

Retrieves an exception previously saved for the given reahl.web.ui.Form, or None if not found.

classmethod get_exception_for_input(form, input_name)

Retrieves an exception previously saved for the given reahl.web.ui.Form and input_name or None if not found.

classmethod clear_for_all_inputs(form)

Removes all saved Exceptions associated with the given reahl.web.ui.Form.

PersistedFileProtocol

class reahl.web.interfaces.PersistedFileProtocol

When a file is uploaded, file is persisted using this class, for the current user’s session for use in a subsequent request. Used via web.persisted_file_class.

file_obj

Returns an object with traditional .read and .seek methods which can be used to read the contents of the persisted file.

classmethod clear_for_form(form)

Removes all files previously saved for the given reahl.web.ui.Form.

classmethod get_persisted_for_form(form, input_name)

Returns the previously persisted file for the given reahl.web.ui.Form, using the given input_name as name.

classmethod add_persisted_for_form(form, input_name, uploaded_file)

Saves the given uploaded_file (a cgi.FileStorage) using the given input_name for the given reahl.web.ui.Form.

classmethod remove_persisted_for_form(form, input_name, filename)

Removes previously persisted file with name filename, as saved for the given reahl.web.ui.Form and input_name.

classmethod is_uploaded_for_form(form, input_name, filename)

Answers whether a file with name filename has previously been saved for the given reahl.web.ui.Form and input_name.

Table Of Contents

Previous topic

Module reahl.web.dhtml

Next topic

Domain functionality