keepluggable.web.pyramid.views module

Pyramid calls its controllers “views”.

Views must be thin. They marshal data into actions that contain the actual business logic ― which thus becomes reusable.

keepluggable.web.pyramid.views.delete_file_and_its_versions(context, request: kerno.web.pyramid.typing.PyramidRequest) pyramid.response.Response[source]

Delete a file and its derived versions.

keepluggable.web.pyramid.views.get_operations(base_url: str = '') Dict[str, Dict[str, Any]][source]

Return a dict containing all information about our views and URLs.

keepluggable.web.pyramid.views.includeme(config)[source]

Pyramid integration.

keepluggable.web.pyramid.views.list_files(context, request: kerno.web.pyramid.typing.PyramidRequest) Dict[str, Any][source]

Return a dict with an items list containing original files.

Example request with the curl command:

curl -i -H 'Accept: application/json' http://localhost:6543/d/1/files
keepluggable.web.pyramid.views.register_operations_with_burla(ops, base_url: str = '') None[source]

More featureful registration of the views using bag.web.burla.

keepluggable.web.pyramid.views.register_pyramid_views(config, base_url: str = '') None[source]

Register keepluggable views with plain Pyramid.

keepluggable.web.pyramid.views.update_metadata(context, request: kerno.web.pyramid.typing.PyramidRequest) Dict[str, Any][source]

Store new metadata for an existing file.

Example request using the curl command:

curl -i -H 'Content-Type: application/json'
-H 'Accept: application/json' -X PUT
-d '{"description": "Super knife", "title": "A knife",
"asset_ids": [1], "room_id": null}'
http://localhost:6543/d/1/files/1/@@metadata
keepluggable.web.pyramid.views.upload_multiple_files(context, request: kerno.web.pyramid.typing.PyramidRequest) Dict[str, Any][source]

Store multiple uploads from the POST variable “files”.

The response has items, an array in which each element is either the metadata for an accepted file, or details of upload failure. Each failure will have "upload_failed": true. You can test failures by uploading zero-length files. The order in the items array is the same as the uploaded files.

keepluggable.web.pyramid.views.upload_single_file(context, request: kerno.web.pyramid.typing.PyramidRequest) Dict[str, Any][source]

When happy, return the uploaded file metadata as JSON.