wte.views.part
The part module provides the functionality for creating, viewing, editing, and deleting Part.
part
Part
Routes are defined in init().
init()
wte.views.part.
ChangeStatusSchema
Messages
badDictType
%(type)s
%(value)r
badType
empty
missingValue
noneType
notExpected
%(name)s
singleValueExpected
return_to
Return to this URL
status
The part’s status
EditPartSchema
child_part_id
The child Part ids for re-ordering
content
The ReST content
display_mode
The part’s display mode
email_notify
Whether to send out an automatic change notification e-mail
email_notify_text
The text of the automatic change notification e-mail
label
The part’s label
template_id
The Template ids for re-ordering
Template
title
The part’s title
ImportPartConverter
FieldStorage
dict
ZipFile
tuple
invalidpart
%(part_type)s
invalidstructure
nopart
notzip
ImportPartSchema
a Part (and any children and Asset).
Asset
Uses the ImportPartConverter to actually check whether the uploaded file is a valid export generated from export().
export()
file
The file to import.
parent_id
The id of the parent Part to import into.
NewPartSchema
order
The optional order index to create the new Part at
The parent Part
RegisterSettingsSchema
access_rights
email_domains
The email domains that the user must belong to
password
The password to use for access rights
require
Which access rights are required
ResetFilesSchema
UserPartProgress
filename
The optional filename to reset.
change_status
Handles the /parts/{pid}/change_status URL, providing the UI and backend for changing the status of a Part.
/parts/{pid}/change_status
Requires that the user has “edit” rights on the Part.
create_part_crumbs
Creates the list of breadcrumbs for a given part. If the current is a list, then all will be added to the end of the crumbs.
current
list
A list of dict for use in the breadcrumbs
crossref_replace
The crossref_replace() function updates a single cross-reference ReST role identified by the match parameter with the correct new target part identifier from the id_mapping. If the identifier in the current cross-reference is not in the id_mapping, then it is replaced with the string ‘external’.
crossref_replace()
match
id_mapping
MatchObject
The updated cross-reference
string
delete
Handles the /modules/{mid}/parts/{pid}/delete URL, providing the UI and backend for deleting a Part.
/modules/{mid}/parts/{pid}/delete
Requires that the user has “delete” rights on the Part.
deregister
Handles the /parts/{pid}/deregister URL, to allow users to de-register from a Part that is a “module”.
/parts/{pid}/deregister
download
Handles the /parts/{pid}/download URL, providing the UI and backend for downloading a Part.
/parts/{pid}/download
The difference between exporting (export()) and downloading is that exporting creates an archive that can be imported into another WTE instance, while downloading creates an HTML version for offline viewing.
download_part_progress
Handles the /users/{uid}/progress/{pid}/download URL, sending back the complete set of data associated with the UserPartProgress.
/users/{uid}/progress/{pid}/download
Requires that the user has “view” rights on the UserPartProgress.
edit
Handles the /parts/{pid}/edit URL, providing the UI and backend for editing a Part.
/parts/{pid}/edit
edit_register_settings
Handles the /parts/{pid}/register/settings URL, providing the UI and backend for editing the settings for registering for a “module” type Part.
/parts/{pid}/register/settings
export
Handles the /parts/{pid}/export URL, providing the UI and backend for exporting a Part.
/parts/{pid}/export
The difference between exporting and downloading (download()) is that exporting creates an archive that can be imported into another WTE instance, while downloading creates an HTML version for offline viewing.
download()
get_all_parts
Recursively returns the Part and all its children.
get_user_part_progress
Returns the UserPartProgress for the given user and part. If none exists, then a new one is instantiated. If the :class:`~wte.models.UserPartProgress` points to a current page that is different to ``page, then the UserPartProgress is updated.
user
part. If none exists, then a new one is instantiated. If the :class:`~wte.models.UserPartProgress` points to a current page that is different to ``page
User
The UserPartProgress
import_file
Handles the /parts/import URL, providing the UI and backend for importing a Part.
/parts/import
The required permissions depend on the type of Part to create: * module – User permission “modules.create” * tutorial – “edit” permission on the parent Part * page – “edit” permission on the parent Part * exercise – “edit” permission on the parent Part * task – “edit” permission on the parent Part
init
Adds the part-specific backend routes (route name, URL pattern handler):
part.list
/parts
list_parts()
part.new
/parts/new
new()
part.search
/parts/search
search()
part.import
import_file()
part.view
/parts/{pid}
view_part()
part.edit
edit()
part.delete
/parts/{pid}/delete
delete()
part.preview
/parts/{pid}/rst_preview
preview()
part.register
/parts/{pid}/register
register()
part.register.settings
edit_register_settings()
part.deregister
deregister()
part.change_status
change_status()
part.export
part.download
part.reset-files
/parts/{pid}/reset_files
reset_files()
part.progress.download
/parts/{pid}/progress/download
download_part_progress()
part.progress.update
/parts/{pid}/progress/update
update_part_progress()
list_parts
Handles the /parts URL, displaying modules. If no parameters are specified, lists all available modules. If a “user_id” parameter is specified, lists all modules for that user.
new
Handles the /parts/new URL, providing the UI and backend for creating a new Part.
preview
Handles the /parts/{pid}/rst_preview URL, generating an HTML preview of the submitted ReST. The ReST text to render has to be set as the content parameter.
In addition to rendering the ReST the in the same way that it is rendered when saving a Part, this will also insert a <span id=”focus”></span> at the current cursor position indicated by the string “§§§§§§§”.
Requires that the user has “edit” rights on the current Part.
register
Handles the /parts/{pid}/register URL, to allow users to register for a Part that is a “module”.
reset_files
Handles the /parts/{pid}/reset_files URL, providing the UI and backend for resetting all Assets of a Part to the default for the current user.
Assets
Requires that the user has “view” rights on the current Part.
search
Handles the /parts/search URL, searching all Part for matches to the request parameter ‘q’. Returns all Part that the current user is allowed to view.
update_part_progress
view_part
Handles the parts/{pid} URL, displaying the Part.
parts/{pid}
Requires that the user has “view” rights on the Part.
wte.views.asset
wte.views.timed_tasks