• Home
  • API Documentation
  • wte.views.asset – Assets

wte.views.asset – Assets¶

The asset module provides the backend functionality for creating, editing, and deleting Asset.

Routes are defined in init().

class wte.views.asset.EditAssetSchema(*args, **kw)[source]¶
The EditAssetSchema handles the
validation of updates to an Asset.

Messages

badDictType:
The input must be dict-like (not a %(type)s: %(value)r)
badType:
The input must be a string (not a %(type)s: %(value)r)
empty:
Please enter a value
missingValue:
Missing value
noneType:
The input must be a string (not None)
notExpected:
The input field %(name)s was not expected.
singleValueExpected:
Please provide only one value
content = None¶

The asset’s content

data = None¶

The asset’s file content

filename = None¶

The asset’s filename

mimetype = None¶

The asset’s mimetype

mimetype_other = None¶

The asset’s alternative mimetype

class wte.views.asset.NewAssetSchema(*args, **kw)[source]¶
The NewAssetSchema handles the
validation of a new Asset.

Messages

badDictType:
The input must be dict-like (not a %(type)s: %(value)r)
badType:
The input must be a string (not a %(type)s: %(value)r)
empty:
Please enter a value
missingValue:
Missing value
noneType:
The input must be a string (not None)
notExpected:
The input field %(name)s was not expected.
singleValueExpected:
Please provide only one value
data = None¶

The asset’s data

filename = None¶

The asset’s filename

wte.views.asset.delete(request)[source]¶

Handles the /parts/{pid}/assets/{aid}/delete URL, providing the UI and backend for deleting Asset.

Requires that the user has “edit” rights on the current Part.

wte.views.asset.edit(request)[source]¶

Handles the /parts/{pid}/assets/{aid}/edit URL, providing the UI and backend for editing Asset.

Requires that the user has “edit” rights on the current Part.

wte.views.asset.init(config)[source]¶

Adds the asset-specific routes (route name, URL pattern handler):

  • asset.new – /parts/{pid}/assets/new/{new_type} – new()
  • asset.search – /parts/{pid}/assets/search – search()
  • asset.edit – /parts/{pid}/assets/{aid}/edit – edit()
  • asset.delete – /parts/{pid}/assets/{aid}/delete – delete()
  • asset.view – /parts/{pid}/files/name/assets/{filename} – view_asset()
  • file.view – /parts/{pid}/files/name/{filename} – view_file()
  • file.save – /parts/{pid}/files/id/{fid}/save – save_file()
wte.views.asset.new(request)[source]¶

Handles the /parts/{pid}/assets/new/{new_type} URL, providing the UI and backend for creating a new Asset.

Requires that the user has “edit” rights on the current Part.

wte.views.asset.save_file(request)[source]¶

Handles the /parts/{pid}/files/id/{fid}/save URL, updating the Asset‘s content.

Requires that the user has “view” rights on the Part. It will also only update an Asset belonging to the current User.

wte.views.asset.search(request)[source]¶

Handles the /parts/{pid}/assets/search URL, searching for all Asset that have a filename that matches the ‘q’ request parameter and that belong to either the current Part or any of its ancestors. The current user must have the “view” permission on the current Part to see any results.

wte.views.asset.view_asset(request)[source]¶

Handles the /parts/{pid}/files/name/assets/{filename} URL, sending back the correct Asset.

Requires that the user has “view” rights on the Part.

wte.views.asset.view_file(request)[source]¶

Handles the parts/{ptid}/pages/{pid}/users/{uid}/files/name/{filename} URL, sending back the correct Asset.

Requires that the user has “view” rights on the Part. It will also only send an Asset belonging to the current User.

  • wte.views.admin – Admin view handlers
  • wte.views.part – Part Backend