wte.helpers.frontend
The frontend module provides helper functionality used to render the frontend page displays.
frontend
wte.helpers.frontend.
codemirror_options
Generates a JSON representation of CodeMirror options that are valid for the given mimetype.
mimetype
Request
mode
The JSON representation of options
codemirror_scripts
Generates the <script> tags necessary to load the CodeMirror mode JS files for the given list of mimetypes.
<script>
mimetypes
The necessary <script> tags
confirm_action
Generates a confirmation JSON object for use with the jQuery.postLink() plugin.
unicode
dict
JSON object
unicode()
confirm_delete
Generates the confirmation JSON object for use with the jQuery.postLink() plugin.
bool
html_id
Turns a given text into a valid HTML id attribute value. Removes spaces and full-stops.
lt
Helper function that checks if a is less than b.
a
b
natural_list
Returns a string representation of the items list. For an empty list or a single item the value is returned. For a list of two items, the items are joined together using the final_separator. For a list of more than two items, the all but the last item are joined using separator and the last item is joined using final_separator.
items
final_separator
separator
list()
A string representation of the list
part_change_notification_text
Generates a default notification text to be emailed when changes are made to a part.
Part
The default notification text
str
readable_timedelta
Converts a datetime.timedelta into a human-readable string.
datetime.timedelta
delta
set_list
Returns a string representation of the unique items in the items. The items must be a list() of tuple() (item, count) as returned by ordered_counted_set().
tuple()
(item, count)
ordered_counted_set()
split_seconds
Converts a time in seconds into a (days, hours, minutes, seconds) tuple for use in time_string().
(days, hours, minutes, seconds)
time_string()
int
tuple
template_for_part
Returns the correct partial template path for a given Part. If there is no partial template for the given Part, then None is returned.
None
string
time_string
Converts the days, hours, minutes, and seconds into a human-readable format.
days
hours
minutes
seconds
int()
The human-readable representation
user_admin_menubar
Generates the menu bar for the users administration list.
wte.helpers
wte.models