Cowbird: Middleware operation service
- Cowbird (the brood parasite)
- The brood parasite manipulates a host, either of the same or of another species, *to raise its young as if it were its ownThe shiny cowbird is an obligate brood parasite, meaning that adults will lay their eggs in the nests of other species and their offspring rely entirely on their hosts for parental care.
Cowbird is a middleware that manages interactions between various birds of the bird-house stack.
It therefore relies on the existence of other services under a common architecture, but applies changes to the resources under those services such that the complete ecosystem can seamlessly operate together (see Components Diagram).
dependencies |
|
---|---|
build status |
|
tests status |
|
docker status |
|
releases |
Documentation
The REST API documentation is auto-generated and served under {COWBIRD_URL}/api/
using
Swagger-UI with tag latest
.
Configuration and Usage
Cowbird
application.Change History
Addressed features, changes and bug fixes per version tag are available in CHANGES.
Docker Images
Following most recent variants are available:
Version |
Cowbird Base |
Cowbird Worker |
Cowbird Web Service |
---|---|---|---|
Most Recent Release |
|||
Latest Commit |
Notes:
Older tags the are also available: Docker Images
Table of Contents
Usage
In most situation, you will want to run Cowbird as a Web Application in combination with a larger set of bird-house components forming a server instance. A minimal docker-compose.yml example is provided, but Cowbird’s actual configuration will greatly depend on your actual service requirements.
Setup and Validation
To use Cowbird in a project, first you need to install it. To do so, please follow steps in Installation and Configuration procedures.
After this, you should be able to call the CLI CLI Utilities to validate it is installed properly using:
cowbird --help
Web Application
To start the Web Application, you can simply run the following command:
make start
This will first install any missing dependencies in the current environment (see Installation), and will
after start a basic Web Application on localhost:7000
with default configurations.
Please refer to Configuration if any of the parameters needs adjustment for custom environments.
For running the application, multiple WSGI HTTP Servers can be employed (e.g.: Gunicorn, Waitress, etc.). They usually all support as input an INI configuration file for specific settings. Cowbird also employs such INI file (cowbird.ini) to customize its behaviour. See Configuration for further details, and please refer to the employed WSGI application documentation of your liking for their respective setup requirements.
API
When the application is started, the Swagger API should be available under /api
path. This will render the current
version API and applicable requests. Please refer to this documentation to discover all provided API paths and
events supported by Cowbird on a running instance (that could be older than latest code base). Alternatively,
documentation of all versions is available on ReadTheDocs.
CLI
After successful Installation of Cowbird package, multiple helper CLI Utilities become available as CLI applications callable from the shell. These can be quite useful to run typical Cowbird events calls from the terminal without having to form corresponding HTTP requests. Please refer to the relevant page for further details.
Documentation
The documentation is automatically built by ReadTheDocs. It is generated from the documentation source,
the parsing of Python docstrings
within the code, the code itself, and the Cowbird REST API.
You can also preview the result by building the documentation locally using:
make docs
The resulting location will be printed on the terminal and can be opened in a web browser.
Testing
Tests are executed using a Web Application that gets spawned by a set of default configurations to run HTTP requests against.
Note
To customize execution parameters, you can export variables such as COWBIRD_INI_FILE_PATH
for example,
and they will be picked up to validate specific results against defined Configuration.
When adding new features or fixing bugs, it is recommended to execute linting checks and tests locally prior to opening a PR, as each PR gets tested and you will waste more time waiting for results to complete then if ran locally.
To validate linting of the code, simply call:
make check
To run all tests locally, simply execute the following command:
make test
Coverage analysis with the same set of tests is also available using:
make coverage
You can also run subsets of tests according to markers and/or specific test function pytest
specification using:
make SPEC="<CUSTOM TEST SPECIFICATIONS>" test-custom
Or some of the predefined filters:
make test-api
make test-cli
Finally, the following command can be executed to built and run a smoke test of the resulting Docker image:
make test-docker
Installation
Basic Setup
At the command line:
make install
This will create a conda
environment named cowbird
, and install all required dependencies of the package in it.
You should be ready to employ Cowbird with example Configuration files at this point.
Advanced
To install in another environment, CONDA_ENV_NAME
can be provided to make
.
Otherwise, following can be used to install with whichever python
is detected (up to user to manage references):
make install-pkg
If you want the full setup for development (including dependencies for test execution), use:
make install-dev
Configuration
At startup, Cowbird application will load multiple configuration files to define various behaviours or setup operations. These are defined through the configuration settings presented in sections below.
All generic Cowbird configuration settings can be defined through either the cowbird.ini file or environment
variables. Values defined in cowbird.ini are expected to follow the cowbird.[variable_name]
format, and
corresponding COWBIRD_[VARIABLE_NAME]
format is used for environment variables. Both of these alternatives match
the constants defined in cowbird/constants.py and can be used interchangeably.
Configuration Files
File: cowbird.ini
This is the base configuration file that defines most of Cowbird’s lower level application configuration (API, CLI). A basic cowbird.example.ini configuration is provided, which should allow any user to run the application locally. It is recommended to create a copy of this file as cowbird.ini to customize settings to your linking (this file is ignored for repository commits).
Furthermore, this file is used by default in each tagged Docker image, and mounted at
${COWBIRD_CONFIG_DIR}/cowbird.ini
location. If you want to provide different configuration, the file should be
overridden in the Docker image using a volume mount parameter, or by specifying an alternative path through the
environment variable COWBIRD_INI_FILE_PATH
.
File: config.yml
This is the core configuration file that defines most of Cowbird’s data configuration which it must work with to manage Handler components. A basic config.example.yml file is provided, for sample definition of expected schemas per handler.
This config file contains the following required sections :
handlers:
The handlers
section contains the definition of managed handlers by Cowbird.
Each handler is provided as a string that must match an actual implementation in Cowbird.
Each handler must be further configured with one or more of the following parameters. If
a required parameter is missing for a handler it will throw a HandlerConfigurationException
exception.
Additional parameters can be used for some handlers, such as admin_user
and admin_password
for a Magpie
handler.
See also the Handlers section for more details on individual handlers.
Parameters :
Parameter name |
Default value |
Description |
---|---|---|
|
|
Bool allowing to deactivate a handler and stop managing it. |
|
|
Relative priority between handlers while handling events. Lower values have higher priority, default value is last. |
|
|
URI of the web service represented by this Cowbird handler. Some Cowbird handlers do not represent web services, but others will throw an exception if missing. |
|
|
Location of the users workspace root.
Required for the following handlers : |
Example :
handlers:
Magpie:
active: true
url: https://${HOSTNAME}/magpie
admin_user: ${MAGPIE_ADMIN_USER}
admin_password: ${MAGPIE_ADMIN_PASSWORD}
FileSystem:
active: true
priority: 1
workspace_dir: ${WORKSPACE_DIR}
jupyterhub_user_data_dir: ${JUPYTERHUB_USER_DATA_DIR}
wps_outputs_dir: ${WPS_OUTPUTS_DIR}
secure_data_proxy_name: ${SECURE_DATA_PROXY_NAME}
public_workspace_wps_outputs_subpath: ${PUBLIC_WORKSPACE_WPS_OUTPUTS_SUBPATH}
sync_permissions:
This section defines how to synchronize permissions between services when they share resources.
This is used only for the synchronization of permissions between Magpie services/resources.
The sync_permissions
are defined first by a list of Magpie services and their associated resources,
defined in the services section below.
The mappings defining how the resources should be synchronized are described in
the other section permissions_mapping.
services
This section contains the different resources that can be synchronized, ordered by service type. The service types found in this section of the config should also exist in Magpie.
See also
For more details on available service types on Magpie, refer to these pages :
Each service type defines a list of resource keys, which are custom names that define a resource path. They should correspond to the names used in the permissions_mapping section below. Each resource path contains the list of its segments, with their corresponding name and type.
The name of a segment can either be a string name, a variable or a MULTI_TOKEN
(**
).
Variables are indicated by a name written between braces (ex.: {variable_name}
) and represent a single
segment name. A variable can be reused across different resource paths if they have
a matching segment name. A resource path can use any number of different variables, but
each variable can only be used one time per resource path.
They are useful to indicate the corresponding location of the resource segment in a mapped permission.
Note that all variables found in a target resource path should also be included in the source resource path.
MULTI_TOKEN
represent any number (0 or more) of names that fit with the corresponding type.
Also, the MULTI_TOKEN
can only be used one time in each list of path segments. This is to avoid ambiguous
cases that would result with using multiple MULTI_TOKEN
, since multiple ways of matching the resource path
would then be possible. For example with a tokenized path **/**
and an input resource seg1/seg2/seg3
,
multiple choices of matching are possible.
We could match seg1/seg2
with the first token, and seg3
with the second token,
we could also match seg1
with the first token, and seg2/seg3
with the second token, etc.
The variables and tokens are useful to know the type of any segments that doesn’t have a fixed name.
permissions_mapping
This section defines an array of permissions mapping between services.
Each item found in the permissions_mapping
uses the following format :
"resource_key1 : <permissions1> <mapping> resource_key2 : <permissions2>"
The resource keys should correspond to resource keys defined in the services section above.
<permissionsX>
is defined as a single permission or a list of permissions :
permission | [permission1, permission2, ...]
<mapping>
is defined as a unidirectional or bidirectional arrow :
-> | <- | <->
Each of the permissions can either use an implicit format (<name>
or <name>-match
)
or an explicit format (<name>-<access>-<scope>
).
When using an implicit format, if the access and/or scope are not specified, it will use the default
access allow
and/or the default scope recursive
.
See also
For more info on Magpie permissions :
The arrows between the 2 resources indicate the direction of the synchronization, and which resources can be a source or target resource.
In the case of the <->
arrow, the synchronization of permissions can be done in either direction. Also, it is
important to note that, in this case, both mapped resources should have matching variable names if any. This means
each resource needs to match all the variables of the other mapped resource. Also, if one of the resource uses
the MULTI_TOKEN
, the other resource should also include it in its path, to know how to match the segments.
In the case of the ->
or <-
arrow, the synchronization is only done one way. In this case, the source resource
path should include every variable names found in the target resource, but it can have more variables that
just won’t be used in the target path. Also, if the target resource uses the MULTI_TOKEN
, the source
resource should have one too. The source can also use the **
token even if the target doesn’t include one.
In the case of a deleted
webhook event, note that the related target permissions only get removed if
they are not in another sync mapping as a target where the source permission still exists.
Deleting the target permission would break that other sync mapping, having an existing source permission
but a deleted target permission.
Instead, a target permission only gets deleted when all related source permissions are also deleted.
For example, with the following mappings :
A -> C
B -> C
or
[A,B] -> C
If the A -> C
mapping was triggered for a deleted
webhook event on A
, the C
target permission
should only be deleted if both A
and B
permissions don’t exist.
Else, the B -> C
mapping would become invalid if B
exists and C
was deleted.
Settings and Constants
Environment variables can be used to define all following configurations (unless mentioned otherwise with
[constant]
keyword next to the parameter name). Most values are parsed as plain strings, unless they refer to an
activable setting (e.g.: True
or False
), or when specified with more specific [<type>]
notation.
Configuration variables will be used by Cowbird on startup unless prior definition is found within cowbird.ini.
All variables (i.e.: non-[constant]
parameters) can also be specified by their cowbird.[variable_name]
setting
counterpart as described at the start of the Configuration section.
Loading Settings
These settings can be used to specify where to find other settings through custom configuration files.
COWBIRD_MODULE_DIR
[constant]Path to the top level
cowbird
module (ie: source code).COWBIRD_ROOT
[constant]Path to the containing directory of Cowbird. This corresponds to the directory where the repository was cloned or where the package was installed.
COWBIRD_CONFIG_DIR
(Default:${COWBIRD_ROOT}/config
)Configuration directory where to look for cowbird.ini file.
COWBIRD_CONFIG_PATH
[required]Explicit path where to find a config.yml configuration file to load at Cowbird startup.
See also
COWBIRD_INI_FILE_PATH
Specifies where to find the initialization file to run Cowbird application.
Warning
This variable ignores the setting/env-var resolution order since settings cannot be defined without firstly loading the file referenced by its value.
See also
Application Settings
Following configuration parameters are used to define values that are employed by Cowbird after loading
the Loading Settings. All cowbird.[variable_name]
counterpart definitions are also available as described
at the start of the Configuration section.
COWBIRD_URL
(Default:"http://localhost:2001"
)Full hostname URL to use so that Cowbird can resolve his own running instance location.
Note
This value is notably useful to indicate the exposed proxy location where Cowbird should be invoked from within a server stack that integrates it.
COWBIRD_SSL_VERIFY
(Default:true
)Specify if requests should enable SSL verification (recommended, should be disabled only for testing purposes).
COWBIRD_REQUEST_TIMEOUT
(Default:5
, in seconds)Specify the connection timeout to be used when sending requests.
COWBIRD_LOG_LEVEL
(Default:INFO
)Logging level of operations. Cowbird will first use the complete logging configuration found in cowbird.ini in order to define logging formatters and handler referencing to the
logger_cowbird
section. If this configuration fail to retrieve an explicit logging level, this configuration variable is used instead to prepare a basic logger, after checking if a correspondingcowbird.log_level
setting was instead specified.Warning
When setting
DEBUG
level or lower, Cowbird could potentially dump some sensitive information in logs. It is important to avoid this setting for production systems.COWBIRD_LOG_PRINT
(Default:False
)Specifies whether Cowbird logging should also enforce printing the details to the console when using CLI Utilities. Otherwise, the configured logging methodology in cowbird.ini is used (which can also define a console handler).
COWBIRD_LOG_REQUEST
(Default:True
)Specifies whether Cowbird should log incoming request details.
Note
This can make Cowbird quite verbose if large quantity of requests are accomplished.
COWBIRD_LOG_EXCEPTION
(Default:True
)Specifies whether Cowbird should log a raised exception during a process execution.
Components
Components Diagram

Handlers
Each handler is associated to a service and is used to process different events and to keep the different services of the platform synchronized. Handlers are useful for example to process user or permission changes, or to manage file modification events.
FileSystem
The FileSystem handler is used to manage some aspects of the directory/file structure associated with the platform. It is specifically used to handle user workspaces and the user access to different other directories. The handler is responsible for creating/deleting a workspace if a user is created/deleted.
Here are some typical directories found in the user_workspaces
:
/user_workspaces/<user_name>/notebooks -> /jupyterhub_user_data/<user_name>
/user_workspaces/<user_name>/shapefile_datastore # Managed by the `GeoServer` handler
/user_workspaces/public/wps_outputs # Managed by the `FileSystem` handler
JupyterHub user data
A symlink is created in the user workspace to give access to the notebook directory of the user. The notebook directory
is the directory that was originally mounted in bird-house as the writable-workspace
. When adding the Cowbird
component to bird-house (see
here), the
mounted writable-workspace
becomes the user workspace managed by Cowbird (e.g.: /user_workspaces/<user_name>
)
which requires a symlink to access the notebook directory originally used by bird-house and JupyterHub.
WPS outputs data
The WPS outputs data, generated by the different WPS birds and Weaver, is stored in a distinct data directory and must be made accessible to the users via their workspace.
There are 2 types of data :
Public data: This data must be accessible to every user.
User specific data: This data must only be accessible to the related user.
The public WPS outputs data is made accessible by generating hardlinks from the WPS outputs data directory to the
user workspaces location (e.g.:/user_workspaces/public/wps_outputs
). When a JupyterLab instance is started via
bird-house, the directory containing the hardlinks will be mounted as a volume, such that the users obtain access to
its content via their JupyterLab instance. The volume will be made read-only to prevent a user from modifying
the public data.
The user WPS outputs data is made accessible by generating hardlinks from a WPS outputs data directory containing user
data to a subdirectory found in the related user’s workspace. For example, with a source path
/wps_outputs/<bird-name>/users/<user-id>/<job-id>/<output-file>
, a hardlink is generated at the path
/user_workspaces/<user-name>/wps_outputs/<bird-name>/<job-id>/<output-file>
. The hardlink path uses a similar
structure as found in the source path, but removes the redundant users
and <user-id>
path segments. The
hardlink files will be automatically available to the user on a JupyterLab instance since the workspace is mounted as
a volume. Any file that is found under a directory /wps_outputs/<bird-name>/users/<user-id>/
is considered to be
user data and any outside file is considered public.
The permissions found on the user data are synchronized with the permissions found on Magpie. If Magpie uses a
secure-data-proxy
service, this service handles the permissions of those files (see here). If a file does not have a corresponding route on the secure-data-proxy
service, it will use the
closest parent permissions.
Note
If the access to a WPS outputs file is allowed, the file access will be read-only and any write permissions from the
secure-data-proxy
service will be ignored. This is because WPS outputs are produced by external processes and
the resulting data should remain constant.
Note
The files/directories permissions are only applied to others
(see Components - Usage of ‘others’
permissions section for details).
Warning
The route resources found under the secure-data-proxy
service must match exactly a path on the filesystem,
starting with the directory name wps_outputs
, and following with the desired children directories/file names.
If the file does not have any read or write permissions, the hardlink will not be available in the user’s workspace.
Note
Permissions should not be modified via the file system, but should only be managed via the
secure-data-proxy
service on Magpie. Permission modifications on the file system will be ignored.
Refer to DAC-571 for more details on the design choices for the management of permissions.
If no secure-data-proxy
service is found, the user files are assumed to be fully available
with read and write permissions for the user.
Note that different design choices were made to respect the constraints of the file system and to prevent the user from accessing forbidden data:
To avoid having to copy every file from the WPS outputs data directory to the corresponding user workpaces, the usage of links was chosen.
The usage of hardlinks was chosen instead of symlinks. The reason is that using symlinks would require mounting the WPS outputs data directory on the user JupyterLab instance. This is because symlinks require access to their source files, contrary to hardlinks which can be mounted individually without access to source files. Mounting the whole WPS outputs data directory would give the user access to all the data. Even if the data is not made available on the JupyterLab browser via the UI, the data would still be accessible via the terminal found on JupyterLab. Using hardlinks lets us mount only the public directory instead of the whole WPS outputs directory, which contains a mix of public and user data.
Changing permissions of the linked workspace files to control user access was not an option since symlinks and hardlinks always use the same permissions as their original source file. Symlinks/hardlinks cannot have custom file permissions independent from their source file. Therefore, it is not possible for example to give access to a user and prevent the access to another user for a specific file using the file permissions, even if users have their own hardlinks or symlinks in their personal workspace.
Another considered option was to add anonymous volumes to hide some parts of the WPS outputs data directory. This could have been useful to mount the whole WPS outputs directory on the user JupyterLab instance and to hide the user data subdirectories found in the WPS outputs by using anonymous volumes for each user subdirectory. This would automatically mount the public data while hiding the user related data. It was still considered easier and safer to go with the hardlinks option to prevent potential errors which could accidentally give access to other users’ data. For example, if a bird directory was created while a user JupyterLab instance was running, it would require both the instance and JupyterHub to be restarted in order to generate the new required anonymous volume to hide the user data from that new bird. Without a restart of the instance, the user could potentially have access to some of the new user data found in the new bird directory.
In conclusion, the best option was to use hardlinks, which do not require access to the original source file, to create separate user and public data access points, and volume mounting to control which locations are made available to the user.
See also
Refer to DAC-149 for details on the design choices for managing the access to WPS outputs data.
Geoserver
The GeoServer handler is used to keep the internal representation on the GeoServer server along with the user workspace in sync with the rest of the platform.
If a new user is created on Magpie, a GeoServer workspace is automatically created for the user, along with a datastore directory in the user workspace to contain the different shapefiles of the user. Similarly, if the user is deleted on Magpie, the GeoServer workspace of the user is automatically deleted to keep the services synchronized.
The workspace and file permissions are also synchronized between Magpie and GeoServer. For example, if a permission is added or removed in Magpie, the file found in the user’s datastore must have corresponding permissions in order to reflect the actual user access permissions.
Since the Magpie permissions on a resource from a service of type GeoServer are not the same as traditional Unix
permissions (e.g.: rwx
) on the workspace/shapefiles, some design choices were done in order to have a coherent
synchronization :
Permission/Category definition
All permissions on Magpie on a resource from a service of type GeoServer are classified as either readable or
writable in order to associate them to the actual path permissions.
If the path receives a read
permission, all Magpie permissions fitting the readable category will be enabled.
If a Magpie permission from the readable category is added, the path will be updated to have read
permissions.
This update on the file system will trigger a synchronization with Magpie, to add all other readable permissions on
Magpie. For example, if the GetFeature
permission is added to a Layer
resource on Magpie, the associated
shapefile will receive read
permissions because GetFeature
is a permission from the readable category. Since the
file permissions are modified, it will trigger another event to synchronize permissions with Magpie, enabling,
on the Layer
resource, all other readable permissions : DescribeFeatureType
, DescribeStoredQueries
,
GetCapabilities
, etc. The same process would apply if we use permissions from the writable category in this last
example.
Permission creation conditions
Note that permissions are only added to Magpie if necessary. For example, if a file needs to allow a readable
permission on Magpie, but that permission already resolves to allow
because of a recursive permission on a parent
resource, no permission will be added. The permission is already resolving to the required permission and avoiding to
add unnecessary permissions will simplify permission solving.
Also, in the case where a user has all the readable permissions enabled on Magpie, for example, and a single one
of them is deleted, Cowbird will not change the file permissions since other permissions from the readable category
will still be found on Magpie. This means that a synchronization will not be triggered and Magpie permissions will
stay the same, meaning all the readable permissions activated except for the one removed.
If eventually a change is applied to the file (e.g.: changing the permissions from r--
to rw-
),
it would trigger a synchronization, and the one Magpie permission that was removed earlier would be re-enabled,
because of the read
permission found on the file.
Consequently, it is not recommended to have a partial usage of readable permissions on Magpie since there is a risk
that the disabled readable permissions will be eventually automatically enabled if an update on the file is done. If we
want to disable the read permissions via Magpie, it is better to disable the permissions from the readable category
all at once, which will trigger a change to remove the read
permission on the associated path and which will prevent
having eventual undesired re-enabled Magpie permissions.
The same would apply if we use write
permissions in this last example.
The files/directories permissions are only applied to others
(see Components - Usage of ‘others’ permissions section for details).
If a permission is applied to a group in Magpie, the GeoServer handler will detect the permission change but will
not do anything since Magpie groups are different than the groups found on the file system. Also, it would not make
sense to update the path associated to a resource for all the users of a group, since the path is supposed to be
associated to a single user anyway.
Note that even if group permission changes on Magpie are not handled by Cowbird, a group permission could still
have an impact on permission resolution. For example, if a shapefile needs to allow a readable permission on Magpie,
but that permission already resolves to allow
because of a group permission, no permission will be added.
File/Layer permissions
File events will only be processed in the case of the .shp
file, since it is considered to be the main
component of a shapefile. The other extensions associated with a shapefile will not be processed if they trigger an
event, and will only be updated in the case of a change on the .shp
file.
Shapefiles will only be assigned read
or write
permissions on the file system. execute
permissions are not
needed for shapefiles.
Directory/Workspace permissions
Workspaces will always keep their execute
permissions even if they don’t have any permissions enabled on Magpie.
This enables accessing the children files, in case the children resource has permissions enabled on Magpie.
Since a children resource has priority on Magpie if its permissions are enabled, it makes sense to allow the access
to the file on the file system too. Note that if the directory only has execute
permissions, the file will only be
accessible via a direct path or url, and it will not be accessible via a file browser, or on the JupyterLab file
browser. This should allow the user to still share his file using a path or url. To allow browsing the directory’s
content, the read
permission is also required on the directory, which can be obtained by enabling permissions of the
readable category on the corresponding workspace on Magpie.
Operations to avoid
Note that some operations should be avoided, as they are undesirable and not supported for now.
- Using subdirectories in the shapefile datastore :
Using subdirectories in the shapefile datastore directory is not supported for now. Only the shapefiles found directly under the datastore directory will be processed by the GeoServer handler and subdirectories will be ignored. This also corresponds to the design in Magpie where a
Workspace
resource can only have children resources of the typeLayer
, and cannot have aWorkspace
type resource as a children.
- Renaming a directory :
The directories associated with the GeoServer workspace are the user workspace (named by the user’s name) and the datastore directory (which uses a default value). Both of these values should never change and renaming them manually might break the monitoring, preventing Cowbird from receiving future file events.
- Renaming a shapefile (.shp only) :
This operation is actually supported, but it should be avoided if possible. It will trigger multiple events on the file system (an update on the parent directory, and a delete followed by a create event on the file), which should keep up to data info in GeoServer and Magpie by simply generating new resources. A risk with this is that the delete event will delete the other shapefile files, and the user could lose some data. It is better to have a copy of the shapefile before applying this operation. Note that renaming one of the other extension (not the .shp file) will not trigger any event since only the main file triggers events.
- Deleting a directory :
This operation will only display a warning in Cowbird’s logs. It should never be done manually, since it will create inconsistencies with the GeoServer workspace and the Magpie resources. The user workspace and the datastore directory should only be deleted when a user is deleted via Magpie.
Usage of others
permissions
With the GeoServer and the FileSystem handlers, the permissions applied on the files/directories are only applied
to others
, and the permissions on the user
and on the group
are not modified. The user and group associated
with the paths will be the admin user/group (root
by default), while the user who will interact with the paths, for
example in JupyterHub, is a distinct user, hence why the permissions are applied to others
. This will also prevent
the user from changing the permissions if he decides to interact with the terminal accessible via JupyterLab.
Note that, consequently, the concept of a Magpie group is not used on the file system for now, since the group on the file system does not correspond to the groups found on Magpie.
CLI Utilities
CLI Helpers and Commands
Multiple CLI helpers are provided.
The common functions provided allow invocation and result retrieval similar to the Web API, but from a terminal. The Configuration files must be available in default location, or provided as input to resolve operations.
Please refer to the corresponding usage detail of each helper by calling them with --help
argument for more details.
More specifically:
# display available helpers
cowbird --help
# display available commands of 'handlers' helper
cowbird handlers --help
# display specific arguments and options of 'list' command of 'handlers' helper
cowbird handlers list --help
The cowbird
CLI should be available on your path directly following Installation of the package.
When using an conda
environment, you should activate it first to make the CLI available.
Source code of these helpers can be found here.
API Reference
This page contains auto-generated API reference documentation [1].
cowbird
Subpackages
cowbird.api
Subpackages
cowbird.api.handlers
Submodules
cowbird.api.handlers.views
Module Contents
Functions
|
List all registered handlers. |
|
Get a handler object from the parameters of a request. |
|
Get handler details. |
|
Resync handler operation. |
- cowbird.api.handlers.views.get_handlers_view(request: pyramid.request.Request) cowbird.typedefs.AnyResponseType [source]
List all registered handlers.
- cowbird.api.handlers.views.get_handler(request: pyramid.request.Request) cowbird.handlers.handler.Handler [source]
Get a handler object from the parameters of a request.
Package Contents
Functions
|
Immediately sets the logger level to avoid duplicate log outputs from the root logger and this logger when |
|
- cowbird.api.handlers.get_logger(name: str, level: int | None = None, force_stdout: bool = None, message_format: str | None = None, datetime_format: str | None = None) logging.Logger [source]
Immediately sets the logger level to avoid duplicate log outputs from the root logger and this logger when level is
logging.NOTSET
.
cowbird.api.home
Submodules
cowbird.api.home.views
Module Contents
Functions
|
Cowbird API homepage. |
|
Version of the API. |
|
Attributes
- cowbird.api.home.views.get_homepage(request: pyramid.request.Request) cowbird.typedefs.AnyResponseType [source]
Cowbird API homepage.
Package Contents
Functions
|
Immediately sets the logger level to avoid duplicate log outputs from the root logger and this logger when |
|
Attributes
- cowbird.api.home.get_logger(name: str, level: int | None = None, force_stdout: bool = None, message_format: str | None = None, datetime_format: str | None = None) logging.Logger [source]
Immediately sets the logger level to avoid duplicate log outputs from the root logger and this logger when level is
logging.NOTSET
.
cowbird.api.swagger
Submodules
cowbird.api.swagger.views
Module Contents
Functions
|
Swagger UI route to display the Cowbird REST API schemas. |
|
Return JSON Swagger specifications of Cowbird REST API. |
Package Contents
Functions
|
Return JSON Swagger specifications of Cowbird REST API. |
|
Swagger UI route to display the Cowbird REST API schemas. |
|
Immediately sets the logger level to avoid duplicate log outputs from the root logger and this logger when |
|
- cowbird.api.swagger.api_schema(request: pyramid.request.Request) cowbird.typedefs.JSON [source]
Return JSON Swagger specifications of Cowbird REST API.
- cowbird.api.swagger.api_swagger(request: pyramid.request.Request) cowbird.typedefs.JSON [source]
Swagger UI route to display the Cowbird REST API schemas.
- cowbird.api.swagger.get_logger(name: str, level: int | None = None, force_stdout: bool = None, message_format: str | None = None, datetime_format: str | None = None) logging.Logger [source]
Immediately sets the logger level to avoid duplicate log outputs from the root logger and this logger when level is
logging.NOTSET
.
cowbird.api.webhooks
Submodules
cowbird.api.webhooks.views
Module Contents
Functions
|
|
|
User webhook used for created or removed user events. |
Permission webhook used for created or removed permission events. |
Attributes
- exception cowbird.api.webhooks.views.WebhookDispatchException[source]
Bases:
Exception
Error indicating that an exception occurred during a webhook dispatch.
Initialize self. See help(type(self)) for accurate signature.
- cowbird.api.webhooks.views.dispatch(handler_fct: Callable[[cowbird.handlers.Handler], None]) None [source]
Package Contents
Functions
|
Immediately sets the logger level to avoid duplicate log outputs from the root logger and this logger when |
|
- cowbird.api.webhooks.get_logger(name: str, level: int | None = None, force_stdout: bool = None, message_format: str | None = None, datetime_format: str | None = None) logging.Logger [source]
Immediately sets the logger level to avoid duplicate log outputs from the root logger and this logger when level is
logging.NOTSET
.
Submodules
cowbird.api.exception
Module Contents
Functions
|
Evaluate various parameter combinations given the requested verification flags. Given a failing verification, |
|
Formats and applies the failing parameter conditions and results to returned JSON content according to flags. |
|
Evaluates the specified |
|
Returns successful HTTP with standardized information formatted with content type. (see |
|
Raises error HTTP with standardized information formatted with content type. |
|
Validates parameter types and formats required by |
|
Inserts the code, details, content and type within the body using json format. Includes also any other specified |
|
Attempts to rewrite the |
Formats the HTTP response content according to desired |
Attributes
- cowbird.api.exception.verify_param(param: Any, param_compare: Any | List[Any] | Type[Any] | List[Type[Any]] | None = None, param_name: str | None = None, param_content: cowbird.typedefs.JSON | None = None, with_param: bool = True, http_error: Type[pyramid.httpexceptions.HTTPError] = HTTPBadRequest, http_kwargs: cowbird.typedefs.ParamsType | None = None, msg_on_fail: str = '', content: cowbird.typedefs.JSON | None = None, content_type: str = CONTENT_TYPE_JSON, not_none: bool = False, not_empty: bool = False, not_in: bool = False, not_equal: bool = False, is_true: bool = False, is_false: bool = False, is_none: bool = False, is_empty: bool = False, is_in: bool = False, is_equal: bool = False, is_type: bool = False, matches: bool = False) None [source]
Evaluate various parameter combinations given the requested verification flags. Given a failing verification, directly raises the specified
http_error
. Invalid usage exceptions generated by this verification process are treated asHTTPInternalServerError
. Exceptions are generated using the standard output method.- Parameters:
param – parameter value to evaluate
param_compare – Other value(s) to test
param
against. Can be an iterable (single value resolved as iterable unlessNone
). To test forNone
type, useis_none
/not_none
flags instead.param_name – name of the tested parameter returned in response if specified for debugging purposes
param_content – Additional JSON content to apply to generated error content on raise when
with_param
isTrue
. Must be JSON serializable. Provided content can override generated error parameter if matching fields.with_param – On raise, adds values of
param
,param_name
andparam_compare
, as well as additional failing conditions metadata to the JSON response body for each of the corresponding value.http_error – derived exception to raise on test failure (default:
HTTPBadRequest
)http_kwargs – additional keyword arguments to pass to
http_error
called in case of HTTP exceptionmsg_on_fail – message details to return in HTTP exception if flag condition failed
content – json formatted additional content to provide in case of exception
content_type – format in which to return the exception (one of
cowbird.common.SUPPORTED_ACCEPT_TYPES
)not_none – test that
param
is notNone
typenot_empty – test that
param
is not an empty iterable (string, list, set, etc.)not_in – test that
param
does not exist inparam_compare
valuesnot_equal – test that
param
is not equal toparam_compare
valueis_true – test that
param
isTrue
is_false – test that
param
isFalse
is_none – test that
param
isNone
typeis_empty – test param for an empty iterable (string, list, set, etc.)
is_in – test that
param
exists inparam_compare
valuesis_equal – test that
param
equalsparam_compare
valueis_type – test that
param
is of same type as specified byparam_compare
typematches – test that
param
matches the regex specified byparam_compare
value
- Raises:
HTTPError – if tests fail, specified exception is raised (default:
HTTPBadRequest
)HTTPInternalServerError – for evaluation error
- Returns:
nothing if all tests passed
- cowbird.api.exception.apply_param_content(content: cowbird.typedefs.JSON, param: Any, param_compare: Any, param_name: str, with_param: bool, param_content: cowbird.typedefs.JSON | None, needs_compare: bool, needs_iterable: bool, is_type: bool, fail_conditions: cowbird.typedefs.JSON) cowbird.typedefs.JSON [source]
Formats and applies the failing parameter conditions and results to returned JSON content according to flags.
See also
- cowbird.api.exception.evaluate_call(call: Callable[[], Any], fallback: Callable[[], None] | None = None, http_error: Type[pyramid.httpexceptions.HTTPError] = HTTPInternalServerError, http_kwargs: cowbird.typedefs.ParamsType | None = None, msg_on_fail: str = '', content: cowbird.typedefs.JSON | None = None, content_type: str = CONTENT_TYPE_JSON) Any [source]
Evaluates the specified
call
with a wrapped HTTP exception handling. On failure, tries to call.fallback
if specified, and finally raises the specifiedhttp_error
.Any potential error generated by
fallback
orhttp_error
themselves are treated asHTTPInternalServerError
.Exceptions are generated using the standard output method formatted based on specified
content_type
.- Example:
normal call:
try: res = func(args) except Exception as exc: fb_func() raise HTTPExcept(exc.message)
wrapped call:
res = evaluate_call(lambda: func(args), fallback=lambda: fb_func(), http_error=HTTPExcept, **kwargs)
- Parameters:
call – function to call, MUST be specified as lambda: <function_call>
fallback – function to call (if any) when call failed, MUST be lambda: <function_call>
http_error – alternative exception to raise on call failure
http_kwargs – additional keyword arguments to pass to http_error if called in case of HTTP exception
msg_on_fail – message details to return in HTTP exception if call failed
content – json formatted additional content to provide in case of exception
content_type – format in which to return the exception (one of cowbird.common.SUPPORTED_ACCEPT_TYPES)
- Raises:
http_error – on call failure
HTTPInternalServerError – on fallback failure
- Returns:
whichever return value call might have if no exception occurred
- cowbird.api.exception.valid_http(http_success: Type[pyramid.httpexceptions.HTTPSuccessful] | Type[pyramid.httpexceptions.HTTPRedirection] = HTTPOk, http_kwargs: cowbird.typedefs.ParamsType | None = None, detail: str | None = '', content: cowbird.typedefs.JSON | None = None, content_type: str | None = CONTENT_TYPE_JSON) pyramid.httpexceptions.HTTPSuccessful | pyramid.httpexceptions.HTTPRedirection [source]
Returns successful HTTP with standardized information formatted with content type. (see
raise_http()
for HTTP error calls)- Parameters:
http_success – any derived class from valid HTTP codes (<400) (default: HTTPOk)
http_kwargs – additional keyword arguments to pass to http_success when called
detail – additional message information (default: empty)
content – json formatted content to include
content_type – format in which to return the exception (one of cowbird.utils.SUPPORTED_ACCEPT_TYPES)
- Returns:
formatted successful response with additional details and HTTP code
- cowbird.api.exception.raise_http(http_error: Type[pyramid.httpexceptions.HTTPError] = HTTPInternalServerError, http_kwargs: cowbird.typedefs.ParamsType | None = None, detail: str = '', content: cowbird.typedefs.JSON | None = None, content_type: str = CONTENT_TYPE_JSON, nothrow: Literal[False] = False) NoReturn [source]
- cowbird.api.exception.raise_http(http_error: Type[pyramid.httpexceptions.HTTPError] = HTTPInternalServerError, http_kwargs: cowbird.typedefs.ParamsType | None = None, detail: str = '', content: cowbird.typedefs.JSON | None = None, content_type: str = CONTENT_TYPE_JSON, nothrow: Literal[True] = False) pyramid.httpexceptions.HTTPException
Raises error HTTP with standardized information formatted with content type.
The content contains the corresponding http error code, the provided message as detail and optional specified additional json content (kwarg dict).
See also
valid_http()
for HTTP successful calls- Parameters:
http_error – any derived class from base HTTPError (default: HTTPInternalServerError)
http_kwargs – additional keyword arguments to pass to http_error if called in case of HTTP exception
detail – additional message information (default: empty)
content – json formatted content to include
content_type – format in which to return the exception (one of cowbird.utils.SUPPORTED_ACCEPT_TYPES)
nothrow – returns the error response instead of raising it automatically, but still handles execution errors
- Raises:
HTTPError – formatted raised exception with additional details and HTTP code
- Returns:
HTTPError formatted exception with additional details and HTTP code only if nothrow is True
- cowbird.api.exception.validate_params(http_class: Type[pyramid.httpexceptions.HTTPException], http_base: Type[pyramid.httpexceptions.HTTPException] | Iterable[Type[pyramid.httpexceptions.HTTPException]], detail: str, content: cowbird.typedefs.JSON | None, content_type: str) Tuple[int, str, cowbird.typedefs.JSON] [source]
Validates parameter types and formats required by
valid_http()
andraise_http()
.- Parameters:
http_class – any derived class from base HTTPException to verify
http_base – any derived sub-class(es) from base HTTPException as minimum requirement for http_class (ie: 2xx, 4xx, 5xx codes). Can be a single class of an iterable of possible requirements (any).
detail – additional message information (default: empty)
content – json formatted content to include
content_type – format in which to return the exception (one of cowbird.utils.SUPPORTED_ACCEPT_TYPES)
- Raises:
HTTPInternalServerError – if any parameter is of invalid expected format
- Returns http_code, detail, content:
parameters with corrected and validated format if applicable
- cowbird.api.exception.format_content_json_str(http_code: int, detail: str, content: cowbird.typedefs.JSON, content_type: str) str [source]
Inserts the code, details, content and type within the body using json format. Includes also any other specified json formatted content in the body. Returns the whole json body as a single string for output.
- Raises:
HTTPInternalServerError – if parsing of the json content failed
- Returns:
formatted json content as string with added HTTP code and details
- cowbird.api.exception.rewrite_content_type(content: str | cowbird.typedefs.JSON, content_type: str) Tuple[str, cowbird.typedefs.JSON | None] [source]
Attempts to rewrite the
type
field inserted by various functions such as:By applying the new value provided by
content_type
.- Returns:
Content with rewritten “type” (if possible) and converted to string directly insertable to a response body. Also provides the converted JSON body if applicable (original content was literal JSON or JSON-like string).
- cowbird.api.exception.generate_response_http_format(http_class: Type[pyramid.httpexceptions.HTTPException], http_kwargs: cowbird.typedefs.ParamsType | None, content: cowbird.typedefs.JSON, content_type: str | None = CONTENT_TYPE_PLAIN, metadata: cowbird.typedefs.JSON | None = None) pyramid.httpexceptions.HTTPException [source]
Formats the HTTP response content according to desired
content_type
using provided HTTP code and content.- Parameters:
http_class – HTTPException derived class to use for output (code, generic title/explanation, etc.)
http_kwargs – additional keyword arguments to pass to http_class when called
content – formatted JSON content or literal string content providing additional details for the response
content_type – one of cowbird.utils.SUPPORTED_ACCEPT_TYPES (default: cowbird.utils.CONTENT_TYPE_PLAIN)
metadata – request metadata to add to the response body. (see:
cowbird.api.requests.get_request_info()
)
- Returns:
http_class instance with requested information and content type if creation succeeds
- Raises:
HTTPInternalServerError instance details about requested information and content type if creation fails
cowbird.api.generic
Module Contents
Classes
Utility that will try to resolve a path without appended slash if one was provided. |
Functions
Overrides default HTTP. |
|
Overrides the default |
|
|
Guess the best applicable response |
Tween that validates that the specified request |
|
Tween that obtains the request |
|
|
Obtains additional exception content details about the |
|
Obtains additional content details about the |
Attributes
- class cowbird.api.generic.RemoveSlashNotFoundViewFactory(notfound_view: Callable[[pyramid.request.Request], cowbird.typedefs.AnyResponseType] | None = None)[source]
Bases:
object
Utility that will try to resolve a path without appended slash if one was provided.
- cowbird.api.generic.internal_server_error(request: pyramid.request.Request) pyramid.httpexceptions.HTTPException [source]
Overrides default HTTP.
- cowbird.api.generic.not_found_or_method_not_allowed(request: pyramid.request.Request) pyramid.httpexceptions.HTTPException [source]
Overrides the default
HTTPNotFound
[404] by appropriateHTTPMethodNotAllowed
[405] when applicable.Not found response can correspond to underlying process operation not finding a required item, or a completely unknown route (path did not match any existing API definition). Method not allowed is more specific to the case where the path matches an existing API route, but the specific request method (GET, POST, etc.) is not allowed on this path.
Without this fix, both situations return [404] regardless.
- cowbird.api.generic.guess_target_format(request: pyramid.request.Request) Tuple[str, bool] [source]
Guess the best applicable response
Content-Type
header according to requestAccept
header andformat
query, or defaulting toCONTENT_TYPE_JSON
.- Returns:
tuple of matched MIME-type and where it was found (
True
: header,False
: query)
- cowbird.api.generic.validate_accept_header_tween(handler: Callable[[pyramid.request.Request], pyramid.response.Response], registry: pyramid.registry.Registry) Callable[[pyramid.request.Request], pyramid.response.Response] [source]
Tween that validates that the specified request
Accept
header orformat
query (if any) is supported by the application and for the given context.- Raises:
HTTPNotAcceptable – if desired
Content-Type
is not supported.
- cowbird.api.generic.apply_response_format_tween(handler: Callable[[pyramid.request.Request], pyramid.httpexceptions.HTTPException], registry: pyramid.registry.Registry) Callable[[pyramid.request.Request], pyramid.response.Response] [source]
Tween that obtains the request
Accept
header orformat
query (if any) to generate the response with the desiredContent-Type
.The target
Content-Type
is expected to have been validated byvalidate_accept_header_tween()
beforehand to handle not-acceptable errors.The tween also ensures that additional request metadata extracted from
get_request_info()
is applied to the response body if not already provided by a previous operation.
- cowbird.api.generic.get_exception_info(response: pyramid.httpexceptions.HTTPException | pyramid.request.Request | pyramid.response.Response, content: cowbird.typedefs.JSON | None = None, exception_details: bool = False) cowbird.typedefs.JSON [source]
Obtains additional exception content details about the
response
according to available information.
cowbird.api.requests
Module Contents
Functions
|
Validates the value against specified type and pattern. |
|
|
|
Obtains the value of |
Obtains and validates the matched value under |
|
|
Obtains the matched value located at the expected position of the specified path variable. |
|
Retrieves a query string value by name (case-insensitive), or returns the default if not present. |
Attributes
- cowbird.api.requests.check_value(value: Any, param_name: str, check_type: Type[Any] | Tuple[Type[Any], Ellipsis] = str, pattern: str | bool | None = ax.PARAM_REGEX, http_error: Type[pyramid.httpexceptions.HTTPError] | None = None, msg_on_fail: str | None = None) None [source]
Validates the value against specified type and pattern.
- Parameters:
value – value to validate.
check_type – verify that parameter value is of specified type. Set to
None
to disable check.pattern – regex pattern to validate the input with. If value evaluates to
False
, skip this kind of validation (default:ax.PARAM_REGEX
).param_name – path variable key.
http_error – derived exception to raise on check failure (default:
HTTPUnprocessableEntity
)msg_on_fail – message details to return in HTTP exception if check failed (default: description message of
UnprocessableEntityResponseSchema
).
- Returns:
None.
- Raises:
HTTPError – if the key is not an applicable path variable for this request.
- cowbird.api.requests.get_request_method_content(request: pyramid.request.Request) Dict[str, Any] [source]
- cowbird.api.requests.get_multiformat_body_raw(request: pyramid.request.Request, key: str, default: Any | None = None) Any [source]
Obtains the value of
key
element from the request body according to specified Content-Type header.See also
- cowbird.api.requests.get_multiformat_body(request: pyramid.request.Request, key: str, default: Any = None, check_type: Type[str] = str, pattern: str | bool | None = ax.PARAM_REGEX, http_error: Type[pyramid.httpexceptions.HTTPError] | None = None, msg_on_fail: str | None = None) str [source]
- cowbird.api.requests.get_multiformat_body(request: pyramid.request.Request, key: str, default: Any = None, check_type: Type[str | None] = (str, type(None)), pattern: str | bool | None = ax.PARAM_REGEX, http_error: Type[pyramid.httpexceptions.HTTPError] | None = None, msg_on_fail: str | None = None) str | None
- cowbird.api.requests.get_multiformat_body(request: pyramid.request.Request, key: str, default: Any = None, check_type: Type[int] = int, pattern: str | bool | None = ax.PARAM_REGEX, http_error: Type[pyramid.httpexceptions.HTTPError] | None = None, msg_on_fail: str | None = None) int
- cowbird.api.requests.get_multiformat_body(request: pyramid.request.Request, key: str, default: Any = None, check_type: Type[float] = float, pattern: str | bool | None = ax.PARAM_REGEX, http_error: Type[pyramid.httpexceptions.HTTPError] | None = None, msg_on_fail: str | None = None) float
- cowbird.api.requests.get_multiformat_body(request: pyramid.request.Request, key: str, default: Any = None, check_type: Type[bool] = bool, pattern: str | bool | None = ax.PARAM_REGEX, http_error: Type[pyramid.httpexceptions.HTTPError] | None = None, msg_on_fail: str | None = None) bool
- cowbird.api.requests.get_multiformat_body(request: pyramid.request.Request, key: str, default: Any = None, check_type: Type[List[Any]] = list, pattern: str | bool | None = ax.PARAM_REGEX, http_error: Type[pyramid.httpexceptions.HTTPError] | None = None, msg_on_fail: str | None = None) cowbird.typedefs.JSON
- cowbird.api.requests.get_multiformat_body(request: pyramid.request.Request, key: str, default: Any = None, check_type: Type[Dict[str, Any]] = dict, pattern: str | bool | None = ax.PARAM_REGEX, http_error: Type[pyramid.httpexceptions.HTTPError] | None = None, msg_on_fail: str | None = None) cowbird.typedefs.JSON
Obtains and validates the matched value under
key
element from the request body.Parsing of the body is accomplished according to
Content-Type
header.- Parameters:
request – request from which to retrieve the key.
key – body key variable.
default – value to return instead if not found. If this default is
None
, it will raise.check_type – verify that parameter value is of specified type. Set to
None
to disable check.pattern – regex pattern to validate the input with. If value evaluates to
False
, skip this kind of validation (default:cowbird.api.exception.PARAM_REGEX
).http_error – derived exception to raise on check failure (default:
HTTPUnprocessableEntity
)msg_on_fail – message details to return in HTTP exception if check failed (default: description message of
UnprocessableEntityResponseSchema
).
- Returns:
matched path variable value.
- Raises:
HTTPBadRequest – if the key could not be retrieved from the request body and has no provided default value.
HTTPUnprocessableEntity – if the retrieved value from the key is invalid for this request.
See also
- cowbird.api.requests.get_path_param(request: pyramid.request.Request, key: str, check_type: Any = str, pattern: str | bool | None = ax.PARAM_REGEX, http_error: Type[pyramid.httpexceptions.HTTPError] | None = None, msg_on_fail: str | None = None) str [source]
Obtains the matched value located at the expected position of the specified path variable.
- Parameters:
request – request from which to retrieve the key.
key – path variable key.
check_type – verify that parameter value is of specified type. Set to
None
to disable check.pattern – regex pattern to validate the input with. If value evaluates to
False
, skip this kind of validation (default:ax.PARAM_REGEX
).http_error – derived exception to raise on check failure (default:
HTTPUnprocessableEntity
)msg_on_fail – message details to return in HTTP exception if check failed (default: description message of
UnprocessableEntityResponseSchema
).
- Returns:
matched path variable value.
- Raises:
HTTPError – if the key is not an applicable path variable for this request.
cowbird.api.schemas
Module Contents
Classes
Valid values as webhook event. |
|
Fundamental building block of schemas. |
|
Fundamental building block of schemas. |
|
Fundamental building block of schemas. |
|
Fundamental building block of schemas. |
|
Fundamental building block of schemas. |
|
Fundamental building block of schemas. |
|
Fundamental building block of schemas. |
|
Fundamental building block of schemas. |
|
Fundamental building block of schemas. |
|
Fundamental building block of schemas. |
|
Fundamental building block of schemas. |
|
Fundamental building block of schemas. |
|
Fundamental building block of schemas. |
|
Fundamental building block of schemas. |
|
Fundamental building block of schemas. |
|
Fundamental building block of schemas. |
|
Fundamental building block of schemas. |
|
Fundamental building block of schemas. |
|
Fundamental building block of schemas. |
|
Fundamental building block of schemas. |
|
Fundamental building block of schemas. |
|
Fundamental building block of schemas. |
|
Fundamental building block of schemas. |
|
Fundamental building block of schemas. |
|
Fundamental building block of schemas. |
|
Fundamental building block of schemas. |
|
Fundamental building block of schemas. |
|
Fundamental building block of schemas. |
|
Fundamental building block of schemas. |
|
Fundamental building block of schemas. |
|
Fundamental building block of schemas. |
|
Fundamental building block of schemas. |
|
Fundamental building block of schemas. |
|
Fundamental building block of schemas. |
|
Fundamental building block of schemas. |
|
Fundamental building block of schemas. |
|
Fundamental building block of schemas. |
|
Fundamental building block of schemas. |
|
Fundamental building block of schemas. |
|
Fundamental building block of schemas. |
|
Fundamental building block of schemas. |
|
Fundamental building block of schemas. |
|
Fundamental building block of schemas. |
|
Fundamental building block of schemas. |
|
Fundamental building block of schemas. |
|
Fundamental building block of schemas. |
|
Fundamental building block of schemas. |
|
Fundamental building block of schemas. |
|
Fundamental building block of schemas. |
|
Fundamental building block of schemas. |
|
Fundamental building block of schemas. |
|
Fundamental building block of schemas. |
|
Fundamental building block of schemas. |
|
Fundamental building block of schemas. |
|
Fundamental building block of schemas. |
|
Fundamental building block of schemas. |
|
Fundamental building block of schemas. |
|
Fundamental building block of schemas. |
|
Fundamental building block of schemas. |
|
Fundamental building block of schemas. |
|
Fundamental building block of schemas. |
|
Fundamental building block of schemas. |
|
Fundamental building block of schemas. |
|
Fundamental building block of schemas. |
|
Fundamental building block of schemas. |
|
Fundamental building block of schemas. |
|
Fundamental building block of schemas. |
|
Fundamental building block of schemas. |
|
Fundamental building block of schemas. |
|
Fundamental building block of schemas. |
|
Fundamental building block of schemas. |
|
Fundamental building block of schemas. |
|
Fundamental building block of schemas. |
|
Fundamental building block of schemas. |
Functions
|
|
|
Employed to simplify Pyramid route and view config definitions from same schema objects. |
|
Return JSON Swagger specifications of Cowbird REST API. |
Attributes
- cowbird.api.schemas.get_security(service: cornice.Service, method: cowbird.typedefs.HTTPMethod) cowbird.typedefs.JSON [source]
- cowbird.api.schemas.service_api_route_info(service_api: cornice.Service, **kwargs: Any) Dict[str, Any] [source]
Employed to simplify Pyramid route and view config definitions from same schema objects.
- class cowbird.api.schemas.ValidOperations[source]
Bases:
cowbird.utils.ExtendedEnum
Valid values as webhook event.
- cowbird.api.schemas.generate_api_schema(swagger_base_spec: cowbird.typedefs.JSON) cowbird.typedefs.JSON [source]
Return JSON Swagger specifications of Cowbird REST API.
Uses Cornice Services and Schemas to return swagger specification.
- Parameters:
swagger_base_spec – dictionary that specifies the ‘host’ and list of HTTP ‘schemes’ to employ.
- class cowbird.api.schemas.Handler_RequestPathSchema(*arg, **kw)[source]
Bases:
colander.MappingSchema
Fundamental building block of schemas.
The constructor accepts these positional arguments:
typ
: The ‘type’ for this node. It should be an instance of a class that implements thecolander.interfaces.Type
interface. Iftyp
is not passed, a call to theschema_type()
method on this class is made to get a default type. (When subclassing,schema_type()
should be overridden to provide a reasonable default type).*children
: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via theadd
method.
The constructor accepts these keyword arguments:
name
: The name of this node.typ
: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.default
: The default serialization value for this node when not set. Ifdefault
iscolander.drop
, the node will be dropped from schema serialization. If not provided, the node will be serialized tocolander.null
.missing
: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker valuecolander.required
, indicating that it is considered ‘required’. Whenmissing
iscolander.required
, therequired
computed attribute will beTrue
. Whenmissing
iscolander.drop
, the node is dropped from the schema if it isn’t set during deserialization.missing_msg
: Optional error message to be used if the value is required and missing.preparer
: Optional preparer for this node. It should be an object that implements thecolander.interfaces.Preparer
interface.validator
: Optional validator for this node. It should be an object that implements thecolander.interfaces.Validator
interface.after_bind
: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of thebind
method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so theafter_bind
methods of the deepest nodes are called before the shallowest. Theafter_bind
callback should accept two values:node
andkw
.node
will be a clone of the bound node object,kw
will be the set of keywords passed to thebind
method.title
: The title of this node. Defaults to a titleization of thename
(underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).description
: The description for this node. Defaults to''
(the empty string). The description is used by higher-level systems (not by Colander itself).widget
: The ‘widget’ for this node. Defaults toNone
. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.insert_before
: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.
Arbitrary keyword arguments remaining will be attached to the node object unmolested.
- class cowbird.api.schemas.AcceptType(*arg, **kw)[source]
Bases:
colander.SchemaNode
Fundamental building block of schemas.
The constructor accepts these positional arguments:
typ
: The ‘type’ for this node. It should be an instance of a class that implements thecolander.interfaces.Type
interface. Iftyp
is not passed, a call to theschema_type()
method on this class is made to get a default type. (When subclassing,schema_type()
should be overridden to provide a reasonable default type).*children
: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via theadd
method.
The constructor accepts these keyword arguments:
name
: The name of this node.typ
: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.default
: The default serialization value for this node when not set. Ifdefault
iscolander.drop
, the node will be dropped from schema serialization. If not provided, the node will be serialized tocolander.null
.missing
: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker valuecolander.required
, indicating that it is considered ‘required’. Whenmissing
iscolander.required
, therequired
computed attribute will beTrue
. Whenmissing
iscolander.drop
, the node is dropped from the schema if it isn’t set during deserialization.missing_msg
: Optional error message to be used if the value is required and missing.preparer
: Optional preparer for this node. It should be an object that implements thecolander.interfaces.Preparer
interface.validator
: Optional validator for this node. It should be an object that implements thecolander.interfaces.Validator
interface.after_bind
: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of thebind
method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so theafter_bind
methods of the deepest nodes are called before the shallowest. Theafter_bind
callback should accept two values:node
andkw
.node
will be a clone of the bound node object,kw
will be the set of keywords passed to thebind
method.title
: The title of this node. Defaults to a titleization of thename
(underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).description
: The description for this node. Defaults to''
(the empty string). The description is used by higher-level systems (not by Colander itself).widget
: The ‘widget’ for this node. Defaults toNone
. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.insert_before
: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.
Arbitrary keyword arguments remaining will be attached to the node object unmolested.
- class cowbird.api.schemas.ContentType(*arg, **kw)[source]
Bases:
colander.SchemaNode
Fundamental building block of schemas.
The constructor accepts these positional arguments:
typ
: The ‘type’ for this node. It should be an instance of a class that implements thecolander.interfaces.Type
interface. Iftyp
is not passed, a call to theschema_type()
method on this class is made to get a default type. (When subclassing,schema_type()
should be overridden to provide a reasonable default type).*children
: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via theadd
method.
The constructor accepts these keyword arguments:
name
: The name of this node.typ
: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.default
: The default serialization value for this node when not set. Ifdefault
iscolander.drop
, the node will be dropped from schema serialization. If not provided, the node will be serialized tocolander.null
.missing
: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker valuecolander.required
, indicating that it is considered ‘required’. Whenmissing
iscolander.required
, therequired
computed attribute will beTrue
. Whenmissing
iscolander.drop
, the node is dropped from the schema if it isn’t set during deserialization.missing_msg
: Optional error message to be used if the value is required and missing.preparer
: Optional preparer for this node. It should be an object that implements thecolander.interfaces.Preparer
interface.validator
: Optional validator for this node. It should be an object that implements thecolander.interfaces.Validator
interface.after_bind
: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of thebind
method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so theafter_bind
methods of the deepest nodes are called before the shallowest. Theafter_bind
callback should accept two values:node
andkw
.node
will be a clone of the bound node object,kw
will be the set of keywords passed to thebind
method.title
: The title of this node. Defaults to a titleization of thename
(underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).description
: The description for this node. Defaults to''
(the empty string). The description is used by higher-level systems (not by Colander itself).widget
: The ‘widget’ for this node. Defaults toNone
. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.insert_before
: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.
Arbitrary keyword arguments remaining will be attached to the node object unmolested.
- class cowbird.api.schemas.RequestHeaderSchemaAPI(*arg, **kw)[source]
Bases:
colander.MappingSchema
Fundamental building block of schemas.
The constructor accepts these positional arguments:
typ
: The ‘type’ for this node. It should be an instance of a class that implements thecolander.interfaces.Type
interface. Iftyp
is not passed, a call to theschema_type()
method on this class is made to get a default type. (When subclassing,schema_type()
should be overridden to provide a reasonable default type).*children
: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via theadd
method.
The constructor accepts these keyword arguments:
name
: The name of this node.typ
: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.default
: The default serialization value for this node when not set. Ifdefault
iscolander.drop
, the node will be dropped from schema serialization. If not provided, the node will be serialized tocolander.null
.missing
: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker valuecolander.required
, indicating that it is considered ‘required’. Whenmissing
iscolander.required
, therequired
computed attribute will beTrue
. Whenmissing
iscolander.drop
, the node is dropped from the schema if it isn’t set during deserialization.missing_msg
: Optional error message to be used if the value is required and missing.preparer
: Optional preparer for this node. It should be an object that implements thecolander.interfaces.Preparer
interface.validator
: Optional validator for this node. It should be an object that implements thecolander.interfaces.Validator
interface.after_bind
: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of thebind
method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so theafter_bind
methods of the deepest nodes are called before the shallowest. Theafter_bind
callback should accept two values:node
andkw
.node
will be a clone of the bound node object,kw
will be the set of keywords passed to thebind
method.title
: The title of this node. Defaults to a titleization of thename
(underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).description
: The description for this node. Defaults to''
(the empty string). The description is used by higher-level systems (not by Colander itself).widget
: The ‘widget’ for this node. Defaults toNone
. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.insert_before
: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.
Arbitrary keyword arguments remaining will be attached to the node object unmolested.
- class cowbird.api.schemas.RequestHeaderSchemaUI(*arg, **kw)[source]
Bases:
colander.MappingSchema
Fundamental building block of schemas.
The constructor accepts these positional arguments:
typ
: The ‘type’ for this node. It should be an instance of a class that implements thecolander.interfaces.Type
interface. Iftyp
is not passed, a call to theschema_type()
method on this class is made to get a default type. (When subclassing,schema_type()
should be overridden to provide a reasonable default type).*children
: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via theadd
method.
The constructor accepts these keyword arguments:
name
: The name of this node.typ
: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.default
: The default serialization value for this node when not set. Ifdefault
iscolander.drop
, the node will be dropped from schema serialization. If not provided, the node will be serialized tocolander.null
.missing
: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker valuecolander.required
, indicating that it is considered ‘required’. Whenmissing
iscolander.required
, therequired
computed attribute will beTrue
. Whenmissing
iscolander.drop
, the node is dropped from the schema if it isn’t set during deserialization.missing_msg
: Optional error message to be used if the value is required and missing.preparer
: Optional preparer for this node. It should be an object that implements thecolander.interfaces.Preparer
interface.validator
: Optional validator for this node. It should be an object that implements thecolander.interfaces.Validator
interface.after_bind
: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of thebind
method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so theafter_bind
methods of the deepest nodes are called before the shallowest. Theafter_bind
callback should accept two values:node
andkw
.node
will be a clone of the bound node object,kw
will be the set of keywords passed to thebind
method.title
: The title of this node. Defaults to a titleization of thename
(underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).description
: The description for this node. Defaults to''
(the empty string). The description is used by higher-level systems (not by Colander itself).widget
: The ‘widget’ for this node. Defaults toNone
. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.insert_before
: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.
Arbitrary keyword arguments remaining will be attached to the node object unmolested.
- class cowbird.api.schemas.QueryRequestSchemaAPI(*arg, **kw)[source]
Bases:
colander.MappingSchema
Fundamental building block of schemas.
The constructor accepts these positional arguments:
typ
: The ‘type’ for this node. It should be an instance of a class that implements thecolander.interfaces.Type
interface. Iftyp
is not passed, a call to theschema_type()
method on this class is made to get a default type. (When subclassing,schema_type()
should be overridden to provide a reasonable default type).*children
: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via theadd
method.
The constructor accepts these keyword arguments:
name
: The name of this node.typ
: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.default
: The default serialization value for this node when not set. Ifdefault
iscolander.drop
, the node will be dropped from schema serialization. If not provided, the node will be serialized tocolander.null
.missing
: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker valuecolander.required
, indicating that it is considered ‘required’. Whenmissing
iscolander.required
, therequired
computed attribute will beTrue
. Whenmissing
iscolander.drop
, the node is dropped from the schema if it isn’t set during deserialization.missing_msg
: Optional error message to be used if the value is required and missing.preparer
: Optional preparer for this node. It should be an object that implements thecolander.interfaces.Preparer
interface.validator
: Optional validator for this node. It should be an object that implements thecolander.interfaces.Validator
interface.after_bind
: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of thebind
method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so theafter_bind
methods of the deepest nodes are called before the shallowest. Theafter_bind
callback should accept two values:node
andkw
.node
will be a clone of the bound node object,kw
will be the set of keywords passed to thebind
method.title
: The title of this node. Defaults to a titleization of thename
(underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).description
: The description for this node. Defaults to''
(the empty string). The description is used by higher-level systems (not by Colander itself).widget
: The ‘widget’ for this node. Defaults toNone
. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.insert_before
: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.
Arbitrary keyword arguments remaining will be attached to the node object unmolested.
- class cowbird.api.schemas.BaseRequestSchemaAPI(*arg, **kw)[source]
Bases:
colander.MappingSchema
Fundamental building block of schemas.
The constructor accepts these positional arguments:
typ
: The ‘type’ for this node. It should be an instance of a class that implements thecolander.interfaces.Type
interface. Iftyp
is not passed, a call to theschema_type()
method on this class is made to get a default type. (When subclassing,schema_type()
should be overridden to provide a reasonable default type).*children
: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via theadd
method.
The constructor accepts these keyword arguments:
name
: The name of this node.typ
: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.default
: The default serialization value for this node when not set. Ifdefault
iscolander.drop
, the node will be dropped from schema serialization. If not provided, the node will be serialized tocolander.null
.missing
: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker valuecolander.required
, indicating that it is considered ‘required’. Whenmissing
iscolander.required
, therequired
computed attribute will beTrue
. Whenmissing
iscolander.drop
, the node is dropped from the schema if it isn’t set during deserialization.missing_msg
: Optional error message to be used if the value is required and missing.preparer
: Optional preparer for this node. It should be an object that implements thecolander.interfaces.Preparer
interface.validator
: Optional validator for this node. It should be an object that implements thecolander.interfaces.Validator
interface.after_bind
: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of thebind
method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so theafter_bind
methods of the deepest nodes are called before the shallowest. Theafter_bind
callback should accept two values:node
andkw
.node
will be a clone of the bound node object,kw
will be the set of keywords passed to thebind
method.title
: The title of this node. Defaults to a titleization of thename
(underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).description
: The description for this node. Defaults to''
(the empty string). The description is used by higher-level systems (not by Colander itself).widget
: The ‘widget’ for this node. Defaults toNone
. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.insert_before
: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.
Arbitrary keyword arguments remaining will be attached to the node object unmolested.
- class cowbird.api.schemas.HeaderResponseSchema(*arg, **kw)[source]
Bases:
colander.MappingSchema
Fundamental building block of schemas.
The constructor accepts these positional arguments:
typ
: The ‘type’ for this node. It should be an instance of a class that implements thecolander.interfaces.Type
interface. Iftyp
is not passed, a call to theschema_type()
method on this class is made to get a default type. (When subclassing,schema_type()
should be overridden to provide a reasonable default type).*children
: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via theadd
method.
The constructor accepts these keyword arguments:
name
: The name of this node.typ
: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.default
: The default serialization value for this node when not set. Ifdefault
iscolander.drop
, the node will be dropped from schema serialization. If not provided, the node will be serialized tocolander.null
.missing
: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker valuecolander.required
, indicating that it is considered ‘required’. Whenmissing
iscolander.required
, therequired
computed attribute will beTrue
. Whenmissing
iscolander.drop
, the node is dropped from the schema if it isn’t set during deserialization.missing_msg
: Optional error message to be used if the value is required and missing.preparer
: Optional preparer for this node. It should be an object that implements thecolander.interfaces.Preparer
interface.validator
: Optional validator for this node. It should be an object that implements thecolander.interfaces.Validator
interface.after_bind
: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of thebind
method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so theafter_bind
methods of the deepest nodes are called before the shallowest. Theafter_bind
callback should accept two values:node
andkw
.node
will be a clone of the bound node object,kw
will be the set of keywords passed to thebind
method.title
: The title of this node. Defaults to a titleization of thename
(underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).description
: The description for this node. Defaults to''
(the empty string). The description is used by higher-level systems (not by Colander itself).widget
: The ‘widget’ for this node. Defaults toNone
. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.insert_before
: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.
Arbitrary keyword arguments remaining will be attached to the node object unmolested.
- class cowbird.api.schemas.BaseResponseSchemaAPI(*arg, **kw)[source]
Bases:
colander.MappingSchema
Fundamental building block of schemas.
The constructor accepts these positional arguments:
typ
: The ‘type’ for this node. It should be an instance of a class that implements thecolander.interfaces.Type
interface. Iftyp
is not passed, a call to theschema_type()
method on this class is made to get a default type. (When subclassing,schema_type()
should be overridden to provide a reasonable default type).*children
: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via theadd
method.
The constructor accepts these keyword arguments:
name
: The name of this node.typ
: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.default
: The default serialization value for this node when not set. Ifdefault
iscolander.drop
, the node will be dropped from schema serialization. If not provided, the node will be serialized tocolander.null
.missing
: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker valuecolander.required
, indicating that it is considered ‘required’. Whenmissing
iscolander.required
, therequired
computed attribute will beTrue
. Whenmissing
iscolander.drop
, the node is dropped from the schema if it isn’t set during deserialization.missing_msg
: Optional error message to be used if the value is required and missing.preparer
: Optional preparer for this node. It should be an object that implements thecolander.interfaces.Preparer
interface.validator
: Optional validator for this node. It should be an object that implements thecolander.interfaces.Validator
interface.after_bind
: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of thebind
method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so theafter_bind
methods of the deepest nodes are called before the shallowest. Theafter_bind
callback should accept two values:node
andkw
.node
will be a clone of the bound node object,kw
will be the set of keywords passed to thebind
method.title
: The title of this node. Defaults to a titleization of thename
(underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).description
: The description for this node. Defaults to''
(the empty string). The description is used by higher-level systems (not by Colander itself).widget
: The ‘widget’ for this node. Defaults toNone
. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.insert_before
: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.
Arbitrary keyword arguments remaining will be attached to the node object unmolested.
- class cowbird.api.schemas.BaseResponseBodySchema(code: int, description: str, **kw: Any)[source]
Bases:
colander.MappingSchema
Fundamental building block of schemas.
The constructor accepts these positional arguments:
typ
: The ‘type’ for this node. It should be an instance of a class that implements thecolander.interfaces.Type
interface. Iftyp
is not passed, a call to theschema_type()
method on this class is made to get a default type. (When subclassing,schema_type()
should be overridden to provide a reasonable default type).*children
: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via theadd
method.
The constructor accepts these keyword arguments:
name
: The name of this node.typ
: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.default
: The default serialization value for this node when not set. Ifdefault
iscolander.drop
, the node will be dropped from schema serialization. If not provided, the node will be serialized tocolander.null
.missing
: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker valuecolander.required
, indicating that it is considered ‘required’. Whenmissing
iscolander.required
, therequired
computed attribute will beTrue
. Whenmissing
iscolander.drop
, the node is dropped from the schema if it isn’t set during deserialization.missing_msg
: Optional error message to be used if the value is required and missing.preparer
: Optional preparer for this node. It should be an object that implements thecolander.interfaces.Preparer
interface.validator
: Optional validator for this node. It should be an object that implements thecolander.interfaces.Validator
interface.after_bind
: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of thebind
method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so theafter_bind
methods of the deepest nodes are called before the shallowest. Theafter_bind
callback should accept two values:node
andkw
.node
will be a clone of the bound node object,kw
will be the set of keywords passed to thebind
method.title
: The title of this node. Defaults to a titleization of thename
(underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).description
: The description for this node. Defaults to''
(the empty string). The description is used by higher-level systems (not by Colander itself).widget
: The ‘widget’ for this node. Defaults toNone
. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.insert_before
: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.
Arbitrary keyword arguments remaining will be attached to the node object unmolested.
- class cowbird.api.schemas.ErrorVerifyParamConditions(*arg, **kw)[source]
Bases:
colander.MappingSchema
Fundamental building block of schemas.
The constructor accepts these positional arguments:
typ
: The ‘type’ for this node. It should be an instance of a class that implements thecolander.interfaces.Type
interface. Iftyp
is not passed, a call to theschema_type()
method on this class is made to get a default type. (When subclassing,schema_type()
should be overridden to provide a reasonable default type).*children
: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via theadd
method.
The constructor accepts these keyword arguments:
name
: The name of this node.typ
: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.default
: The default serialization value for this node when not set. Ifdefault
iscolander.drop
, the node will be dropped from schema serialization. If not provided, the node will be serialized tocolander.null
.missing
: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker valuecolander.required
, indicating that it is considered ‘required’. Whenmissing
iscolander.required
, therequired
computed attribute will beTrue
. Whenmissing
iscolander.drop
, the node is dropped from the schema if it isn’t set during deserialization.missing_msg
: Optional error message to be used if the value is required and missing.preparer
: Optional preparer for this node. It should be an object that implements thecolander.interfaces.Preparer
interface.validator
: Optional validator for this node. It should be an object that implements thecolander.interfaces.Validator
interface.after_bind
: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of thebind
method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so theafter_bind
methods of the deepest nodes are called before the shallowest. Theafter_bind
callback should accept two values:node
andkw
.node
will be a clone of the bound node object,kw
will be the set of keywords passed to thebind
method.title
: The title of this node. Defaults to a titleization of thename
(underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).description
: The description for this node. Defaults to''
(the empty string). The description is used by higher-level systems (not by Colander itself).widget
: The ‘widget’ for this node. Defaults toNone
. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.insert_before
: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.
Arbitrary keyword arguments remaining will be attached to the node object unmolested.
- class cowbird.api.schemas.ErrorVerifyParamBodySchema(*arg, **kw)[source]
Bases:
colander.MappingSchema
Fundamental building block of schemas.
The constructor accepts these positional arguments:
typ
: The ‘type’ for this node. It should be an instance of a class that implements thecolander.interfaces.Type
interface. Iftyp
is not passed, a call to theschema_type()
method on this class is made to get a default type. (When subclassing,schema_type()
should be overridden to provide a reasonable default type).*children
: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via theadd
method.
The constructor accepts these keyword arguments:
name
: The name of this node.typ
: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.default
: The default serialization value for this node when not set. Ifdefault
iscolander.drop
, the node will be dropped from schema serialization. If not provided, the node will be serialized tocolander.null
.missing
: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker valuecolander.required
, indicating that it is considered ‘required’. Whenmissing
iscolander.required
, therequired
computed attribute will beTrue
. Whenmissing
iscolander.drop
, the node is dropped from the schema if it isn’t set during deserialization.missing_msg
: Optional error message to be used if the value is required and missing.preparer
: Optional preparer for this node. It should be an object that implements thecolander.interfaces.Preparer
interface.validator
: Optional validator for this node. It should be an object that implements thecolander.interfaces.Validator
interface.after_bind
: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of thebind
method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so theafter_bind
methods of the deepest nodes are called before the shallowest. Theafter_bind
callback should accept two values:node
andkw
.node
will be a clone of the bound node object,kw
will be the set of keywords passed to thebind
method.title
: The title of this node. Defaults to a titleization of thename
(underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).description
: The description for this node. Defaults to''
(the empty string). The description is used by higher-level systems (not by Colander itself).widget
: The ‘widget’ for this node. Defaults toNone
. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.insert_before
: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.
Arbitrary keyword arguments remaining will be attached to the node object unmolested.
- class cowbird.api.schemas.ErrorFallbackBodySchema(*arg, **kw)[source]
Bases:
colander.MappingSchema
Fundamental building block of schemas.
The constructor accepts these positional arguments:
typ
: The ‘type’ for this node. It should be an instance of a class that implements thecolander.interfaces.Type
interface. Iftyp
is not passed, a call to theschema_type()
method on this class is made to get a default type. (When subclassing,schema_type()
should be overridden to provide a reasonable default type).*children
: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via theadd
method.
The constructor accepts these keyword arguments:
name
: The name of this node.typ
: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.default
: The default serialization value for this node when not set. Ifdefault
iscolander.drop
, the node will be dropped from schema serialization. If not provided, the node will be serialized tocolander.null
.missing
: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker valuecolander.required
, indicating that it is considered ‘required’. Whenmissing
iscolander.required
, therequired
computed attribute will beTrue
. Whenmissing
iscolander.drop
, the node is dropped from the schema if it isn’t set during deserialization.missing_msg
: Optional error message to be used if the value is required and missing.preparer
: Optional preparer for this node. It should be an object that implements thecolander.interfaces.Preparer
interface.validator
: Optional validator for this node. It should be an object that implements thecolander.interfaces.Validator
interface.after_bind
: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of thebind
method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so theafter_bind
methods of the deepest nodes are called before the shallowest. Theafter_bind
callback should accept two values:node
andkw
.node
will be a clone of the bound node object,kw
will be the set of keywords passed to thebind
method.title
: The title of this node. Defaults to a titleization of thename
(underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).description
: The description for this node. Defaults to''
(the empty string). The description is used by higher-level systems (not by Colander itself).widget
: The ‘widget’ for this node. Defaults toNone
. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.insert_before
: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.
Arbitrary keyword arguments remaining will be attached to the node object unmolested.
- class cowbird.api.schemas.ErrorCallBodySchema(*arg, **kw)[source]
Bases:
ErrorFallbackBodySchema
Fundamental building block of schemas.
The constructor accepts these positional arguments:
typ
: The ‘type’ for this node. It should be an instance of a class that implements thecolander.interfaces.Type
interface. Iftyp
is not passed, a call to theschema_type()
method on this class is made to get a default type. (When subclassing,schema_type()
should be overridden to provide a reasonable default type).*children
: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via theadd
method.
The constructor accepts these keyword arguments:
name
: The name of this node.typ
: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.default
: The default serialization value for this node when not set. Ifdefault
iscolander.drop
, the node will be dropped from schema serialization. If not provided, the node will be serialized tocolander.null
.missing
: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker valuecolander.required
, indicating that it is considered ‘required’. Whenmissing
iscolander.required
, therequired
computed attribute will beTrue
. Whenmissing
iscolander.drop
, the node is dropped from the schema if it isn’t set during deserialization.missing_msg
: Optional error message to be used if the value is required and missing.preparer
: Optional preparer for this node. It should be an object that implements thecolander.interfaces.Preparer
interface.validator
: Optional validator for this node. It should be an object that implements thecolander.interfaces.Validator
interface.after_bind
: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of thebind
method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so theafter_bind
methods of the deepest nodes are called before the shallowest. Theafter_bind
callback should accept two values:node
andkw
.node
will be a clone of the bound node object,kw
will be the set of keywords passed to thebind
method.title
: The title of this node. Defaults to a titleization of thename
(underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).description
: The description for this node. Defaults to''
(the empty string). The description is used by higher-level systems (not by Colander itself).widget
: The ‘widget’ for this node. Defaults toNone
. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.insert_before
: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.
Arbitrary keyword arguments remaining will be attached to the node object unmolested.
- class cowbird.api.schemas.ErrorResponseBodySchema(code: int, description: str, **kw: Any)[source]
Bases:
BaseResponseBodySchema
Fundamental building block of schemas.
The constructor accepts these positional arguments:
typ
: The ‘type’ for this node. It should be an instance of a class that implements thecolander.interfaces.Type
interface. Iftyp
is not passed, a call to theschema_type()
method on this class is made to get a default type. (When subclassing,schema_type()
should be overridden to provide a reasonable default type).*children
: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via theadd
method.
The constructor accepts these keyword arguments:
name
: The name of this node.typ
: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.default
: The default serialization value for this node when not set. Ifdefault
iscolander.drop
, the node will be dropped from schema serialization. If not provided, the node will be serialized tocolander.null
.missing
: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker valuecolander.required
, indicating that it is considered ‘required’. Whenmissing
iscolander.required
, therequired
computed attribute will beTrue
. Whenmissing
iscolander.drop
, the node is dropped from the schema if it isn’t set during deserialization.missing_msg
: Optional error message to be used if the value is required and missing.preparer
: Optional preparer for this node. It should be an object that implements thecolander.interfaces.Preparer
interface.validator
: Optional validator for this node. It should be an object that implements thecolander.interfaces.Validator
interface.after_bind
: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of thebind
method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so theafter_bind
methods of the deepest nodes are called before the shallowest. Theafter_bind
callback should accept two values:node
andkw
.node
will be a clone of the bound node object,kw
will be the set of keywords passed to thebind
method.title
: The title of this node. Defaults to a titleization of thename
(underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).description
: The description for this node. Defaults to''
(the empty string). The description is used by higher-level systems (not by Colander itself).widget
: The ‘widget’ for this node. Defaults toNone
. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.insert_before
: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.
Arbitrary keyword arguments remaining will be attached to the node object unmolested.
- class cowbird.api.schemas.InternalServerErrorResponseBodySchema(**kw: Any)[source]
Bases:
ErrorResponseBodySchema
Fundamental building block of schemas.
The constructor accepts these positional arguments:
typ
: The ‘type’ for this node. It should be an instance of a class that implements thecolander.interfaces.Type
interface. Iftyp
is not passed, a call to theschema_type()
method on this class is made to get a default type. (When subclassing,schema_type()
should be overridden to provide a reasonable default type).*children
: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via theadd
method.
The constructor accepts these keyword arguments:
name
: The name of this node.typ
: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.default
: The default serialization value for this node when not set. Ifdefault
iscolander.drop
, the node will be dropped from schema serialization. If not provided, the node will be serialized tocolander.null
.missing
: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker valuecolander.required
, indicating that it is considered ‘required’. Whenmissing
iscolander.required
, therequired
computed attribute will beTrue
. Whenmissing
iscolander.drop
, the node is dropped from the schema if it isn’t set during deserialization.missing_msg
: Optional error message to be used if the value is required and missing.preparer
: Optional preparer for this node. It should be an object that implements thecolander.interfaces.Preparer
interface.validator
: Optional validator for this node. It should be an object that implements thecolander.interfaces.Validator
interface.after_bind
: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of thebind
method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so theafter_bind
methods of the deepest nodes are called before the shallowest. Theafter_bind
callback should accept two values:node
andkw
.node
will be a clone of the bound node object,kw
will be the set of keywords passed to thebind
method.title
: The title of this node. Defaults to a titleization of thename
(underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).description
: The description for this node. Defaults to''
(the empty string). The description is used by higher-level systems (not by Colander itself).widget
: The ‘widget’ for this node. Defaults toNone
. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.insert_before
: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.
Arbitrary keyword arguments remaining will be attached to the node object unmolested.
- class cowbird.api.schemas.BadRequestResponseSchema(*arg, **kw)[source]
Bases:
BaseResponseSchemaAPI
Fundamental building block of schemas.
The constructor accepts these positional arguments:
typ
: The ‘type’ for this node. It should be an instance of a class that implements thecolander.interfaces.Type
interface. Iftyp
is not passed, a call to theschema_type()
method on this class is made to get a default type. (When subclassing,schema_type()
should be overridden to provide a reasonable default type).*children
: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via theadd
method.
The constructor accepts these keyword arguments:
name
: The name of this node.typ
: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.default
: The default serialization value for this node when not set. Ifdefault
iscolander.drop
, the node will be dropped from schema serialization. If not provided, the node will be serialized tocolander.null
.missing
: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker valuecolander.required
, indicating that it is considered ‘required’. Whenmissing
iscolander.required
, therequired
computed attribute will beTrue
. Whenmissing
iscolander.drop
, the node is dropped from the schema if it isn’t set during deserialization.missing_msg
: Optional error message to be used if the value is required and missing.preparer
: Optional preparer for this node. It should be an object that implements thecolander.interfaces.Preparer
interface.validator
: Optional validator for this node. It should be an object that implements thecolander.interfaces.Validator
interface.after_bind
: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of thebind
method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so theafter_bind
methods of the deepest nodes are called before the shallowest. Theafter_bind
callback should accept two values:node
andkw
.node
will be a clone of the bound node object,kw
will be the set of keywords passed to thebind
method.title
: The title of this node. Defaults to a titleization of thename
(underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).description
: The description for this node. Defaults to''
(the empty string). The description is used by higher-level systems (not by Colander itself).widget
: The ‘widget’ for this node. Defaults toNone
. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.insert_before
: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.
Arbitrary keyword arguments remaining will be attached to the node object unmolested.
- class cowbird.api.schemas.UnauthorizedResponseBodySchema(**kw: Any)[source]
Bases:
ErrorResponseBodySchema
Fundamental building block of schemas.
The constructor accepts these positional arguments:
typ
: The ‘type’ for this node. It should be an instance of a class that implements thecolander.interfaces.Type
interface. Iftyp
is not passed, a call to theschema_type()
method on this class is made to get a default type. (When subclassing,schema_type()
should be overridden to provide a reasonable default type).*children
: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via theadd
method.
The constructor accepts these keyword arguments:
name
: The name of this node.typ
: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.default
: The default serialization value for this node when not set. Ifdefault
iscolander.drop
, the node will be dropped from schema serialization. If not provided, the node will be serialized tocolander.null
.missing
: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker valuecolander.required
, indicating that it is considered ‘required’. Whenmissing
iscolander.required
, therequired
computed attribute will beTrue
. Whenmissing
iscolander.drop
, the node is dropped from the schema if it isn’t set during deserialization.missing_msg
: Optional error message to be used if the value is required and missing.preparer
: Optional preparer for this node. It should be an object that implements thecolander.interfaces.Preparer
interface.validator
: Optional validator for this node. It should be an object that implements thecolander.interfaces.Validator
interface.after_bind
: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of thebind
method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so theafter_bind
methods of the deepest nodes are called before the shallowest. Theafter_bind
callback should accept two values:node
andkw
.node
will be a clone of the bound node object,kw
will be the set of keywords passed to thebind
method.title
: The title of this node. Defaults to a titleization of thename
(underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).description
: The description for this node. Defaults to''
(the empty string). The description is used by higher-level systems (not by Colander itself).widget
: The ‘widget’ for this node. Defaults toNone
. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.insert_before
: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.
Arbitrary keyword arguments remaining will be attached to the node object unmolested.
- class cowbird.api.schemas.UnauthorizedResponseSchema(*arg, **kw)[source]
Bases:
BaseResponseSchemaAPI
Fundamental building block of schemas.
The constructor accepts these positional arguments:
typ
: The ‘type’ for this node. It should be an instance of a class that implements thecolander.interfaces.Type
interface. Iftyp
is not passed, a call to theschema_type()
method on this class is made to get a default type. (When subclassing,schema_type()
should be overridden to provide a reasonable default type).*children
: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via theadd
method.
The constructor accepts these keyword arguments:
name
: The name of this node.typ
: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.default
: The default serialization value for this node when not set. Ifdefault
iscolander.drop
, the node will be dropped from schema serialization. If not provided, the node will be serialized tocolander.null
.missing
: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker valuecolander.required
, indicating that it is considered ‘required’. Whenmissing
iscolander.required
, therequired
computed attribute will beTrue
. Whenmissing
iscolander.drop
, the node is dropped from the schema if it isn’t set during deserialization.missing_msg
: Optional error message to be used if the value is required and missing.preparer
: Optional preparer for this node. It should be an object that implements thecolander.interfaces.Preparer
interface.validator
: Optional validator for this node. It should be an object that implements thecolander.interfaces.Validator
interface.after_bind
: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of thebind
method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so theafter_bind
methods of the deepest nodes are called before the shallowest. Theafter_bind
callback should accept two values:node
andkw
.node
will be a clone of the bound node object,kw
will be the set of keywords passed to thebind
method.title
: The title of this node. Defaults to a titleization of thename
(underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).description
: The description for this node. Defaults to''
(the empty string). The description is used by higher-level systems (not by Colander itself).widget
: The ‘widget’ for this node. Defaults toNone
. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.insert_before
: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.
Arbitrary keyword arguments remaining will be attached to the node object unmolested.
- class cowbird.api.schemas.HTTPForbiddenResponseSchema(*arg, **kw)[source]
Bases:
BaseResponseSchemaAPI
Fundamental building block of schemas.
The constructor accepts these positional arguments:
typ
: The ‘type’ for this node. It should be an instance of a class that implements thecolander.interfaces.Type
interface. Iftyp
is not passed, a call to theschema_type()
method on this class is made to get a default type. (When subclassing,schema_type()
should be overridden to provide a reasonable default type).*children
: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via theadd
method.
The constructor accepts these keyword arguments:
name
: The name of this node.typ
: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.default
: The default serialization value for this node when not set. Ifdefault
iscolander.drop
, the node will be dropped from schema serialization. If not provided, the node will be serialized tocolander.null
.missing
: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker valuecolander.required
, indicating that it is considered ‘required’. Whenmissing
iscolander.required
, therequired
computed attribute will beTrue
. Whenmissing
iscolander.drop
, the node is dropped from the schema if it isn’t set during deserialization.missing_msg
: Optional error message to be used if the value is required and missing.preparer
: Optional preparer for this node. It should be an object that implements thecolander.interfaces.Preparer
interface.validator
: Optional validator for this node. It should be an object that implements thecolander.interfaces.Validator
interface.after_bind
: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of thebind
method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so theafter_bind
methods of the deepest nodes are called before the shallowest. Theafter_bind
callback should accept two values:node
andkw
.node
will be a clone of the bound node object,kw
will be the set of keywords passed to thebind
method.title
: The title of this node. Defaults to a titleization of thename
(underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).description
: The description for this node. Defaults to''
(the empty string). The description is used by higher-level systems (not by Colander itself).widget
: The ‘widget’ for this node. Defaults toNone
. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.insert_before
: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.
Arbitrary keyword arguments remaining will be attached to the node object unmolested.
- class cowbird.api.schemas.NotFoundResponseSchema(*arg, **kw)[source]
Bases:
BaseResponseSchemaAPI
Fundamental building block of schemas.
The constructor accepts these positional arguments:
typ
: The ‘type’ for this node. It should be an instance of a class that implements thecolander.interfaces.Type
interface. Iftyp
is not passed, a call to theschema_type()
method on this class is made to get a default type. (When subclassing,schema_type()
should be overridden to provide a reasonable default type).*children
: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via theadd
method.
The constructor accepts these keyword arguments:
name
: The name of this node.typ
: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.default
: The default serialization value for this node when not set. Ifdefault
iscolander.drop
, the node will be dropped from schema serialization. If not provided, the node will be serialized tocolander.null
.missing
: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker valuecolander.required
, indicating that it is considered ‘required’. Whenmissing
iscolander.required
, therequired
computed attribute will beTrue
. Whenmissing
iscolander.drop
, the node is dropped from the schema if it isn’t set during deserialization.missing_msg
: Optional error message to be used if the value is required and missing.preparer
: Optional preparer for this node. It should be an object that implements thecolander.interfaces.Preparer
interface.validator
: Optional validator for this node. It should be an object that implements thecolander.interfaces.Validator
interface.after_bind
: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of thebind
method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so theafter_bind
methods of the deepest nodes are called before the shallowest. Theafter_bind
callback should accept two values:node
andkw
.node
will be a clone of the bound node object,kw
will be the set of keywords passed to thebind
method.title
: The title of this node. Defaults to a titleization of thename
(underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).description
: The description for this node. Defaults to''
(the empty string). The description is used by higher-level systems (not by Colander itself).widget
: The ‘widget’ for this node. Defaults toNone
. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.insert_before
: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.
Arbitrary keyword arguments remaining will be attached to the node object unmolested.
- class cowbird.api.schemas.MethodNotAllowedResponseSchema(*arg, **kw)[source]
Bases:
BaseResponseSchemaAPI
Fundamental building block of schemas.
The constructor accepts these positional arguments:
typ
: The ‘type’ for this node. It should be an instance of a class that implements thecolander.interfaces.Type
interface. Iftyp
is not passed, a call to theschema_type()
method on this class is made to get a default type. (When subclassing,schema_type()
should be overridden to provide a reasonable default type).*children
: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via theadd
method.
The constructor accepts these keyword arguments:
name
: The name of this node.typ
: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.default
: The default serialization value for this node when not set. Ifdefault
iscolander.drop
, the node will be dropped from schema serialization. If not provided, the node will be serialized tocolander.null
.missing
: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker valuecolander.required
, indicating that it is considered ‘required’. Whenmissing
iscolander.required
, therequired
computed attribute will beTrue
. Whenmissing
iscolander.drop
, the node is dropped from the schema if it isn’t set during deserialization.missing_msg
: Optional error message to be used if the value is required and missing.preparer
: Optional preparer for this node. It should be an object that implements thecolander.interfaces.Preparer
interface.validator
: Optional validator for this node. It should be an object that implements thecolander.interfaces.Validator
interface.after_bind
: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of thebind
method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so theafter_bind
methods of the deepest nodes are called before the shallowest. Theafter_bind
callback should accept two values:node
andkw
.node
will be a clone of the bound node object,kw
will be the set of keywords passed to thebind
method.title
: The title of this node. Defaults to a titleization of thename
(underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).description
: The description for this node. Defaults to''
(the empty string). The description is used by higher-level systems (not by Colander itself).widget
: The ‘widget’ for this node. Defaults toNone
. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.insert_before
: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.
Arbitrary keyword arguments remaining will be attached to the node object unmolested.
- class cowbird.api.schemas.NotAcceptableResponseSchema(*arg, **kw)[source]
Bases:
BaseResponseSchemaAPI
Fundamental building block of schemas.
The constructor accepts these positional arguments:
typ
: The ‘type’ for this node. It should be an instance of a class that implements thecolander.interfaces.Type
interface. Iftyp
is not passed, a call to theschema_type()
method on this class is made to get a default type. (When subclassing,schema_type()
should be overridden to provide a reasonable default type).*children
: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via theadd
method.
The constructor accepts these keyword arguments:
name
: The name of this node.typ
: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.default
: The default serialization value for this node when not set. Ifdefault
iscolander.drop
, the node will be dropped from schema serialization. If not provided, the node will be serialized tocolander.null
.missing
: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker valuecolander.required
, indicating that it is considered ‘required’. Whenmissing
iscolander.required
, therequired
computed attribute will beTrue
. Whenmissing
iscolander.drop
, the node is dropped from the schema if it isn’t set during deserialization.missing_msg
: Optional error message to be used if the value is required and missing.preparer
: Optional preparer for this node. It should be an object that implements thecolander.interfaces.Preparer
interface.validator
: Optional validator for this node. It should be an object that implements thecolander.interfaces.Validator
interface.after_bind
: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of thebind
method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so theafter_bind
methods of the deepest nodes are called before the shallowest. Theafter_bind
callback should accept two values:node
andkw
.node
will be a clone of the bound node object,kw
will be the set of keywords passed to thebind
method.title
: The title of this node. Defaults to a titleization of thename
(underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).description
: The description for this node. Defaults to''
(the empty string). The description is used by higher-level systems (not by Colander itself).widget
: The ‘widget’ for this node. Defaults toNone
. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.insert_before
: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.
Arbitrary keyword arguments remaining will be attached to the node object unmolested.
- class cowbird.api.schemas.UnprocessableEntityResponseSchema(*arg, **kw)[source]
Bases:
BaseResponseSchemaAPI
Fundamental building block of schemas.
The constructor accepts these positional arguments:
typ
: The ‘type’ for this node. It should be an instance of a class that implements thecolander.interfaces.Type
interface. Iftyp
is not passed, a call to theschema_type()
method on this class is made to get a default type. (When subclassing,schema_type()
should be overridden to provide a reasonable default type).*children
: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via theadd
method.
The constructor accepts these keyword arguments:
name
: The name of this node.typ
: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.default
: The default serialization value for this node when not set. Ifdefault
iscolander.drop
, the node will be dropped from schema serialization. If not provided, the node will be serialized tocolander.null
.missing
: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker valuecolander.required
, indicating that it is considered ‘required’. Whenmissing
iscolander.required
, therequired
computed attribute will beTrue
. Whenmissing
iscolander.drop
, the node is dropped from the schema if it isn’t set during deserialization.missing_msg
: Optional error message to be used if the value is required and missing.preparer
: Optional preparer for this node. It should be an object that implements thecolander.interfaces.Preparer
interface.validator
: Optional validator for this node. It should be an object that implements thecolander.interfaces.Validator
interface.after_bind
: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of thebind
method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so theafter_bind
methods of the deepest nodes are called before the shallowest. Theafter_bind
callback should accept two values:node
andkw
.node
will be a clone of the bound node object,kw
will be the set of keywords passed to thebind
method.title
: The title of this node. Defaults to a titleization of thename
(underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).description
: The description for this node. Defaults to''
(the empty string). The description is used by higher-level systems (not by Colander itself).widget
: The ‘widget’ for this node. Defaults toNone
. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.insert_before
: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.
Arbitrary keyword arguments remaining will be attached to the node object unmolested.
- class cowbird.api.schemas.InternalServerErrorResponseSchema(*arg, **kw)[source]
Bases:
BaseResponseSchemaAPI
Fundamental building block of schemas.
The constructor accepts these positional arguments:
typ
: The ‘type’ for this node. It should be an instance of a class that implements thecolander.interfaces.Type
interface. Iftyp
is not passed, a call to theschema_type()
method on this class is made to get a default type. (When subclassing,schema_type()
should be overridden to provide a reasonable default type).*children
: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via theadd
method.
The constructor accepts these keyword arguments:
name
: The name of this node.typ
: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.default
: The default serialization value for this node when not set. Ifdefault
iscolander.drop
, the node will be dropped from schema serialization. If not provided, the node will be serialized tocolander.null
.missing
: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker valuecolander.required
, indicating that it is considered ‘required’. Whenmissing
iscolander.required
, therequired
computed attribute will beTrue
. Whenmissing
iscolander.drop
, the node is dropped from the schema if it isn’t set during deserialization.missing_msg
: Optional error message to be used if the value is required and missing.preparer
: Optional preparer for this node. It should be an object that implements thecolander.interfaces.Preparer
interface.validator
: Optional validator for this node. It should be an object that implements thecolander.interfaces.Validator
interface.after_bind
: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of thebind
method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so theafter_bind
methods of the deepest nodes are called before the shallowest. Theafter_bind
callback should accept two values:node
andkw
.node
will be a clone of the bound node object,kw
will be the set of keywords passed to thebind
method.title
: The title of this node. Defaults to a titleization of thename
(underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).description
: The description for this node. Defaults to''
(the empty string). The description is used by higher-level systems (not by Colander itself).widget
: The ‘widget’ for this node. Defaults toNone
. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.insert_before
: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.
Arbitrary keyword arguments remaining will be attached to the node object unmolested.
- class cowbird.api.schemas.PermissionSchema(*arg, **kw)[source]
Bases:
colander.SchemaNode
Fundamental building block of schemas.
The constructor accepts these positional arguments:
typ
: The ‘type’ for this node. It should be an instance of a class that implements thecolander.interfaces.Type
interface. Iftyp
is not passed, a call to theschema_type()
method on this class is made to get a default type. (When subclassing,schema_type()
should be overridden to provide a reasonable default type).*children
: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via theadd
method.
The constructor accepts these keyword arguments:
name
: The name of this node.typ
: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.default
: The default serialization value for this node when not set. Ifdefault
iscolander.drop
, the node will be dropped from schema serialization. If not provided, the node will be serialized tocolander.null
.missing
: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker valuecolander.required
, indicating that it is considered ‘required’. Whenmissing
iscolander.required
, therequired
computed attribute will beTrue
. Whenmissing
iscolander.drop
, the node is dropped from the schema if it isn’t set during deserialization.missing_msg
: Optional error message to be used if the value is required and missing.preparer
: Optional preparer for this node. It should be an object that implements thecolander.interfaces.Preparer
interface.validator
: Optional validator for this node. It should be an object that implements thecolander.interfaces.Validator
interface.after_bind
: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of thebind
method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so theafter_bind
methods of the deepest nodes are called before the shallowest. Theafter_bind
callback should accept two values:node
andkw
.node
will be a clone of the bound node object,kw
will be the set of keywords passed to thebind
method.title
: The title of this node. Defaults to a titleization of thename
(underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).description
: The description for this node. Defaults to''
(the empty string). The description is used by higher-level systems (not by Colander itself).widget
: The ‘widget’ for this node. Defaults toNone
. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.insert_before
: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.
Arbitrary keyword arguments remaining will be attached to the node object unmolested.
- class cowbird.api.schemas.PermissionListSchema(*args, **kw)[source]
Bases:
colander.SequenceSchema
Fundamental building block of schemas.
The constructor accepts these positional arguments:
typ
: The ‘type’ for this node. It should be an instance of a class that implements thecolander.interfaces.Type
interface. Iftyp
is not passed, a call to theschema_type()
method on this class is made to get a default type. (When subclassing,schema_type()
should be overridden to provide a reasonable default type).*children
: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via theadd
method.
The constructor accepts these keyword arguments:
name
: The name of this node.typ
: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.default
: The default serialization value for this node when not set. Ifdefault
iscolander.drop
, the node will be dropped from schema serialization. If not provided, the node will be serialized tocolander.null
.missing
: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker valuecolander.required
, indicating that it is considered ‘required’. Whenmissing
iscolander.required
, therequired
computed attribute will beTrue
. Whenmissing
iscolander.drop
, the node is dropped from the schema if it isn’t set during deserialization.missing_msg
: Optional error message to be used if the value is required and missing.preparer
: Optional preparer for this node. It should be an object that implements thecolander.interfaces.Preparer
interface.validator
: Optional validator for this node. It should be an object that implements thecolander.interfaces.Validator
interface.after_bind
: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of thebind
method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so theafter_bind
methods of the deepest nodes are called before the shallowest. Theafter_bind
callback should accept two values:node
andkw
.node
will be a clone of the bound node object,kw
will be the set of keywords passed to thebind
method.title
: The title of this node. Defaults to a titleization of thename
(underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).description
: The description for this node. Defaults to''
(the empty string). The description is used by higher-level systems (not by Colander itself).widget
: The ‘widget’ for this node. Defaults toNone
. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.insert_before
: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.
Arbitrary keyword arguments remaining will be attached to the node object unmolested.
- class cowbird.api.schemas.ResourceSchema(*arg, **kw)[source]
Bases:
colander.SchemaNode
Fundamental building block of schemas.
The constructor accepts these positional arguments:
typ
: The ‘type’ for this node. It should be an instance of a class that implements thecolander.interfaces.Type
interface. Iftyp
is not passed, a call to theschema_type()
method on this class is made to get a default type. (When subclassing,schema_type()
should be overridden to provide a reasonable default type).*children
: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via theadd
method.
The constructor accepts these keyword arguments:
name
: The name of this node.typ
: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.default
: The default serialization value for this node when not set. Ifdefault
iscolander.drop
, the node will be dropped from schema serialization. If not provided, the node will be serialized tocolander.null
.missing
: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker valuecolander.required
, indicating that it is considered ‘required’. Whenmissing
iscolander.required
, therequired
computed attribute will beTrue
. Whenmissing
iscolander.drop
, the node is dropped from the schema if it isn’t set during deserialization.missing_msg
: Optional error message to be used if the value is required and missing.preparer
: Optional preparer for this node. It should be an object that implements thecolander.interfaces.Preparer
interface.validator
: Optional validator for this node. It should be an object that implements thecolander.interfaces.Validator
interface.after_bind
: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of thebind
method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so theafter_bind
methods of the deepest nodes are called before the shallowest. Theafter_bind
callback should accept two values:node
andkw
.node
will be a clone of the bound node object,kw
will be the set of keywords passed to thebind
method.title
: The title of this node. Defaults to a titleization of thename
(underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).description
: The description for this node. Defaults to''
(the empty string). The description is used by higher-level systems (not by Colander itself).widget
: The ‘widget’ for this node. Defaults toNone
. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.insert_before
: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.
Arbitrary keyword arguments remaining will be attached to the node object unmolested.
- class cowbird.api.schemas.ResourceListSchema(*args, **kw)[source]
Bases:
colander.SequenceSchema
Fundamental building block of schemas.
The constructor accepts these positional arguments:
typ
: The ‘type’ for this node. It should be an instance of a class that implements thecolander.interfaces.Type
interface. Iftyp
is not passed, a call to theschema_type()
method on this class is made to get a default type. (When subclassing,schema_type()
should be overridden to provide a reasonable default type).*children
: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via theadd
method.
The constructor accepts these keyword arguments:
name
: The name of this node.typ
: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.default
: The default serialization value for this node when not set. Ifdefault
iscolander.drop
, the node will be dropped from schema serialization. If not provided, the node will be serialized tocolander.null
.missing
: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker valuecolander.required
, indicating that it is considered ‘required’. Whenmissing
iscolander.required
, therequired
computed attribute will beTrue
. Whenmissing
iscolander.drop
, the node is dropped from the schema if it isn’t set during deserialization.missing_msg
: Optional error message to be used if the value is required and missing.preparer
: Optional preparer for this node. It should be an object that implements thecolander.interfaces.Preparer
interface.validator
: Optional validator for this node. It should be an object that implements thecolander.interfaces.Validator
interface.after_bind
: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of thebind
method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so theafter_bind
methods of the deepest nodes are called before the shallowest. Theafter_bind
callback should accept two values:node
andkw
.node
will be a clone of the bound node object,kw
will be the set of keywords passed to thebind
method.title
: The title of this node. Defaults to a titleization of thename
(underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).description
: The description for this node. Defaults to''
(the empty string). The description is used by higher-level systems (not by Colander itself).widget
: The ‘widget’ for this node. Defaults toNone
. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.insert_before
: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.
Arbitrary keyword arguments remaining will be attached to the node object unmolested.
- class cowbird.api.schemas.HandlerSummarySchema(*arg, **kw)[source]
Bases:
colander.SchemaNode
Fundamental building block of schemas.
The constructor accepts these positional arguments:
typ
: The ‘type’ for this node. It should be an instance of a class that implements thecolander.interfaces.Type
interface. Iftyp
is not passed, a call to theschema_type()
method on this class is made to get a default type. (When subclassing,schema_type()
should be overridden to provide a reasonable default type).*children
: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via theadd
method.
The constructor accepts these keyword arguments:
name
: The name of this node.typ
: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.default
: The default serialization value for this node when not set. Ifdefault
iscolander.drop
, the node will be dropped from schema serialization. If not provided, the node will be serialized tocolander.null
.missing
: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker valuecolander.required
, indicating that it is considered ‘required’. Whenmissing
iscolander.required
, therequired
computed attribute will beTrue
. Whenmissing
iscolander.drop
, the node is dropped from the schema if it isn’t set during deserialization.missing_msg
: Optional error message to be used if the value is required and missing.preparer
: Optional preparer for this node. It should be an object that implements thecolander.interfaces.Preparer
interface.validator
: Optional validator for this node. It should be an object that implements thecolander.interfaces.Validator
interface.after_bind
: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of thebind
method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so theafter_bind
methods of the deepest nodes are called before the shallowest. Theafter_bind
callback should accept two values:node
andkw
.node
will be a clone of the bound node object,kw
will be the set of keywords passed to thebind
method.title
: The title of this node. Defaults to a titleization of thename
(underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).description
: The description for this node. Defaults to''
(the empty string). The description is used by higher-level systems (not by Colander itself).widget
: The ‘widget’ for this node. Defaults toNone
. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.insert_before
: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.
Arbitrary keyword arguments remaining will be attached to the node object unmolested.
- class cowbird.api.schemas.HandlerListSchema(*args, **kw)[source]
Bases:
colander.SequenceSchema
Fundamental building block of schemas.
The constructor accepts these positional arguments:
typ
: The ‘type’ for this node. It should be an instance of a class that implements thecolander.interfaces.Type
interface. Iftyp
is not passed, a call to theschema_type()
method on this class is made to get a default type. (When subclassing,schema_type()
should be overridden to provide a reasonable default type).*children
: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via theadd
method.
The constructor accepts these keyword arguments:
name
: The name of this node.typ
: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.default
: The default serialization value for this node when not set. Ifdefault
iscolander.drop
, the node will be dropped from schema serialization. If not provided, the node will be serialized tocolander.null
.missing
: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker valuecolander.required
, indicating that it is considered ‘required’. Whenmissing
iscolander.required
, therequired
computed attribute will beTrue
. Whenmissing
iscolander.drop
, the node is dropped from the schema if it isn’t set during deserialization.missing_msg
: Optional error message to be used if the value is required and missing.preparer
: Optional preparer for this node. It should be an object that implements thecolander.interfaces.Preparer
interface.validator
: Optional validator for this node. It should be an object that implements thecolander.interfaces.Validator
interface.after_bind
: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of thebind
method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so theafter_bind
methods of the deepest nodes are called before the shallowest. Theafter_bind
callback should accept two values:node
andkw
.node
will be a clone of the bound node object,kw
will be the set of keywords passed to thebind
method.title
: The title of this node. Defaults to a titleization of thename
(underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).description
: The description for this node. Defaults to''
(the empty string). The description is used by higher-level systems (not by Colander itself).widget
: The ‘widget’ for this node. Defaults toNone
. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.insert_before
: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.
Arbitrary keyword arguments remaining will be attached to the node object unmolested.
- class cowbird.api.schemas.HandlerConfigurationSchema(*arg, **kw)[source]
Bases:
colander.MappingSchema
Fundamental building block of schemas.
The constructor accepts these positional arguments:
typ
: The ‘type’ for this node. It should be an instance of a class that implements thecolander.interfaces.Type
interface. Iftyp
is not passed, a call to theschema_type()
method on this class is made to get a default type. (When subclassing,schema_type()
should be overridden to provide a reasonable default type).*children
: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via theadd
method.
The constructor accepts these keyword arguments:
name
: The name of this node.typ
: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.default
: The default serialization value for this node when not set. Ifdefault
iscolander.drop
, the node will be dropped from schema serialization. If not provided, the node will be serialized tocolander.null
.missing
: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker valuecolander.required
, indicating that it is considered ‘required’. Whenmissing
iscolander.required
, therequired
computed attribute will beTrue
. Whenmissing
iscolander.drop
, the node is dropped from the schema if it isn’t set during deserialization.missing_msg
: Optional error message to be used if the value is required and missing.preparer
: Optional preparer for this node. It should be an object that implements thecolander.interfaces.Preparer
interface.validator
: Optional validator for this node. It should be an object that implements thecolander.interfaces.Validator
interface.after_bind
: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of thebind
method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so theafter_bind
methods of the deepest nodes are called before the shallowest. Theafter_bind
callback should accept two values:node
andkw
.node
will be a clone of the bound node object,kw
will be the set of keywords passed to thebind
method.title
: The title of this node. Defaults to a titleization of thename
(underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).description
: The description for this node. Defaults to''
(the empty string). The description is used by higher-level systems (not by Colander itself).widget
: The ‘widget’ for this node. Defaults toNone
. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.insert_before
: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.
Arbitrary keyword arguments remaining will be attached to the node object unmolested.
- class cowbird.api.schemas.HandlerDetailSchema(*arg, **kw)[source]
Bases:
colander.MappingSchema
Fundamental building block of schemas.
The constructor accepts these positional arguments:
typ
: The ‘type’ for this node. It should be an instance of a class that implements thecolander.interfaces.Type
interface. Iftyp
is not passed, a call to theschema_type()
method on this class is made to get a default type. (When subclassing,schema_type()
should be overridden to provide a reasonable default type).*children
: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via theadd
method.
The constructor accepts these keyword arguments:
name
: The name of this node.typ
: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.default
: The default serialization value for this node when not set. Ifdefault
iscolander.drop
, the node will be dropped from schema serialization. If not provided, the node will be serialized tocolander.null
.missing
: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker valuecolander.required
, indicating that it is considered ‘required’. Whenmissing
iscolander.required
, therequired
computed attribute will beTrue
. Whenmissing
iscolander.drop
, the node is dropped from the schema if it isn’t set during deserialization.missing_msg
: Optional error message to be used if the value is required and missing.preparer
: Optional preparer for this node. It should be an object that implements thecolander.interfaces.Preparer
interface.validator
: Optional validator for this node. It should be an object that implements thecolander.interfaces.Validator
interface.after_bind
: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of thebind
method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so theafter_bind
methods of the deepest nodes are called before the shallowest. Theafter_bind
callback should accept two values:node
andkw
.node
will be a clone of the bound node object,kw
will be the set of keywords passed to thebind
method.title
: The title of this node. Defaults to a titleization of thename
(underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).description
: The description for this node. Defaults to''
(the empty string). The description is used by higher-level systems (not by Colander itself).widget
: The ‘widget’ for this node. Defaults toNone
. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.insert_before
: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.
Arbitrary keyword arguments remaining will be attached to the node object unmolested.
- class cowbird.api.schemas.Handlers_GET_RequestSchema(*arg, **kw)[source]
Bases:
BaseRequestSchemaAPI
Fundamental building block of schemas.
The constructor accepts these positional arguments:
typ
: The ‘type’ for this node. It should be an instance of a class that implements thecolander.interfaces.Type
interface. Iftyp
is not passed, a call to theschema_type()
method on this class is made to get a default type. (When subclassing,schema_type()
should be overridden to provide a reasonable default type).*children
: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via theadd
method.
The constructor accepts these keyword arguments:
name
: The name of this node.typ
: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.default
: The default serialization value for this node when not set. Ifdefault
iscolander.drop
, the node will be dropped from schema serialization. If not provided, the node will be serialized tocolander.null
.missing
: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker valuecolander.required
, indicating that it is considered ‘required’. Whenmissing
iscolander.required
, therequired
computed attribute will beTrue
. Whenmissing
iscolander.drop
, the node is dropped from the schema if it isn’t set during deserialization.missing_msg
: Optional error message to be used if the value is required and missing.preparer
: Optional preparer for this node. It should be an object that implements thecolander.interfaces.Preparer
interface.validator
: Optional validator for this node. It should be an object that implements thecolander.interfaces.Validator
interface.after_bind
: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of thebind
method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so theafter_bind
methods of the deepest nodes are called before the shallowest. Theafter_bind
callback should accept two values:node
andkw
.node
will be a clone of the bound node object,kw
will be the set of keywords passed to thebind
method.title
: The title of this node. Defaults to a titleization of thename
(underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).description
: The description for this node. Defaults to''
(the empty string). The description is used by higher-level systems (not by Colander itself).widget
: The ‘widget’ for this node. Defaults toNone
. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.insert_before
: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.
Arbitrary keyword arguments remaining will be attached to the node object unmolested.
- class cowbird.api.schemas.Handlers_GET_ResponseBodySchema(code: int, description: str, **kw: Any)[source]
Bases:
BaseResponseBodySchema
Fundamental building block of schemas.
The constructor accepts these positional arguments:
typ
: The ‘type’ for this node. It should be an instance of a class that implements thecolander.interfaces.Type
interface. Iftyp
is not passed, a call to theschema_type()
method on this class is made to get a default type. (When subclassing,schema_type()
should be overridden to provide a reasonable default type).*children
: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via theadd
method.
The constructor accepts these keyword arguments:
name
: The name of this node.typ
: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.default
: The default serialization value for this node when not set. Ifdefault
iscolander.drop
, the node will be dropped from schema serialization. If not provided, the node will be serialized tocolander.null
.missing
: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker valuecolander.required
, indicating that it is considered ‘required’. Whenmissing
iscolander.required
, therequired
computed attribute will beTrue
. Whenmissing
iscolander.drop
, the node is dropped from the schema if it isn’t set during deserialization.missing_msg
: Optional error message to be used if the value is required and missing.preparer
: Optional preparer for this node. It should be an object that implements thecolander.interfaces.Preparer
interface.validator
: Optional validator for this node. It should be an object that implements thecolander.interfaces.Validator
interface.after_bind
: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of thebind
method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so theafter_bind
methods of the deepest nodes are called before the shallowest. Theafter_bind
callback should accept two values:node
andkw
.node
will be a clone of the bound node object,kw
will be the set of keywords passed to thebind
method.title
: The title of this node. Defaults to a titleization of thename
(underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).description
: The description for this node. Defaults to''
(the empty string). The description is used by higher-level systems (not by Colander itself).widget
: The ‘widget’ for this node. Defaults toNone
. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.insert_before
: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.
Arbitrary keyword arguments remaining will be attached to the node object unmolested.
- class cowbird.api.schemas.Handlers_GET_OkResponseSchema(*arg, **kw)[source]
Bases:
BaseResponseSchemaAPI
Fundamental building block of schemas.
The constructor accepts these positional arguments:
typ
: The ‘type’ for this node. It should be an instance of a class that implements thecolander.interfaces.Type
interface. Iftyp
is not passed, a call to theschema_type()
method on this class is made to get a default type. (When subclassing,schema_type()
should be overridden to provide a reasonable default type).*children
: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via theadd
method.
The constructor accepts these keyword arguments:
name
: The name of this node.typ
: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.default
: The default serialization value for this node when not set. Ifdefault
iscolander.drop
, the node will be dropped from schema serialization. If not provided, the node will be serialized tocolander.null
.missing
: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker valuecolander.required
, indicating that it is considered ‘required’. Whenmissing
iscolander.required
, therequired
computed attribute will beTrue
. Whenmissing
iscolander.drop
, the node is dropped from the schema if it isn’t set during deserialization.missing_msg
: Optional error message to be used if the value is required and missing.preparer
: Optional preparer for this node. It should be an object that implements thecolander.interfaces.Preparer
interface.validator
: Optional validator for this node. It should be an object that implements thecolander.interfaces.Validator
interface.after_bind
: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of thebind
method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so theafter_bind
methods of the deepest nodes are called before the shallowest. Theafter_bind
callback should accept two values:node
andkw
.node
will be a clone of the bound node object,kw
will be the set of keywords passed to thebind
method.title
: The title of this node. Defaults to a titleization of thename
(underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).description
: The description for this node. Defaults to''
(the empty string). The description is used by higher-level systems (not by Colander itself).widget
: The ‘widget’ for this node. Defaults toNone
. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.insert_before
: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.
Arbitrary keyword arguments remaining will be attached to the node object unmolested.
- class cowbird.api.schemas.Handlers_GET_BadRequestResponseSchema(*arg, **kw)[source]
Bases:
BaseResponseSchemaAPI
Fundamental building block of schemas.
The constructor accepts these positional arguments:
typ
: The ‘type’ for this node. It should be an instance of a class that implements thecolander.interfaces.Type
interface. Iftyp
is not passed, a call to theschema_type()
method on this class is made to get a default type. (When subclassing,schema_type()
should be overridden to provide a reasonable default type).*children
: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via theadd
method.
The constructor accepts these keyword arguments:
name
: The name of this node.typ
: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.default
: The default serialization value for this node when not set. Ifdefault
iscolander.drop
, the node will be dropped from schema serialization. If not provided, the node will be serialized tocolander.null
.missing
: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker valuecolander.required
, indicating that it is considered ‘required’. Whenmissing
iscolander.required
, therequired
computed attribute will beTrue
. Whenmissing
iscolander.drop
, the node is dropped from the schema if it isn’t set during deserialization.missing_msg
: Optional error message to be used if the value is required and missing.preparer
: Optional preparer for this node. It should be an object that implements thecolander.interfaces.Preparer
interface.validator
: Optional validator for this node. It should be an object that implements thecolander.interfaces.Validator
interface.after_bind
: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of thebind
method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so theafter_bind
methods of the deepest nodes are called before the shallowest. Theafter_bind
callback should accept two values:node
andkw
.node
will be a clone of the bound node object,kw
will be the set of keywords passed to thebind
method.title
: The title of this node. Defaults to a titleization of thename
(underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).description
: The description for this node. Defaults to''
(the empty string). The description is used by higher-level systems (not by Colander itself).widget
: The ‘widget’ for this node. Defaults toNone
. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.insert_before
: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.
Arbitrary keyword arguments remaining will be attached to the node object unmolested.
- class cowbird.api.schemas.Handlers_POST_RequestBodySchema(*arg, **kw)[source]
Bases:
HandlerDetailSchema
Fundamental building block of schemas.
The constructor accepts these positional arguments:
typ
: The ‘type’ for this node. It should be an instance of a class that implements thecolander.interfaces.Type
interface. Iftyp
is not passed, a call to theschema_type()
method on this class is made to get a default type. (When subclassing,schema_type()
should be overridden to provide a reasonable default type).*children
: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via theadd
method.
The constructor accepts these keyword arguments:
name
: The name of this node.typ
: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.default
: The default serialization value for this node when not set. Ifdefault
iscolander.drop
, the node will be dropped from schema serialization. If not provided, the node will be serialized tocolander.null
.missing
: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker valuecolander.required
, indicating that it is considered ‘required’. Whenmissing
iscolander.required
, therequired
computed attribute will beTrue
. Whenmissing
iscolander.drop
, the node is dropped from the schema if it isn’t set during deserialization.missing_msg
: Optional error message to be used if the value is required and missing.preparer
: Optional preparer for this node. It should be an object that implements thecolander.interfaces.Preparer
interface.validator
: Optional validator for this node. It should be an object that implements thecolander.interfaces.Validator
interface.after_bind
: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of thebind
method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so theafter_bind
methods of the deepest nodes are called before the shallowest. Theafter_bind
callback should accept two values:node
andkw
.node
will be a clone of the bound node object,kw
will be the set of keywords passed to thebind
method.title
: The title of this node. Defaults to a titleization of thename
(underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).description
: The description for this node. Defaults to''
(the empty string). The description is used by higher-level systems (not by Colander itself).widget
: The ‘widget’ for this node. Defaults toNone
. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.insert_before
: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.
Arbitrary keyword arguments remaining will be attached to the node object unmolested.
- class cowbird.api.schemas.Handlers_POST_RequestSchema(*arg, **kw)[source]
Bases:
BaseRequestSchemaAPI
Fundamental building block of schemas.
The constructor accepts these positional arguments:
typ
: The ‘type’ for this node. It should be an instance of a class that implements thecolander.interfaces.Type
interface. Iftyp
is not passed, a call to theschema_type()
method on this class is made to get a default type. (When subclassing,schema_type()
should be overridden to provide a reasonable default type).*children
: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via theadd
method.
The constructor accepts these keyword arguments:
name
: The name of this node.typ
: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.default
: The default serialization value for this node when not set. Ifdefault
iscolander.drop
, the node will be dropped from schema serialization. If not provided, the node will be serialized tocolander.null
.missing
: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker valuecolander.required
, indicating that it is considered ‘required’. Whenmissing
iscolander.required
, therequired
computed attribute will beTrue
. Whenmissing
iscolander.drop
, the node is dropped from the schema if it isn’t set during deserialization.missing_msg
: Optional error message to be used if the value is required and missing.preparer
: Optional preparer for this node. It should be an object that implements thecolander.interfaces.Preparer
interface.validator
: Optional validator for this node. It should be an object that implements thecolander.interfaces.Validator
interface.after_bind
: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of thebind
method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so theafter_bind
methods of the deepest nodes are called before the shallowest. Theafter_bind
callback should accept two values:node
andkw
.node
will be a clone of the bound node object,kw
will be the set of keywords passed to thebind
method.title
: The title of this node. Defaults to a titleization of thename
(underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).description
: The description for this node. Defaults to''
(the empty string). The description is used by higher-level systems (not by Colander itself).widget
: The ‘widget’ for this node. Defaults toNone
. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.insert_before
: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.
Arbitrary keyword arguments remaining will be attached to the node object unmolested.
- class cowbird.api.schemas.Handlers_POST_CreatedResponseSchema(*arg, **kw)[source]
Bases:
BaseResponseSchemaAPI
Fundamental building block of schemas.
The constructor accepts these positional arguments:
typ
: The ‘type’ for this node. It should be an instance of a class that implements thecolander.interfaces.Type
interface. Iftyp
is not passed, a call to theschema_type()
method on this class is made to get a default type. (When subclassing,schema_type()
should be overridden to provide a reasonable default type).*children
: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via theadd
method.
The constructor accepts these keyword arguments:
name
: The name of this node.typ
: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.default
: The default serialization value for this node when not set. Ifdefault
iscolander.drop
, the node will be dropped from schema serialization. If not provided, the node will be serialized tocolander.null
.missing
: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker valuecolander.required
, indicating that it is considered ‘required’. Whenmissing
iscolander.required
, therequired
computed attribute will beTrue
. Whenmissing
iscolander.drop
, the node is dropped from the schema if it isn’t set during deserialization.missing_msg
: Optional error message to be used if the value is required and missing.preparer
: Optional preparer for this node. It should be an object that implements thecolander.interfaces.Preparer
interface.validator
: Optional validator for this node. It should be an object that implements thecolander.interfaces.Validator
interface.after_bind
: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of thebind
method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so theafter_bind
methods of the deepest nodes are called before the shallowest. Theafter_bind
callback should accept two values:node
andkw
.node
will be a clone of the bound node object,kw
will be the set of keywords passed to thebind
method.title
: The title of this node. Defaults to a titleization of thename
(underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).description
: The description for this node. Defaults to''
(the empty string). The description is used by higher-level systems (not by Colander itself).widget
: The ‘widget’ for this node. Defaults toNone
. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.insert_before
: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.
Arbitrary keyword arguments remaining will be attached to the node object unmolested.
- class cowbird.api.schemas.Handlers_POST_BadRequestResponseSchema(*arg, **kw)[source]
Bases:
BaseResponseSchemaAPI
Fundamental building block of schemas.
The constructor accepts these positional arguments:
typ
: The ‘type’ for this node. It should be an instance of a class that implements thecolander.interfaces.Type
interface. Iftyp
is not passed, a call to theschema_type()
method on this class is made to get a default type. (When subclassing,schema_type()
should be overridden to provide a reasonable default type).*children
: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via theadd
method.
The constructor accepts these keyword arguments:
name
: The name of this node.typ
: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.default
: The default serialization value for this node when not set. Ifdefault
iscolander.drop
, the node will be dropped from schema serialization. If not provided, the node will be serialized tocolander.null
.missing
: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker valuecolander.required
, indicating that it is considered ‘required’. Whenmissing
iscolander.required
, therequired
computed attribute will beTrue
. Whenmissing
iscolander.drop
, the node is dropped from the schema if it isn’t set during deserialization.missing_msg
: Optional error message to be used if the value is required and missing.preparer
: Optional preparer for this node. It should be an object that implements thecolander.interfaces.Preparer
interface.validator
: Optional validator for this node. It should be an object that implements thecolander.interfaces.Validator
interface.after_bind
: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of thebind
method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so theafter_bind
methods of the deepest nodes are called before the shallowest. Theafter_bind
callback should accept two values:node
andkw
.node
will be a clone of the bound node object,kw
will be the set of keywords passed to thebind
method.title
: The title of this node. Defaults to a titleization of thename
(underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).description
: The description for this node. Defaults to''
(the empty string). The description is used by higher-level systems (not by Colander itself).widget
: The ‘widget’ for this node. Defaults toNone
. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.insert_before
: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.
Arbitrary keyword arguments remaining will be attached to the node object unmolested.
- class cowbird.api.schemas.Handler_SummaryBodyResponseSchema(code: int, description: str, **kw: Any)[source]
Bases:
BaseResponseBodySchema
Fundamental building block of schemas.
The constructor accepts these positional arguments:
typ
: The ‘type’ for this node. It should be an instance of a class that implements thecolander.interfaces.Type
interface. Iftyp
is not passed, a call to theschema_type()
method on this class is made to get a default type. (When subclassing,schema_type()
should be overridden to provide a reasonable default type).*children
: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via theadd
method.
The constructor accepts these keyword arguments:
name
: The name of this node.typ
: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.default
: The default serialization value for this node when not set. Ifdefault
iscolander.drop
, the node will be dropped from schema serialization. If not provided, the node will be serialized tocolander.null
.missing
: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker valuecolander.required
, indicating that it is considered ‘required’. Whenmissing
iscolander.required
, therequired
computed attribute will beTrue
. Whenmissing
iscolander.drop
, the node is dropped from the schema if it isn’t set during deserialization.missing_msg
: Optional error message to be used if the value is required and missing.preparer
: Optional preparer for this node. It should be an object that implements thecolander.interfaces.Preparer
interface.validator
: Optional validator for this node. It should be an object that implements thecolander.interfaces.Validator
interface.after_bind
: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of thebind
method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so theafter_bind
methods of the deepest nodes are called before the shallowest. Theafter_bind
callback should accept two values:node
andkw
.node
will be a clone of the bound node object,kw
will be the set of keywords passed to thebind
method.title
: The title of this node. Defaults to a titleization of thename
(underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).description
: The description for this node. Defaults to''
(the empty string). The description is used by higher-level systems (not by Colander itself).widget
: The ‘widget’ for this node. Defaults toNone
. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.insert_before
: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.
Arbitrary keyword arguments remaining will be attached to the node object unmolested.
- class cowbird.api.schemas.Handler_GET_RequestSchema(*arg, **kw)[source]
Bases:
BaseRequestSchemaAPI
Fundamental building block of schemas.
The constructor accepts these positional arguments:
typ
: The ‘type’ for this node. It should be an instance of a class that implements thecolander.interfaces.Type
interface. Iftyp
is not passed, a call to theschema_type()
method on this class is made to get a default type. (When subclassing,schema_type()
should be overridden to provide a reasonable default type).*children
: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via theadd
method.
The constructor accepts these keyword arguments:
name
: The name of this node.typ
: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.default
: The default serialization value for this node when not set. Ifdefault
iscolander.drop
, the node will be dropped from schema serialization. If not provided, the node will be serialized tocolander.null
.missing
: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker valuecolander.required
, indicating that it is considered ‘required’. Whenmissing
iscolander.required
, therequired
computed attribute will beTrue
. Whenmissing
iscolander.drop
, the node is dropped from the schema if it isn’t set during deserialization.missing_msg
: Optional error message to be used if the value is required and missing.preparer
: Optional preparer for this node. It should be an object that implements thecolander.interfaces.Preparer
interface.validator
: Optional validator for this node. It should be an object that implements thecolander.interfaces.Validator
interface.after_bind
: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of thebind
method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so theafter_bind
methods of the deepest nodes are called before the shallowest. Theafter_bind
callback should accept two values:node
andkw
.node
will be a clone of the bound node object,kw
will be the set of keywords passed to thebind
method.title
: The title of this node. Defaults to a titleization of thename
(underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).description
: The description for this node. Defaults to''
(the empty string). The description is used by higher-level systems (not by Colander itself).widget
: The ‘widget’ for this node. Defaults toNone
. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.insert_before
: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.
Arbitrary keyword arguments remaining will be attached to the node object unmolested.
- class cowbird.api.schemas.Handler_GET_ResponseBodySchema(code: int, description: str, **kw: Any)[source]
Bases:
BaseResponseBodySchema
Fundamental building block of schemas.
The constructor accepts these positional arguments:
typ
: The ‘type’ for this node. It should be an instance of a class that implements thecolander.interfaces.Type
interface. Iftyp
is not passed, a call to theschema_type()
method on this class is made to get a default type. (When subclassing,schema_type()
should be overridden to provide a reasonable default type).*children
: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via theadd
method.
The constructor accepts these keyword arguments:
name
: The name of this node.typ
: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.default
: The default serialization value for this node when not set. Ifdefault
iscolander.drop
, the node will be dropped from schema serialization. If not provided, the node will be serialized tocolander.null
.missing
: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker valuecolander.required
, indicating that it is considered ‘required’. Whenmissing
iscolander.required
, therequired
computed attribute will beTrue
. Whenmissing
iscolander.drop
, the node is dropped from the schema if it isn’t set during deserialization.missing_msg
: Optional error message to be used if the value is required and missing.preparer
: Optional preparer for this node. It should be an object that implements thecolander.interfaces.Preparer
interface.validator
: Optional validator for this node. It should be an object that implements thecolander.interfaces.Validator
interface.after_bind
: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of thebind
method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so theafter_bind
methods of the deepest nodes are called before the shallowest. Theafter_bind
callback should accept two values:node
andkw
.node
will be a clone of the bound node object,kw
will be the set of keywords passed to thebind
method.title
: The title of this node. Defaults to a titleization of thename
(underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).description
: The description for this node. Defaults to''
(the empty string). The description is used by higher-level systems (not by Colander itself).widget
: The ‘widget’ for this node. Defaults toNone
. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.insert_before
: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.
Arbitrary keyword arguments remaining will be attached to the node object unmolested.
- class cowbird.api.schemas.Handler_GET_OkResponseSchema(*arg, **kw)[source]
Bases:
BaseResponseSchemaAPI
Fundamental building block of schemas.
The constructor accepts these positional arguments:
typ
: The ‘type’ for this node. It should be an instance of a class that implements thecolander.interfaces.Type
interface. Iftyp
is not passed, a call to theschema_type()
method on this class is made to get a default type. (When subclassing,schema_type()
should be overridden to provide a reasonable default type).*children
: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via theadd
method.
The constructor accepts these keyword arguments:
name
: The name of this node.typ
: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.default
: The default serialization value for this node when not set. Ifdefault
iscolander.drop
, the node will be dropped from schema serialization. If not provided, the node will be serialized tocolander.null
.missing
: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker valuecolander.required
, indicating that it is considered ‘required’. Whenmissing
iscolander.required
, therequired
computed attribute will beTrue
. Whenmissing
iscolander.drop
, the node is dropped from the schema if it isn’t set during deserialization.missing_msg
: Optional error message to be used if the value is required and missing.preparer
: Optional preparer for this node. It should be an object that implements thecolander.interfaces.Preparer
interface.validator
: Optional validator for this node. It should be an object that implements thecolander.interfaces.Validator
interface.after_bind
: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of thebind
method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so theafter_bind
methods of the deepest nodes are called before the shallowest. Theafter_bind
callback should accept two values:node
andkw
.node
will be a clone of the bound node object,kw
will be the set of keywords passed to thebind
method.title
: The title of this node. Defaults to a titleization of thename
(underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).description
: The description for this node. Defaults to''
(the empty string). The description is used by higher-level systems (not by Colander itself).widget
: The ‘widget’ for this node. Defaults toNone
. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.insert_before
: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.
Arbitrary keyword arguments remaining will be attached to the node object unmolested.
- class cowbird.api.schemas.Handler_Check_NotFoundResponseSchema(*arg, **kw)[source]
Bases:
BaseResponseSchemaAPI
Fundamental building block of schemas.
The constructor accepts these positional arguments:
typ
: The ‘type’ for this node. It should be an instance of a class that implements thecolander.interfaces.Type
interface. Iftyp
is not passed, a call to theschema_type()
method on this class is made to get a default type. (When subclassing,schema_type()
should be overridden to provide a reasonable default type).*children
: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via theadd
method.
The constructor accepts these keyword arguments:
name
: The name of this node.typ
: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.default
: The default serialization value for this node when not set. Ifdefault
iscolander.drop
, the node will be dropped from schema serialization. If not provided, the node will be serialized tocolander.null
.missing
: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker valuecolander.required
, indicating that it is considered ‘required’. Whenmissing
iscolander.required
, therequired
computed attribute will beTrue
. Whenmissing
iscolander.drop
, the node is dropped from the schema if it isn’t set during deserialization.missing_msg
: Optional error message to be used if the value is required and missing.preparer
: Optional preparer for this node. It should be an object that implements thecolander.interfaces.Preparer
interface.validator
: Optional validator for this node. It should be an object that implements thecolander.interfaces.Validator
interface.after_bind
: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of thebind
method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so theafter_bind
methods of the deepest nodes are called before the shallowest. Theafter_bind
callback should accept two values:node
andkw
.node
will be a clone of the bound node object,kw
will be the set of keywords passed to thebind
method.title
: The title of this node. Defaults to a titleization of thename
(underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).description
: The description for this node. Defaults to''
(the empty string). The description is used by higher-level systems (not by Colander itself).widget
: The ‘widget’ for this node. Defaults toNone
. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.insert_before
: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.
Arbitrary keyword arguments remaining will be attached to the node object unmolested.
- class cowbird.api.schemas.HandlerResync_PUT_RequestSchema(*arg, **kw)[source]
Bases:
BaseRequestSchemaAPI
Fundamental building block of schemas.
The constructor accepts these positional arguments:
typ
: The ‘type’ for this node. It should be an instance of a class that implements thecolander.interfaces.Type
interface. Iftyp
is not passed, a call to theschema_type()
method on this class is made to get a default type. (When subclassing,schema_type()
should be overridden to provide a reasonable default type).*children
: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via theadd
method.
The constructor accepts these keyword arguments:
name
: The name of this node.typ
: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.default
: The default serialization value for this node when not set. Ifdefault
iscolander.drop
, the node will be dropped from schema serialization. If not provided, the node will be serialized tocolander.null
.missing
: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker valuecolander.required
, indicating that it is considered ‘required’. Whenmissing
iscolander.required
, therequired
computed attribute will beTrue
. Whenmissing
iscolander.drop
, the node is dropped from the schema if it isn’t set during deserialization.missing_msg
: Optional error message to be used if the value is required and missing.preparer
: Optional preparer for this node. It should be an object that implements thecolander.interfaces.Preparer
interface.validator
: Optional validator for this node. It should be an object that implements thecolander.interfaces.Validator
interface.after_bind
: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of thebind
method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so theafter_bind
methods of the deepest nodes are called before the shallowest. Theafter_bind
callback should accept two values:node
andkw
.node
will be a clone of the bound node object,kw
will be the set of keywords passed to thebind
method.title
: The title of this node. Defaults to a titleization of thename
(underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).description
: The description for this node. Defaults to''
(the empty string). The description is used by higher-level systems (not by Colander itself).widget
: The ‘widget’ for this node. Defaults toNone
. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.insert_before
: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.
Arbitrary keyword arguments remaining will be attached to the node object unmolested.
- class cowbird.api.schemas.HandlerResync_PUT_OkResponseSchema(*arg, **kw)[source]
Bases:
BaseResponseSchemaAPI
Fundamental building block of schemas.
The constructor accepts these positional arguments:
typ
: The ‘type’ for this node. It should be an instance of a class that implements thecolander.interfaces.Type
interface. Iftyp
is not passed, a call to theschema_type()
method on this class is made to get a default type. (When subclassing,schema_type()
should be overridden to provide a reasonable default type).*children
: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via theadd
method.
The constructor accepts these keyword arguments:
name
: The name of this node.typ
: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.default
: The default serialization value for this node when not set. Ifdefault
iscolander.drop
, the node will be dropped from schema serialization. If not provided, the node will be serialized tocolander.null
.missing
: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker valuecolander.required
, indicating that it is considered ‘required’. Whenmissing
iscolander.required
, therequired
computed attribute will beTrue
. Whenmissing
iscolander.drop
, the node is dropped from the schema if it isn’t set during deserialization.missing_msg
: Optional error message to be used if the value is required and missing.preparer
: Optional preparer for this node. It should be an object that implements thecolander.interfaces.Preparer
interface.validator
: Optional validator for this node. It should be an object that implements thecolander.interfaces.Validator
interface.after_bind
: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of thebind
method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so theafter_bind
methods of the deepest nodes are called before the shallowest. Theafter_bind
callback should accept two values:node
andkw
.node
will be a clone of the bound node object,kw
will be the set of keywords passed to thebind
method.title
: The title of this node. Defaults to a titleization of thename
(underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).description
: The description for this node. Defaults to''
(the empty string). The description is used by higher-level systems (not by Colander itself).widget
: The ‘widget’ for this node. Defaults toNone
. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.insert_before
: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.
Arbitrary keyword arguments remaining will be attached to the node object unmolested.
- class cowbird.api.schemas.Handlers_POST_ForbiddenResponseSchema(*arg, **kw)[source]
Bases:
BaseResponseSchemaAPI
Fundamental building block of schemas.
The constructor accepts these positional arguments:
typ
: The ‘type’ for this node. It should be an instance of a class that implements thecolander.interfaces.Type
interface. Iftyp
is not passed, a call to theschema_type()
method on this class is made to get a default type. (When subclassing,schema_type()
should be overridden to provide a reasonable default type).*children
: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via theadd
method.
The constructor accepts these keyword arguments:
name
: The name of this node.typ
: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.default
: The default serialization value for this node when not set. Ifdefault
iscolander.drop
, the node will be dropped from schema serialization. If not provided, the node will be serialized tocolander.null
.missing
: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker valuecolander.required
, indicating that it is considered ‘required’. Whenmissing
iscolander.required
, therequired
computed attribute will beTrue
. Whenmissing
iscolander.drop
, the node is dropped from the schema if it isn’t set during deserialization.missing_msg
: Optional error message to be used if the value is required and missing.preparer
: Optional preparer for this node. It should be an object that implements thecolander.interfaces.Preparer
interface.validator
: Optional validator for this node. It should be an object that implements thecolander.interfaces.Validator
interface.after_bind
: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of thebind
method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so theafter_bind
methods of the deepest nodes are called before the shallowest. Theafter_bind
callback should accept two values:node
andkw
.node
will be a clone of the bound node object,kw
will be the set of keywords passed to thebind
method.title
: The title of this node. Defaults to a titleization of thename
(underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).description
: The description for this node. Defaults to''
(the empty string). The description is used by higher-level systems (not by Colander itself).widget
: The ‘widget’ for this node. Defaults toNone
. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.insert_before
: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.
Arbitrary keyword arguments remaining will be attached to the node object unmolested.
- class cowbird.api.schemas.Handlers_POST_ConflictResponseSchema(*arg, **kw)[source]
Bases:
BaseResponseSchemaAPI
Fundamental building block of schemas.
The constructor accepts these positional arguments:
typ
: The ‘type’ for this node. It should be an instance of a class that implements thecolander.interfaces.Type
interface. Iftyp
is not passed, a call to theschema_type()
method on this class is made to get a default type. (When subclassing,schema_type()
should be overridden to provide a reasonable default type).*children
: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via theadd
method.
The constructor accepts these keyword arguments:
name
: The name of this node.typ
: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.default
: The default serialization value for this node when not set. Ifdefault
iscolander.drop
, the node will be dropped from schema serialization. If not provided, the node will be serialized tocolander.null
.missing
: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker valuecolander.required
, indicating that it is considered ‘required’. Whenmissing
iscolander.required
, therequired
computed attribute will beTrue
. Whenmissing
iscolander.drop
, the node is dropped from the schema if it isn’t set during deserialization.missing_msg
: Optional error message to be used if the value is required and missing.preparer
: Optional preparer for this node. It should be an object that implements thecolander.interfaces.Preparer
interface.validator
: Optional validator for this node. It should be an object that implements thecolander.interfaces.Validator
interface.after_bind
: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of thebind
method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so theafter_bind
methods of the deepest nodes are called before the shallowest. Theafter_bind
callback should accept two values:node
andkw
.node
will be a clone of the bound node object,kw
will be the set of keywords passed to thebind
method.title
: The title of this node. Defaults to a titleization of thename
(underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).description
: The description for this node. Defaults to''
(the empty string). The description is used by higher-level systems (not by Colander itself).widget
: The ‘widget’ for this node. Defaults toNone
. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.insert_before
: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.
Arbitrary keyword arguments remaining will be attached to the node object unmolested.
- class cowbird.api.schemas.Handlers_POST_UnprocessableEntityResponseSchema(*arg, **kw)[source]
Bases:
BaseResponseSchemaAPI
Fundamental building block of schemas.
The constructor accepts these positional arguments:
typ
: The ‘type’ for this node. It should be an instance of a class that implements thecolander.interfaces.Type
interface. Iftyp
is not passed, a call to theschema_type()
method on this class is made to get a default type. (When subclassing,schema_type()
should be overridden to provide a reasonable default type).*children
: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via theadd
method.
The constructor accepts these keyword arguments:
name
: The name of this node.typ
: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.default
: The default serialization value for this node when not set. Ifdefault
iscolander.drop
, the node will be dropped from schema serialization. If not provided, the node will be serialized tocolander.null
.missing
: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker valuecolander.required
, indicating that it is considered ‘required’. Whenmissing
iscolander.required
, therequired
computed attribute will beTrue
. Whenmissing
iscolander.drop
, the node is dropped from the schema if it isn’t set during deserialization.missing_msg
: Optional error message to be used if the value is required and missing.preparer
: Optional preparer for this node. It should be an object that implements thecolander.interfaces.Preparer
interface.validator
: Optional validator for this node. It should be an object that implements thecolander.interfaces.Validator
interface.after_bind
: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of thebind
method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so theafter_bind
methods of the deepest nodes are called before the shallowest. Theafter_bind
callback should accept two values:node
andkw
.node
will be a clone of the bound node object,kw
will be the set of keywords passed to thebind
method.title
: The title of this node. Defaults to a titleization of thename
(underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).description
: The description for this node. Defaults to''
(the empty string). The description is used by higher-level systems (not by Colander itself).widget
: The ‘widget’ for this node. Defaults toNone
. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.insert_before
: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.
Arbitrary keyword arguments remaining will be attached to the node object unmolested.
- class cowbird.api.schemas.Handlers_POST_InternalServerErrorResponseSchema(*arg, **kw)[source]
Bases:
BaseResponseSchemaAPI
Fundamental building block of schemas.
The constructor accepts these positional arguments:
typ
: The ‘type’ for this node. It should be an instance of a class that implements thecolander.interfaces.Type
interface. Iftyp
is not passed, a call to theschema_type()
method on this class is made to get a default type. (When subclassing,schema_type()
should be overridden to provide a reasonable default type).*children
: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via theadd
method.
The constructor accepts these keyword arguments:
name
: The name of this node.typ
: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.default
: The default serialization value for this node when not set. Ifdefault
iscolander.drop
, the node will be dropped from schema serialization. If not provided, the node will be serialized tocolander.null
.missing
: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker valuecolander.required
, indicating that it is considered ‘required’. Whenmissing
iscolander.required
, therequired
computed attribute will beTrue
. Whenmissing
iscolander.drop
, the node is dropped from the schema if it isn’t set during deserialization.missing_msg
: Optional error message to be used if the value is required and missing.preparer
: Optional preparer for this node. It should be an object that implements thecolander.interfaces.Preparer
interface.validator
: Optional validator for this node. It should be an object that implements thecolander.interfaces.Validator
interface.after_bind
: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of thebind
method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so theafter_bind
methods of the deepest nodes are called before the shallowest. Theafter_bind
callback should accept two values:node
andkw
.node
will be a clone of the bound node object,kw
will be the set of keywords passed to thebind
method.title
: The title of this node. Defaults to a titleization of thename
(underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).description
: The description for this node. Defaults to''
(the empty string). The description is used by higher-level systems (not by Colander itself).widget
: The ‘widget’ for this node. Defaults toNone
. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.insert_before
: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.
Arbitrary keyword arguments remaining will be attached to the node object unmolested.
- class cowbird.api.schemas.Handler_PATCH_RequestBodySchema(*arg, **kw)[source]
Bases:
HandlerDetailSchema
Fundamental building block of schemas.
The constructor accepts these positional arguments:
typ
: The ‘type’ for this node. It should be an instance of a class that implements thecolander.interfaces.Type
interface. Iftyp
is not passed, a call to theschema_type()
method on this class is made to get a default type. (When subclassing,schema_type()
should be overridden to provide a reasonable default type).*children
: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via theadd
method.
The constructor accepts these keyword arguments:
name
: The name of this node.typ
: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.default
: The default serialization value for this node when not set. Ifdefault
iscolander.drop
, the node will be dropped from schema serialization. If not provided, the node will be serialized tocolander.null
.missing
: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker valuecolander.required
, indicating that it is considered ‘required’. Whenmissing
iscolander.required
, therequired
computed attribute will beTrue
. Whenmissing
iscolander.drop
, the node is dropped from the schema if it isn’t set during deserialization.missing_msg
: Optional error message to be used if the value is required and missing.preparer
: Optional preparer for this node. It should be an object that implements thecolander.interfaces.Preparer
interface.validator
: Optional validator for this node. It should be an object that implements thecolander.interfaces.Validator
interface.after_bind
: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of thebind
method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so theafter_bind
methods of the deepest nodes are called before the shallowest. Theafter_bind
callback should accept two values:node
andkw
.node
will be a clone of the bound node object,kw
will be the set of keywords passed to thebind
method.title
: The title of this node. Defaults to a titleization of thename
(underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).description
: The description for this node. Defaults to''
(the empty string). The description is used by higher-level systems (not by Colander itself).widget
: The ‘widget’ for this node. Defaults toNone
. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.insert_before
: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.
Arbitrary keyword arguments remaining will be attached to the node object unmolested.
- class cowbird.api.schemas.Handler_PATCH_RequestSchema(*arg, **kw)[source]
Bases:
BaseRequestSchemaAPI
Fundamental building block of schemas.
The constructor accepts these positional arguments:
typ
: The ‘type’ for this node. It should be an instance of a class that implements thecolander.interfaces.Type
interface. Iftyp
is not passed, a call to theschema_type()
method on this class is made to get a default type. (When subclassing,schema_type()
should be overridden to provide a reasonable default type).*children
: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via theadd
method.
The constructor accepts these keyword arguments:
name
: The name of this node.typ
: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.default
: The default serialization value for this node when not set. Ifdefault
iscolander.drop
, the node will be dropped from schema serialization. If not provided, the node will be serialized tocolander.null
.missing
: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker valuecolander.required
, indicating that it is considered ‘required’. Whenmissing
iscolander.required
, therequired
computed attribute will beTrue
. Whenmissing
iscolander.drop
, the node is dropped from the schema if it isn’t set during deserialization.missing_msg
: Optional error message to be used if the value is required and missing.preparer
: Optional preparer for this node. It should be an object that implements thecolander.interfaces.Preparer
interface.validator
: Optional validator for this node. It should be an object that implements thecolander.interfaces.Validator
interface.after_bind
: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of thebind
method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so theafter_bind
methods of the deepest nodes are called before the shallowest. Theafter_bind
callback should accept two values:node
andkw
.node
will be a clone of the bound node object,kw
will be the set of keywords passed to thebind
method.title
: The title of this node. Defaults to a titleization of thename
(underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).description
: The description for this node. Defaults to''
(the empty string). The description is used by higher-level systems (not by Colander itself).widget
: The ‘widget’ for this node. Defaults toNone
. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.insert_before
: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.
Arbitrary keyword arguments remaining will be attached to the node object unmolested.
- class cowbird.api.schemas.Handler_PATCH_ResponseBodySchema(code: int, description: str, **kw: Any)[source]
Bases:
Handler_GET_ResponseBodySchema
Fundamental building block of schemas.
The constructor accepts these positional arguments:
typ
: The ‘type’ for this node. It should be an instance of a class that implements thecolander.interfaces.Type
interface. Iftyp
is not passed, a call to theschema_type()
method on this class is made to get a default type. (When subclassing,schema_type()
should be overridden to provide a reasonable default type).*children
: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via theadd
method.
The constructor accepts these keyword arguments:
name
: The name of this node.typ
: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.default
: The default serialization value for this node when not set. Ifdefault
iscolander.drop
, the node will be dropped from schema serialization. If not provided, the node will be serialized tocolander.null
.missing
: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker valuecolander.required
, indicating that it is considered ‘required’. Whenmissing
iscolander.required
, therequired
computed attribute will beTrue
. Whenmissing
iscolander.drop
, the node is dropped from the schema if it isn’t set during deserialization.missing_msg
: Optional error message to be used if the value is required and missing.preparer
: Optional preparer for this node. It should be an object that implements thecolander.interfaces.Preparer
interface.validator
: Optional validator for this node. It should be an object that implements thecolander.interfaces.Validator
interface.after_bind
: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of thebind
method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so theafter_bind
methods of the deepest nodes are called before the shallowest. Theafter_bind
callback should accept two values:node
andkw
.node
will be a clone of the bound node object,kw
will be the set of keywords passed to thebind
method.title
: The title of this node. Defaults to a titleization of thename
(underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).description
: The description for this node. Defaults to''
(the empty string). The description is used by higher-level systems (not by Colander itself).widget
: The ‘widget’ for this node. Defaults toNone
. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.insert_before
: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.
Arbitrary keyword arguments remaining will be attached to the node object unmolested.
- class cowbird.api.schemas.Handler_PATCH_OkResponseSchema(*arg, **kw)[source]
Bases:
BaseResponseSchemaAPI
Fundamental building block of schemas.
The constructor accepts these positional arguments:
typ
: The ‘type’ for this node. It should be an instance of a class that implements thecolander.interfaces.Type
interface. Iftyp
is not passed, a call to theschema_type()
method on this class is made to get a default type. (When subclassing,schema_type()
should be overridden to provide a reasonable default type).*children
: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via theadd
method.
The constructor accepts these keyword arguments:
name
: The name of this node.typ
: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.default
: The default serialization value for this node when not set. Ifdefault
iscolander.drop
, the node will be dropped from schema serialization. If not provided, the node will be serialized tocolander.null
.missing
: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker valuecolander.required
, indicating that it is considered ‘required’. Whenmissing
iscolander.required
, therequired
computed attribute will beTrue
. Whenmissing
iscolander.drop
, the node is dropped from the schema if it isn’t set during deserialization.missing_msg
: Optional error message to be used if the value is required and missing.preparer
: Optional preparer for this node. It should be an object that implements thecolander.interfaces.Preparer
interface.validator
: Optional validator for this node. It should be an object that implements thecolander.interfaces.Validator
interface.after_bind
: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of thebind
method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so theafter_bind
methods of the deepest nodes are called before the shallowest. Theafter_bind
callback should accept two values:node
andkw
.node
will be a clone of the bound node object,kw
will be the set of keywords passed to thebind
method.title
: The title of this node. Defaults to a titleization of thename
(underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).description
: The description for this node. Defaults to''
(the empty string). The description is used by higher-level systems (not by Colander itself).widget
: The ‘widget’ for this node. Defaults toNone
. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.insert_before
: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.
Arbitrary keyword arguments remaining will be attached to the node object unmolested.
- class cowbird.api.schemas.Handler_PATCH_BadRequestResponseSchema(*arg, **kw)[source]
Bases:
BaseResponseSchemaAPI
Fundamental building block of schemas.
The constructor accepts these positional arguments:
typ
: The ‘type’ for this node. It should be an instance of a class that implements thecolander.interfaces.Type
interface. Iftyp
is not passed, a call to theschema_type()
method on this class is made to get a default type. (When subclassing,schema_type()
should be overridden to provide a reasonable default type).*children
: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via theadd
method.
The constructor accepts these keyword arguments:
name
: The name of this node.typ
: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.default
: The default serialization value for this node when not set. Ifdefault
iscolander.drop
, the node will be dropped from schema serialization. If not provided, the node will be serialized tocolander.null
.missing
: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker valuecolander.required
, indicating that it is considered ‘required’. Whenmissing
iscolander.required
, therequired
computed attribute will beTrue
. Whenmissing
iscolander.drop
, the node is dropped from the schema if it isn’t set during deserialization.missing_msg
: Optional error message to be used if the value is required and missing.preparer
: Optional preparer for this node. It should be an object that implements thecolander.interfaces.Preparer
interface.validator
: Optional validator for this node. It should be an object that implements thecolander.interfaces.Validator
interface.after_bind
: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of thebind
method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so theafter_bind
methods of the deepest nodes are called before the shallowest. Theafter_bind
callback should accept two values:node
andkw
.node
will be a clone of the bound node object,kw
will be the set of keywords passed to thebind
method.title
: The title of this node. Defaults to a titleization of thename
(underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).description
: The description for this node. Defaults to''
(the empty string). The description is used by higher-level systems (not by Colander itself).widget
: The ‘widget’ for this node. Defaults toNone
. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.insert_before
: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.
Arbitrary keyword arguments remaining will be attached to the node object unmolested.
- class cowbird.api.schemas.Handler_PATCH_ForbiddenResponseSchema_ReservedKeyword(*arg, **kw)[source]
Bases:
BaseResponseSchemaAPI
Fundamental building block of schemas.
The constructor accepts these positional arguments:
typ
: The ‘type’ for this node. It should be an instance of a class that implements thecolander.interfaces.Type
interface. Iftyp
is not passed, a call to theschema_type()
method on this class is made to get a default type. (When subclassing,schema_type()
should be overridden to provide a reasonable default type).*children
: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via theadd
method.
The constructor accepts these keyword arguments:
name
: The name of this node.typ
: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.default
: The default serialization value for this node when not set. Ifdefault
iscolander.drop
, the node will be dropped from schema serialization. If not provided, the node will be serialized tocolander.null
.missing
: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker valuecolander.required
, indicating that it is considered ‘required’. Whenmissing
iscolander.required
, therequired
computed attribute will beTrue
. Whenmissing
iscolander.drop
, the node is dropped from the schema if it isn’t set during deserialization.missing_msg
: Optional error message to be used if the value is required and missing.preparer
: Optional preparer for this node. It should be an object that implements thecolander.interfaces.Preparer
interface.validator
: Optional validator for this node. It should be an object that implements thecolander.interfaces.Validator
interface.after_bind
: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of thebind
method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so theafter_bind
methods of the deepest nodes are called before the shallowest. Theafter_bind
callback should accept two values:node
andkw
.node
will be a clone of the bound node object,kw
will be the set of keywords passed to thebind
method.title
: The title of this node. Defaults to a titleization of thename
(underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).description
: The description for this node. Defaults to''
(the empty string). The description is used by higher-level systems (not by Colander itself).widget
: The ‘widget’ for this node. Defaults toNone
. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.insert_before
: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.
Arbitrary keyword arguments remaining will be attached to the node object unmolested.
- class cowbird.api.schemas.Handler_PATCH_ForbiddenResponseSchema(*arg, **kw)[source]
Bases:
BaseResponseSchemaAPI
Fundamental building block of schemas.
The constructor accepts these positional arguments:
typ
: The ‘type’ for this node. It should be an instance of a class that implements thecolander.interfaces.Type
interface. Iftyp
is not passed, a call to theschema_type()
method on this class is made to get a default type. (When subclassing,schema_type()
should be overridden to provide a reasonable default type).*children
: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via theadd
method.
The constructor accepts these keyword arguments:
name
: The name of this node.typ
: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.default
: The default serialization value for this node when not set. Ifdefault
iscolander.drop
, the node will be dropped from schema serialization. If not provided, the node will be serialized tocolander.null
.missing
: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker valuecolander.required
, indicating that it is considered ‘required’. Whenmissing
iscolander.required
, therequired
computed attribute will beTrue
. Whenmissing
iscolander.drop
, the node is dropped from the schema if it isn’t set during deserialization.missing_msg
: Optional error message to be used if the value is required and missing.preparer
: Optional preparer for this node. It should be an object that implements thecolander.interfaces.Preparer
interface.validator
: Optional validator for this node. It should be an object that implements thecolander.interfaces.Validator
interface.after_bind
: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of thebind
method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so theafter_bind
methods of the deepest nodes are called before the shallowest. Theafter_bind
callback should accept two values:node
andkw
.node
will be a clone of the bound node object,kw
will be the set of keywords passed to thebind
method.title
: The title of this node. Defaults to a titleization of thename
(underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).description
: The description for this node. Defaults to''
(the empty string). The description is used by higher-level systems (not by Colander itself).widget
: The ‘widget’ for this node. Defaults toNone
. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.insert_before
: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.
Arbitrary keyword arguments remaining will be attached to the node object unmolested.
- class cowbird.api.schemas.Handler_PATCH_UnprocessableEntityResponseSchema(*arg, **kw)[source]
Bases:
Handlers_POST_UnprocessableEntityResponseSchema
Fundamental building block of schemas.
The constructor accepts these positional arguments:
typ
: The ‘type’ for this node. It should be an instance of a class that implements thecolander.interfaces.Type
interface. Iftyp
is not passed, a call to theschema_type()
method on this class is made to get a default type. (When subclassing,schema_type()
should be overridden to provide a reasonable default type).*children
: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via theadd
method.
The constructor accepts these keyword arguments:
name
: The name of this node.typ
: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.default
: The default serialization value for this node when not set. Ifdefault
iscolander.drop
, the node will be dropped from schema serialization. If not provided, the node will be serialized tocolander.null
.missing
: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker valuecolander.required
, indicating that it is considered ‘required’. Whenmissing
iscolander.required
, therequired
computed attribute will beTrue
. Whenmissing
iscolander.drop
, the node is dropped from the schema if it isn’t set during deserialization.missing_msg
: Optional error message to be used if the value is required and missing.preparer
: Optional preparer for this node. It should be an object that implements thecolander.interfaces.Preparer
interface.validator
: Optional validator for this node. It should be an object that implements thecolander.interfaces.Validator
interface.after_bind
: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of thebind
method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so theafter_bind
methods of the deepest nodes are called before the shallowest. Theafter_bind
callback should accept two values:node
andkw
.node
will be a clone of the bound node object,kw
will be the set of keywords passed to thebind
method.title
: The title of this node. Defaults to a titleization of thename
(underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).description
: The description for this node. Defaults to''
(the empty string). The description is used by higher-level systems (not by Colander itself).widget
: The ‘widget’ for this node. Defaults toNone
. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.insert_before
: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.
Arbitrary keyword arguments remaining will be attached to the node object unmolested.
- class cowbird.api.schemas.UserWebhook_POST_RequestBodySchema(*arg, **kw)[source]
Bases:
colander.MappingSchema
Fundamental building block of schemas.
The constructor accepts these positional arguments:
typ
: The ‘type’ for this node. It should be an instance of a class that implements thecolander.interfaces.Type
interface. Iftyp
is not passed, a call to theschema_type()
method on this class is made to get a default type. (When subclassing,schema_type()
should be overridden to provide a reasonable default type).*children
: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via theadd
method.
The constructor accepts these keyword arguments:
name
: The name of this node.typ
: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.default
: The default serialization value for this node when not set. Ifdefault
iscolander.drop
, the node will be dropped from schema serialization. If not provided, the node will be serialized tocolander.null
.missing
: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker valuecolander.required
, indicating that it is considered ‘required’. Whenmissing
iscolander.required
, therequired
computed attribute will beTrue
. Whenmissing
iscolander.drop
, the node is dropped from the schema if it isn’t set during deserialization.missing_msg
: Optional error message to be used if the value is required and missing.preparer
: Optional preparer for this node. It should be an object that implements thecolander.interfaces.Preparer
interface.validator
: Optional validator for this node. It should be an object that implements thecolander.interfaces.Validator
interface.after_bind
: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of thebind
method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so theafter_bind
methods of the deepest nodes are called before the shallowest. Theafter_bind
callback should accept two values:node
andkw
.node
will be a clone of the bound node object,kw
will be the set of keywords passed to thebind
method.title
: The title of this node. Defaults to a titleization of thename
(underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).description
: The description for this node. Defaults to''
(the empty string). The description is used by higher-level systems (not by Colander itself).widget
: The ‘widget’ for this node. Defaults toNone
. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.insert_before
: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.
Arbitrary keyword arguments remaining will be attached to the node object unmolested.
- class cowbird.api.schemas.UserWebhook_POST_RequestSchema(*arg, **kw)[source]
Bases:
BaseRequestSchemaAPI
Fundamental building block of schemas.
The constructor accepts these positional arguments:
typ
: The ‘type’ for this node. It should be an instance of a class that implements thecolander.interfaces.Type
interface. Iftyp
is not passed, a call to theschema_type()
method on this class is made to get a default type. (When subclassing,schema_type()
should be overridden to provide a reasonable default type).*children
: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via theadd
method.
The constructor accepts these keyword arguments:
name
: The name of this node.typ
: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.default
: The default serialization value for this node when not set. Ifdefault
iscolander.drop
, the node will be dropped from schema serialization. If not provided, the node will be serialized tocolander.null
.missing
: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker valuecolander.required
, indicating that it is considered ‘required’. Whenmissing
iscolander.required
, therequired
computed attribute will beTrue
. Whenmissing
iscolander.drop
, the node is dropped from the schema if it isn’t set during deserialization.missing_msg
: Optional error message to be used if the value is required and missing.preparer
: Optional preparer for this node. It should be an object that implements thecolander.interfaces.Preparer
interface.validator
: Optional validator for this node. It should be an object that implements thecolander.interfaces.Validator
interface.after_bind
: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of thebind
method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so theafter_bind
methods of the deepest nodes are called before the shallowest. Theafter_bind
callback should accept two values:node
andkw
.node
will be a clone of the bound node object,kw
will be the set of keywords passed to thebind
method.title
: The title of this node. Defaults to a titleization of thename
(underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).description
: The description for this node. Defaults to''
(the empty string). The description is used by higher-level systems (not by Colander itself).widget
: The ‘widget’ for this node. Defaults toNone
. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.insert_before
: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.
Arbitrary keyword arguments remaining will be attached to the node object unmolested.
- class cowbird.api.schemas.UserWebhook_POST_BadRequestResponseSchema(*arg, **kw)[source]
Bases:
BaseResponseSchemaAPI
Fundamental building block of schemas.
The constructor accepts these positional arguments:
typ
: The ‘type’ for this node. It should be an instance of a class that implements thecolander.interfaces.Type
interface. Iftyp
is not passed, a call to theschema_type()
method on this class is made to get a default type. (When subclassing,schema_type()
should be overridden to provide a reasonable default type).*children
: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via theadd
method.
The constructor accepts these keyword arguments:
name
: The name of this node.typ
: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.default
: The default serialization value for this node when not set. Ifdefault
iscolander.drop
, the node will be dropped from schema serialization. If not provided, the node will be serialized tocolander.null
.missing
: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker valuecolander.required
, indicating that it is considered ‘required’. Whenmissing
iscolander.required
, therequired
computed attribute will beTrue
. Whenmissing
iscolander.drop
, the node is dropped from the schema if it isn’t set during deserialization.missing_msg
: Optional error message to be used if the value is required and missing.preparer
: Optional preparer for this node. It should be an object that implements thecolander.interfaces.Preparer
interface.validator
: Optional validator for this node. It should be an object that implements thecolander.interfaces.Validator
interface.after_bind
: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of thebind
method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so theafter_bind
methods of the deepest nodes are called before the shallowest. Theafter_bind
callback should accept two values:node
andkw
.node
will be a clone of the bound node object,kw
will be the set of keywords passed to thebind
method.title
: The title of this node. Defaults to a titleization of thename
(underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).description
: The description for this node. Defaults to''
(the empty string). The description is used by higher-level systems (not by Colander itself).widget
: The ‘widget’ for this node. Defaults toNone
. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.insert_before
: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.
Arbitrary keyword arguments remaining will be attached to the node object unmolested.
- class cowbird.api.schemas.UserWebhook_POST_OkResponseSchema(*arg, **kw)[source]
Bases:
BaseResponseSchemaAPI
Fundamental building block of schemas.
The constructor accepts these positional arguments:
typ
: The ‘type’ for this node. It should be an instance of a class that implements thecolander.interfaces.Type
interface. Iftyp
is not passed, a call to theschema_type()
method on this class is made to get a default type. (When subclassing,schema_type()
should be overridden to provide a reasonable default type).*children
: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via theadd
method.
The constructor accepts these keyword arguments:
name
: The name of this node.typ
: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.default
: The default serialization value for this node when not set. Ifdefault
iscolander.drop
, the node will be dropped from schema serialization. If not provided, the node will be serialized tocolander.null
.missing
: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker valuecolander.required
, indicating that it is considered ‘required’. Whenmissing
iscolander.required
, therequired
computed attribute will beTrue
. Whenmissing
iscolander.drop
, the node is dropped from the schema if it isn’t set during deserialization.missing_msg
: Optional error message to be used if the value is required and missing.preparer
: Optional preparer for this node. It should be an object that implements thecolander.interfaces.Preparer
interface.validator
: Optional validator for this node. It should be an object that implements thecolander.interfaces.Validator
interface.after_bind
: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of thebind
method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so theafter_bind
methods of the deepest nodes are called before the shallowest. Theafter_bind
callback should accept two values:node
andkw
.node
will be a clone of the bound node object,kw
will be the set of keywords passed to thebind
method.title
: The title of this node. Defaults to a titleization of thename
(underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).description
: The description for this node. Defaults to''
(the empty string). The description is used by higher-level systems (not by Colander itself).widget
: The ‘widget’ for this node. Defaults toNone
. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.insert_before
: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.
Arbitrary keyword arguments remaining will be attached to the node object unmolested.
- class cowbird.api.schemas.UserWebhook_POST_InternalServerErrorResponseSchema(*arg, **kw)[source]
Bases:
BaseResponseSchemaAPI
Fundamental building block of schemas.
The constructor accepts these positional arguments:
typ
: The ‘type’ for this node. It should be an instance of a class that implements thecolander.interfaces.Type
interface. Iftyp
is not passed, a call to theschema_type()
method on this class is made to get a default type. (When subclassing,schema_type()
should be overridden to provide a reasonable default type).*children
: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via theadd
method.
The constructor accepts these keyword arguments:
name
: The name of this node.typ
: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.default
: The default serialization value for this node when not set. Ifdefault
iscolander.drop
, the node will be dropped from schema serialization. If not provided, the node will be serialized tocolander.null
.missing
: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker valuecolander.required
, indicating that it is considered ‘required’. Whenmissing
iscolander.required
, therequired
computed attribute will beTrue
. Whenmissing
iscolander.drop
, the node is dropped from the schema if it isn’t set during deserialization.missing_msg
: Optional error message to be used if the value is required and missing.preparer
: Optional preparer for this node. It should be an object that implements thecolander.interfaces.Preparer
interface.validator
: Optional validator for this node. It should be an object that implements thecolander.interfaces.Validator
interface.after_bind
: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of thebind
method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so theafter_bind
methods of the deepest nodes are called before the shallowest. Theafter_bind
callback should accept two values:node
andkw
.node
will be a clone of the bound node object,kw
will be the set of keywords passed to thebind
method.title
: The title of this node. Defaults to a titleization of thename
(underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).description
: The description for this node. Defaults to''
(the empty string). The description is used by higher-level systems (not by Colander itself).widget
: The ‘widget’ for this node. Defaults toNone
. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.insert_before
: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.
Arbitrary keyword arguments remaining will be attached to the node object unmolested.
- class cowbird.api.schemas.PermissionWebhook_POST_RequestBodySchema(*arg, **kw)[source]
Bases:
colander.MappingSchema
Fundamental building block of schemas.
The constructor accepts these positional arguments:
typ
: The ‘type’ for this node. It should be an instance of a class that implements thecolander.interfaces.Type
interface. Iftyp
is not passed, a call to theschema_type()
method on this class is made to get a default type. (When subclassing,schema_type()
should be overridden to provide a reasonable default type).*children
: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via theadd
method.
The constructor accepts these keyword arguments:
name
: The name of this node.typ
: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.default
: The default serialization value for this node when not set. Ifdefault
iscolander.drop
, the node will be dropped from schema serialization. If not provided, the node will be serialized tocolander.null
.missing
: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker valuecolander.required
, indicating that it is considered ‘required’. Whenmissing
iscolander.required
, therequired
computed attribute will beTrue
. Whenmissing
iscolander.drop
, the node is dropped from the schema if it isn’t set during deserialization.missing_msg
: Optional error message to be used if the value is required and missing.preparer
: Optional preparer for this node. It should be an object that implements thecolander.interfaces.Preparer
interface.validator
: Optional validator for this node. It should be an object that implements thecolander.interfaces.Validator
interface.after_bind
: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of thebind
method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so theafter_bind
methods of the deepest nodes are called before the shallowest. Theafter_bind
callback should accept two values:node
andkw
.node
will be a clone of the bound node object,kw
will be the set of keywords passed to thebind
method.title
: The title of this node. Defaults to a titleization of thename
(underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).description
: The description for this node. Defaults to''
(the empty string). The description is used by higher-level systems (not by Colander itself).widget
: The ‘widget’ for this node. Defaults toNone
. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.insert_before
: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.
Arbitrary keyword arguments remaining will be attached to the node object unmolested.
- class cowbird.api.schemas.PermissionWebhook_POST_RequestSchema(*arg, **kw)[source]
Bases:
BaseRequestSchemaAPI
Fundamental building block of schemas.
The constructor accepts these positional arguments:
typ
: The ‘type’ for this node. It should be an instance of a class that implements thecolander.interfaces.Type
interface. Iftyp
is not passed, a call to theschema_type()
method on this class is made to get a default type. (When subclassing,schema_type()
should be overridden to provide a reasonable default type).*children
: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via theadd
method.
The constructor accepts these keyword arguments:
name
: The name of this node.typ
: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.default
: The default serialization value for this node when not set. Ifdefault
iscolander.drop
, the node will be dropped from schema serialization. If not provided, the node will be serialized tocolander.null
.missing
: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker valuecolander.required
, indicating that it is considered ‘required’. Whenmissing
iscolander.required
, therequired
computed attribute will beTrue
. Whenmissing
iscolander.drop
, the node is dropped from the schema if it isn’t set during deserialization.missing_msg
: Optional error message to be used if the value is required and missing.preparer
: Optional preparer for this node. It should be an object that implements thecolander.interfaces.Preparer
interface.validator
: Optional validator for this node. It should be an object that implements thecolander.interfaces.Validator
interface.after_bind
: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of thebind
method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so theafter_bind
methods of the deepest nodes are called before the shallowest. Theafter_bind
callback should accept two values:node
andkw
.node
will be a clone of the bound node object,kw
will be the set of keywords passed to thebind
method.title
: The title of this node. Defaults to a titleization of thename
(underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).description
: The description for this node. Defaults to''
(the empty string). The description is used by higher-level systems (not by Colander itself).widget
: The ‘widget’ for this node. Defaults toNone
. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.insert_before
: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.
Arbitrary keyword arguments remaining will be attached to the node object unmolested.
- class cowbird.api.schemas.PermissionWebhook_POST_BadRequestResponseSchema(*arg, **kw)[source]
Bases:
BaseResponseSchemaAPI
Fundamental building block of schemas.
The constructor accepts these positional arguments:
typ
: The ‘type’ for this node. It should be an instance of a class that implements thecolander.interfaces.Type
interface. Iftyp
is not passed, a call to theschema_type()
method on this class is made to get a default type. (When subclassing,schema_type()
should be overridden to provide a reasonable default type).*children
: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via theadd
method.
The constructor accepts these keyword arguments:
name
: The name of this node.typ
: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.default
: The default serialization value for this node when not set. Ifdefault
iscolander.drop
, the node will be dropped from schema serialization. If not provided, the node will be serialized tocolander.null
.missing
: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker valuecolander.required
, indicating that it is considered ‘required’. Whenmissing
iscolander.required
, therequired
computed attribute will beTrue
. Whenmissing
iscolander.drop
, the node is dropped from the schema if it isn’t set during deserialization.missing_msg
: Optional error message to be used if the value is required and missing.preparer
: Optional preparer for this node. It should be an object that implements thecolander.interfaces.Preparer
interface.validator
: Optional validator for this node. It should be an object that implements thecolander.interfaces.Validator
interface.after_bind
: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of thebind
method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so theafter_bind
methods of the deepest nodes are called before the shallowest. Theafter_bind
callback should accept two values:node
andkw
.node
will be a clone of the bound node object,kw
will be the set of keywords passed to thebind
method.title
: The title of this node. Defaults to a titleization of thename
(underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).description
: The description for this node. Defaults to''
(the empty string). The description is used by higher-level systems (not by Colander itself).widget
: The ‘widget’ for this node. Defaults toNone
. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.insert_before
: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.
Arbitrary keyword arguments remaining will be attached to the node object unmolested.
- class cowbird.api.schemas.PermissionWebhook_POST_OkResponseSchema(*arg, **kw)[source]
Bases:
BaseResponseSchemaAPI
Fundamental building block of schemas.
The constructor accepts these positional arguments:
typ
: The ‘type’ for this node. It should be an instance of a class that implements thecolander.interfaces.Type
interface. Iftyp
is not passed, a call to theschema_type()
method on this class is made to get a default type. (When subclassing,schema_type()
should be overridden to provide a reasonable default type).*children
: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via theadd
method.
The constructor accepts these keyword arguments:
name
: The name of this node.typ
: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.default
: The default serialization value for this node when not set. Ifdefault
iscolander.drop
, the node will be dropped from schema serialization. If not provided, the node will be serialized tocolander.null
.missing
: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker valuecolander.required
, indicating that it is considered ‘required’. Whenmissing
iscolander.required
, therequired
computed attribute will beTrue
. Whenmissing
iscolander.drop
, the node is dropped from the schema if it isn’t set during deserialization.missing_msg
: Optional error message to be used if the value is required and missing.preparer
: Optional preparer for this node. It should be an object that implements thecolander.interfaces.Preparer
interface.validator
: Optional validator for this node. It should be an object that implements thecolander.interfaces.Validator
interface.after_bind
: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of thebind
method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so theafter_bind
methods of the deepest nodes are called before the shallowest. Theafter_bind
callback should accept two values:node
andkw
.node
will be a clone of the bound node object,kw
will be the set of keywords passed to thebind
method.title
: The title of this node. Defaults to a titleization of thename
(underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).description
: The description for this node. Defaults to''
(the empty string). The description is used by higher-level systems (not by Colander itself).widget
: The ‘widget’ for this node. Defaults toNone
. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.insert_before
: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.
Arbitrary keyword arguments remaining will be attached to the node object unmolested.
- class cowbird.api.schemas.Version_GET_ResponseBodySchema(code: int, description: str, **kw: Any)[source]
Bases:
BaseResponseBodySchema
Fundamental building block of schemas.
The constructor accepts these positional arguments:
typ
: The ‘type’ for this node. It should be an instance of a class that implements thecolander.interfaces.Type
interface. Iftyp
is not passed, a call to theschema_type()
method on this class is made to get a default type. (When subclassing,schema_type()
should be overridden to provide a reasonable default type).*children
: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via theadd
method.
The constructor accepts these keyword arguments:
name
: The name of this node.typ
: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.default
: The default serialization value for this node when not set. Ifdefault
iscolander.drop
, the node will be dropped from schema serialization. If not provided, the node will be serialized tocolander.null
.missing
: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker valuecolander.required
, indicating that it is considered ‘required’. Whenmissing
iscolander.required
, therequired
computed attribute will beTrue
. Whenmissing
iscolander.drop
, the node is dropped from the schema if it isn’t set during deserialization.missing_msg
: Optional error message to be used if the value is required and missing.preparer
: Optional preparer for this node. It should be an object that implements thecolander.interfaces.Preparer
interface.validator
: Optional validator for this node. It should be an object that implements thecolander.interfaces.Validator
interface.after_bind
: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of thebind
method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so theafter_bind
methods of the deepest nodes are called before the shallowest. Theafter_bind
callback should accept two values:node
andkw
.node
will be a clone of the bound node object,kw
will be the set of keywords passed to thebind
method.title
: The title of this node. Defaults to a titleization of thename
(underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).description
: The description for this node. Defaults to''
(the empty string). The description is used by higher-level systems (not by Colander itself).widget
: The ‘widget’ for this node. Defaults toNone
. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.insert_before
: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.
Arbitrary keyword arguments remaining will be attached to the node object unmolested.
- class cowbird.api.schemas.Version_GET_OkResponseSchema(*arg, **kw)[source]
Bases:
BaseResponseSchemaAPI
Fundamental building block of schemas.
The constructor accepts these positional arguments:
typ
: The ‘type’ for this node. It should be an instance of a class that implements thecolander.interfaces.Type
interface. Iftyp
is not passed, a call to theschema_type()
method on this class is made to get a default type. (When subclassing,schema_type()
should be overridden to provide a reasonable default type).*children
: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via theadd
method.
The constructor accepts these keyword arguments:
name
: The name of this node.typ
: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.default
: The default serialization value for this node when not set. Ifdefault
iscolander.drop
, the node will be dropped from schema serialization. If not provided, the node will be serialized tocolander.null
.missing
: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker valuecolander.required
, indicating that it is considered ‘required’. Whenmissing
iscolander.required
, therequired
computed attribute will beTrue
. Whenmissing
iscolander.drop
, the node is dropped from the schema if it isn’t set during deserialization.missing_msg
: Optional error message to be used if the value is required and missing.preparer
: Optional preparer for this node. It should be an object that implements thecolander.interfaces.Preparer
interface.validator
: Optional validator for this node. It should be an object that implements thecolander.interfaces.Validator
interface.after_bind
: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of thebind
method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so theafter_bind
methods of the deepest nodes are called before the shallowest. Theafter_bind
callback should accept two values:node
andkw
.node
will be a clone of the bound node object,kw
will be the set of keywords passed to thebind
method.title
: The title of this node. Defaults to a titleization of thename
(underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).description
: The description for this node. Defaults to''
(the empty string). The description is used by higher-level systems (not by Colander itself).widget
: The ‘widget’ for this node. Defaults toNone
. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.insert_before
: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.
Arbitrary keyword arguments remaining will be attached to the node object unmolested.
- class cowbird.api.schemas.FailedDependencyErrorResponseSchema(*arg, **kw)[source]
Bases:
BaseResponseSchemaAPI
Fundamental building block of schemas.
The constructor accepts these positional arguments:
typ
: The ‘type’ for this node. It should be an instance of a class that implements thecolander.interfaces.Type
interface. Iftyp
is not passed, a call to theschema_type()
method on this class is made to get a default type. (When subclassing,schema_type()
should be overridden to provide a reasonable default type).*children
: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via theadd
method.
The constructor accepts these keyword arguments:
name
: The name of this node.typ
: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.default
: The default serialization value for this node when not set. Ifdefault
iscolander.drop
, the node will be dropped from schema serialization. If not provided, the node will be serialized tocolander.null
.missing
: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker valuecolander.required
, indicating that it is considered ‘required’. Whenmissing
iscolander.required
, therequired
computed attribute will beTrue
. Whenmissing
iscolander.drop
, the node is dropped from the schema if it isn’t set during deserialization.missing_msg
: Optional error message to be used if the value is required and missing.preparer
: Optional preparer for this node. It should be an object that implements thecolander.interfaces.Preparer
interface.validator
: Optional validator for this node. It should be an object that implements thecolander.interfaces.Validator
interface.after_bind
: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of thebind
method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so theafter_bind
methods of the deepest nodes are called before the shallowest. Theafter_bind
callback should accept two values:node
andkw
.node
will be a clone of the bound node object,kw
will be the set of keywords passed to thebind
method.title
: The title of this node. Defaults to a titleization of thename
(underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).description
: The description for this node. Defaults to''
(the empty string). The description is used by higher-level systems (not by Colander itself).widget
: The ‘widget’ for this node. Defaults toNone
. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.insert_before
: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.
Arbitrary keyword arguments remaining will be attached to the node object unmolested.
- class cowbird.api.schemas.Homepage_GET_OkResponseSchema(*arg, **kw)[source]
Bases:
BaseResponseSchemaAPI
Fundamental building block of schemas.
The constructor accepts these positional arguments:
typ
: The ‘type’ for this node. It should be an instance of a class that implements thecolander.interfaces.Type
interface. Iftyp
is not passed, a call to theschema_type()
method on this class is made to get a default type. (When subclassing,schema_type()
should be overridden to provide a reasonable default type).*children
: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via theadd
method.
The constructor accepts these keyword arguments:
name
: The name of this node.typ
: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.default
: The default serialization value for this node when not set. Ifdefault
iscolander.drop
, the node will be dropped from schema serialization. If not provided, the node will be serialized tocolander.null
.missing
: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker valuecolander.required
, indicating that it is considered ‘required’. Whenmissing
iscolander.required
, therequired
computed attribute will beTrue
. Whenmissing
iscolander.drop
, the node is dropped from the schema if it isn’t set during deserialization.missing_msg
: Optional error message to be used if the value is required and missing.preparer
: Optional preparer for this node. It should be an object that implements thecolander.interfaces.Preparer
interface.validator
: Optional validator for this node. It should be an object that implements thecolander.interfaces.Validator
interface.after_bind
: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of thebind
method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so theafter_bind
methods of the deepest nodes are called before the shallowest. Theafter_bind
callback should accept two values:node
andkw
.node
will be a clone of the bound node object,kw
will be the set of keywords passed to thebind
method.title
: The title of this node. Defaults to a titleization of thename
(underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).description
: The description for this node. Defaults to''
(the empty string). The description is used by higher-level systems (not by Colander itself).widget
: The ‘widget’ for this node. Defaults toNone
. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.insert_before
: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.
Arbitrary keyword arguments remaining will be attached to the node object unmolested.
- class cowbird.api.schemas.SwaggerAPI_GET_OkResponseSchema(*arg, **kw)[source]
Bases:
colander.MappingSchema
Fundamental building block of schemas.
The constructor accepts these positional arguments:
typ
: The ‘type’ for this node. It should be an instance of a class that implements thecolander.interfaces.Type
interface. Iftyp
is not passed, a call to theschema_type()
method on this class is made to get a default type. (When subclassing,schema_type()
should be overridden to provide a reasonable default type).*children
: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via theadd
method.
The constructor accepts these keyword arguments:
name
: The name of this node.typ
: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.default
: The default serialization value for this node when not set. Ifdefault
iscolander.drop
, the node will be dropped from schema serialization. If not provided, the node will be serialized tocolander.null
.missing
: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker valuecolander.required
, indicating that it is considered ‘required’. Whenmissing
iscolander.required
, therequired
computed attribute will beTrue
. Whenmissing
iscolander.drop
, the node is dropped from the schema if it isn’t set during deserialization.missing_msg
: Optional error message to be used if the value is required and missing.preparer
: Optional preparer for this node. It should be an object that implements thecolander.interfaces.Preparer
interface.validator
: Optional validator for this node. It should be an object that implements thecolander.interfaces.Validator
interface.after_bind
: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of thebind
method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so theafter_bind
methods of the deepest nodes are called before the shallowest. Theafter_bind
callback should accept two values:node
andkw
.node
will be a clone of the bound node object,kw
will be the set of keywords passed to thebind
method.title
: The title of this node. Defaults to a titleization of thename
(underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).description
: The description for this node. Defaults to''
(the empty string). The description is used by higher-level systems (not by Colander itself).widget
: The ‘widget’ for this node. Defaults toNone
. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.insert_before
: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.
Arbitrary keyword arguments remaining will be attached to the node object unmolested.
Package Contents
Functions
|
Immediately sets the logger level to avoid duplicate log outputs from the root logger and this logger when |
|
Include API sub-modules. |
- cowbird.api.get_logger(name: str, level: int | None = None, force_stdout: bool = None, message_format: str | None = None, datetime_format: str | None = None) logging.Logger [source]
Immediately sets the logger level to avoid duplicate log outputs from the root logger and this logger when level is
logging.NOTSET
.
cowbird.cli
Submodules
cowbird.cli.handlers
Cowbird CLI helper to execute handler operations.
Module Contents
Functions
|
|
|
cowbird.cli.utils
Module Contents
Functions
|
Generates both fields with the same description as each parameter is used in different context. |
|
|
|
|
|
|
|
|
|
Attributes
- cowbird.cli.utils.subparser_help(description: str, parent_parser: argparse.ArgumentParser | None = None) SubParserArgs [source]
Generates both fields with the same description as each parameter is used in different context.
Field
help
is printed next to the subparser name when parent parser is called with--help
. Fielddescription
populates the help details under the usage command when calling child parser--help
.
Package Contents
Functions
|
|
|
Generates both fields with the same description as each parameter is used in different context. |
|
Immediately sets the logger level to avoid duplicate log outputs from the root logger and this logger when |
|
Automatically groups all sub-helper CLI listed in |
Attributes
- cowbird.cli.subparser_help(description: str, parent_parser: argparse.ArgumentParser | None = None) SubParserArgs [source]
Generates both fields with the same description as each parameter is used in different context.
Field
help
is printed next to the subparser name when parent parser is called with--help
. Fielddescription
populates the help details under the usage command when calling child parser--help
.
- cowbird.cli.get_logger(name: str, level: int | None = None, force_stdout: bool = None, message_format: str | None = None, datetime_format: str | None = None) logging.Logger [source]
Immediately sets the logger level to avoid duplicate log outputs from the root logger and this logger when level is
logging.NOTSET
.
- cowbird.cli.main(args: Sequence[str] | None = None) int | None [source]
Automatically groups all sub-helper CLI listed in
cowbird.cli
as a commoncowbird
CLI entrypoint.Dispatches the provided arguments to the appropriate sub-helper CLI as requested. Each sub-helper CLI must implement functions
make_parser
andmain
to generate the arguments and dispatch them to the corresponding caller.
cowbird.database
Database package for pyramid.
Add the database in the pyramid registry and a property db for the requests.
Submodules
cowbird.database.base
Module Contents
Classes
Return the unique identifier of db type matching settings. |
- class cowbird.database.base.DatabaseInterface(_: cowbird.typedefs.AnySettingsContainer)[source]
Return the unique identifier of db type matching settings.
Database interface defining a minimum set of function mostly around store management.
- abstract get_store(store_type: cowbird.typedefs.StoreSelector, *store_args: Any, **store_kwargs: Any) cowbird.database.stores.StoreInterface [source]
- abstract reset_store(store_type: cowbird.typedefs.StoreSelector) cowbird.database.stores.StoreInterface [source]
cowbird.database.mongodb
Module Contents
Classes
Return the unique identifier of db type matching settings. |
Functions
|
Obtains the basic database connection from settings. |
|
Obtains the database with configuration ready for usage. |
Attributes
- class cowbird.database.mongodb.MongoDatabase(container: cowbird.typedefs.AnySettingsContainer)[source]
Bases:
cowbird.database.base.DatabaseInterface
Return the unique identifier of db type matching settings.
Initialize the mongo database from various type of container.
- get_store(store_type: str | Type[cowbird.database.stores.StoreInterface] | AnyMongodbStoreType, *store_args: Any, **store_kwargs: Any) AnyMongodbStore [source]
Retrieve a store from the database.
- Parameters:
store_type – type of the store to retrieve/create.
store_args – additional arguments to pass down to the store.
store_kwargs – additional keyword arguments to pass down to the store.
cowbird.database.stores
Stores to read/write data to from/to MongoDB using pymongo.
Module Contents
Classes
Check that the store implementation defines its type and index_fields. |
|
Base class extended by all concrete store implementations. |
|
Registry for monitoring instances. |
Attributes
- class cowbird.database.stores.StoreInterface[source]
Bases:
object
Check that the store implementation defines its type and index_fields.
- class cowbird.database.stores.MongodbStore(collection: pymongo.collection.Collection, *_: Any, **__: Any)[source]
Base class extended by all concrete store implementations.
Validate and hold the collection for all the implementation.
- classmethod get_args_kwargs(*args: Any, **kwargs: Any) Tuple[Tuple[Any, Ellipsis], Dict[str, Any]] [source]
Filters
MongodbStore
-specific arguments to safely pass them down its__init__
.
- class cowbird.database.stores.MonitoringStore(*args: Any, **kwargs: Any)[source]
Bases:
StoreInterface
,MongodbStore
Registry for monitoring instances.
Uses MongoDB to store what is monitored and by whom.
Init the store used to save monitors.
- save_monitor(monitor: cowbird.monitoring.monitor.Monitor) None [source]
Stores Monitor in MongoDB storage.
- delete_monitor(monitor: cowbird.monitoring.monitor.Monitor) None [source]
Removes Monitor from MongoDB storage.
- list_monitors() List[cowbird.monitoring.monitor.Monitor] [source]
Lists all Monitor in MongoDB storage.
Package Contents
Classes
Return the unique identifier of db type matching settings. |
Functions
|
Retrieves the application |
|
Retrieve application settings from a supported container. |
|
Obtains the database connection from configured application settings. |
|
Attributes
- class cowbird.database.MongoDatabase(container: cowbird.typedefs.AnySettingsContainer)[source]
Bases:
cowbird.database.base.DatabaseInterface
Return the unique identifier of db type matching settings.
Initialize the mongo database from various type of container.
- _database: pymongo.database.Database
- _settings: cowbird.typedefs.SettingsType
- _stores: Dict[str, AnyMongodbStore]
- type = 'mongodb'
- get_store(store_type: str | Type[cowbird.database.stores.StoreInterface] | AnyMongodbStoreType, *store_args: Any, **store_kwargs: Any) AnyMongodbStore [source]
Retrieve a store from the database.
- Parameters:
store_type – type of the store to retrieve/create.
store_args – additional arguments to pass down to the store.
store_kwargs – additional keyword arguments to pass down to the store.
- cowbird.database.get_registry(container: cowbird.typedefs.AnyRegistryContainer, nothrow: bool = False) pyramid.registry.Registry | None [source]
Retrieves the application
registry
from various containers referencing to it.
- cowbird.database.get_settings(container: cowbird.typedefs.AnySettingsContainer | None, app: bool = False) cowbird.typedefs.SettingsType [source]
Retrieve application settings from a supported container.
- Parameters:
container – supported container with a handle to application settings.
app – allow retrieving from current thread registry if no container was defined.
- Returns:
found application settings dictionary.
- Raises:
TypeError – when no application settings could be found or unsupported container.
- cowbird.database.get_db(container: cowbird.typedefs.AnySettingsContainer, reset_connection: bool = False) mongodb.MongoDatabase [source]
Obtains the database connection from configured application settings.
If
reset_connection
isTrue
, thecontainer
must be the applicationRegistry
or any container that can retrieve it to accomplish reference reset. Otherwise, any settings container can be provided.
cowbird.handlers
Subpackages
cowbird.handlers.impl
Submodules
cowbird.handlers.impl.catalog
Module Contents
Classes
Keep the catalog index in sync when files are created/deleted/updated. |
Attributes
- class cowbird.handlers.impl.catalog.Catalog(settings: cowbird.typedefs.SettingsType, name: str, **kwargs: Any)[source]
Bases:
cowbird.handlers.handler.Handler
,cowbird.monitoring.fsmonitor.FSMonitor
Keep the catalog index in sync when files are created/deleted/updated.
Create the catalog instance.
- Parameters:
settings – Cowbird settings for convenience
name – Handler name
- abstract permission_created(permission: cowbird.permissions_synchronizer.Permission) None [source]
- abstract permission_deleted(permission: cowbird.permissions_synchronizer.Permission) None [source]
- static get_instance() Catalog | None [source]
Return the Catalog singleton instance from the class name used to retrieve the FSMonitor from the DB.
- on_created(path: str) None [source]
Called when a new path is found.
- Parameters:
path – Absolute path of a new file/directory
- on_deleted(path: str) None [source]
Called when a path is deleted.
- Parameters:
path – Absolute path of a new file/directory
cowbird.handlers.impl.filesystem
Module Contents
Classes
Keep the proper directory structure in sync with the platform. |
Attributes
- cowbird.handlers.impl.filesystem.DEFAULT_PUBLIC_WORKSPACE_WPS_OUTPUTS_SUBPATH = 'public/wps_outputs'[source]
- class cowbird.handlers.impl.filesystem.FileSystem(settings: cowbird.typedefs.SettingsType, name: str, jupyterhub_user_data_dir: str, wps_outputs_dir: str, secure_data_proxy_name: str = DEFAULT_SECURE_DATA_PROXY_NAME, wps_outputs_res_name: str = DEFAULT_WPS_OUTPUTS_RES_NAME, notebooks_dir_name: str = DEFAULT_NOTEBOOKS_DIR_NAME, public_workspace_wps_outputs_subpath: str = DEFAULT_PUBLIC_WORKSPACE_WPS_OUTPUTS_SUBPATH, user_wps_outputs_dir_name: str = DEFAULT_USER_WPS_OUTPUTS_DIR_NAME, **kwargs: Any)[source]
Bases:
cowbird.handlers.handler.Handler
,cowbird.monitoring.fsmonitor.FSMonitor
Keep the proper directory structure in sync with the platform.
Create the file system instance.
- Parameters:
settings – Cowbird settings for convenience
name – Handler name
jupyterhub_user_data_dir – Path to the JupyterHub user data directory, which will be symlinked to the working directory
wps_outputs_dir – Path to the wps outputs directory
secure_data_proxy_name – Name of the secure-data-proxy service found on Magpie
wps_outputs_res_name – Name of the WPS outputs resource found on Magpie under the secure-data-proxy service
notebooks_dir_name – Name of the symlink directory found in the user workspace and which directs to the user’s notebook directory
public_workspace_wps_outputs_subpath – Subpath to the directory containing hardlinks to the public WPS outputs data
user_wps_outputs_dir_name – Name of the directory found in the user workspace and which contains the hardlinks to the user WPS outputs data
- start_wps_outputs_monitoring(monitoring: cowbird.monitoring.monitoring.Monitoring) None [source]
- static get_instance() FileSystem [source]
Return the FileSystem singleton instance from the class name used to retrieve the FSMonitor from the DB.
- _get_secure_data_proxy_file_perms(src_path: str, user_name: str) Tuple[bool, bool] [source]
Finds a route from the secure-data-proxy service that matches the resource path (or one of its parent resource) and gets the user permissions on that route.
- update_secure_data_proxy_path_perms(src_path: str, user_name: str) bool [source]
Gets a path’s permissions from the secure-data-proxy service and updates the file system permissions accordingly.
Returns a boolean to indicate if the user should have some type of access to the path or not.
- static create_hardlink_path(src_path: str, hardlink_path: str, access_allowed: bool) None [source]
Creates a hardlink path from a source file, if the user has access rights.
- _create_wps_outputs_hardlink(src_path: str, overwrite: bool = False, process_user_files: bool = True, process_public_files: bool = True) None [source]
- on_created(path: str) None [source]
Call when a new path is found.
- Parameters:
path – Absolute path of a new file/directory
- on_modified(path: str) None [source]
Called when a path is updated.
- Parameters:
path – Absolute path of a new file/directory
- _delete_wps_outputs_hardlink(src_path: str, process_user_paths: bool = True, process_public_paths: bool = True) bool [source]
Deletes the hardlink path that corresponds to the input source path.
Returns a bool to indicate if a hardlink path was deleted or not.
- on_deleted(path: str) None [source]
Called when a path is deleted.
- Parameters:
path – Absolute path of a new file/directory
- _check_if_res_from_secure_data_proxy(res_tree: List[cowbird.typedefs.JSON]) bool [source]
Checks if the resource is part of a secure-data-proxy service of type API.
- _update_permissions_on_filesystem(permission: cowbird.permissions_synchronizer.Permission) None [source]
- permission_created(permission: cowbird.permissions_synchronizer.Permission) None [source]
- permission_deleted(permission: cowbird.permissions_synchronizer.Permission) None [source]
cowbird.handlers.impl.geoserver
Module Contents
Classes
Base class for protocol classes. |
|
Base class for protocol classes. |
|
Base class for protocol classes. |
|
Keep Geoserver internal representation in sync with the platform. |
Functions
Decorator for response and logging handling for the different Geoserver HTTP requests. |
|
|
|
|
|
|
|
|
|
|
|
|
Attributes
- class cowbird.handlers.impl.geoserver.GeoserverFuncSupportsWorkspace[source]
Bases:
Protocol
Base class for protocol classes.
Protocol classes are defined as:
class Proto(Protocol): def meth(self) -> int: ...
Such classes are primarily used with static type checkers that recognize structural subtyping (static duck-typing), for example:
class C: def meth(self) -> int: return 0 def func(x: Proto) -> int: return x.meth() func(C()) # Passes static type check
See PEP 544 for details. Protocol classes decorated with @typing.runtime_checkable act as simple-minded runtime protocols that check only the presence of given attributes, ignoring their type signatures. Protocol classes can be generic, they are defined as:
class GenProto(Protocol[T]): def meth(self) -> T: ...
- class cowbird.handlers.impl.geoserver.GeoserverFuncSupportsDatastore[source]
Bases:
Protocol
Base class for protocol classes.
Protocol classes are defined as:
class Proto(Protocol): def meth(self) -> int: ...
Such classes are primarily used with static type checkers that recognize structural subtyping (static duck-typing), for example:
class C: def meth(self) -> int: return 0 def func(x: Proto) -> int: return x.meth() func(C()) # Passes static type check
See PEP 544 for details. Protocol classes decorated with @typing.runtime_checkable act as simple-minded runtime protocols that check only the presence of given attributes, ignoring their type signatures. Protocol classes can be generic, they are defined as:
class GenProto(Protocol[T]): def meth(self) -> T: ...
- class cowbird.handlers.impl.geoserver.GeoserverFuncSupportsShapefile[source]
Bases:
Protocol
Base class for protocol classes.
Protocol classes are defined as:
class Proto(Protocol): def meth(self) -> int: ...
Such classes are primarily used with static type checkers that recognize structural subtyping (static duck-typing), for example:
class C: def meth(self) -> int: return 0 def func(x: Proto) -> int: return x.meth() func(C()) # Passes static type check
See PEP 544 for details. Protocol classes decorated with @typing.runtime_checkable act as simple-minded runtime protocols that check only the presence of given attributes, ignoring their type signatures. Protocol classes can be generic, they are defined as:
class GenProto(Protocol[T]): def meth(self) -> T: ...
- cowbird.handlers.impl.geoserver.SHAPEFILE_OPTIONAL_EXTENSIONS = ['.atx', '.sbx', '.qix', '.aih', '.ain', '.shp.xml', '.cpg'][source]
- cowbird.handlers.impl.geoserver.geoserver_response_handling(func: GeoserverFuncSupportsWorkspace) GeoserverFuncSupportsWorkspace [source]
- cowbird.handlers.impl.geoserver.geoserver_response_handling(func: GeoserverFuncSupportsDatastore) GeoserverFuncSupportsDatastore
- cowbird.handlers.impl.geoserver.geoserver_response_handling(func: GeoserverFuncSupportsShapefile) GeoserverFuncSupportsShapefile
Decorator for response and logging handling for the different Geoserver HTTP requests.
- Parameters:
func – Function executing a http request to Geoserver
- Returns:
Response object
- class cowbird.handlers.impl.geoserver.Geoserver(settings: cowbird.typedefs.SettingsType, name: str, admin_user: str | None = None, admin_password: str | None = None, **kwargs: Any)[source]
Bases:
cowbird.handlers.handler.Handler
,cowbird.monitoring.fsmonitor.FSMonitor
Keep Geoserver internal representation in sync with the platform.
Create the geoserver handler instance.
- Parameters:
settings – Cowbird settings for convenience
name – Handler name
admin_user – Geoserver admin username
admin_password – Geoserver admin password
- get_shapefile_list(workspace_name: str, shapefile_name: str) List[str] [source]
Generates the list of all files associated with a shapefile name.
- _update_resource_paths_permissions(resource_type: str, permission: cowbird.permissions_synchronizer.Permission, resource_id: int, workspace_name: str, layer_name: str | None = None) None [source]
Updates a single Magpie resource’s associated paths according to its permissions found on Magpie.
- _update_resource_paths_permissions_recursive(resource: cowbird.typedefs.JSON, permission: cowbird.permissions_synchronizer.Permission, workspace_name: str) None [source]
Recursive method to update all the path permissions of a resource and its children resources as found on Magpie.
- _update_permissions_on_filesystem(permission: cowbird.permissions_synchronizer.Permission) None [source]
Updates the permissions of dir/files on the file system, after receiving a permission webhook event from Magpie.
- permission_created(permission: cowbird.permissions_synchronizer.Permission) None [source]
Called when Magpie sends a permission created webhook event.
- permission_deleted(permission: cowbird.permissions_synchronizer.Permission) None [source]
Called when Magpie sends a permission deleted webhook event.
- static get_instance() Geoserver | None [source]
Return the Geoserver singleton instance from the class name used to retrieve the FSMonitor from the DB.
- static publish_shapefile_task_chain(workspace_name: str, shapefile_name: str) None [source]
Applies the chain of tasks required to publish a new file to Geoserver.
- on_created(path: str) None [source]
Call when a new path is found.
- Parameters:
path – Absolute path of a new file/directory
- static remove_shapefile_task(workspace_name: str, shapefile_name: str) None [source]
Applies the celery task required to remove a shapefile from Geoserver.
- on_deleted(path: str) None [source]
Called when a path is deleted.
- Parameters:
path – Absolute path of a new file/directory
- on_modified(path: str) None [source]
Called when a path is updated.
- Parameters:
path – Absolute path of a new file/directory
- static _is_permission_update_required(effective_permissions: List[cowbird.typedefs.JSON], user_name: str, res_id: int, perm_name: str, perm_access: str, perm_scope: str, delete_if_required: bool = False) bool [source]
Checks if the required permission already exists on the resource, else returns true if an update is required.
Also, deletes the permission if the associated input argument is activated.
- static _update_magpie_permissions(user_name: str, res_id: int, perm_scope: str, is_readable: bool, is_writable: bool) None [source]
Updates permissions on a Magpie resource (workspace/layer).
- _update_magpie_workspace_permissions(workspace_name: str) None [source]
Updates the permissions of a workspace resource on Magpie to the current permissions found on the corresponding datastore folder.
- _update_magpie_layer_permissions(workspace_name: str, layer_name: str) None [source]
Updates the permissions of a layer resource on Magpie to the current permissions found on the corresponding shapefile.
- create_workspace(name: str) None [source]
Create a new Geoserver workspace.
- Parameters:
name – Workspace name
- remove_workspace(name: str) None [source]
Removes a workspace from geoserver. Will also remove all datastores associated with the workspace.
- Parameters:
name – Workspace name
- create_datastore(workspace_name: str) None [source]
Create a new Geoserver workspace.
- Parameters:
self – Geoserver instance
workspace_name – Workspace name where the datastore must be created
- publish_shapefile(workspace_name: str, shapefile_name: str) None [source]
Publish a shapefile in the specified workspace.
- Parameters:
workspace_name – Name of the workspace from which the shapefile will be published
shapefile_name – The shapefile’s name, without file extension
- validate_shapefile(workspace_name: str, shapefile_name: str) None [source]
Validate shapefile.
Will look for the three other files necessary for Geoserver publishing (.prj, .dbf, .shx) and raise a FileNotFoundError exception if one is missing.
- Parameters:
workspace_name – Name of the workspace from which the shapefile will be published
shapefile_name – The shapefile’s name, without file extension
- _get_shapefile_permissions(workspace_name: str, shapefile_name: str) Tuple[bool, bool] [source]
Resolves the shapefile permissions on the file system, by checking the shapefile’s main file permissions.
- _normalize_shapefile_permissions(workspace_name: str, shapefile_name: str, is_readable: bool, is_writable: bool) None [source]
Makes sure all files associated with a shapefile is owned by the default user/group and have the same permissions.
- remove_shapefile(workspace_name: str, filename: str) None [source]
Remove a shapefile from the specified workspace.
- Parameters:
workspace_name – Name of the workspace from which the shapefile will be removed
filename – The shapefile’s name, without file extension
- static _get_shapefile_info(filename: str) Tuple[str, str] [source]
- Parameters:
filename – Relative filename of a new file
- Returns:
Workspace name (str) where file is located and shapefile name (str)
- static _get_datastore_name(workspace_name: str) str [source]
Return datastore name used to represent the datastore inside Geoserver.
To be used in the HTTP requests sent to Geoserver. This name does not exist on the file system.
- _shapefile_folder_dir(workspace_name: str) str [source]
Returns the path to the user’s shapefile datastore inside the file system.
- static _geoserver_user_datastore_dir(user_name: str) str [source]
Returns the path to the user’s shapefile datastore inside the Geoserver instance container.
Uses the
WORKSPACE_DIR
env variable mapped in the Geoserver container.
- _create_workspace_request(*, workspace_name: str) requests.Response [source]
Request to create a new workspace.
- Parameters:
workspace_name – Name of workspace to be created
- Returns:
Response object
- _remove_workspace_request(*, workspace_name: str) requests.Response [source]
Request to remove workspace and all associated datastores and layers.
- Parameters:
workspace_name – Name of workspace to remove
- Returns:
Response object
- _create_datastore_request(*, workspace_name: str, datastore_name: str) requests.Response [source]
Initial creation of the datastore with no connection parameters.
- Parameters:
workspace_name – Name of the workspace in which the datastore is created
datastore_name – Name of the datastore that will be created
- Returns:
Response object
- _configure_datastore_request(*, workspace_name: str, datastore_name: str, datastore_path: str) requests.Response [source]
Configures the connection parameters of the datastore.
This is done as a secondary step because Geoserver tends to create the wrong type of datastore (shapefile instead of directory of shapefiles) when setting them at creation.
- Parameters:
workspace_name – Name of the workspace in which the datastore is created
datastore_name – Name of the datastore that will be created
- Returns:
Response object
- _publish_shapefile_request(*, workspace_name: str, datastore_name: str, filename: str) requests.Response [source]
Request to publish a shapefile in Geoserver. Does so by creating a Feature type in Geoserver.
- Parameters:
workspace_name – Workspace where file will be published
datastore_name – Datastore where file will be published
filename – Name of the shapefile (with no extensions)
- Returns:
Response object
- _remove_shapefile_request(*, workspace_name: str, datastore_name: str, filename: str) requests.Response [source]
Request to remove specified Geoserver Feature type and corresponding layer.
- Parameters:
workspace_name – Workspace where file is published
datastore_name – Datastore where file is published
filename – Name of the shapefile (with no extensions)
- Returns:
Response object
- cowbird.handlers.impl.geoserver.create_workspace(_task: celery.Task[[str], None], user_name: str) None [source]
- cowbird.handlers.impl.geoserver.create_datastore(_task: celery.Task[[str], None], datastore_name: str) None [source]
- cowbird.handlers.impl.geoserver.remove_workspace(_task: celery.Task[[str], None], workspace_name: str) None [source]
- cowbird.handlers.impl.geoserver.validate_shapefile(_task: celery.Task[[Any, Any], None], workspace_name: str, shapefile_name: str) None [source]
- cowbird.handlers.impl.geoserver.publish_shapefile(_task: celery.Task[[Any, Any], None], workspace_name: str, shapefile_name: str) None [source]
cowbird.handlers.impl.magpie
Module Contents
Classes
Complete the Magpie's webhook call by calling Magpie temporary urls. Also keep service-shared resources in sync when |
Attributes
- class cowbird.handlers.impl.magpie.Magpie(settings: cowbird.typedefs.SettingsType, name: str, admin_user: str, admin_password: str, **kwargs: Any)[source]
Bases:
cowbird.handlers.handler.Handler
Complete the Magpie’s webhook call by calling Magpie temporary urls. Also keep service-shared resources in sync when permissions are updated for one of them.
** Cowbird components diagram 1.2.0 needs to be updated since Magpie can handle permissions synchronisation directly on permission update events. No need to handle them explicitly in nginx, thredds and geoserver classes.
Create the magpie instance and instantiate the permission synchronizer that will handle the permission events.
- Parameters:
settings – Cowbird settings for convenience
name – Handler name
admin_user – Magpie admin username used for login.
admin_password – Magpie admin password used for login.
- _send_request(method: str, url: str, params: Any | None = None, json: Any | None = None) requests.Response [source]
Wrapping function to send requests to Magpie, which also handles login and cookies.
- get_parents_resource_tree(resource_id: int) List[cowbird.typedefs.JSON] [source]
Returns the associated Magpie Resource object and all its parents in a list ordered from parent to child.
- get_resource(resource_id: int) Dict[str, cowbird.typedefs.JSON] [source]
Returns the associated Magpie Resource object.
- get_geoserver_workspace_res_id(workspace_name: str, create_if_missing: bool | None = False) int | None [source]
Finds the resource id of a workspace resource from the geoserver type services.
- get_geoserver_layer_res_id(workspace_name: str, layer_name: str, create_if_missing: bool = False) int [source]
Tries to get the resource id of a specific layer, on geoserver type services, and if requested, creates the resource and workspace if they do not exist yet.
- get_user_permissions(user: str) Dict[str, cowbird.typedefs.JSON] [source]
Gets all user resource permissions.
- get_user_permissions_by_res_id(user: str, res_id: int, effective: bool = False) Dict[str, cowbird.typedefs.JSON] [source]
- get_user_names_by_group_name(grp_name: str) List[str] [source]
Returns the list of Magpie usernames from a group.
- get_group_permissions(grp: str) Dict[str, cowbird.typedefs.JSON] [source]
Gets all group resource permissions.
- get_group_permissions_by_res_id(grp: str, res_id: int, effective: bool = False) Dict[str, cowbird.typedefs.JSON] [source]
- create_permissions(permissions_data: List[cowbird.typedefs.PermissionConfigItemType]) None [source]
Make sure that the specified permissions exist on Magpie.
- create_permission_by_res_id(res_id: int, perm_name: str, perm_access: str, perm_scope: str, user_name: str | None = '', grp_name: str | None = '') pyramid.response.Response | None [source]
- create_permission_by_user_and_res_id(user_name: str, res_id: int, perm_name: str, perm_access: str, perm_scope: str) pyramid.response.Response | None [source]
- create_permission_by_grp_and_res_id(grp_name: str, res_id: int, perm_name: str, perm_access: str, perm_scope: str) pyramid.response.Response | None [source]
- delete_permission_by_user_and_res_id(user_name: str, res_id: int, permission_name: str) None [source]
- delete_permission_by_grp_and_res_id(grp_name: str, res_id: int, permission_name: str) None [source]
- delete_permission(permissions_data: List[Dict[str, str]]) None [source]
Remove the specified permission from Magpie if it exists.
cowbird.handlers.impl.nginx
Module Contents
Classes
Nothing to do right now. |
- class cowbird.handlers.impl.nginx.Nginx(settings: cowbird.typedefs.SettingsType, name: str, **kwargs: Any)[source]
Bases:
cowbird.handlers.handler.Handler
Nothing to do right now.
Create the nginx instance.
- Parameters:
settings – Cowbird settings for convenience
name – Handler name
- abstract permission_created(permission: cowbird.permissions_synchronizer.Permission) None [source]
- abstract permission_deleted(permission: cowbird.permissions_synchronizer.Permission) None [source]
cowbird.handlers.impl.thredds
Module Contents
Classes
Nothing to do right now. |
- class cowbird.handlers.impl.thredds.Thredds(settings: cowbird.typedefs.SettingsType, name: str, **kwargs: Any)[source]
Bases:
cowbird.handlers.handler.Handler
Nothing to do right now.
Create the thredds instance.
- Parameters:
settings – Cowbird settings for convenience
name – Handler name
- abstract permission_created(permission: cowbird.permissions_synchronizer.Permission) None [source]
- abstract permission_deleted(permission: cowbird.permissions_synchronizer.Permission) None [source]
Submodules
cowbird.handlers.handler
Module Contents
Classes
Helper class that provides a standard way to create an ABC using |
Attributes
- cowbird.handlers.handler.HANDLER_WORKSPACE_DIR_PARAM: AnyHandlerParameter = 'workspace_dir'[source]
- exception cowbird.handlers.handler.HandlerConfigurationException[source]
Bases:
Exception
Exception thrown when a handler cannot be instantiated because of a bad configuration.
Initialize self. See help(type(self)) for accurate signature.
- class cowbird.handlers.handler.Handler(settings: cowbird.typedefs.SettingsType, name: str, **kwargs: Any)[source]
Bases:
abc.ABC
Helper class that provides a standard way to create an ABC using inheritance.
- Parameters:
settings – Cowbird settings for convenience
name – Handler name
kwargs – The base class handle, but doesn’t require the following variables:
url – Location of the web service represented by the cowbird handler
workspace_dir – Workspace directory
priority – Relative priority between handlers while handling events. Lower value has higher priority, default value is last.
- __slots__[source]
Handler interface used to notify implemented handlers of users/permissions changes.
Todo
At some point we will need a consistency function that goes through all Magpie users and make sure that handlers are up-to-date.
- abstract permission_created(permission: cowbird.permissions_synchronizer.Permission) None [source]
- abstract permission_deleted(permission: cowbird.permissions_synchronizer.Permission) None [source]
cowbird.handlers.handler_factory
Module Contents
Classes
Create handler instance using handler name. |
Attributes
- cowbird.handlers.handler_factory.VALID_HANDLERS = ['Catalog', 'Geoserver', 'Magpie', 'Nginx', 'Thredds', 'FileSystem'][source]
- class cowbird.handlers.handler_factory.HandlerFactory[source]
Create handler instance using handler name.
- create_handler(name: Literal[Catalog]) cowbird.handlers.impl.catalog.Catalog [source]
- create_handler(name: Literal[FileSystem]) cowbird.handlers.impl.filesystem.FileSystem
- create_handler(name: Literal[Geoserver]) cowbird.handlers.impl.geoserver.Geoserver
- create_handler(name: Literal[Magpie]) cowbird.handlers.impl.magpie.Magpie
- create_handler(name: Literal[Nginx]) cowbird.handlers.impl.nginx.Nginx
- create_handler(name: Literal[Thredds]) cowbird.handlers.impl.thredds.Thredds
- create_handler(name: str) cowbird.handlers.handler.Handler | None
Instantiates a new Handler implementation using its name, overwriting an existing instance if required.
- get_handler(name: Literal[Catalog]) cowbird.handlers.impl.catalog.Catalog [source]
- get_handler(name: Literal[FileSystem]) cowbird.handlers.impl.filesystem.FileSystem
- get_handler(name: Literal[Geoserver]) cowbird.handlers.impl.geoserver.Geoserver
- get_handler(name: Literal[Magpie]) cowbird.handlers.impl.magpie.Magpie
- get_handler(name: Literal[Nginx]) cowbird.handlers.impl.nginx.Nginx
- get_handler(name: Literal[Thredds]) cowbird.handlers.impl.thredds.Thredds
- get_handler(name: str) cowbird.handlers.handler.Handler | None
Instantiates a Handler implementation using its name if it doesn’t exist or else returns the existing one from cache.
- get_active_handlers() List[cowbird.handlers.handler.Handler] [source]
Return a sorted list by priority of Handler implementation activated in the config.
Package Contents
Classes
Helper class that provides a standard way to create an ABC using |
|
Create handler instance using handler name. |
Functions
|
Obtains the handlers managed by the application. |
Attributes
- class cowbird.handlers.Handler(settings: cowbird.typedefs.SettingsType, name: str, **kwargs: Any)[source]
Bases:
abc.ABC
Helper class that provides a standard way to create an ABC using inheritance.
- Parameters:
settings – Cowbird settings for convenience
name – Handler name
kwargs – The base class handle, but doesn’t require the following variables:
url – Location of the web service represented by the cowbird handler
workspace_dir – Workspace directory
priority – Relative priority between handlers while handling events. Lower value has higher priority, default value is last.
- abstract property required_params: List[AnyHandlerParameter]
- __slots__
Handler interface used to notify implemented handlers of users/permissions changes.
Todo
At some point we will need a consistency function that goes through all Magpie users and make sure that handlers are up-to-date.
- abstract permission_created(permission: cowbird.permissions_synchronizer.Permission) None [source]
- abstract permission_deleted(permission: cowbird.permissions_synchronizer.Permission) None [source]
- class cowbird.handlers.HandlerFactory[source]
Create handler instance using handler name.
- create_handler(name: Literal[Catalog]) cowbird.handlers.impl.catalog.Catalog [source]
- create_handler(name: Literal[FileSystem]) cowbird.handlers.impl.filesystem.FileSystem
- create_handler(name: Literal[Geoserver]) cowbird.handlers.impl.geoserver.Geoserver
- create_handler(name: Literal[Magpie]) cowbird.handlers.impl.magpie.Magpie
- create_handler(name: Literal[Nginx]) cowbird.handlers.impl.nginx.Nginx
- create_handler(name: Literal[Thredds]) cowbird.handlers.impl.thredds.Thredds
- create_handler(name: str) cowbird.handlers.handler.Handler | None
Instantiates a new Handler implementation using its name, overwriting an existing instance if required.
- get_handler(name: Literal[Catalog]) cowbird.handlers.impl.catalog.Catalog [source]
- get_handler(name: Literal[FileSystem]) cowbird.handlers.impl.filesystem.FileSystem
- get_handler(name: Literal[Geoserver]) cowbird.handlers.impl.geoserver.Geoserver
- get_handler(name: Literal[Magpie]) cowbird.handlers.impl.magpie.Magpie
- get_handler(name: Literal[Nginx]) cowbird.handlers.impl.nginx.Nginx
- get_handler(name: Literal[Thredds]) cowbird.handlers.impl.thredds.Thredds
- get_handler(name: str) cowbird.handlers.handler.Handler | None
Instantiates a Handler implementation using its name if it doesn’t exist or else returns the existing one from cache.
- get_active_handlers() List[cowbird.handlers.handler.Handler] [source]
Return a sorted list by priority of Handler implementation activated in the config.
- cowbird.handlers.get_handlers(container: cowbird.typedefs.AnySettingsContainer | None = None) List[handler.Handler] [source]
Obtains the handlers managed by the application.
cowbird.monitoring
Submodules
cowbird.monitoring.fsmonitor
Module Contents
Classes
Interface being called when something changes on the filesystem. |
- class cowbird.monitoring.fsmonitor.FSMonitor[source]
Bases:
abc.ABC
Interface being called when something changes on the filesystem.
- abstract static get_instance() FSMonitor | None [source]
Must return an instance of the class implementing FSMonitor.
- abstract on_created(path: str) None [source]
Called when a new path is found.
- Parameters:
path – Absolute path of a new file/directory
cowbird.monitoring.monitor
Module Contents
Classes
Implementation of the watchdog |
Attributes
- exception cowbird.monitoring.monitor.MonitorException[source]
Bases:
Exception
Error indicating that a
Monitor
cannot be started because of an invalid path or callback.Initialize self. See help(type(self)) for accurate signature.
- class cowbird.monitoring.monitor.Monitor(path: str, recursive: bool, callback: cowbird.monitoring.fsmonitor.FSMonitor | Type[cowbird.monitoring.fsmonitor.FSMonitor] | str)[source]
Bases:
watchdog.events.FileSystemEventHandler
Implementation of the watchdog
FileSystemEventHandler
class Allows to start/stop directory monitoring and send events toFSMonitor
callback.Initialize the path monitoring and ready to be started.
- Parameters:
path – Path to monitor
recursive – Monitor subdirectory recursively?
callback – Events are sent to this FSMonitor. Can be an object, a class type implementing
FSMonitor
or a string containing module and class name. The class type or string is used to instantiate an object using the class methodFSMonitor.get_instance()
- property callback_instance: cowbird.monitoring.fsmonitor.FSMonitor[source]
- property key: MonitorKey[source]
Return a dict that can be used as a unique key to identify this
Monitor
in a BD.
- property is_alive: bool[source]
Returns true if the monitor observer exists and is currently running.
- static get_fsmonitor_instance(callback: cowbird.monitoring.fsmonitor.FSMonitor | Type[cowbird.monitoring.fsmonitor.FSMonitor] | str) cowbird.monitoring.fsmonitor.FSMonitor [source]
Return a
FSMonitor
instance from multiple possible forms including theFSMonitor
type, theFSMonitor
full qualified class name or a direct instance which is returned as is.
- static get_qualified_class_name(monitor: cowbird.monitoring.fsmonitor.FSMonitor) str [source]
Returns the full qualified class name of the
FSMonitor
object (string of the form module.class_name)
- params() MonitorParameters [source]
Return a dict serializing this object from which a new
Monitor
can be recreated using the init function.
- on_moved(event: watchdog.events.DirMovedEvent | watchdog.events.FileMovedEvent) None [source]
Called when a file or a directory is moved or renamed.
- Parameters:
event – Event representing file/directory movement.
- on_created(event: watchdog.events.DirCreatedEvent | watchdog.events.FileCreatedEvent) None [source]
Called when a file or directory is created.
- Parameters:
event – Event representing file/directory creation.
cowbird.monitoring.monitoring
Module Contents
Classes
Class handling file system monitoring and registering listeners. |
Attributes
- exception cowbird.monitoring.monitoring.MonitoringConfigurationException[source]
Bases:
Exception
Exception thrown when the monitoring instance cannot be initialized because of a bad configuration.
Initialize self. See help(type(self)) for accurate signature.
- class cowbird.monitoring.monitoring.Monitoring(config: cowbird.typedefs.AnySettingsContainer = None)[source]
Class handling file system monitoring and registering listeners.
Todo
At some point we will need a consistency function that goes through all monitored folder and make sure that monitoring handlers are up to date.
Initialize the monitoring instance from configured application settings.
- Parameters:
config – AnySettingsContainer object from which the db can be retrieved. The default value of None is only there to disable pylint E1120. The singleton instance must be initialized with a proper config and after that the init function should not be hit.
- register(path: str, recursive: bool, cb_monitor: cowbird.monitoring.fsmonitor.FSMonitor | Type[cowbird.monitoring.fsmonitor.FSMonitor] | str) cowbird.monitoring.monitor.Monitor | None [source]
Register a monitor for a specific path and start it. If a monitor already exists for the specific path/cb_monitor combination it is directly returned. If this monitor was not recursively monitoring its path and the recursive flag is now true, this one take precedence and the monitor is updated accordingly. If the recursive flag was true, and now it is false it has no effect.
- Parameters:
path – Path to monitor
recursive – Monitor subdirectory recursively?
cb_monitor – FSMonitor for which an instance is created and events are sent Can be an object, a class type implementing FSMonitor or a string containing module and class name.
- Returns:
The monitor registered or already existing for the specific path/cb_monitor combination. Note that the monitor is not created/returned if a MonitorException occurs.
- unregister(path: str, cb_monitor: cowbird.monitoring.fsmonitor.FSMonitor | Type[cowbird.monitoring.fsmonitor.FSMonitor] | str) bool [source]
Stop a monitor and unregister it.
- Parameters:
path – Path used by the monitor
cb_monitor – FSMonitor object to remove Can be an object, a class type implementing FSMonitor or a string containing module and class name.
- Returns:
True if the monitor is found and successfully stopped, False otherwise
Submodules
cowbird.__meta__
General meta information on the package.
Module Contents
cowbird.app
Cowbird is a middleware that manages interactions between various birds of the bird-house stack.
Module Contents
Functions
|
This function returns the Pyramid WSGI application. |
|
This function returns the Pyramid WSGI application. |
Attributes
- cowbird.app.get_app(global_config: cowbird.typedefs.SettingsType | None = None, **settings: cowbird.typedefs.SettingValue) pyramid.router.Router [source]
This function returns the Pyramid WSGI application.
It can also be used for test purpose (some config needed only in pyramid and not in tests are still in the main)
cowbird.config
Module Contents
Functions
|
Loads a file path or dictionary as YAML/JSON configuration. |
Loads all configuration files specified by the path (if a directory), a single configuration (if a file) or directly |
|
|
Applies environment variable expansion recursively to all applicable fields of a configuration definition. |
|
Validates the schema of the handlers section found in the config. |
|
Validates the schema of the sync_permissions section found in the config. |
Validates a resource_key and its related info from the config and returns some resource info relevant to the config |
|
|
Validates if both resources of a bidirectional mapping respect validation rules. |
|
Validates if both source and target resource of a unidirectional mapping respect validation rules. |
|
Obtain the different info found in a mapping string from the config. |
|
Returns a tuple of all permissions found in a string. |
|
Validates if mappings in the config have valid resource keys and use tokens properly. |
|
|
|
Validates if all services used in the sync config are actual available services. |
Attributes
- exception cowbird.config.ConfigError[source]
Bases:
RuntimeError
Generic error during configuration loading.
Initialize self. See help(type(self)) for accurate signature.
- exception cowbird.config.ConfigErrorInvalidTokens[source]
Bases:
ConfigError
Config error specific to invalid SINGLE_TOKEN or MULTI_TOKEN tokens.
Initialize self. See help(type(self)) for accurate signature.
- exception cowbird.config.ConfigErrorInvalidServiceKey[source]
Bases:
ConfigError
Config error for invalid service keys.
Initialize self. See help(type(self)) for accurate signature.
- exception cowbird.config.ConfigErrorInvalidResourceKey[source]
Bases:
ConfigError
Config error for invalid resource keys.
Initialize self. See help(type(self)) for accurate signature.
- cowbird.config._load_config(path_or_dict: str | cowbird.typedefs.ConfigDict, section: str, allow_missing: bool = False) cowbird.typedefs.ConfigDict [source]
Loads a file path or dictionary as YAML/JSON configuration.
- cowbird.config.get_all_configs(path_or_dict: str | cowbird.typedefs.ConfigDict, section: Literal[handlers], allow_missing: bool = False) List[Dict[str, cowbird.typedefs.HandlerConfig]] [source]
- cowbird.config.get_all_configs(path_or_dict: str | cowbird.typedefs.ConfigDict, section: Literal[sync_permissions], allow_missing: bool = False) List[cowbird.typedefs.SyncPointConfig]
Loads all configuration files specified by the path (if a directory), a single configuration (if a file) or directly returns the specified dictionary section (if a configuration dictionary).
- Returns:
list of configurations loaded if input was a directory path
list of single configuration if input was a file path
list of single configuration if input was a JSON dict
empty list if none of the other cases where matched
Note
Order of file loading will be resolved by alphabetically sorted filename if specifying a directory path.
- cowbird.config._expand_all(config: cowbird.typedefs.ConfigDict) cowbird.typedefs.ConfigDict [source]
Applies environment variable expansion recursively to all applicable fields of a configuration definition.
- cowbird.config.validate_handlers_config_schema(handlers_cfg: Dict[str, cowbird.typedefs.HandlerConfig]) None [source]
Validates the schema of the handlers section found in the config.
- cowbird.config.validate_sync_perm_config_schema(sync_cfg: cowbird.typedefs.SyncPointConfig) None [source]
Validates the schema of the sync_permissions section found in the config.
- cowbird.config.validate_and_get_resource_info(res_key: str, segments: List[cowbird.typedefs.ConfigSegment]) cowbird.typedefs.ConfigResTokenInfo [source]
Validates a resource_key and its related info from the config and returns some resource info relevant to the config mapping validation.
Returned info contains the following: - if the resource uses a MULTI_TOKEN in its resource_path - the list of named tokens found in the resource_path
- cowbird.config.validate_bidirectional_mapping(mapping: str, res_info: Dict[str, cowbird.typedefs.ConfigResTokenInfo], res_key1: str, res_key2: str) None [source]
Validates if both resources of a bidirectional mapping respect validation rules.
Both should either use MULTI_TOKEN or not use it and both should use exactly the same named tokens.
- cowbird.config.validate_unidirectional_mapping(mapping: str, src_info: cowbird.typedefs.ConfigResTokenInfo, tgt_info: cowbird.typedefs.ConfigResTokenInfo) None [source]
Validates if both source and target resource of a unidirectional mapping respect validation rules.
Source resource should use MULTI_TOKEN if target uses it, and source resource should include all named tokens found in the target resource.
- cowbird.config.get_mapping_info(mapping: str) Tuple[str | Any, Ellipsis] [source]
Obtain the different info found in a mapping string from the config.
Returns the following matching groups : (res_key1, permission1, direction, res_key2, permission2)
- cowbird.config.get_permissions_from_str(permissions: str) List[str] [source]
Returns a tuple of all permissions found in a string.
Used for permission strings found in the config, which can either be a single permission or a list of permissions.
cowbird.constants
Constant settings for Cowbird application.
Constants defined with format COWBIRD_[VARIABLE_NAME]
can be matched with corresponding
settings formatted as cowbird.[variable_name]
in the cowbird.ini
configuration file.
Note
Since the cowbird.ini
file has to be loaded by the application to retrieve various configuration settings,
constant COWBIRD_INI_FILE_PATH
(or any other path variable defined before it - see below) has to be defined
by environment variable if the default location is not desired (ie: if you want to provide your own configuration).
Module Contents
Functions
|
Get logging level from INI configuration file or fallback to default |
|
Find the equivalent setting name of the provided environment variable name. |
|
Search in order for matched value of |
|
Validates that some value is provided for every mandatory configuration setting. |
Attributes
- cowbird.constants._get_default_log_level() AnyLogLevel [source]
Get logging level from INI configuration file or fallback to default
INFO
if it cannot be retrieved.
- cowbird.constants.COWBIRD_CONSTANTS = ['COWBIRD_CONSTANTS', 'COWBIRD_MODULE_DIR', 'COWBIRD_ROOT', 'COWBIRD_ADMIN_PERMISSION'][source]
- cowbird.constants.get_constant_setting_name(name: str) str [source]
Find the equivalent setting name of the provided environment variable name.
Lower-case name and replace all non-ascii chars by _. Then, convert known prefixes with their dotted name.
- cowbird.constants.get_constant(constant_name: str, settings_container: cowbird.typedefs.AnySettingsContainer | None = None, settings_name: str | None = None, default_value: cowbird.typedefs.SettingValue | None = None, raise_missing: bool = True, print_missing: bool = False, raise_not_set: bool = True) cowbird.typedefs.SettingValue [source]
- Search in order for matched value of
constant_name
: search in
COWBIRD_CONSTANTS
search in settings if specified
search alternative setting names (see below)
search in
cowbird.constants
definitionssearch in environment variables
Parameter
constant_name
is expected to have the formatCOWBIRD_[VARIABLE_NAME]
although any value can be passed to retrieve generic settings from all above-mentioned search locations.If
settings_name
is provided as alternative name, it is used as is to search for results ifconstant_name
was not found. Otherwise,cowbird.[variable_name]
is used for additional search when the formatCOWBIRD_[VARIABLE_NAME]
was used forconstant_name
(i.e.:COWBIRD_ADMIN_USER
will also search forcowbird.admin_user
and so on for corresponding constants).- Parameters:
constant_name – key to search for a value
settings_container – WSGI application settings container (if not provided, uses found one in current thread)
settings_name – alternative name for settings if specified
default_value – default value to be returned if not found anywhere, and exception raises are disabled.
raise_missing – raise exception if key is not found anywhere
print_missing – print message if key is not found anywhere, return
None
raise_not_set – raise an exception if the found key is
None
, search until last case if others areNone
- Returns:
found value or default_value
- Raises:
ValueError – if resulting value is invalid based on options (by default raise missing/
None
value)LookupError – if no appropriate value could be found from all search locations (according to options)
- Search in order for matched value of
cowbird.permissions_synchronizer
Module Contents
Classes
Define every property required to set a permission in Magpie. |
|
A sync point contains services sharing resources via multiple APIs. |
|
Keep service-shared resources in sync when permissions are updated for one of them. |
Attributes
- class cowbird.permissions_synchronizer.Permission(service_name: str, service_type: str, resource_id: int, resource_full_name: str, name: str, access: str, scope: str, user: str = None, group: str = None)[source]
Define every property required to set a permission in Magpie.
- __eq__(other: Permission) bool [source]
Return self==value.
- class cowbird.permissions_synchronizer.SyncPoint(services: cowbird.typedefs.SyncPointServicesType, permissions_mapping_list: cowbird.typedefs.SyncPointMappingType)[source]
A sync point contains services sharing resources via multiple APIs.
It defines how the same resource is defined in each service and what are the mapping between permission accesses.
Init the sync point, holding services with their respective resources root and how access are mapped between them.
- Parameters:
services – Dict containing the resource keys by service type and all the names/types of each segment of those resource keys
permissions_mapping_list – List of strings representing a permission mapping between two resource keys
- static _get_explicit_permission(permission: str) str [source]
Converts a permission that could use an implicit format (‘<name>’ or ‘<name>-match’) and converts it to use an explicit format (‘<name>-<access>-<scope>’).
- _add_mapping(src_key: str, src_permissions: str, target_key: str, target_permissions: str) None [source]
Adds a source/target permission mapping to the object’s permissions mapping.
- static _generate_regex_from_segments(res_segments: List[cowbird.typedefs.ConfigSegment]) Tuple[str, int] [source]
Generates a regex for a resource_nametype_path (ex.: /name1::type1/name2::type2) from a list of segments.
Returns the regex along with the count of segments in the regex that are named. This count excludes tokenized segments.
- static _remove_type_from_nametype_path(nametype_path: str) str [source]
Removes the type from a nametype path (ex.: /name1::type1/name2::type2 becomes /name1/name2).
- _find_matching_res(service_type: str, resource_nametype_path: str) Tuple[str, Dict[str, str]] [source]
Finds a resource key that matches the input resource path, in the sync_permissions config. Note that it returns the longest match and only the named segments of the path are included in the length value. Any tokenized segment is ignored in the length.
- Parameters:
service_type – Type of the service associated with the input resource.
resource_nametype_path – Full resource path name, which includes the type of each segment (ex.: /name1::type1/name2::type2)
- static _create_res_data(target_segments: List[cowbird.typedefs.ConfigSegment], input_matched_groups: Dict[str, str]) List[cowbird.typedefs.ResourceSegment] [source]
Creates resource data, by replacing any tokens found in the segment names to their actual corresponding values. This data includes the name and type of each segments of a full resource path.
- Parameters:
target_segments – List containing the name and type info of each segment of the target resource path.
input_matched_groups –
- _get_resource_full_name_and_type(res_key: str, matched_groups: Dict[str, str]) Tuple[str, List[cowbird.typedefs.ResourceSegment]] [source]
Finds the resource data from the config by using the resource key.
Returns the formatted resource data along with the related service name.
- _get_src_permissions() Iterator[Tuple[str, str]] [source]
Yields all source resource/permissions found in the mappings.
- static _is_in_permissions(target_permission: str, svc_name: str, src_res_data: List[cowbird.typedefs.ResourceSegment], permissions: cowbird.typedefs.JSON) bool [source]
Checks if a target permission is found in a permissions dict.
The check is done by looking for the target permission’s resource path in the permissions dict.
- _filter_used_targets(target_res_and_permissions: TargetResourcePermissions, input_src_res_key: str, src_matched_groups: Dict[str, str], input_permission: Permission) Tuple[Dict[str, List[str]], Dict[str, List[str]]] [source]
Filters a dictionary of target resource/permissions, keeping only the permissions which should actually be removed.
This is used for the deleted webhook event, where all target permissions should not necessarily be synced. Any target permission that is also a target permission in another mapping and where the source permission of that other mapping still exists, should not be synced yet, since it would destroy that other mapping. Ex.:
A -> C B -> C or [A,B] -> C
If the A -> C mapping was triggered for a deleted webhook event, the C target permission should only be synced if both A and B permissions don’t exist.
- _get_permission_data(user_targets: Dict[str, List[str]], group_targets: Dict[str, List[str]], src_matched_groups: Dict[str, str], input_permission: Permission) cowbird.typedefs.PermissionData [source]
Formats permissions data to send to Magpie. Output contains, for each target resource key, the resource path (with the name of each segment and its corresponding type), and all the permissions to sync, defining for each permission, if it is on a user, a group, or both.
Output dict format :
{ <target_key>: { "res_path": [<list of segment names/types>], "permissions": { <permission_key>: [user, grp], ...}}, ... }
- _prepare_permissions_to_remove(target_res_and_permissions: TargetResourcePermissions, input_permission: Permission, input_src_res_key: str, src_matched_groups: Dict[str, str]) cowbird.typedefs.PermissionData [source]
Removes every source resource found in the mappings that has an existing permission that is synced to one of the input target permissions.
Used in the case of a deleted webhook event.
- _find_permissions_to_sync(src_res_key: str, src_matched_groups: Dict[str, str], input_permission: Permission, perm_operation: Callable[[List[cowbird.typedefs.PermissionConfigItemType]], None]) cowbird.typedefs.PermissionData [source]
Finds all permissions that should be synchronised with the source resource.
- sync(perm_operation: Callable[[List[cowbird.typedefs.PermissionConfigItemType]], None], permission: Permission, src_resource_tree: cowbird.typedefs.ResourceTree) None [source]
Create or delete target permissions, that are mapped to the source resource that triggered the event.
- Parameters:
perm_operation – Magpie create_permission or delete_permission function
permission – Permission to synchronize with others services
src_resource_tree – Resource tree associated with the permission to synchronize
- class cowbird.permissions_synchronizer.PermissionSynchronizer(magpie_inst: cowbird.handlers.impl.magpie.Magpie)[source]
Bases:
object
Keep service-shared resources in sync when permissions are updated for one of them.
Todo
At some point we will need a consistency function that goes through all permissions of all services and make sure that linked services have the same permissions.
- create_permission(permission: Permission) None [source]
Create the same permission on each service sharing the same resource.
- delete_permission(permission: Permission) None [source]
Delete the same permission on each service sharing the same resource.
cowbird.request_task
Module Contents
Classes
Celery base task that should be used to handle API requests. |
- exception cowbird.request_task.AbortException[source]
Bases:
Exception
Exception raised when the chain must be interrupted.
Initialize self. See help(type(self)) for accurate signature.
- class cowbird.request_task.RequestTask[source]
Bases:
celery.app.task.Task
,abc.ABC
Celery base task that should be used to handle API requests.
- Using this class will set the following Task configuration :
auto-retry for every RequestException
backoff and jitter strategy
There is also an abort_chain function to stop the chain of requests in case of an unrecoverable event
To use this class simply decorate your asynchronous function like this:
from celery import shared_task @shared_task(bind=True, base=RequestTask) def function_name(self, any, wanted, parameters): pass # function operations
Parameter
bind=True
will provide the self argument to the function which is the celery Task (not required).Parameter
base=RequestTask
will instantiate a RequestTask rather than a base celery Task as the self object.- autoretry_for: Tuple[Exception] = ()[source]
Exceptions that are accepted as valid raising cases to attempt request retry.
- retry_backoff = True[source]
Enable backoff strategy during request retry upon known raised exception.
- retry_backoff_max = 600[source]
Maximum backoff delay permitted using request retry.
Retries are abandoned if this delay is reached.
cowbird.typedefs
Additional typing definitions.
Module Contents
cowbird.utils
Module Contents
Classes
Utility |
|
A metaclass that creates a Singleton base class when called. |
|
Represents a null value to differentiate from None. |
Functions
|
Immediately sets the logger level to avoid duplicate log outputs from the root logger and this logger when |
|
Applies the provided logging configuration settings to the logger. |
|
Logs the requested message to the logger and optionally enforce printing to the console according to configuration |
|
Logs the provided message to the logger and raises the corresponding exception afterwards. |
|
Converts |
|
Evaluate if argument is a callable |
|
|
|
Generates application configuration with all required utilities and settings configured. |
Loads configuration INI settings with additional handling. |
|
|
Retrieves the application |
|
Retrieves the 'JSON' body of a response using the property/callable according to the response's implementation. |
|
Retrieves |
|
Converts a |
|
Retrieve application settings from a supported container. |
|
Obtains the |
|
|
|
Subscriber event that logs basic details about the incoming requests. |
|
Tween factory that logs any exception before re-raising it. |
|
|
|
|
|
|
|
|
|
|
|
Applies new permissions to a path, if required. |
Applies/remove read, write and execute permissions (on |
|
|
Applies default ownership to a path, if required. |
Attributes
- cowbird.utils.get_logger(name: str, level: int | None = None, force_stdout: bool = None, message_format: str | None = None, datetime_format: str | None = None) logging.Logger [source]
Immediately sets the logger level to avoid duplicate log outputs from the root logger and this logger when level is
logging.NOTSET
.
- cowbird.utils.set_logger_config(logger: logging.Logger, force_stdout: bool = False, message_format: str | None = None, datetime_format: str | None = None) logging.Logger [source]
Applies the provided logging configuration settings to the logger.
- cowbird.utils.print_log(msg: str, logger: logging.Logger | None = None, level: int = logging.INFO, **kwargs: Any) None [source]
Logs the requested message to the logger and optionally enforce printing to the console according to configuration value defined by
COWBIRD_LOG_PRINT
.
- cowbird.utils.raise_log(msg: str, exception: Type[Exception] = Exception, logger: logging.Logger | None = None, level: int = logging.ERROR) NoReturn [source]
Logs the provided message to the logger and raises the corresponding exception afterwards.
- Raises:
exception – whichever exception provided is raised systematically after logging.
- cowbird.utils.bool2str(value: Any) str [source]
Converts
value
to explicit"true"
or"false"
str
with permissive variants comparison that can represent common falsy or truthy values.
- cowbird.utils.islambda(func: Any) bool [source]
Evaluate if argument is a callable
lambda
expression.
- cowbird.utils.get_app_config(container: cowbird.typedefs.AnySettingsContainer) pyramid.config.Configurator [source]
Generates application configuration with all required utilities and settings configured.
- cowbird.utils.get_settings_from_config_ini(config_ini_path: str, section: str | None = None) cowbird.typedefs.SettingsType [source]
Loads configuration INI settings with additional handling.
- cowbird.utils.get_registry(container: cowbird.typedefs.AnyRegistryContainer, nothrow: bool = False) pyramid.registry.Registry | None [source]
Retrieves the application
registry
from various containers referencing to it.
- cowbird.utils.get_json(response: cowbird.typedefs.AnyResponseType) cowbird.typedefs.JSON [source]
Retrieves the ‘JSON’ body of a response using the property/callable according to the response’s implementation.
- cowbird.utils.get_header(header_name: str, header_container: cowbird.typedefs.AnyHeadersType, default: str | None = None, split: str | List[str] | None = None) str | None [source]
Retrieves
header_name
by fuzzy match (independently of upper/lower-case and underscore/dash) from various framework implementations ofHeaders
.If
split
is specified, the matchedheader_name
is first split with it and the first item is returned. This allows to parse complex headers (e.g.:text/plain; charset=UTF-8
totext/plain
withsplit=';'
).- Parameters:
header_name – header to find.
header_container – where to look for header_name.
default – value to returned if header_container is invalid or header_name could not be found.
split – character(s) to use to split the found header_name.
- cowbird.utils.convert_response(response: cowbird.typedefs.AnyResponseType) pyramid.response.Response [source]
Converts a
requests.Response
object to an equivalentpyramid.response.Response
object.Content of the
response
is expected to be JSON.- Parameters:
response – response to be converted
- Returns:
converted response
- cowbird.utils.get_settings(container: cowbird.typedefs.AnySettingsContainer | None, app: bool = False) cowbird.typedefs.SettingsType [source]
Retrieve application settings from a supported container.
- Parameters:
container – supported container with a handle to application settings.
app – allow retrieving from current thread registry if no container was defined.
- Returns:
found application settings dictionary.
- Raises:
TypeError – when no application settings could be found or unsupported container.
- cowbird.utils.fully_qualified_name(obj: Any | Type[Any]) str [source]
Obtains the
'<module>.<name>'
full path definition of the object to allow finding and importing it.
- cowbird.utils.log_request(event: pyramid.events.NewRequest) None [source]
Subscriber event that logs basic details about the incoming requests.
- cowbird.utils.log_exception_tween(handler: Callable[[pyramid.request.Request], cowbird.typedefs.AnyResponseType], registry: pyramid.registry.Registry) Callable[[pyramid.request.Request], cowbird.typedefs.AnyResponseType] [source]
Tween factory that logs any exception before re-raising it.
Application errors are marked as
ERROR
while non-critical HTTP errors are marked asWARNING
.
- class cowbird.utils.ExtendedEnum[source]
Bases:
enum.Enum
Utility
enum.Enum
methods.Create an extended enum with these utilities as follows:
class CustomEnum(ExtendedEnum): ItemA = "A" ItemB = "B"
- classmethod names() List[str] [source]
Returns the member names assigned to corresponding enum elements.
- class cowbird.utils.SingletonMeta[source]
Bases:
type
A metaclass that creates a Singleton base class when called.
Create a class such that.
class A(object, metaclass=SingletonMeta): pass class B(object, metaclass=SingletonMeta): pass a1 = A() a2 = A() b1 = B() b2 = B() a1 is a2 # True b1 is b2 # True a1 is b1 # False
- class cowbird.utils.NullType[source]
Bases:
object
Represents a null value to differentiate from None.
- cowbird.utils.get_config_path(container: cowbird.typedefs.AnySettingsContainer | None = None) str [source]
- cowbird.utils.get_ssl_verify(container: cowbird.typedefs.AnySettingsContainer | None = None) bool [source]
- cowbird.utils.get_timeout(container: cowbird.typedefs.AnySettingsContainer | None = None) int [source]
- cowbird.utils.apply_new_path_permissions(path: str, is_readable: bool, is_writable: bool, is_executable: bool) None [source]
Applies new permissions to a path, if required.
- cowbird.utils.update_filesystem_permissions(permission: int, is_readable: bool, is_writable: bool, is_executable: bool) int [source]
Applies/remove read, write and execute permissions (on
others
only) to the input file system permissions.Note that
others
permissions are used instead of theuser
/group
permissions, to manage the user’s data access. See Components - Usage of ‘others’ permissions for more details on the usage ofothers
permissions.
Package Contents
Functions
|
view
Module Contents
Classes
Attributes
request
Module Contents
Classes
__init__
Package Contents
Classes
Base class for protocol classes. |
|
Bases:
Protocol
Base class for protocol classes.
Protocol classes are defined as:
class Proto(Protocol): def meth(self) -> int: ...
Such classes are primarily used with static type checkers that recognize structural subtyping (static duck-typing), for example:
class C: def meth(self) -> int: return 0 def func(x: Proto) -> int: return x.meth() func(C()) # Passes static type check
See PEP 544 for details. Protocol classes decorated with @typing.runtime_checkable act as simple-minded runtime protocols that check only the presence of given attributes, ignoring their type signatures. Protocol classes can be generic, they are defined as:
class GenProto(Protocol[T]): def meth(self) -> T: ...
tests
Submodules
tests.test_api
Tests for cowbird.api
module.
Module Contents
Classes
Test API operations of application. |
Functions
Validate that regardless of response type (success/error) and status-code, metadata details are added. |
- class tests.test_api.TestAPI(methodName='runTest')[source]
Bases:
unittest.TestCase
Test API operations of application.
Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.
- classmethod setUpClass()[source]
Hook method for setting up class fixture before running tests in the class.
tests.test_cli
Tests for cowbird.cli
module.
Module Contents
Functions
|
|
Attributes
tests.test_constants
Module Contents
Functions
|
|
tests.test_filesystem
Module Contents
Classes
Base test FileSystem parent class, containing some utility functions and common setup/teardown operations. |
|
Test FileSystem generic operations. |
|
FileSystem tests specific to the user wps outputs data. |
Attributes
- class tests.test_filesystem.BaseTestFileSystem(methodName='runTest')[source]
Bases:
unittest.TestCase
Base test FileSystem parent class, containing some utility functions and common setup/teardown operations.
Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.
- classmethod setUpClass()[source]
Hook method for setting up class fixture before running tests in the class.
- class tests.test_filesystem.TestFileSystemBasic(methodName='runTest')[source]
Bases:
BaseTestFileSystem
Test FileSystem generic operations.
Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.
- test_manage_user_workspace(mock_head_request)[source]
Tests creating and deleting a user workspace.
- class tests.test_filesystem.TestFileSystemWpsOutputsUser(methodName='runTest')[source]
Bases:
BaseTestFileSystem
FileSystem tests specific to the user wps outputs data.
These tests can include verifications on the different path permissions. Note that
others
permissions are used instead of theuser
/group
permissions, to manage the user’s data access. See Components - Usage of ‘others’ permissions for more details on the usage ofothers
permissions.Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.
- create_secure_data_proxy_service()[source]
Generates a new secure-data-proxy service in Magpie app.
- static check_path_perms_and_hardlink(src_path: str, hardlink_path: str, perms: int)[source]
Checks if a path has the expected permissions, and if a hardlink exists, according to the other permissions.
- test_user_created()[source]
Tests if creating a user generates the hardlinks to the pre-existing user WPS outputs data.
- test_user_wps_output_created_secure_data_proxy()[source]
Tests creating wps outputs for a user when Magpie uses a secure-data-proxy service to manage access permissions to the wps output data.
- test_permission_updates_user_data()[source]
Tests updating permissions on data found directly in a specific user directory.
tests.test_geoserver
These tests require a working Geoserver instance.
They can be run with the Make test-geoserver target. More integration tests should be in Jupyter Notebook format as is the case with Birdhouse-deploy / DACCS platform.
Module Contents
Classes
Test cases to validate the synchronization between Magpie permissions and file permissions in a Geoserver workspace. |
Functions
Setup basic parameters for an unmodified local test run (using the example files) unless environment variables are |
|
|
Prepares a workspace, its datastore and a test shapefile along with the associated Geoserver resources. |
|
Removes a workspace on the file system and the associated resources on Geoserver. |
|
|
|
Attributes
- tests.test_geoserver.get_geoserver_settings()[source]
Setup basic parameters for an unmodified local test run (using the example files) unless environment variables are set.
- tests.test_geoserver.prepare_geoserver_test_workspace(test_instance: TestGeoserver, geoserver_handler: cowbird.handlers.impl.geoserver.Geoserver, workspace_key: str) Tuple[str, str] [source]
Prepares a workspace, its datastore and a test shapefile along with the associated Geoserver resources.
- tests.test_geoserver.reset_geoserver_test_workspace(test_instance, geoserver_handler)[source]
Removes a workspace on the file system and the associated resources on Geoserver.
- class tests.test_geoserver.TestGeoserverRequests[source]
Bases:
TestGeoserver
- test_workspace_creation(geoserver: cowbird.handlers.impl.geoserver.Geoserver) None [source]
- test_empty_workspace_removal(geoserver: cowbird.handlers.impl.geoserver.Geoserver) None [source]
- test_duplicate_workspace(geoserver: cowbird.handlers.impl.geoserver.Geoserver) None [source]
- test_workspace_removal(geoserver: cowbird.handlers.impl.geoserver.Geoserver) None [source]
- test_datastore_creation(geoserver: cowbird.handlers.impl.geoserver.Geoserver) None [source]
- test_datastore_creation_missing_workspace(geoserver: cowbird.handlers.impl.geoserver.Geoserver) None [source]
- test_datastore_configuration(geoserver: cowbird.handlers.impl.geoserver.Geoserver) None [source]
- test_duplicate_datastore(geoserver: cowbird.handlers.impl.geoserver.Geoserver) None [source]
- test_publish_and_remove_shapefile(geoserver: cowbird.handlers.impl.geoserver.Geoserver) None [source]
- class tests.test_geoserver.TestGeoserverPermissions[source]
Bases:
TestGeoserver
Test cases to validate the synchronization between Magpie permissions and file permissions in a Geoserver workspace.
See Components - Geoserver for more details on the design/implementation choices.
- check_magpie_permissions(res_id, expected_perms, expected_access=Access.ALLOW.value, expected_scope=Scope.MATCH.value, effective=True)[source]
Checks if a resource has the expected permissions on Magpie for a specific access and scope value.
- test_shapefile_on_created()[source]
Tests if the right Magpie permissions are created upon a shapefile creation in a Geoserver workspace.
- test_shapefile_on_modified()[source]
Tests if the right Magpie permissions are updated upon a shapefile permission modification in a Geoserver workspace.
- test_shapefile_on_modified_other_ext()[source]
Tests modification events on any other file of the shapefile that does not have the main extension (.shp), which should not trigger any other event or modification.
- test_shapefile_on_deleted()[source]
Tests if the right Magpie permissions are deleted upon a shapefile removal in a Geoserver workspace.
- test_workspace_on_modified()[source]
Tests if Magpie resources associated with the user workspace are updated correctly.
- test_workspace_on_deleted(caplog)[source]
Tests if Magpie resources associated with the user workspace are deleted only when a user_deleted event is triggered.
- test_magpie_layer_permissions()[source]
Tests modifications on layer permissions on Magpie and the resulting updates of the permissions on the related files.
- apply_and_check_recursive_permissions(resource_id, resource_name)[source]
Used in different test cases to check the creation and deletion of a recursive permission on Magpie, validating if the resource’s files and all the children resources’ files are updated.
- test_magpie_workspace_permission()[source]
Tests modifications on a workspace’s recursive permissions on Magpie and the updates of the related files.
tests.test_handler_factory
Module Contents
Classes
A class whose instances are single test cases. |
|
Helper class that provides a standard way to create an ABC using |
|
Helper class that provides a standard way to create an ABC using |
|
Helper class that provides a standard way to create an ABC using |
Attributes
- class tests.test_handler_factory.TestHandlerFactory(methodName='runTest')[source]
Bases:
unittest.TestCase
A class whose instances are single test cases.
By default, the test code itself should be placed in a method named ‘runTest’.
If the fixture may be used for many test cases, create as many test methods as are needed. When instantiating such a TestCase subclass, specify in the constructor arguments the name of the test method that the instance is to execute.
Test authors should subclass TestCase for their own tests. Construction and deconstruction of the test’s environment (‘fixture’) can be implemented by overriding the ‘setUp’ and ‘tearDown’ methods respectively.
If it is necessary to override the __init__ method, the base class __init__ method must always be called. It is important that subclasses should not change the signature of their __init__ method, since instances of the classes are instantiated automatically by parts of the framework in order to be run.
When subclassing TestCase, you can set these attributes: * failureException: determines which exception will be raised when
the instance’s assertion methods fail; test methods raising this exception will be deemed to have ‘failed’ rather than ‘errored’.
- longMessage: determines whether long messages (including repr of
objects used in assert methods) will be printed on failure in addition to any explicit message passed.
- maxDiff: sets the maximum length of a diff in failure messages
by assert methods using difflib. It is looked up as an instance attribute so can be configured by individual tests if required.
Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.
- class tests.test_handler_factory.BadHandler(settings: cowbird.typedefs.SettingsType, name: str, **kwargs: Any)[source]
Bases:
tests.utils.MockAnyHandlerBase
Helper class that provides a standard way to create an ABC using inheritance.
- Parameters:
settings – Cowbird settings for convenience
name – Handler name
kwargs – The base class handle, but doesn’t require the following variables:
url – Location of the web service represented by the cowbird handler
workspace_dir – Workspace directory
priority – Relative priority between handlers while handling events. Lower value has higher priority, default value is last.
- class tests.test_handler_factory.BadParamHandler(settings: cowbird.typedefs.SettingsType, name: str, **kwargs: Any)[source]
Bases:
tests.utils.MockAnyHandlerBase
Helper class that provides a standard way to create an ABC using inheritance.
- Parameters:
settings – Cowbird settings for convenience
name – Handler name
kwargs – The base class handle, but doesn’t require the following variables:
url – Location of the web service represented by the cowbird handler
workspace_dir – Workspace directory
priority – Relative priority between handlers while handling events. Lower value has higher priority, default value is last.
- class tests.test_handler_factory.GoodHandler(settings: cowbird.typedefs.SettingsType, name: str, **kwargs: Any)[source]
Bases:
tests.utils.MockAnyHandlerBase
Helper class that provides a standard way to create an ABC using inheritance.
- Parameters:
settings – Cowbird settings for convenience
name – Handler name
kwargs – The base class handle, but doesn’t require the following variables:
url – Location of the web service represented by the cowbird handler
workspace_dir – Workspace directory
priority – Relative priority between handlers while handling events. Lower value has higher priority, default value is last.
tests.test_magpie
Module Contents
Classes
Tests different methods found in the Magpie handler. |
Functions
|
|
|
|
|
|
|
|
|
|
|
|
|
Attributes
- tests.test_magpie.create_user(magpie: cowbird.handlers.impl.magpie.Magpie, user_name: str, email: str, password: str, group_name: str) int [source]
- tests.test_magpie.delete_user(magpie: cowbird.handlers.impl.magpie.Magpie, user_name: str) None [source]
- tests.test_magpie.create_group(magpie: cowbird.handlers.impl.magpie.Magpie, group_name: str, descr: str, discoverable: bool, terms: str) int [source]
- tests.test_magpie.delete_group(magpie: cowbird.handlers.impl.magpie.Magpie, group_name: str) None [source]
- tests.test_magpie.create_service(magpie: cowbird.handlers.impl.magpie.Magpie, service_data: Dict[str, str]) int [source]
- tests.test_magpie.delete_service(magpie: cowbird.handlers.impl.magpie.Magpie, service_name: str) None [source]
- tests.test_magpie.delete_all_services(magpie: cowbird.handlers.impl.magpie.Magpie) None [source]
tests.test_mongodb
Module Contents
Classes
A class whose instances are single test cases. |
- class tests.test_mongodb.MongodbServiceStoreTestCase(methodName='runTest')[source]
Bases:
unittest.TestCase
A class whose instances are single test cases.
By default, the test code itself should be placed in a method named ‘runTest’.
If the fixture may be used for many test cases, create as many test methods as are needed. When instantiating such a TestCase subclass, specify in the constructor arguments the name of the test method that the instance is to execute.
Test authors should subclass TestCase for their own tests. Construction and deconstruction of the test’s environment (‘fixture’) can be implemented by overriding the ‘setUp’ and ‘tearDown’ methods respectively.
If it is necessary to override the __init__ method, the base class __init__ method must always be called. It is important that subclasses should not change the signature of their __init__ method, since instances of the classes are instantiated automatically by parts of the framework in order to be run.
When subclassing TestCase, you can set these attributes: * failureException: determines which exception will be raised when
the instance’s assertion methods fail; test methods raising this exception will be deemed to have ‘failed’ rather than ‘errored’.
- longMessage: determines whether long messages (including repr of
objects used in assert methods) will be printed on failure in addition to any explicit message passed.
- maxDiff: sets the maximum length of a diff in failure messages
by assert methods using difflib. It is looked up as an instance attribute so can be configured by individual tests if required.
Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.
- classmethod setUpClass()[source]
Hook method for setting up class fixture before running tests in the class.
tests.test_monitoring
Module Contents
Classes
A class whose instances are single test cases. |
|
Interface being called when something changes on the filesystem. |
|
Interface being called when something changes on the filesystem. |
Functions
|
- class tests.test_monitoring.TestMonitoring(methodName='runTest')[source]
Bases:
unittest.TestCase
A class whose instances are single test cases.
By default, the test code itself should be placed in a method named ‘runTest’.
If the fixture may be used for many test cases, create as many test methods as are needed. When instantiating such a TestCase subclass, specify in the constructor arguments the name of the test method that the instance is to execute.
Test authors should subclass TestCase for their own tests. Construction and deconstruction of the test’s environment (‘fixture’) can be implemented by overriding the ‘setUp’ and ‘tearDown’ methods respectively.
If it is necessary to override the __init__ method, the base class __init__ method must always be called. It is important that subclasses should not change the signature of their __init__ method, since instances of the classes are instantiated automatically by parts of the framework in order to be run.
When subclassing TestCase, you can set these attributes: * failureException: determines which exception will be raised when
the instance’s assertion methods fail; test methods raising this exception will be deemed to have ‘failed’ rather than ‘errored’.
- longMessage: determines whether long messages (including repr of
objects used in assert methods) will be printed on failure in addition to any explicit message passed.
- maxDiff: sets the maximum length of a diff in failure messages
by assert methods using difflib. It is looked up as an instance attribute so can be configured by individual tests if required.
Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.
- classmethod setUpClass()[source]
Hook method for setting up class fixture before running tests in the class.
- class tests.test_monitoring.TestMonitor[source]
Bases:
cowbird.monitoring.fsmonitor.FSMonitor
Interface being called when something changes on the filesystem.
- on_created(path)[source]
Called when a new path is found.
- Parameters:
path – Absolute path of a new file/directory
tests.test_permissions_synchronizer
Module Contents
Classes
Test permissions synchronization. |
|
Tests different config setups for permissions synchronization. |
Functions
|
Checks if the config loads without error, or if it triggers the expected exception in the case of an invalid config. |
Attributes
- class tests.test_permissions_synchronizer.TestSyncPermissions(methodName='runTest')[source]
Bases:
unittest.TestCase
Test permissions synchronization.
These tests parse the sync config and checks that when a permission is created/deleted in the PermissionSynchronizer the proper permissions are created/deleted for every synchronized service. These tests require a running instance of Magpie.
Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.
- classmethod setUpClass()[source]
Hook method for setting up class fixture before running tests in the class.
- create_test_permission(resource_id: int, perm_name: magpie.permissions.Permission, perm_access: magpie.permissions.Access, perm_scope: magpie.permissions.Scope, user_name: str, group_name: str) None [source]
Creates a test permission in Magpie app.
- delete_test_permission(resource_id: int, permission_name: magpie.permissions.Permission, user_name: str, group_name: str) None [source]
Creates a test permission in Magpie app.
- check_user_permissions(resource_id: int, expected_permissions: List) None [source]
Checks if the test user has the expected_permissions on the resource_id.
- check_group_permissions(resource_id: int, expected_permissions: List) None [source]
Checks if the test group has the expected_permissions on the resource_id.
- test_webhooks_no_tokens()[source]
Tests the permissions synchronization of resources that don’t use any tokens in the config.
- test_webhooks_valid_tokens()[source]
Tests the permissions synchronization of resources that use valid tokens in the config.
- test_webhooks_invalid_multimatch()[source]
Tests the invalid case where a resource in the incoming webhook matches multiple resource keys in the config.
- tests.test_permissions_synchronizer.check_config(config_data: Dict, expected_exception_type: Type[Exception] = None) None [source]
Checks if the config loads without error, or if it triggers the expected exception in the case of an invalid config.
- class tests.test_permissions_synchronizer.TestSyncPermissionsConfig(methodName='runTest')[source]
Bases:
unittest.TestCase
Tests different config setups for permissions synchronization.
Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.
- test_not_unique_multitoken()[source]
Tests if config respects the constraint of using maximum one MULTI_TOKEN in a single resource.
- test_not_unique_named_token()[source]
Tests an invalid config where duplicate named tokens are used in a single resource.
- test_unknown_res_key()[source]
Tests an invalid config where an unknown resource key is found in the permissions_mapping.
- test_duplicate_resource_key()[source]
Tests an invalid config where the same resource key is used for different resources.
- test_invalid_mapping_format()[source]
Tests an invalid config where a permissions_mapping uses an invalid format.
- test_multi_token_bidirectional()[source]
Tests the usage of MULTI_TOKEN in a bidirectional mapping.
- test_unidirectional_multi_token()[source]
Tests the usage of MULTI_TOKEN in a unidirectional mapping.
- test_bidirectional_named_tokens()[source]
Tests config with a bidirectional mapping that uses named tokens.
tests.test_request_task
Helpful documentation on how to setup celery test fixtures:
TL;DR :
- Add a session fixture with an in-memory celery config.
- Use the celery_session_app
and celery_session_worker
fixtures for the tests.
- Don’t forget to use the shared_task decorator instead of the usual app.task
because shared_task
uses
a proxy allowing the task to be bound to any app (including the
celery_session_app
fixture).
Module Contents
Classes
Celery base task that should be used to handle API requests. |
|
A class whose instances are single test cases. |
Functions
|
|
|
|
|
- class tests.test_request_task.UnreliableRequestTask[source]
Bases:
cowbird.request_task.RequestTask
,abc.ABC
Celery base task that should be used to handle API requests.
- Using this class will set the following Task configuration :
auto-retry for every RequestException
backoff and jitter strategy
There is also an abort_chain function to stop the chain of requests in case of an unrecoverable event
To use this class simply decorate your asynchronous function like this:
from celery import shared_task @shared_task(bind=True, base=RequestTask) def function_name(self, any, wanted, parameters): pass # function operations
Parameter
bind=True
will provide the self argument to the function which is the celery Task (not required).Parameter
base=RequestTask
will instantiate a RequestTask rather than a base celery Task as the self object.
- tests.test_request_task.unreliable_request_task(self: cowbird.request_task.RequestTask, param1: int, param2: int) int [source]
- tests.test_request_task.abort_sum_task(self: cowbird.request_task.RequestTask, param1: int, param2: int) int [source]
- class tests.test_request_task.TestRequestTask(methodName='runTest')[source]
Bases:
unittest.TestCase
A class whose instances are single test cases.
By default, the test code itself should be placed in a method named ‘runTest’.
If the fixture may be used for many test cases, create as many test methods as are needed. When instantiating such a TestCase subclass, specify in the constructor arguments the name of the test method that the instance is to execute.
Test authors should subclass TestCase for their own tests. Construction and deconstruction of the test’s environment (‘fixture’) can be implemented by overriding the ‘setUp’ and ‘tearDown’ methods respectively.
If it is necessary to override the __init__ method, the base class __init__ method must always be called. It is important that subclasses should not change the signature of their __init__ method, since instances of the classes are instantiated automatically by parts of the framework in order to be run.
When subclassing TestCase, you can set these attributes: * failureException: determines which exception will be raised when
the instance’s assertion methods fail; test methods raising this exception will be deemed to have ‘failed’ rather than ‘errored’.
- longMessage: determines whether long messages (including repr of
objects used in assert methods) will be printed on failure in addition to any explicit message passed.
- maxDiff: sets the maximum length of a diff in failure messages
by assert methods using difflib. It is looked up as an instance attribute so can be configured by individual tests if required.
Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.
- classmethod setUpClass()[source]
Hook method for setting up class fixture before running tests in the class.
- classmethod tearDownClass()[source]
Hook method for deconstructing the class fixture after running all tests in the class.
- test_geoserver_user_created(create_workspace_mock, create_datastore_mock, create_datastore_dir_mock)[source]
tests.test_utils
Tests for the various utility operations.
Module Contents
Classes
Utility |
|
A class whose instances are single test cases. |
- class tests.test_utils.DummyEnum[source]
Bases:
cowbird.utils.ExtendedEnum
Utility
enum.Enum
methods.Create an extended enum with these utilities as follows:
class CustomEnum(ExtendedEnum): ItemA = "A" ItemB = "B"
- class tests.test_utils.TestUtils(methodName='runTest')[source]
Bases:
unittest.TestCase
A class whose instances are single test cases.
By default, the test code itself should be placed in a method named ‘runTest’.
If the fixture may be used for many test cases, create as many test methods as are needed. When instantiating such a TestCase subclass, specify in the constructor arguments the name of the test method that the instance is to execute.
Test authors should subclass TestCase for their own tests. Construction and deconstruction of the test’s environment (‘fixture’) can be implemented by overriding the ‘setUp’ and ‘tearDown’ methods respectively.
If it is necessary to override the __init__ method, the base class __init__ method must always be called. It is important that subclasses should not change the signature of their __init__ method, since instances of the classes are instantiated automatically by parts of the framework in order to be run.
When subclassing TestCase, you can set these attributes: * failureException: determines which exception will be raised when
the instance’s assertion methods fail; test methods raising this exception will be deemed to have ‘failed’ rather than ‘errored’.
- longMessage: determines whether long messages (including repr of
objects used in assert methods) will be printed on failure in addition to any explicit message passed.
- maxDiff: sets the maximum length of a diff in failure messages
by assert methods using difflib. It is looked up as an instance attribute so can be configured by individual tests if required.
Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.
- classmethod setUpClass()[source]
Hook method for setting up class fixture before running tests in the class.
- test_verify_param_args_incorrect_usage()[source]
Invalid usage of function raises internal server error instead of ‘normal HTTP error’.
- test_verify_param_compare_types()[source]
Arguments
param
andparam_compare
must be of same type for valid comparison, except foris_type
where compare parameter must be the type directly.Changed in version 2.0: Since
param
can come from user input, we should NOT raiseHTTPInternalServerError
because the whole point of the method is to ensure that values are compared accordingly in a controlled fashion. Therefore, error to be raised is an ‘expected’ validation failure (HTTPBadRequest
or whicheverhttp_error
provided) instead of runtime ‘unexpected’ processing error.On the other hand, when
is_type
flag is requested, we know thatparam_compare
must be a type. Inversely,param_compare
must not be a type ifis_type
is not requested, but other flags require some form of comparison between values. We evaluate these use cases here.See also
test_verify_param_args_incorrect_usage()
for invalid input use-cases
- test_evaluate_call_callable_incorrect_usage()[source]
Verifies that incorrect usage of utility is raised accordingly.
- test_evaluate_call_recursive_safeguard()[source]
Validate use case if internal function that handles formatting and generation of a resulting HTTP response raises itself an error (because of implementation issue), while it is processing another pre-raised error, that it does not end up into an endless recursive call stack of raised errors.
tests.utils
Module Contents
Classes
Special version supporting |
|
Helper class that provides a standard way to create an ABC using |
|
Helper class that provides a standard way to create an ABC using |
|
Helper class that provides a standard way to create an ABC using |
Functions
|
|
|
Instantiate a local test application. |
|
Obtains the referenced test application, local application or remote URL from Test Case implementation. |
|
Obtains stored hostname in the class implementation. |
|
Obtains stored headers in the class implementation. |
|
Obtains the specified response Content-Type header(s) without additional formatting parameters. |
|
Obtains the JSON payload of the response regardless of its class implementation. |
|
Generates a message string with formatted JSON body for display with easier readability. |
|
Decorator to mock |
|
Generates a fake request with provided arguments. |
|
Calls the request using either a |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Calls the callable and verifies that the specific exception was raised. |
|
Calls the callable and verifies that no exception was raised. |
Validates basic Cowbird API response metadata. For UI pages, employ |
|
|
Validates error response |
|
Checks if the path has the right permissions, by verifying the last digits of the octal permissions. |
|
Attributes
- class tests.utils.TestVersion(vstring: AnyTestVersion)[source]
Bases:
packaging.version.Version
Special version supporting
latest
keyword to ignore safeguard check ofwarn_version()
during development.See also
Environment variable
COWBIRD_TEST_VERSION
should be set with the desired version orlatest
to evaluate even new features above the last tagged version.Initialize a Version object.
- Parameters:
version – The string representation of a version which will be parsed and normalized before use.
- Raises:
InvalidVersion – If the
version
does not conform to PEP 440 in any way then this exception will be raised.
- class tests.utils.MockMagpieHandler(settings, name, **kwargs)[source]
Bases:
cowbird.handlers.handler.Handler
Helper class that provides a standard way to create an ABC using inheritance.
- Parameters:
settings – Cowbird settings for convenience
name – Handler name
kwargs – The base class handle, but doesn’t require the following variables:
url – Location of the web service represented by the cowbird handler
workspace_dir – Workspace directory
priority – Relative priority between handlers while handling events. Lower value has higher priority, default value is last.
- class tests.utils.MockAnyHandlerBase(settings: cowbird.typedefs.SettingsType, name: str, **kwargs: Any)[source]
Bases:
cowbird.handlers.handler.Handler
Helper class that provides a standard way to create an ABC using inheritance.
- Parameters:
settings – Cowbird settings for convenience
name – Handler name
kwargs – The base class handle, but doesn’t require the following variables:
url – Location of the web service represented by the cowbird handler
workspace_dir – Workspace directory
priority – Relative priority between handlers while handling events. Lower value has higher priority, default value is last.
- class tests.utils.MockAnyHandler(settings: cowbird.typedefs.SettingsType, name: str, **kwargs: Any)[source]
Bases:
MockAnyHandlerBase
Helper class that provides a standard way to create an ABC using inheritance.
- Parameters:
settings – Cowbird settings for convenience
name – Handler name
kwargs – The base class handle, but doesn’t require the following variables:
url – Location of the web service represented by the cowbird handler
workspace_dir – Workspace directory
priority – Relative priority between handlers while handling events. Lower value has higher priority, default value is last.
- tests.utils.get_test_app(settings: cowbird.typedefs.SettingsType | None = None) webtest.app.TestApp [source]
Instantiate a local test application.
- tests.utils.get_app_or_url(test_item: AnyTestItemType) TestAppOrUrlType [source]
Obtains the referenced test application, local application or remote URL from Test Case implementation.
- tests.utils.get_hostname(test_item: AnyTestItemType) str [source]
Obtains stored hostname in the class implementation.
- tests.utils.get_headers(app_or_url: TestAppOrUrlType, header_dict: cowbird.typedefs.AnyHeadersType) cowbird.typedefs.HeadersType [source]
Obtains stored headers in the class implementation.
- tests.utils.get_response_content_types_list(response: cowbird.typedefs.AnyResponseType) List[str] [source]
Obtains the specified response Content-Type header(s) without additional formatting parameters.
- tests.utils.get_json_body(response: cowbird.typedefs.AnyResponseType) cowbird.typedefs.JSON [source]
Obtains the JSON payload of the response regardless of its class implementation.
- tests.utils.json_msg(json_body: cowbird.typedefs.JSON, msg: str | None = null) str [source]
Generates a message string with formatted JSON body for display with easier readability.
- tests.utils.mock_get_settings(test)[source]
Decorator to mock
cowbird.utils.get_settings()
to allow retrieval of settings fromDummyRequest
.Warning
Only apply on test methods (not on class TestCase) to ensure that
pytest
can collect them correctly.
- tests.utils.mock_request(request_path_query: str = '', method: str = 'GET', params: Dict[str, str] | None = None, body: str | cowbird.typedefs.JSON = '', content_type: str | None = None, headers: cowbird.typedefs.AnyHeadersType | None = None, cookies: cowbird.typedefs.AnyCookiesType | None = None, settings: cowbird.typedefs.SettingsType = None) pyramid.request.Request [source]
Generates a fake request with provided arguments.
Can be employed by functions that expect a request object as input to retrieve details such as body content, the request path, or internal settings, but that no actual request needs to be accomplished.
- tests.utils.test_request(test_item: AnyTestItemType, method: str, path: str, data: cowbird.typedefs.JSON | str | None = None, json: cowbird.typedefs.JSON | str | None = None, body: cowbird.typedefs.JSON | str | None = None, params: Dict[str, str] | None = None, timeout: int = 10, retries: int = 3, allow_redirects: bool = True, content_type: str | None = None, headers: cowbird.typedefs.AnyHeadersType | None = None, cookies: cowbird.typedefs.AnyCookiesType | None = None, **kwargs: Any) cowbird.typedefs.AnyResponseType [source]
Calls the request using either a
webtest.TestApp
instance orrequests.Request
from a string URL.Keyword arguments
json
,data
andbody
are all looked for to obtain the data.Header
Content-Type
is set with respect to explicitjson
or via providedheaders
when available. Explicitcontent_type
can also be provided to override all of these.Request cookies are set according to
cookies
, or can be interpreted fromSet-Cookie
header.Warning
When using
TestApp
, some internal cookies can be stored from previous requests to retain the active user. Make sure to provide new set of cookies (or logout user explicitly) if different session must be used, otherwise they will be picked up automatically. For ‘empty’ cookies, provide an empty dictionary.- Parameters:
test_item – one of BaseTestCase, webtest.TestApp or remote server URL to call with requests
method – request method (GET, POST, PATCH, PUT, DELETE)
path – test path starting at base path that will be appended to the application’s endpoint.
params – query parameters added to the request path.
json – explicit JSON body content to use as request body.
data – body content string to use as request body, can be JSON if matching
Content-Type
is identified.body – alias to
data
.content_type – Enforce specific content-type of provided data body. Otherwise, attempt to retrieve it from request headers. Inferred JSON content-type when
json
is employed, unless overridden explicitly.headers – Set of headers to send the request. Header
Content-Type
is looked for if not overridden.cookies – Cookies to provide to the request.
timeout – passed down to
requests
when using URL, otherwise ignored (unsupported).retries – number of retry attempts in case the requested failed due to timeout (only when using URL).
allow_redirects – Passed down to
requests
when using URL, handled manually for same behaviour when usingTestApp
.kwargs – any additional keywords that will be forwarded to the request call.
- Returns:
response of the request
- tests.utils.check_all_equal(iter_val: Collection[Any], iter_ref: Collection[Any] | cowbird.utils.NullType, msg: str | None = None, any_order: bool = False) None [source]
- Parameters:
iter_val – tested values.
iter_ref – reference values.
msg – override message to display if failing test.
any_order – allow equal values to be provided in any order, otherwise order must match as well as values.
- Raises:
AssertionError – If all values in
iter_val
are not equal to values withiniter_ref
. Ifany_order
isFalse
, also raises if equal items are not in the same order.
- tests.utils.check_val_equal(val: Any, ref: Any | cowbird.utils.NullType, msg: str | None = None) None [source]
- Raises:
AssertionError – if
val
is not equal toref
.
- tests.utils.check_val_not_equal(val: Any, ref: Any | cowbird.utils.NullType, msg: str | None = None) None [source]
- Raises:
AssertionError – if
val
is equal toref
.
- tests.utils.check_val_is_in(val: Any, ref: Any | cowbird.utils.NullType, msg: str | None = None) None [source]
- Raises:
AssertionError – if
val
is not in toref
.
- tests.utils.check_val_not_in(val: Any, ref: Any | cowbird.utils.NullType, msg: str | None = None) None [source]
- Raises:
AssertionError – if
val
is in toref
.
- tests.utils.check_val_type(val: Any, ref: Type[Any] | cowbird.utils.NullType | Iterable[Type[Any]], msg: str | None = None) None [source]
- Raises:
AssertionError – if
val
is not an instanced ofref
.
- tests.utils.check_raises(func: Callable[[], Any], exception_type: Type[Exception], msg: str | None = None) Exception [source]
Calls the callable and verifies that the specific exception was raised.
- Raises:
AssertionError – on failing exception check or missing raised exception.
- Returns:
raised exception of expected type if it was raised.
- tests.utils.check_no_raise(func: Callable[[], Any], msg: str | None = None) Any [source]
Calls the callable and verifies that no exception was raised.
- Raises:
AssertionError – on any raised exception.
- tests.utils.check_response_basic_info(response: cowbird.typedefs.AnyResponseType, expected_code: int = 200, expected_type: str = CONTENT_TYPE_JSON, expected_method: str = 'GET', extra_message: str | None = None) cowbird.typedefs.JSON | str [source]
Validates basic Cowbird API response metadata. For UI pages, employ
check_ui_response_basic_info()
instead.If the expected content-type is JSON, further validations are accomplished with specific metadata fields that are always expected in the response body. Otherwise, minimal validation of basic fields that can be validated regardless of content-type is done.
- Parameters:
response – response to validate.
expected_code – status code to validate from the response.
expected_type – Content-Type to validate from the response.
expected_method – method ‘GET’, ‘POST’, etc. to validate from the response if an error.
extra_message – additional message to append to every specific test message if provided.
- Returns:
json body of the response for convenience.
- tests.utils.check_error_param_structure(body: cowbird.typedefs.JSON, param_value: Any | None = null, param_name: str | None = null, param_compare: Any | None = null, param_name_exists: bool = False, param_compare_exists: bool = False) None [source]
Validates error response
param
information based on different Cowbird version formats.- Parameters:
body – JSON body of the response to validate.
param_value – Expected ‘value’ of param the parameter. Contained field value not verified if
null
, only presence of the field.param_name – Expected ‘name’ of param. Ignored for older Cowbird version that did not provide this information. Contained field value not verified if
null
andparam_name_exists
isTrue
(only its presence). If provided, automatically impliesparam_name_exists=True
. Skipped otherwise.param_compare – Expected ‘compare’/’param_compare’ value (filed name according to version) Contained field value not verified if
null
andparam_compare_exists
isTrue
(only its presence). If provided, automatically impliesparam_compare_exists=True
. Skipped otherwise.param_name_exists – verify that ‘name’ is in the body, not validating its value.
param_compare_exists – verify that ‘compare’/’param_compare’ is in the body, not validating its value.
- Raises:
AssertionError – on any failing condition
Contributing
Contributions are welcome, and they are greatly appreciated! Every little bit helps, and credit will always be given. All contributors are presented in AUTHORS file.
You can contribute in many ways:
Types of Contributions
Report Bugs
Report bugs as a new issue.
If you are reporting a bug, please include:
Your operating system name and version.
Any details about your local setup that might be helpful in troubleshooting.
Detailed steps to reproduce the bug.
Write Documentation
Cowbird could always use more documentation, whether as part of the official Cowbird docs, in docstrings, or even on the web in blog posts, articles, and such.
Submit Feedback
The best way to send feedback is to file a new issue.
If you are proposing a feature:
Explain in detail how it would work.
Keep the scope as narrow as possible, to make it easier to implement.
Remember that this is a volunteer-driven project, and that contributions are welcome :)
Provide utilities
If you made a convenient utility or tool that works conjointly with Cowbird in other to provide useful features or simply provide ease-of-life, don’t hesitate to open a PR referring to it in the documentation utilities. We love sharing and avoiding to rewrite stuff.
Get Started!
Ready to contribute? Here’s how to set up cowbird for local development.
Clone the repository :
git clone https://github.com/Ouranosinc/cowbird
Install your local copy (see installation)
When you’re done making changes, check that your changes pass code formatting and tests:
make check
make test
Commit your changes and push your branch to GitHub.
Submit a pull request to the author (tests will run to evaluate that everything still works).
Pull Request Guidelines
Before you submit a pull request, check that it meets these guidelines:
The pull request should include tests.
If the pull request adds functionality, the docs should be updated. Put your new functionality into a function with a docstring, and add the feature to the list in CHANGES (under relevant category of section Unreleased).
The tests should work for the specified version of Python for this project.
Tips
To run a subset of tests:
make SPEC="<CUSTOM TEST SPECIFICATIONS>" test-custom
With <CUSTOM TEST SPECIFICATIONS>
being any predefined markers, specific test classes or functions as supported
by pytest
runner.
Credits
Contributors
Francis Charette Migneault <francis.charette-migneault@crim.ca> [@fmigneault]
Charles-William Cummings <charles-william.cummings@crim.ca> [@ChaamC]
David Byrns <david.byrns@crim.ca> [@dbyrns]
Francis Pelletier <francis.pelletier@crim.ca> [@f-PLT]
Changes
Unreleased (latest)
Nothing yet.
2.1.0 (2023-09-18)
Features / Changes
Add monitoring to the
FileSystem
handler to watch WPS outputs data.Synchronize both public and user WPS outputs data to the workspace folder with hardlinks for user access.
Add resync endpoint
/handlers/{handler_name}/resync
to trigger a handler’s resync operations. Only theFileSystem
handler is implemented for now, regenerating hardlinks associated to WPS outputs public data.
2.0.0 (2023-07-21)
Update Docker image to use
python:3.10-alpine
instead ofpython:3.7-alpine
for latest security updates and performance improvements.Update GitHub CI tests to include Python 3.9, 3.10 and 3.11, and use 3.10 by default for additional checks.
Update multiple package dependencies flagged by PyUp as well as any relevant code changes to support updated packages.
Move
ports
sections of exampledocker/docker-compose.*.yml
files to thedev
variant to reflect a realisticprod
vsdev
configuration scheme and allowports
overrides without merge of lists to avoid conflicts.Add typing requirements and
check-types[-only]
targets toMakefile
. To avoid breaking the CI on any minor typing issue, leave it asallow_failure: true
for the moment. Further typing conversions and fixes can be applied gradually on a best-effort basis.Covert type comments to type annotations.
Fix and improve
Geoserver
typings.Drop Python 3.7 that reached end-of-life.
1.2.0 (2023-07-10)
Features / Changes
Add permission synchronization between Magpie’s permissions and Geoserver files permissions.
Bug Fixes
Fix bug where the monitors saved on the database and the internal monitors dictionary from the
Monitoring
class would be desynchronized, not always having the expected monitors, or having monitors that were not started properly.Fix failing permissions synchronizer by adding
service_type
to the Magpie webhooks and ignoring permissions from resources not defined in the config (relates to Ouranosinc/Magpie#582).
1.1.1 (2023-03-24)
Features / Changes
Return HTTP 424 (Failed Dependency) when the
celery
worker version cannot be retrieved onGET /version
. Also, provide better error logs and detail messages in case of error to help debug the cause of the problem.
Bug Fixes
Fix incorrect typings and typographic errors.
1.1.0 (2023-03-14)
Features / Changes
Enforce specification of
COWBIRD_CONFIG_PATH
environment variable orcowbird.config_path
INI configuration to provide thecowbird.yml
file with definitions of services and permissions to manage, and raise directly at application startup otherwise. Without those definitions, Cowbird has no reason to exist.Add logging details when
handlers
are processed, succeed and failed their operation to provide insights about Cowbird integration with other services.Add
COWBIRD_REQUEST_TIMEOUT
environment variable andcowbird.request_timeout
INI configuration parameters for specifying the connection timeout (default:5s
) to be applied when sending requests.Add missing
COWBIRD_SSL_VERIFY
configuration setting in documentation.Review
FileSystem
’s handler for user workspace creation/deletion and to ensure compatibility with birdhouse-deploy’s setup.
Bug Fixes
Add
timeout
to all request calls (pylint
recommended fix to avoid infinite lock).Minor typing fixes.
1.0.0 (2022-08-18)
Features / Changes
Renamed Cowbird
services
term tohandlers
, to avoid confusion with Magpie services.
Bug Fixes
n/a
0.5.0 (2022-08-15)
Features / Changes
Add synchronization of Magpie permissions between different Magpie services, when receiving incoming webhooks.
Update config’s
services
sections undersync_permissions
to use actual Magpie service names instead of Cowbird handler names (relates to #22).Reorganize
config.example.yml
to support more sync cases, provide info on the type of each segment of a resource path and to use tokenized path.Add schema validation when starting cowbird app.
Bug Fixes
n/a
0.4.1 (2022-03-09)
Features / Changes
Add an SSL verification setting.
Add Geoserver workspace and datastore creation/removal linked to user creation/removal.
Add automated publishing of shapefiles to Geoserver when new files are found.
Use
pip
legacy and faster resolver as per pypa/pip#9187 (comment) since current one is endlessly failing to resolve development packages (linting tools fromcheck
targets).
Bug Fixes
Pin
pymongo<4
to work with pinnedcelery
version.
0.4.0 (2021-08-05)
Features / Changes
Basic users’ workspaces management for new or removed users.
Add a Mongo database backend to store/restore monitoring state across sessions.
Bug Fixes
Celery has now a proper result backend.
Celery tasks are auto-discovered package-wide, no need to import them manually.
0.3.0 (2021-07-06)
Features / Changes
Add the RequestTask celery task for handling external services requests.
Add a docker image for the celery worker
Bug Fixes
n/a
0.2.0 (2021-05-12)
Features / Changes
Preliminary design which includes:
Webhook API
Services interface
Permissions synchronizer
File system monitoring
Bug Fixes
n/a
0.1.0 (2021-02-18)
Features / Changes
First structured release which includes:
CI/CD utilities
Minimal testing of utils
Documentation of generic details (WebApp, CLI, OpenAPI, configs, etc.)
Metadata of the package
Minimal
/services
API route with dummyService
Corresponding
cowbird services list
CLI command
Bug Fixes
n/a
Glossary
- Handler
Managed component for which Cowbird provides some sort of interactive Operation.
- Operation
Sequence of execution steps that configures or sends requests to other components of the bird-house stack in order to produce an end result where those components, that normally don’t interact directly together, will be able to obtain a combined and enhanced feature.