15.2.103. camcops_server.cc_modules.cc_forms

camcops_server/cc_modules/cc_forms.py


Copyright (C) 2012-2020 Rudolf Cardinal (rudolf@pobox.com).

This file is part of CamCOPS.

CamCOPS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

CamCOPS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with CamCOPS. If not, see <https://www.gnu.org/licenses/>.


Forms for use by the web front end.

COLANDER NODES, NULLS, AND VALIDATION

  • Surprisingly tricky.

  • Nodes must be validly intialized with NO USER-DEFINED PARAMETERS to __init__; the Deform framework clones them.

  • A null appstruct is used to initialize nodes as Forms are created. Therefore, the “default” value must be acceptable to the underlying type’s serialize() function. Note in particular that “default = None” is not acceptable to Integer. Having no default is fine, though.

  • In general, flexible inheritance is very hard to implement.

  • Note that this error:

    AttributeError: 'EditTaskFilterSchema' object has no attribute 'typ'
    

    means you have failed to call super().__init__() properly from __init__().

  • When creating a schema, its members seem to have to be created in the class declaration as class properties, not in __init__().

ACCESSING THE PYRAMID REQUEST IN FORMS AND SCHEMAS

We often want to be able to access the request for translation purposes, or sometimes more specialized reasons.

Forms are created dynamically as simple Python objects. So, for a deform.form.Form, just add a request parameter to the constructor, and pass it when you create the form. An example is camcops_server.cc_modules.cc_forms.DeleteCancelForm.

For a colander.Schema and colander.SchemaNode, construction is separate from binding. The schema nodes are created as part of a schema class, not a schema instance. The schema is created by the form, and then bound to a request. Access to the request is therefore via the after_bind() callback function, offered by colander, via the kw parameter or self.bindings. We use Binding.REQUEST as a standard key for this dictionary. The bindings are also available in validator() and similar functions, as self.bindings.

All forms containing any schema that needs to see the request should have this sort of __init__ function:

class SomeForm(...):
    def __init__(...):
        schema = schema_class().bind(request=request)
        super().__init__(
            schema,
            ...,
            **kwargs
        )

The simplest thing, therefore, is for all forms to do this. Some of our forms use a form superclass that does this via the schema_class argument (which is not part of colander, so if you see that, the superclass should do the work of binding a request).

For translation, throughout there will be _ = self.gettext or _ = request.gettext.

Form titles need to be dynamically written via cardinal_pythonlib.deform_utils.DynamicDescriptionsForm or similar.

class camcops_server.cc_modules.cc_forms.AddCancelForm(schema_class: Type[colander.Schema], request: CamcopsRequest, **kwargs)[source]

Form with “add” and “cancel” buttons.

