MoinMoin.themes package

Module contents

MoinMoin - Theme Support

class MoinMoin.themes.ThemeSupport(cfg)[source]

Bases: object

Support code for template feeding.

get_action_tabs(fqname, current_endpoint)[source]

Create a list of commonly used item views. Used by Basic theme.

Return type:list
Returns:list of item views
get_endpoint_iconmap()[source]
get_fqnames(fqname)[source]

Return the list of other fqnames associated with the item.

get_local_panel(fqname)[source]

Split uncommonly used cfg.item views into user actions, item actions, and view options.

Return type:list
Returns:list of lists containing: user actions, item actions, and view options for Basic theme
get_namespaces(ns=None)[source]

Return the list of tuples (composite name, namespace) referring to namespaces other than the current namespace.

item_exists(itemname)[source]

Check whether the item pointed to by the given itemname exists or not

Return type:boolean
Returns:whether item pointed to by the link exists or not
location_breadcrumbs(fqname)[source]

Assemble the location using breadcrumbs (was: title)

Return type:list
Returns:location breadcrumbs items in tuple (segment_name, fq_name, exists)
login_url()[source]

Return URL usable for user login

Return type:unicode (or None, if no login url is supported)
Returns:url for user login
navibar(*args, **kw)[source]

Assemble the navibar

Return type:list
Returns:list of tuples (css_class, url, link_text, title)
parent_item(item_name)[source]

Return name of parent item for the current item

Return type:unicode
Returns:parent item name
path_breadcrumbs()[source]

Assemble the path breadcrumbs (a.k.a.: trail)

Return type:list
Returns:path breadcrumbs items in tuple (wiki_name, item_name, url, exists, err)

Split navibar links into pagename, link to page

Admin or user might want to use shorter navibar items by using the [[page|title]] or [[url|title]] syntax.

Supported syntax:
  • PageName
  • WikiName:PageName
  • wiki:WikiName:PageName
  • url
  • all targets as seen above with title: [[target|title]]
Parameters:text – the text used in config or user preferences
Return type:tuple
Returns:pagename or url, link to page or url
subitem_index(fqname)[source]

Get a list of subitems for the given fqname

Return type:list
Returns:list of item tuples (item_name, item_title, item_mime_type, has_children)
userhome()[source]

Assemble arguments used to build user homepage link

Return type:tuple
Returns:arguments of user homepage link in tuple (wiki_href, display_name, title, exists)
MoinMoin.themes.contenttype_to_class(contenttype)[source]

Convert a contenttype string to a css class.

MoinMoin.themes.get_assigned_to_info(meta)[source]
MoinMoin.themes.get_current_theme()[source]
MoinMoin.themes.get_editor_info(meta, external=False)[source]

Create a dict of formatted user info.

Return type:dict
Returns:dict of formatted user info such as name, ip addr, email,...
MoinMoin.themes.render_template(template, **context)[source]
MoinMoin.themes.setup_jinja_env()[source]
MoinMoin.themes.shorten_ctype(contenttype)[source]

Returns user understandable terms for contenttype.

Parameters:contenttype – contains the long form of the contenttype
Return type:unicode
Returns:user understandable version of contenttype
MoinMoin.themes.shorten_fqname(fqname, length=25)[source]

Shorten fqname

Shorten a given long fqname so that it looks good depending upon whether the field is a UUID or not.

Parameters:
  • fqname – fqname, namedtuple
  • length – maximum length for shortened fqnames in case the field is not a UUID.
Return type:

unicode

Returns:

shortened fqname.

MoinMoin.themes.shorten_id(name, length=7)[source]

Shorten IDs to specified length

Shorten long IDs into just the first <length> characters. There’s no need to display the whole IDs everywhere.

Parameters:
  • name – item name, unicode
  • length – Maximum length of the resulting ID, int
Return type:

unicode

Returns:

<name> truncated to <length> characters

MoinMoin.themes.shorten_item_name(name, length=25)[source]

Shorten item names

Shorten very long item names that tend to break the user interface. The short name is usually fine, unless really stupid long names are used (WYGIWYD).

Parameters:
  • name – item name, unicode
  • length – maximum length for shortened item names, int
Return type:

unicode

Returns:

shortened version.

MoinMoin.themes.themed_error(e)[source]
MoinMoin.themes.time_hh_mm(dt)[source]

Convert a datetime object into a short string of the form HH:MM where HH varies from 0 to 23.

MoinMoin.themes.utctimestamp(dt)[source]

convert a datetime object (UTC) to a UNIX timestamp (UTC)

Note: time library writers seem to have a distorted relationship to inverse
functions and also to UTC (see time.gmtime, see datetime.utcfromtimestamp).