trac.admin.api – Trac Administration panels

Primary interface for managing administration panels.

Interfaces

class trac.admin.api.IAdminPanelProvider

Bases: trac.core.Interface

Extension point interface for adding panels to the web-based administration interface.

See also trac.admin.api.IAdminPanelProvider extension point

get_admin_panels(req)

Return a list of available admin panels.

The items returned by this function must be tuples of the form (category, category_label, page, page_label).

render_admin_panel(req, category, page, path_info)

Process a request for an admin panel.

This function should return a tuple of the form (template, data), where template is the name of the template to use and data is the data to use when rendering the template.

Note

When a plugin wants to use a legacy Genshi template instead of a Jinja2 template, it needs to return instead a triple of the form (template, data, None), similar to what IRequestHandler.process_request does.

class trac.admin.api.IAdminCommandProvider

Bases: trac.core.Interface

Extension point interface for adding commands to the console administration interface trac-admin.

See also trac.admin.api.IAdminCommandProvider extension point

get_admin_commands()

Return a list of available admin commands.

The items returned by this function must be tuples of the form (command, args, help, complete, execute), where command contains the space-separated command and sub-command names, args is a string describing the command arguments and help is the help text. The first paragraph of the help text is taken as a short help, shown in the list of commands.

complete is called to auto-complete the command arguments, with the current list of arguments as its only argument. It should return a list of relevant values for the last argument in the list.

execute is called to execute the command, with the command arguments passed as positional arguments.

Exceptions

class trac.admin.api.AdminCommandError(msg, show_usage=False, cmd=None)

Bases: trac.core.TracError

Exception raised when an admin command cannot be executed.

Components

class trac.admin.api.AdminCommandManager

Bases: trac.core.Component

trac-admin command manager.

complete_command(args, cmd_only=False)

Perform auto-completion on the given arguments.

execute_command(*args)

Execute a command given by a list of arguments.

get_command_help(args=[])

Return help information for a set of commands.

providers

List of components that implement IAdminCommandProvider

Classes

class trac.admin.api.PathList

Bases: list

A list of paths for command argument auto-completion.

complete(text)

Return the items in the list matching text.

class trac.admin.api.PrefixList

Bases: list

A list of prefixes for command argument auto-completion.

Helper Functions

trac.admin.api.get_console_locale(env=None, lang=None, categories=('LANGUAGE', 'LC_ALL', 'LC_MESSAGES', 'LANG'))

Return negotiated locale for console by locale environments and [trac] default_language.

trac.admin.api.get_dir_list(path, dirs_only=False)

Return a list of paths to filesystem entries in the same directory as the given path.