__init__(schema_class: Type[colander.Schema], request: CamcopsRequest, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

class camcops_server.cc_modules.cc_forms.AddGroupForm(request: CamcopsRequest, **kwargs)[source]

Form to add a group.

__init__(request: CamcopsRequest, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

class camcops_server.cc_modules.cc_forms.AddGroupSchema(*args, **kw)[source]

Schema to add a group.

class camcops_server.cc_modules.cc_forms.AddIdDefinitionForm(request: CamcopsRequest, **kwargs)[source]

Form to add an ID number definition.

__init__(request: CamcopsRequest, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

class camcops_server.cc_modules.cc_forms.AddIdDefinitionSchema(*args, **kw)[source]

Schema to add an ID number definition.

class camcops_server.cc_modules.cc_forms.AddSpecialNoteForm(request: CamcopsRequest, **kwargs)[source]

Form to add a special note to a task.

__init__(request: CamcopsRequest, **kwargs) → None[source]

Args: args: other positional arguments to InformativeForm dynamic_descriptions: use dynamic descriptions? dynamic_titles: use dynamic titles? kwargs: other keyword arguments to InformativeForm

class camcops_server.cc_modules.cc_forms.AddSpecialNoteSchema(*args, **kw)[source]

Schema to add a special note to a task.

class camcops_server.cc_modules.cc_forms.AddUserGroupadminForm(request: CamcopsRequest, **kwargs)[source]

Form to add a user. Version for group administrators.

__init__(request: CamcopsRequest, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

class camcops_server.cc_modules.cc_forms.AddUserGroupadminSchema(*args, **kw)[source]

Schema to add a user. Version for group administrators.

class camcops_server.cc_modules.cc_forms.AddUserSuperuserForm(request: CamcopsRequest, **kwargs)[source]

Form to add a user. Version for superusers.

__init__(request: CamcopsRequest, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

class camcops_server.cc_modules.cc_forms.AddUserSuperuserSchema(*args, **kw)[source]

Schema to add a user. Version for superusers.

class camcops_server.cc_modules.cc_forms.AdministeredGroupsSequence(*args, **kw)[source]

Sequence to offer a choice of the groups administered by the requestor.

Typical use: (non-superuser) group administrator assigns group memberships to a user.

__init__(*args, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

class camcops_server.cc_modules.cc_forms.AllGroupsSequence(*args, **kw)[source]

Sequence to offer a choice of all possible groups.

Typical use: superuser assigns group memberships to a user.

class camcops_server.cc_modules.cc_forms.AllOtherGroupsSequence(*args, **kw)[source]

Sequence to offer a choice of all possible OTHER groups (as determined relative to the group specified in kw[Binding.GROUP]).

Typical use: superuser assigns group permissions to another group.

class camcops_server.cc_modules.cc_forms.AllowedGroupsSequence(*args, **kw)[source]

Sequence to offer a choice of all the groups the user is allowed to see.

__init__(*args, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

class camcops_server.cc_modules.cc_forms.ApplyCancelForm(schema_class: Type[colander.Schema], request: CamcopsRequest, **kwargs)[source]

Form with “apply” and “cancel” buttons.

__init__(schema_class: Type[colander.Schema], request: CamcopsRequest, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

class camcops_server.cc_modules.cc_forms.AuditTrailForm(request: CamcopsRequest, **kwargs)[source]

Form to filter and then view audit trail entries.

__init__(request: CamcopsRequest, **kwargs) → None[source]

Args: schema_class:

class of the Colander Schema to use as this form’s schema

submit_title:

title (text) to be used for the “submit” button

request:

camcops_server.cc_modules.cc_request.CamcopsRequest

class camcops_server.cc_modules.cc_forms.AuditTrailSchema(*args, **kw)[source]

Schema to filter audit trail entries.

class camcops_server.cc_modules.cc_forms.AutocompleteAttrValues[source]

Some values for the HTML “autocomplete” attribute, as per https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete. Not all are used.

class camcops_server.cc_modules.cc_forms.Binding[source]

Keys used for binding dictionaries with Colander schemas (schemata).

Must match kwargs of calls to bind() function of each Schema.

class camcops_server.cc_modules.cc_forms.BootstrapCssClasses[source]

Constants from Bootstrap to control display.

class camcops_server.cc_modules.cc_forms.BugfixSelectWidget(multiple=False, **kwargs)[source]

Fixes a bug where newer versions of Chameleon (e.g. 3.8.0) render Deform’s multiple = False (in SelectWidget) as this, which is wrong:

<select name="which_idnum" id="deformField2" class=" form-control " multiple="False">
                                                                    ^^^^^^^^^^^^^^^^
    <option value="1">CPFT RiO number</option>
    <option value="2">NHS number</option>
    <option value="1000">MyHospital number</option>
</select>

… whereas previous versions of Chameleon (e.g. 3.4) omitted the tag. (I think it’s a Chameleon change, anyway! And it’s probably a bugfix in Chameleon that exposed a bug in Deform.)

See camcops_server.cc_modules.webview.debug_form_rendering().

__init__(multiple=False, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

class camcops_server.cc_modules.cc_forms.CSRFSchema(*args, **kw)[source]

Base class for form schemas that use CSRF (XSRF; cross-site request forgery) tokens.

You can’t put the call to bind() at the end of __init__(), because bind() calls clone() with no arguments and clone() ends up calling __init__()`

The item name should be one that the ZAP penetration testing tool expects, or you get:

No known Anti-CSRF token [anticsrf, CSRFToken,
__RequestVerificationToken, csrfmiddlewaretoken, authenticity_token,
OWASP_CSRFTOKEN, anoncsrf, csrf_token, _csrf, _csrfSecret] was found in
the following HTML form: [Form 1: "_charset_" "__formid__"
"deformField1" "deformField2" "deformField3" "deformField4" ].
class camcops_server.cc_modules.cc_forms.CSRFToken(*args, **kw)[source]

Node to embed a cross-site request forgery (CSRF) prevention token in a form.

As per https://deformdemo.repoze.org/pyramid_csrf_demo/, modified for a more recent Colander API.

NOTE that this makes use of colander.SchemaNode.bind; this CLONES the Schema, and resolves any deferred values by means of the keywords passed to bind(). Since the Schema is created at module load time, but since we’re asking the Schema to know about the request’s CSRF values, this is the only mechanism (https://docs.pylonsproject.org/projects/colander/en/latest/api.html#colander.SchemaNode.bind).

From https://deform2000.readthedocs.io/en/latest/basics.html:

“The default of a schema node indicates the value to be serialized if a value for the schema node is not found in the input data during serialization. It should be the deserialized representation. If a schema node does not have a default, it is considered “serialization required”.”

“The missing of a schema node indicates the value to be deserialized if a value for the schema node is not found in the input data during deserialization. It should be the deserialized representation. If a schema node does not have a missing value, a colander.Invalid exception will be raised if the data structure being deserialized does not contain a matching value.”

RNC: Serialized values are always STRINGS.

schema_type

alias of colander.String

class camcops_server.cc_modules.cc_forms.ChangeOtherPasswordForm(request: CamcopsRequest, **kwargs)[source]

Form to change another user’s password.

__init__(request: CamcopsRequest, **kwargs) → None[source]

Args: schema_class:

class of the Colander Schema to use as this form’s schema

submit_title:

title (text) to be used for the “submit” button

request:

camcops_server.cc_modules.cc_request.CamcopsRequest

class camcops_server.cc_modules.cc_forms.ChangeOtherPasswordSchema(*args, **kw)[source]

Schema to change another user’s password.

class camcops_server.cc_modules.cc_forms.ChangeOwnPasswordForm(request: CamcopsRequest, must_differ: bool = True, **kwargs)[source]

Form to change one’s own password.

__init__(request: CamcopsRequest, must_differ: bool = True, **kwargs) → None[source]
Parameters

must_differ – must the new password be different from the old one?

class camcops_server.cc_modules.cc_forms.ChangeOwnPasswordSchema(*args, **kw)[source]

Schema to change one’s own password.

__init__(*args, must_differ: bool = True, **kwargs) → None[source]
Parameters

must_differ – must the new password be different from the old one?

class camcops_server.cc_modules.cc_forms.ChooseTrackerForm(request: CamcopsRequest, as_ctv: bool, **kwargs)[source]

Form to select a tracker or CTV.

__init__(request: CamcopsRequest, as_ctv: bool, **kwargs) → None[source]
Parameters

as_ctv – CTV, not tracker?

class camcops_server.cc_modules.cc_forms.ChooseTrackerSchema(*args, **kw)[source]

Schema to select a tracker or CTV.

class camcops_server.cc_modules.cc_forms.DangerousEditPatientSchema(*args, **kw)[source]
class camcops_server.cc_modules.cc_forms.DangerousForm(schema_class: Type[colander.Schema], submit_action: str, submit_title: str, request: CamcopsRequest, **kwargs)[source]

Form with one “submit” button (with user-specifiable title text and action name), in a CSS class indicating that it’s a dangerous operation, plus a “Cancel” button.

__init__(schema_class: Type[colander.Schema], submit_action: str, submit_title: str, request: CamcopsRequest, **kwargs) → None[source]

Args: args: other positional arguments to InformativeForm dynamic_descriptions: use dynamic descriptions? dynamic_titles: use dynamic titles? kwargs: other keyword arguments to InformativeForm

class camcops_server.cc_modules.cc_forms.DatabaseDialectSelector(*args, **kw)[source]

Node to choice an SQL dialect (for viewing DDL).

__init__(*args, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

schema_type

alias of colander.String

class camcops_server.cc_modules.cc_forms.DateTimeFilteredReportParamSchema(*args, **kw)[source]
class camcops_server.cc_modules.cc_forms.DeleteCancelForm(schema_class: Type[colander.Schema], request: CamcopsRequest, **kwargs)[source]

Form with a “delete” button (visually marked as dangerous) and a “cancel” button.

__init__(schema_class: Type[colander.Schema], request: CamcopsRequest, **kwargs) → None[source]

Args: args: other positional arguments to InformativeForm dynamic_descriptions: use dynamic descriptions? dynamic_titles: use dynamic titles? kwargs: other keyword arguments to InformativeForm

class camcops_server.cc_modules.cc_forms.DeleteGroupForm(request: CamcopsRequest, **kwargs)[source]

Form to delete a group.

__init__(request: CamcopsRequest, **kwargs) → None[source]

Args: args: other positional arguments to InformativeForm dynamic_descriptions: use dynamic descriptions? dynamic_titles: use dynamic titles? kwargs: other keyword arguments to InformativeForm

class camcops_server.cc_modules.cc_forms.DeleteGroupSchema(*args, **kw)[source]

Schema to delete a group.

class camcops_server.cc_modules.cc_forms.DeleteIdDefinitionForm(request: CamcopsRequest, **kwargs)[source]

Form to add an ID number definition.

__init__(request: CamcopsRequest, **kwargs) → None[source]

Args: args: other positional arguments to InformativeForm dynamic_descriptions: use dynamic descriptions? dynamic_titles: use dynamic titles? kwargs: other keyword arguments to InformativeForm

class camcops_server.cc_modules.cc_forms.DeleteIdDefinitionSchema(*args, **kw)[source]

Schema to delete an ID number definition.

class camcops_server.cc_modules.cc_forms.DeletePatientChooseForm(request: CamcopsRequest, **kwargs)[source]

Form to delete a patient.

__init__(request: CamcopsRequest, **kwargs) → None[source]

Args: args: other positional arguments to InformativeForm dynamic_descriptions: use dynamic descriptions? dynamic_titles: use dynamic titles? kwargs: other keyword arguments to InformativeForm

class camcops_server.cc_modules.cc_forms.DeletePatientChooseSchema(*args, **kw)[source]

Schema to delete a patient.

class camcops_server.cc_modules.cc_forms.DeletePatientConfirmForm(request: CamcopsRequest, **kwargs)[source]

Form to confirm deletion of a patient.

__init__(request: CamcopsRequest, **kwargs) → None[source]

Args: args: other positional arguments to InformativeForm dynamic_descriptions: use dynamic descriptions? dynamic_titles: use dynamic titles? kwargs: other keyword arguments to InformativeForm

class camcops_server.cc_modules.cc_forms.DeletePatientConfirmSchema(*args, **kw)[source]

Schema to confirm deletion of a patient.

class camcops_server.cc_modules.cc_forms.DeleteServerCreatedPatientForm(request: CamcopsRequest, **kwargs: Any)[source]

Form to delete a patient created on the server

__init__(request: CamcopsRequest, **kwargs: Any) → None[source]

Args: args: other positional arguments to InformativeForm dynamic_descriptions: use dynamic descriptions? dynamic_titles: use dynamic titles? kwargs: other keyword arguments to InformativeForm

class camcops_server.cc_modules.cc_forms.DeleteServerCreatedPatientSchema(*args, **kw)[source]

Schema to delete a patient created on the server.

class camcops_server.cc_modules.cc_forms.DeleteSpecialNoteForm(request: CamcopsRequest, **kwargs)[source]

Form to delete (hide) a special note.

__init__(request: CamcopsRequest, **kwargs) → None[source]

Args: args: other positional arguments to InformativeForm dynamic_descriptions: use dynamic descriptions? dynamic_titles: use dynamic titles? kwargs: other keyword arguments to InformativeForm

class camcops_server.cc_modules.cc_forms.DeleteSpecialNoteSchema(*args, **kw)[source]

Schema to add a special note to a task.

class camcops_server.cc_modules.cc_forms.DeleteTaskScheduleForm(request: CamcopsRequest, **kwargs: Any)[source]

Form to delete a task schedule.

__init__(request: CamcopsRequest, **kwargs: Any) → None[source]

Args: args: other positional arguments to InformativeForm dynamic_descriptions: use dynamic descriptions? dynamic_titles: use dynamic titles? kwargs: other keyword arguments to InformativeForm

class camcops_server.cc_modules.cc_forms.DeleteTaskScheduleItemForm(request: CamcopsRequest, **kwargs: Any)[source]

Form to delete a task schedule item.

__init__(request: CamcopsRequest, **kwargs: Any) → None[source]

Args: args: other positional arguments to InformativeForm dynamic_descriptions: use dynamic descriptions? dynamic_titles: use dynamic titles? kwargs: other keyword arguments to InformativeForm

class camcops_server.cc_modules.cc_forms.DeleteTaskScheduleItemSchema(*args, **kw)[source]

Schema to delete a task schedule item.

class camcops_server.cc_modules.cc_forms.DeleteTaskScheduleSchema(*args, **kw)[source]

Schema to delete a task schedule.

class camcops_server.cc_modules.cc_forms.DeleteUserForm(request: CamcopsRequest, **kwargs)[source]

Form to delete a user.

__init__(request: CamcopsRequest, **kwargs) → None[source]

Args: args: other positional arguments to InformativeForm dynamic_descriptions: use dynamic descriptions? dynamic_titles: use dynamic titles? kwargs: other keyword arguments to InformativeForm

class camcops_server.cc_modules.cc_forms.DeleteUserSchema(*args, **kw)[source]

Schema to delete a user.

class camcops_server.cc_modules.cc_forms.DeliveryModeNode(*args, **kw)[source]

Mode of delivery of data downloads.

__init__(*args, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

schema_type

alias of colander.String

class camcops_server.cc_modules.cc_forms.DevicesSequence(*args, **kw)[source]

Sequence to capture multiple client devices (for task filters: “uploaded by one of the following devices…”).

__init__(*args, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

class camcops_server.cc_modules.cc_forms.DumpTypeSelector(*args, **kw)[source]

Node to select the filtering method for a data dump.

__init__(*args, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

schema_type

alias of colander.String

class camcops_server.cc_modules.cc_forms.DurationNode(*args, **kw)[source]
schema_type

alias of DurationType

class camcops_server.cc_modules.cc_forms.DurationType[source]

Custom colander schema type to convert between Pendulum Duration objects and months, weeks and days.

class camcops_server.cc_modules.cc_forms.DurationWidget(request: CamcopsRequest, **kwargs: Any)[source]

Widget for entering a duration as a number of months, weeks and days. The default template renders three text input fields. Total days = (months * 30) + (weeks * 7) + days.

__init__(request: CamcopsRequest, **kwargs: Any) → None[source]

Initialize self. See help(type(self)) for accurate signature.

deserialize(field: Field, pstruct: Union[Dict[str, Any], colander._null]) → Dict[str, int][source]

The deserialize method of a widget must deserialize a pstruct value to a cstruct value and return the cstruct value. The pstruct argument is a value resulting from the parse method of the Peppercorn package. The field argument is the field object to which this widget is attached.

serialize(field: Field, cstruct: Union[Dict[str, Any], None, colander._null], **kw: Any) → Any[source]

The serialize method of a widget must serialize a cstruct value to an HTML rendering. A cstruct value is the value which results from a Colander schema serialization for the schema node associated with this widget. serialize should return the HTML rendering: the result of this method should always be a string containing HTML. The field argument is the field object to which this widget is attached. The **kw argument allows a caller to pass named arguments that might be used to influence individual widget renderings.

class camcops_server.cc_modules.cc_forms.DynamicDescriptionsNonceForm(*args, dynamic_descriptions: bool = True, dynamic_titles: bool = False, **kwargs)[source]

Similarly; see InformativeNonceForm.

todo: if Deform is updated, work this into cardinal_pythonlib.

class camcops_server.cc_modules.cc_forms.EditFinalizedPatientForm(request: CamcopsRequest, **kwargs: Any)[source]

Form to edit a finalized patient.

__init__(request: CamcopsRequest, **kwargs: Any) → None[source]

Args: args: other positional arguments to InformativeForm dynamic_descriptions: use dynamic descriptions? dynamic_titles: use dynamic titles? kwargs: other keyword arguments to InformativeForm

class camcops_server.cc_modules.cc_forms.EditGroupForm(request: CamcopsRequest, group: camcops_server.cc_modules.cc_group.Group, **kwargs)[source]

Form to edit a group.

__init__(request: CamcopsRequest, group: camcops_server.cc_modules.cc_group.Group, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

class camcops_server.cc_modules.cc_forms.EditGroupSchema(*args, **kw)[source]

Schema to edit a group.

class camcops_server.cc_modules.cc_forms.EditIdDefinitionForm(request: CamcopsRequest, **kwargs)[source]

Form to edit an ID number definition.

__init__(request: CamcopsRequest, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

class camcops_server.cc_modules.cc_forms.EditIdDefinitionSchema(*args, **kw)[source]

Schema to edit an ID number definition.

class camcops_server.cc_modules.cc_forms.EditPatientSchema(*args, **kw)[source]

Schema to edit a patient.

class camcops_server.cc_modules.cc_forms.EditServerCreatedPatientForm(request: CamcopsRequest, **kwargs: Any)[source]

Form to add or edit a patient not yet on the device (for scheduled tasks)

__init__(request: CamcopsRequest, **kwargs: Any) → None[source]

Args: args: other positional arguments to InformativeForm dynamic_descriptions: use dynamic descriptions? dynamic_titles: use dynamic titles? kwargs: other keyword arguments to InformativeForm

class camcops_server.cc_modules.cc_forms.EditServerCreatedPatientSchema(*args, **kw)[source]
class camcops_server.cc_modules.cc_forms.EditServerSettingsForm(request: CamcopsRequest, **kwargs)[source]

Form to edit the global settings for the server.

__init__(request: CamcopsRequest, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

class camcops_server.cc_modules.cc_forms.EditServerSettingsSchema(*args, **kw)[source]

Schema to edit the global settings for the server.

class camcops_server.cc_modules.cc_forms.EditTaskFilterAdminSchema(*args, **kw)[source]

Schema to edit the “admin” parts of a task filter.

class camcops_server.cc_modules.cc_forms.EditTaskFilterForm(request: CamcopsRequest, open_who: bool = False, open_what: bool = False, open_when: bool = False, open_admin: bool = False, **kwargs)[source]

Form to edit a task filter.

__init__(request: CamcopsRequest, open_who: bool = False, open_what: bool = False, open_when: bool = False, open_admin: bool = False, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

class camcops_server.cc_modules.cc_forms.EditTaskFilterSchema(*args, **kw)[source]

Schema to edit a task filter.

class camcops_server.cc_modules.cc_forms.EditTaskFilterWhatSchema(*args, **kw)[source]

Schema to edit the “what” parts of a task filter.

class camcops_server.cc_modules.cc_forms.EditTaskFilterWhenSchema(*args, **kw)[source]

Schema to edit the “when” parts of a task filter.

class camcops_server.cc_modules.cc_forms.EditTaskFilterWhoSchema(*args, **kw)[source]

Schema to edit the “who” parts of a task filter.

class camcops_server.cc_modules.cc_forms.EditTaskScheduleForm(request: CamcopsRequest, **kwargs: Any)[source]
__init__(request: CamcopsRequest, **kwargs: Any) → None[source]

Args: args: other positional arguments to InformativeForm dynamic_descriptions: use dynamic descriptions? dynamic_titles: use dynamic titles? kwargs: other keyword arguments to InformativeForm

class camcops_server.cc_modules.cc_forms.EditTaskScheduleItemForm(request: CamcopsRequest, **kwargs: Any)[source]
__init__(request: CamcopsRequest, **kwargs: Any) → None[source]

Args: args: other positional arguments to InformativeForm dynamic_descriptions: use dynamic descriptions? dynamic_titles: use dynamic titles? kwargs: other keyword arguments to InformativeForm

class camcops_server.cc_modules.cc_forms.EditUserFullForm(request: CamcopsRequest, **kwargs)[source]

Form to edit a user. Full version for superusers.

__init__(request: CamcopsRequest, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

class camcops_server.cc_modules.cc_forms.EditUserFullSchema(*args, **kw)[source]

Schema to edit a user. Version for superusers; can also make the user a superuser.

class camcops_server.cc_modules.cc_forms.EditUserGroupAdminForm(request: CamcopsRequest, **kwargs)[source]

Form to edit a user. Version for group administrators.

__init__(request: CamcopsRequest, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

class camcops_server.cc_modules.cc_forms.EditUserGroupAdminSchema(*args, **kw)[source]

Schema to edit a user. Version for group administrators.

class camcops_server.cc_modules.cc_forms.EditUserGroupMembershipGroupAdminForm(request: CamcopsRequest, **kwargs)[source]

Form to edit a user’s permissions within a group. Version for group administrators.

__init__(request: CamcopsRequest, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

class camcops_server.cc_modules.cc_forms.EditUserGroupPermissionsFullForm(request: CamcopsRequest, **kwargs)[source]

Form to edit a user’s permissions within a group. Version for superusers.

__init__(request: CamcopsRequest, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

class camcops_server.cc_modules.cc_forms.EmailBccNode(*args, **kw)[source]
class camcops_server.cc_modules.cc_forms.EmailBodyNode(*args, **kw)[source]
__init__(*args, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

class camcops_server.cc_modules.cc_forms.EmailCcNode(*args, **kw)[source]
class camcops_server.cc_modules.cc_forms.EmailFromNode(*args, **kw)[source]
class camcops_server.cc_modules.cc_forms.EmailTemplateNode(*args, **kw)[source]
__init__(*args, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

class camcops_server.cc_modules.cc_forms.EndDateTimeSelector(*args, **kw)[source]

Optional node to select an end date/time (in UTC).

__init__(*args, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

class camcops_server.cc_modules.cc_forms.EndPendulumSelector(*args, **kw)[source]

Optional node to select an end date/time.

__init__(*args, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

class camcops_server.cc_modules.cc_forms.EraseTaskForm(request: CamcopsRequest, **kwargs)[source]

Form to erase a task.

__init__(request: CamcopsRequest, **kwargs) → None[source]

Args: args: other positional arguments to InformativeForm dynamic_descriptions: use dynamic descriptions? dynamic_titles: use dynamic titles? kwargs: other keyword arguments to InformativeForm

class camcops_server.cc_modules.cc_forms.EraseTaskSchema(*args, **kw)[source]

Schema to erase a task.

class camcops_server.cc_modules.cc_forms.ExportedTaskListForm(request: CamcopsRequest, **kwargs)[source]

Form to filter and then view exported task logs.

__init__(request: CamcopsRequest, **kwargs) → None[source]

Args: schema_class:

class of the Colander Schema to use as this form’s schema

submit_title:

title (text) to be used for the “submit” button

request:

camcops_server.cc_modules.cc_request.CamcopsRequest

class camcops_server.cc_modules.cc_forms.ExportedTaskListSchema(*args, **kw)[source]

Schema to filter HL7 message logs.

class camcops_server.cc_modules.cc_forms.ForciblyFinalizeChooseDeviceForm(request: CamcopsRequest, **kwargs)[source]

Form to force-finalize records from a device.

__init__(request: CamcopsRequest, **kwargs) → None[source]

Args: schema_class:

class of the Colander Schema to use as this form’s schema

submit_title:

title (text) to be used for the “submit” button

request:

camcops_server.cc_modules.cc_request.CamcopsRequest

class camcops_server.cc_modules.cc_forms.ForciblyFinalizeChooseDeviceSchema(*args, **kw)[source]

Schema to force-finalize records from a device.

class camcops_server.cc_modules.cc_forms.ForciblyFinalizeConfirmForm(request: CamcopsRequest, **kwargs)[source]

Form to confirm force-finalizing of a device.

__init__(request: CamcopsRequest, **kwargs) → None[source]

Args: args: other positional arguments to InformativeForm dynamic_descriptions: use dynamic descriptions? dynamic_titles: use dynamic titles? kwargs: other keyword arguments to InformativeForm

class camcops_server.cc_modules.cc_forms.ForciblyFinalizeConfirmSchema(*args, **kw)[source]

Schema to confirm force-finalizing of a device.

class camcops_server.cc_modules.cc_forms.FormInlineCssMixin(*args, **kwargs)[source]

Modification to a Deform form that makes it display “inline” via CSS. This has the effect of wrapping everything horizontally.

Should PRECEDE the Form (or something derived from it) in the inheritance order.

__init__(*args, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

class camcops_server.cc_modules.cc_forms.GroupIpUseNode(*args, **kw)[source]
class camcops_server.cc_modules.cc_forms.GroupIpUseWidget(request: CamcopsRequest, **kwargs: Any)[source]
__init__(request: CamcopsRequest, **kwargs: Any) → None[source]

Initialize self. See help(type(self)) for accurate signature.

deserialize(field: Field, pstruct: Union[Dict[str, Any], colander._null]) → Dict[str, bool][source]

The deserialize method of a widget must deserialize a pstruct value to a cstruct value and return the cstruct value. The pstruct argument is a value resulting from the parse method of the Peppercorn package. The field argument is the field object to which this widget is attached.

serialize(field: Field, cstruct: Union[Dict[str, Any], None, colander._null], **kw: Any) → Any[source]

The serialize method of a widget must serialize a cstruct value to an HTML rendering. A cstruct value is the value which results from a Colander schema serialization for the schema node associated with this widget. serialize should return the HTML rendering: the result of this method should always be a string containing HTML. The field argument is the field object to which this widget is attached. The **kw argument allows a caller to pass named arguments that might be used to influence individual widget renderings.

class camcops_server.cc_modules.cc_forms.GroupNameNode(*args, **kw)[source]

Node to capture a CamCOPS group name, and check it’s valid as a string.

class camcops_server.cc_modules.cc_forms.GroupsSequenceBase(*args, **kw)[source]

Sequence schema to capture zero or more non-duplicate groups.

__init__(*args, minimum_number: int = 0, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

class camcops_server.cc_modules.cc_forms.HardWorkConfirmationSchema(*args, **kw)[source]

Schema to make it hard to do something. We require a pattern of yes/no answers before we will proceed.

class camcops_server.cc_modules.cc_forms.HiddenDownloadFilenameNode(*args, **kw)[source]

Note to encode a hidden filename.

class camcops_server.cc_modules.cc_forms.HiddenRedirectionUrlNode(*args, **kw)[source]

Note to encode a hidden URL, for redirection.

class camcops_server.cc_modules.cc_forms.Hl7AssigningAuthorityNode(*args, **kw)[source]

Optional node to capture the name of an HL7 Assigning Authority.

__init__(*args, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

class camcops_server.cc_modules.cc_forms.Hl7IdTypeNode(*args, **kw)[source]

Optional node to capture the name of an HL7 Identifier Type code.

__init__(*args, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

class camcops_server.cc_modules.cc_forms.HorizontalFormMixin(schema: colander.Schema, *args, **kwargs)[source]

Modification to a Deform form that displays itself with horizontal layout, using custom templates via HorizontalFormWidget. Not fantastic.

__init__(schema: colander.Schema, *args, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

class camcops_server.cc_modules.cc_forms.HorizontalFormWidget(**kw)[source]

Widget to render a form horizontally, with custom templates.

See deform.template.ZPTRendererFactory, which explains how strings are resolved to Chameleon ZPT (Zope) templates.

See

class camcops_server.cc_modules.cc_forms.IdDefinitionDescriptionNode(*args, **kw)[source]

Node to capture the description of an ID number type.

__init__(*args, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

schema_type

alias of colander.String

class camcops_server.cc_modules.cc_forms.IdDefinitionShortDescriptionNode(*args, **kw)[source]

Node to capture the short description of an ID number type.

__init__(*args, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

schema_type

alias of colander.String

class camcops_server.cc_modules.cc_forms.IdNumSequenceAnyCombination(*args, **kw)[source]

Sequence to capture multiple ID numbers (as type/value pairs).

__init__(*args, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

class camcops_server.cc_modules.cc_forms.IdNumSequenceUniquePerWhichIdnum(*args, **kw)[source]

Sequence to capture multiple ID numbers (as type/value pairs) but with only up to one per ID number type.

__init__(*args, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

class camcops_server.cc_modules.cc_forms.IdValidationMethodNode(*args, **kw)[source]

Node to choose a build-in ID number validation method.

__init__(*args, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

class camcops_server.cc_modules.cc_forms.IncludeBlobsNode(*args, **kw)[source]

Boolean node: should BLOBs be included (for downloads)?

__init__(*args, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

schema_type

alias of colander.Boolean

class camcops_server.cc_modules.cc_forms.IncludeInformationSchemaColumnsNode(*args, **kw)[source]

Boolean node: should INFORMATION_SCHEMA.COLUMNS be included (for downloads)?

False by default – adds about 350 kb to an ODS download, for example.

__init__(*args, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

schema_type

alias of colander.Boolean

class camcops_server.cc_modules.cc_forms.InformativeNonceForm(schema, action='', method='POST', buttons=(), formid='deform', use_ajax=False, ajax_options='{}', autocomplete=None, focus='on', **kw)[source]

A Form class to use our modifications to Deform, as per https://github.com/Pylons/deform/issues/512, to pass a nonce value through to the <script> and <style> tags in the Deform templates.

todo: if Deform is updated, work this into cardinal_pythonlib.

class camcops_server.cc_modules.cc_forms.JsonNode(*args, **kw)[source]
schema_type

alias of JsonType

class camcops_server.cc_modules.cc_forms.JsonType[source]

Schema type for JsonNode

class camcops_server.cc_modules.cc_forms.JsonWidget(request: CamcopsRequest, **kwargs: Any)[source]

Widget supporting jsoneditor https://github.com/josdejong/jsoneditor

__init__(request: CamcopsRequest, **kwargs: Any) → None[source]

Initialize self. See help(type(self)) for accurate signature.

deserialize(field: Field, pstruct: Union[str, colander._null]) → Union[str, colander._null][source]

The deserialize method of a widget must deserialize a pstruct value to a cstruct value and return the cstruct value. The pstruct argument is a value resulting from the parse method of the Peppercorn package. The field argument is the field object to which this widget is attached.

serialize(field: Field, cstruct: Union[str, colander._null], **kw: Any) → Any[source]

The serialize method of a widget must serialize a cstruct value to an HTML rendering. A cstruct value is the value which results from a Colander schema serialization for the schema node associated with this widget. serialize should return the HTML rendering: the result of this method should always be a string containing HTML. The field argument is the field object to which this widget is attached. The **kw argument allows a caller to pass named arguments that might be used to influence individual widget renderings.

class camcops_server.cc_modules.cc_forms.LanguageSelector(*args, **kw)[source]

Node to choose a language code, from those supported by the server.

__init__(*args, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

schema_type

alias of colander.String

class camcops_server.cc_modules.cc_forms.LinkingIdNumSelector(*args, **kw)[source]

Convenience node: pick a single ID number, with title/description indicating that it’s the ID number to link on.

class camcops_server.cc_modules.cc_forms.LoginForm(request: CamcopsRequest, autocomplete_password: bool = True, **kwargs)[source]

Form to capture login details.

__init__(request: CamcopsRequest, autocomplete_password: bool = True, **kwargs) → None[source]
Parameters

autocomplete_password – suggest to the browser that it’s OK to store the password for autocompletion? Note that browsers may ignore this.

class camcops_server.cc_modules.cc_forms.LoginSchema(*args, **kw)[source]

Schema to capture login details.

__init__(*args, autocomplete_password: bool = True, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

class camcops_server.cc_modules.cc_forms.MandatoryDeviceIdSelector(*args, **kw)[source]

Mandatory node to select a client device ID.

__init__(*args, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

schema_type

alias of colander.Integer

class camcops_server.cc_modules.cc_forms.MandatoryGroupIdSelectorAdministeredGroups(*args, **kw)[source]

Offers a picklist of groups from GROUPS ADMINISTERED BY REQUESTOR. Used by groupadmins: “add user to one of my groups”.

__init__(*args, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

class camcops_server.cc_modules.cc_forms.MandatoryGroupIdSelectorAllGroups(*args, **kw)[source]

Offers a picklist of groups from ALL POSSIBLE GROUPS. Used by superusers: “add user to any group”.

__init__(*args, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

class camcops_server.cc_modules.cc_forms.MandatoryGroupIdSelectorAllowedGroups(*args, **kw)[source]

Offers a picklist of groups from THOSE THE USER IS ALLOWED TO SEE. Used for task filters.

__init__(*args, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

class camcops_server.cc_modules.cc_forms.MandatoryGroupIdSelectorOtherGroups(*args, **kw)[source]

Offers a picklist of groups THAT ARE NOT THE SPECIFIED GROUP (as specified in kw[Binding.GROUP]). Used by superusers: “which other groups can this group see?”

__init__(*args, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

class camcops_server.cc_modules.cc_forms.MandatoryGroupIdSelectorUserGroups(*args, **kw)[source]

Offers a picklist of groups from THOSE THE USER IS A MEMBER OF. Used for: “which of your groups do you want to upload into?”

__init__(*args, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

class camcops_server.cc_modules.cc_forms.MandatoryIdNumNode(*args, **kw)[source]

Mandatory node to capture an ID number type and the associated actual ID number (value).

This is also where we apply ID number validation rules (e.g. NHS number).

__init__(*args, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

class camcops_server.cc_modules.cc_forms.MandatoryIdNumValue(*args, **kw)[source]

Mandatory node to capture an ID number value.

__init__(*args, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

schema_type

alias of colander.Integer

class camcops_server.cc_modules.cc_forms.MandatorySexSelector(*args, **kw)[source]

Mandatory node to choose sex.

__init__(*args, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

class camcops_server.cc_modules.cc_forms.MandatorySingleTaskSelector(*args, **kw)[source]

Node to pick one task type.

__init__(*args: Any, **kwargs: Any) → None[source]

Initialize self. See help(type(self)) for accurate signature.

class camcops_server.cc_modules.cc_forms.MandatoryUserIdSelectorUsersAllowedToSee(*args, **kw)[source]

Mandatory node to choose a user, from the users that the requesting user is allowed to see.

__init__(*args, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

schema_type

alias of colander.Integer

class camcops_server.cc_modules.cc_forms.MandatoryWhichIdNumSelector(*args, **kw)[source]

Node to enforce the choice of a single ID number type (e.g. “NHS number” or “study Blah ID number”).

__init__(*args, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

class camcops_server.cc_modules.cc_forms.MultiTaskSelector(*args, **kw)[source]

Node to select multiple task types.

__init__(*args, tracker_tasks_only: bool = False, minimum_number: int = 0, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

schema_type

alias of colander.Set

class camcops_server.cc_modules.cc_forms.MustChangePasswordNode(*args, **kw)[source]

Boolean node: must the user change their password?

__init__(*args, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

schema_type

alias of colander.Boolean

class camcops_server.cc_modules.cc_forms.NewPasswordNode(*args, **kw)[source]

Node to enter a new password.

__init__(*args, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

schema_type

alias of colander.String

class camcops_server.cc_modules.cc_forms.OfferBasicDumpForm(request: CamcopsRequest, **kwargs)[source]

Form to offer a basic (TSV/ZIP) data dump.

__init__(request: CamcopsRequest, **kwargs) → None[source]

Args: schema_class:

class of the Colander Schema to use as this form’s schema

submit_title:

title (text) to be used for the “submit” button

request:

camcops_server.cc_modules.cc_request.CamcopsRequest

class camcops_server.cc_modules.cc_forms.OfferBasicDumpSchema(*args, **kw)[source]

Schema to choose the settings for a basic (TSV/ZIP) data dump.

class camcops_server.cc_modules.cc_forms.OfferDumpManualSchema(*args, **kw)[source]

Schema to offer the “manual” settings for a data dump (groups, task types).

__init__(*args, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

class camcops_server.cc_modules.cc_forms.OfferSqlDumpForm(request: CamcopsRequest, **kwargs)[source]

Form to choose the settings for an SQL data dump.

__init__(request: CamcopsRequest, **kwargs) → None[source]

Args: schema_class:

class of the Colander Schema to use as this form’s schema

submit_title:

title (text) to be used for the “submit” button

request:

camcops_server.cc_modules.cc_request.CamcopsRequest

class camcops_server.cc_modules.cc_forms.OfferSqlDumpSchema(*args, **kw)[source]

Schema to choose the settings for an SQL data dump.

class camcops_server.cc_modules.cc_forms.OfferTermsForm(request: CamcopsRequest, agree_button_text: str, **kwargs)[source]

Form to offer terms and ask the user to accept them.

__init__(request: CamcopsRequest, agree_button_text: str, **kwargs) → None[source]
Parameters

agree_button_text – text for the “agree” button

class camcops_server.cc_modules.cc_forms.OfferTermsSchema(*args, **kw)[source]

Schema to offer terms and ask the user to accept them.

class camcops_server.cc_modules.cc_forms.OldUserPasswordCheck(*args, **kw)[source]

Schema to capture an old password (for when a password is being changed).

__init__(*args, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

schema_type

alias of colander.String

class camcops_server.cc_modules.cc_forms.OptionalAuditSourceNode(*args, **kw)[source]

Optional IPv4 or IPv6 address.

class camcops_server.cc_modules.cc_forms.OptionalExportRecipientNameSelector(*args, **kw)[source]

Optional node to pick an export recipient name from those present in the database.

__init__(*args, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

class camcops_server.cc_modules.cc_forms.OptionalGroupIdSelectorUserGroups(*args, **kw)[source]

Offers a picklist of groups from THOSE THE USER IS A MEMBER OF. Used for “which do you want to upload into?”. Optional.

__init__(*args, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

class camcops_server.cc_modules.cc_forms.OptionalIPAddressNode(*args, **kw)[source]

Optional IPv4 or IPv6 address.

class camcops_server.cc_modules.cc_forms.OptionalPatientNameNode(*args, **kw)[source]
class camcops_server.cc_modules.cc_forms.OptionalSexSelector(*args, **kw)[source]

Optional node to choose sex.

__init__(*args, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

class camcops_server.cc_modules.cc_forms.OptionalSingleTaskSelector(*args, **kw)[source]

Node to pick one task type.

__init__(*args, tracker_tasks_only: bool = False, **kwargs) → None[source]
Parameters

tracker_tasks_only – restrict the choices to tasks that offer trackers.

class camcops_server.cc_modules.cc_forms.OptionalUserNameSelector(*args, **kw)[source]

Optional node to select a username, from all possible users.

__init__(*args, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

class camcops_server.cc_modules.cc_forms.PatientIdPerRowNode(*args, **kw)[source]

Boolean node: should patient ID information, and other cross-referencing denormalized info, be included per row?

See DB_PATIENT_ID_PER_ROW.

__init__(*args, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

schema_type

alias of colander.Boolean

class camcops_server.cc_modules.cc_forms.PolicyNode(*args, **kw)[source]

Node to capture a CamCOPS ID number policy, and make sure it is syntactically valid.

class camcops_server.cc_modules.cc_forms.RefreshTasksForm(request: CamcopsRequest, **kwargs)[source]

Form for a “refresh tasks” button.

__init__(request: CamcopsRequest, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

class camcops_server.cc_modules.cc_forms.RefreshTasksSchema(*args, **kw)[source]

Schema for a “refresh tasks” button.

class camcops_server.cc_modules.cc_forms.ReportOutputTypeSelector(*args, **kw)[source]

Node to select the output format for a report.

__init__(*args, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

schema_type

alias of colander.String

class camcops_server.cc_modules.cc_forms.ReportParamForm(request: CamcopsRequest, schema_class: Type[camcops_server.cc_modules.cc_forms.ReportParamSchema], **kwargs)[source]

Form to view a specific report. Often derived from, to configure the report in more detail.

__init__(request: CamcopsRequest, schema_class: Type[camcops_server.cc_modules.cc_forms.ReportParamSchema], **kwargs) → None[source]

Args: schema_class:

class of the Colander Schema to use as this form’s schema

submit_title:

title (text) to be used for the “submit” button

request:

camcops_server.cc_modules.cc_request.CamcopsRequest

class camcops_server.cc_modules.cc_forms.ReportParamSchema(*args, **kw)[source]

Schema to embed a report type (ID) and output format (view type).

class camcops_server.cc_modules.cc_forms.RequestAwareMixin(*args, **kwargs)[source]

Mixin to add Pyramid request awareness to Schema/SchemaNode objects, together with some translations and other convenience functions.

__init__(*args, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

class camcops_server.cc_modules.cc_forms.RowsPerPageSelector(*args, **kw)[source]

Node to select how many rows per page are shown.

__init__(*args, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

schema_type

alias of colander.Integer

camcops_server.cc_modules.cc_forms.SelectWidget

alias of camcops_server.cc_modules.cc_forms.BugfixSelectWidget

class camcops_server.cc_modules.cc_forms.SendEmailForm(request: CamcopsRequest, **kwargs)[source]

Form for sending email

__init__(request: CamcopsRequest, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

class camcops_server.cc_modules.cc_forms.SendEmailSchema(*args, **kw)[source]
class camcops_server.cc_modules.cc_forms.ServerPkSelector(*args, **kw)[source]

Optional node to request an integer, marked as a server PK.

__init__(*args, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

class camcops_server.cc_modules.cc_forms.SetUserUploadGroupForm(request: CamcopsRequest, user: User, **kwargs)[source]

Form to choose the group into which a user uploads.

__init__(request: CamcopsRequest, user: User, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

class camcops_server.cc_modules.cc_forms.SetUserUploadGroupSchema(*args, **kw)[source]

Schema to choose the group into which a user uploads.

class camcops_server.cc_modules.cc_forms.SimpleSubmitForm(schema_class: Type[colander.Schema], submit_title: str, request: CamcopsRequest, **kwargs)[source]

Form with a simple “submit” button.

__init__(schema_class: Type[colander.Schema], submit_title: str, request: CamcopsRequest, **kwargs) → None[source]
Parameters
class camcops_server.cc_modules.cc_forms.SortTsvByHeadingsNode(*args, **kw)[source]

Boolean node: sort TSV files by column name?

__init__(*args, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

schema_type

alias of colander.Boolean

class camcops_server.cc_modules.cc_forms.SpreadsheetFormatSelector(*args, **kw)[source]

Node to select a way of downloading an SQLite database.

__init__(*args, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

schema_type

alias of colander.String

class camcops_server.cc_modules.cc_forms.SqliteSelector(*args, **kw)[source]

Node to select a way of downloading an SQLite database.

__init__(*args, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

schema_type

alias of colander.String

class camcops_server.cc_modules.cc_forms.StartDateTimeSelector(*args, **kw)[source]

Optional node to select a start date/time (in UTC).

__init__(*args, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

class camcops_server.cc_modules.cc_forms.StartPendulumSelector(*args, **kw)[source]

Optional node to select a start date/time.

__init__(*args, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

class camcops_server.cc_modules.cc_forms.TaskScheduleItemSchema(*args, **kw)[source]
class camcops_server.cc_modules.cc_forms.TaskScheduleNode(*args, **kw)[source]
__init__(*args: Any, **kwargs: Any) → None[source]

Initialize self. See help(type(self)) for accurate signature.

class camcops_server.cc_modules.cc_forms.TaskScheduleSchema(*args, **kw)[source]
class camcops_server.cc_modules.cc_forms.TaskScheduleSelector(*args, **kw)[source]

Drop-down with all available task schedules

__init__(*args: Any, **kwargs: Any) → None[source]

Initialize self. See help(type(self)) for accurate signature.

class camcops_server.cc_modules.cc_forms.TaskScheduleSequence(*args, **kw)[source]
__init__(*args: Any, **kwargs: Any) → None[source]

Initialize self. See help(type(self)) for accurate signature.

class camcops_server.cc_modules.cc_forms.TaskTrackerOutputTypeSelector(*args, **kw)[source]

Node to select the output format for a tracker.

__init__(*args, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

schema_type

alias of colander.String

class camcops_server.cc_modules.cc_forms.TasksPerPageForm(request: CamcopsRequest, **kwargs)[source]

Form to edit the number of tasks per page, for the task view.

__init__(request: CamcopsRequest, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

class camcops_server.cc_modules.cc_forms.TasksPerPageSchema(*args, **kw)[source]

Schema to edit the number of rows per page, for the task view.

class camcops_server.cc_modules.cc_forms.TextContentsSequence(*args, **kw)[source]

Sequence to capture multiple pieces of text (representing text contents for a task filter).

__init__(*args, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

class camcops_server.cc_modules.cc_forms.TranslatableDateTimeSelectorNode(*args, **kw)[source]

Translates the “Date” and “Time” labels for the widget, via the request.

Todo

TranslatableDateTimeSelectorNode not fully implemented

__init__(*args, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

class camcops_server.cc_modules.cc_forms.TranslatableOptionalPendulumNode(*args, **kw)[source]

Translates the “Date” and “Time” labels for the widget, via the request.

Todo

TranslatableOptionalPendulumNode not fully implemented

__init__(*args, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

class camcops_server.cc_modules.cc_forms.TranslatableSequenceWidget(request: CamcopsRequest, **kwargs)[source]

SequenceWidget does support translation via _(), but not in a request-specific way.

__init__(request: CamcopsRequest, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

class camcops_server.cc_modules.cc_forms.TranslatableValidateDangerousOperationNode(*args, **kw)[source]

Translatable version of ValidateDangerousOperationNode.

class camcops_server.cc_modules.cc_forms.UploadingUserSequence(*args, **kw)[source]

Sequence to capture multiple users (for task filters: “uploaded by one of the following users…”).

__init__(*args, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

class camcops_server.cc_modules.cc_forms.UserDownloadDeleteForm(request: CamcopsRequest, **kwargs)[source]

Form that provides a single button to delete a user download.

__init__(request: CamcopsRequest, **kwargs) → None[source]

Args: schema_class:

class of the Colander Schema to use as this form’s schema

submit_title:

title (text) to be used for the “submit” button

request:

camcops_server.cc_modules.cc_request.CamcopsRequest

class camcops_server.cc_modules.cc_forms.UserDownloadDeleteSchema(*args, **kw)[source]

Schema to capture details of a file to be deleted.

class camcops_server.cc_modules.cc_forms.UserFilterForm(request: CamcopsRequest, **kwargs: Any)[source]

Form to filter the list of users

__init__(request: CamcopsRequest, **kwargs: Any) → None[source]

Initialize self. See help(type(self)) for accurate signature.

class camcops_server.cc_modules.cc_forms.UserFilterSchema(*args, **kw)[source]

Schema to filter the list of users

class camcops_server.cc_modules.cc_forms.UserGroupPermissionsFullSchema(*args, **kw)[source]

Edit group-specific permissions for a user. For superusers; includes the option to make the user a groupadmin.

class camcops_server.cc_modules.cc_forms.UserGroupPermissionsGroupAdminSchema(*args, **kw)[source]

Edit group-specific permissions for a user. For group administrators.

class camcops_server.cc_modules.cc_forms.UsernameNode(*args, **kw)[source]

Node to enter a username.

__init__(*args, autocomplete: str = 'off', **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

schema_type

alias of colander.String

class camcops_server.cc_modules.cc_forms.ViaIndexSelector(*args, **kw)[source]

Node to choose whether we use the server index or not. Default is true.

__init__(*args, **kwargs) → None[source]

Initialize self. See help(type(self)) for accurate signature.

class camcops_server.cc_modules.cc_forms.ViewDdlForm(request: CamcopsRequest, **kwargs)[source]

Form to choose how to view DDL (and then view it).

__init__(request: CamcopsRequest, **kwargs) → None[source]

Args: schema_class:

class of the Colander Schema to use as this form’s schema

submit_title:

title (text) to be used for the “submit” button

request:

camcops_server.cc_modules.cc_request.CamcopsRequest

class camcops_server.cc_modules.cc_forms.ViewDdlSchema(*args, **kw)[source]

Schema to choose how to view DDL.

camcops_server.cc_modules.cc_forms.add_css_class(kwargs: Dict[str, Any], extra_classes: str, param_name: str = 'css_class') → None[source]

Modifies a kwargs dictionary to add a CSS class to the css_class parameter.

Parameters
  • kwargs – a dictionary

  • extra_classes – CSS classes to add (as a space-separated string)

  • param_name – parameter name to modify; by default, “css_class”

camcops_server.cc_modules.cc_forms.make_node_widget_horizontal(node: colander.SchemaNode) → None[source]

Applies Bootstrap “form-inline” styling to the schema node’s widget.

Note: often better to use the inline=True option to the widget’s constructor.

camcops_server.cc_modules.cc_forms.make_widget_horizontal(widget: deform.widget.Widget) → None[source]

Applies Bootstrap “form-inline” styling to the widget.