habitat.views.utils

Shared utility functions for views.

Functions

datetime_to_timestamp
must_be_admin(user[, msg]) Raise UnauthorizedError if the user is not an admin
parse
read_json_schema(schemaname)
rfc3339_to_datetime
rfc3339_to_timestamp
rfc3339_to_utc_datetime
timegm
validate
validate_doc(data, schema) Validate data against schema, raising descriptive errors
validate_rfc3339 Mock out external modules that might annoy documentation build systems.

Classes

tzutc

Exceptions

ForbiddenError Mock out external modules that might annoy documentation build systems.
UnauthorizedError Mock out external modules that might annoy documentation build systems.
ValidationError
habitat.views.utils.must_be_admin(user, msg='Only server administrators may edit this document.')[source]

Raise UnauthorizedError if the user is not an admin

habitat.views.utils.validate_doc(data, schema)[source]

Validate data against schema, raising descriptive errors