adhocracy_core.rest.views module

GET/POST/PUT requests processing.

class ResourceRESTView(context, request)[source]

Bases: object

Default view for Resources, implements get and options.

Initialize self.

context = None

Context Resource.

request = None

pyramid.request.Request.

registry = None

pyramid.registry.Registry.

content = None

adhocracy_core.content.ResourceContentRegistry.

options() → dict[source]

Get possible request/response data structures and http methods.

get() → dict[source]

Get resource data (unless hidden).

class SimpleRESTView(context, request)[source]

Bases: adhocracy_core.rest.views.ResourceRESTView

View for simples (non versionable), implements get, options and put.

Initialize self.

put() → dict[source]

Edit resource and get response data.

delete() → dict[source]

Delete resource.

class PoolRESTView(context, request)[source]

Bases: adhocracy_core.rest.views.SimpleRESTView

View for Pools, implements get, options, put and post.

Initialize self.

get() → dict[source]

Get resource data.

delete() → dict[source]

Delete resource.

build_post_response(resource) → dict[source]

Build response data structure for a POST request.

post() → dict[source]

Create new resource and get response data.

put() → dict[source]

HTTP PUT.

class ItemRESTView(context, request)[source]

Bases: adhocracy_core.rest.views.PoolRESTView

View for Items and ItemVersions, overwrites GET and POST handling.

Initialize self.

get() → dict[source]

Get resource data.

delete() → dict[source]

Delete resource.

post()[source]

Create new resource and get response data.

For adhocracy_core.interfaces.IItemVersion:

If a new version is already created in this transaction we don’t want to create a new one. Instead we modify the existing one.

This is needed to make adhocray_core.rest.batchview.BatchView work.

class BadgeAssignmentsRESTView(context, request)[source]

Bases: adhocracy_core.rest.views.PoolRESTView

REST view for the badge assignment.

Initialize self.

get() → dict[source]

HTTP GET.

post()[source]

HTTP POST.

options() → dict[source]

Get possible request/response data structures and http methods.

class UsersRESTView(context, request)[source]

Bases: adhocracy_core.rest.views.PoolRESTView

View the IUsersService pool overwrites POST handling.

Initialize self.

post()[source]

HTTP POST.

class AssetsServiceRESTView(context, request)[source]

Bases: adhocracy_core.rest.views.PoolRESTView

View allowing multipart requests for asset upload.

Initialize self.

post()[source]

HTTP POST.

class AssetRESTView(context, request)[source]

Bases: adhocracy_core.rest.views.SimpleRESTView

View for assets, allows PUTting new versions via multipart.

Initialize self.

put() → dict[source]

HTTP PUT.

class AssetDownloadRESTView(context, request)[source]

Bases: adhocracy_core.rest.views.ResourceRESTView

View for downloading assets as binary blobs.

Initialize self.

get() → dict[source]

Get asset data.

ensure_caching_headers(response)[source]

Ensure cache headers for custom response objects.

class MetaApiView(context: <InterfaceClass adhocracy_core.resources.root.IRootPool>, request: <InterfaceClass pyramid.interfaces.IRequest>)[source]

Bases: object

Access to metadata about the API specification of this installation.

Returns a JSON document describing the existing resources and sheets.

get() → dict[source]

Get the API specification of this installation as JSON.

class LoginUsernameView(context: <InterfaceClass adhocracy_core.resources.root.IRootPool>, request: <InterfaceClass pyramid.interfaces.IRequest>)[source]

Bases: object

Log in a user via their name.

options() → dict[source]

Return options for view.

post() → dict[source]

Create new resource and get response data.

Filter Set-Cookie headers, add Secure flag if https is used.

class LoginEmailView(context: <InterfaceClass adhocracy_core.resources.root.IRootPool>, request: <InterfaceClass pyramid.interfaces.IRequest>)[source]

Bases: object

Log in a user via their email address.

options() → dict[source]

Return options for view.

post() → dict[source]

Create new resource and get response data.

class ActivateAccountView(context: <InterfaceClass adhocracy_core.resources.root.IRootPool>, request: <InterfaceClass pyramid.interfaces.IRequest>)[source]

Bases: object

Log in a user via their name.

options() → dict[source]

Return options for view.

post() → dict[source]

Activate a user account and log the user in.

class ReportAbuseView(context: <InterfaceClass adhocracy_core.resources.root.IRootPool>, request: <InterfaceClass pyramid.interfaces.IRequest>)[source]

Bases: object

Receive and process an abuse complaint.

options() → dict[source]

Return options for view.

post() → dict[source]

Receive and process an abuse complaint.

class MessageUserView(context: <InterfaceClass adhocracy_core.resources.root.IRootPool>, request: <InterfaceClass pyramid.interfaces.IRequest>)[source]

Bases: object

Send a message to another user.

options() → dict[source]

Return options for view.

post() → dict[source]

Send a message to another user.

class CreatePasswordResetView(context: <InterfaceClass adhocracy_core.resources.root.IRootPool>, request: <InterfaceClass pyramid.interfaces.IRequest>)[source]

Bases: object

Create a password reset resource.

options() → dict[source]

Return options for view.

post() → dict[source]

Create as password reset resource.

class PasswordResetView(context: <InterfaceClass adhocracy_core.resources.root.IRootPool>, request: <InterfaceClass pyramid.interfaces.IRequest>)[source]

Bases: object

Reset a user password.

options() → dict[source]

Return options for view.

post() → dict[source]

Reset password.

class LoginServiceKontoView(context: <InterfaceClass adhocracy_core.resources.root.IRootPool>, request: <InterfaceClass pyramid.interfaces.IRequest>)[source]

Bases: object

Log in a user via service konto token.

options() → dict[source]

Return options for view.

post() → dict[source]

Login user.

includeme(config)[source]

Register Views.