trac.admin.api – Trac Administration panels¶
Primary interface for managing administration panels.
Interfaces¶
-
class
trac.admin.api.IAdminPanelProvider¶ Bases:
trac.core.InterfaceExtension 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), wheretemplateis the name of the template to use anddatais 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 whatIRequestHandler.process_requestdoes.
-
-
class
trac.admin.api.IAdminCommandProvider¶ Bases:
trac.core.InterfaceExtension 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), wherecommandcontains the space-separated command and sub-command names,argsis a string describing the command arguments andhelpis the help text. The first paragraph of the help text is taken as a short help, shown in the list of commands.completeis 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.executeis 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.TracErrorException raised when an admin command cannot be executed.
Components¶
-
class
trac.admin.api.AdminCommandManager¶ Bases:
trac.core.Componenttrac-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:
listA list of paths for command argument auto-completion.
-
complete(text)¶ Return the items in the list matching text.
-
-
class
trac.admin.api.PrefixList¶ Bases:
listA 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.