Changeset 37567

04/25/16 11:05:32 (7 years ago)

reset wiki

251 edited


  • wiki/pages/SandBox

    r37566 r37567  
     1= The Sandbox =
     3This is just a page to practice and learn WikiFormatting.
     5Go ahead, edit it freely.
  • wiki/pages/TicketQuery

    r37566 r37567  
     1= !TicketQuery Wiki Macro
     3The !TicketQuery macro lets you display information on tickets within wiki pages.
     4The query language used by the `[[TicketQuery]]` macro is described in [TracQuery#UsingtheTicketQueryMacro TracQuery] page.
     6== Usage
     10== Example
     12||= **Example** =||= **Result** =||= **Macro** =||
     14||=Number of [query:status=new&milestone= Triage tickets]: =||\
     15|| **[[TicketQuery(status=new&milestone=,count)]]**||\
     16|| `[[TicketQuery(status=new&milestone=,count)]]` ||
     18||=Number of new tickets: =||\
     19|| **[[TicketQuery(status=new,count)]]**||\
     20|| `[[TicketQuery(status=new,count)]]` ||
     22||=Number of reopened tickets: =||\
     23|| **[[TicketQuery(status=reopened,count)]]**||\
     24|| `[[TicketQuery(status=reopened,count)]]` ||
     26||=Number of assigned tickets: =||\
     27|| **[[TicketQuery(status=assigned,count)]]**||\
     28|| `[[TicketQuery(status=assigned,count)]]` ||
     30||=Number of invalid tickets: =||\
     31|| **[[TicketQuery(status=closed,resolution=invalid,count)]]**||\
     32|| `[[TicketQuery(status=closed,resolution=invalid,count)]]` ||
     34||=Number of worksforme tickets: =||\
     35|| **[[TicketQuery(status=closed,resolution=worksforme,count)]]**||\
     36|| `[[TicketQuery(status=closed,resolution=worksforme,count)]]` ||
     38||=Number of duplicate tickets: =||\
     39|| **[[TicketQuery(status=closed,resolution=duplicate,count)]]**||\
     40|| `[[TicketQuery(status=closed,resolution=duplicate,count)]]` ||
     42||=Number of wontfix tickets: =||\
     43|| **[[TicketQuery(status=closed,resolution=wontfix,count)]]**||\
     44|| `[[TicketQuery(status=closed,resolution=wontfix,count)]]` ||
     46||=Number of fixed tickets: =||\
     47|| **[[TicketQuery(status=closed,resolution=fixed,count)]]**||\
     48|| `[[TicketQuery(status=closed,resolution=fixed,count)]]` ||
     50||=Total number of tickets: =||\
     51|| **[[TicketQuery(count)]]**||\
     52|| `[[TicketQuery(count)]]` ||
     54||=Number of tickets reported **or** owned by current user: =||\
     55|| **[[TicketQuery(reporter=$USER,or,owner=$USER,count)]]**||\
     56|| `[[TicketQuery(reporter=$USER,or,owner=$USER,count)]]` ||
     58||=Number of tickets created this month: =||\
     59|| **[[TicketQuery(created=thismonth..,count)]]**||\
     60|| `[[TicketQuery(created=thismonth..,count)]]` ||
     62||=Last 3 modified tickets: =||\
     64|| `[[TicketQuery(max=3,order=modified,desc=1,compact)]]` ||
     66{{{#!th rowspan=2, style="text-align: left;"
     67Details of ticket #1:
     69{{{#!td style="border-bottom: 0;"
     75{{{#!td colspan=2, style="border-top: 0;"
     80== Using the `[[TicketQuery]]` Macro
     82The [trac:TicketQuery TicketQuery] macro lets you display lists of tickets matching certain criteria anywhere you can use WikiFormatting.
     89This is displayed as:
     90  [[TicketQuery(version=0.6|0.7&resolution=duplicate)]]
     92Just like the [wiki:TracQuery#UsingTracLinks query: wiki links], the parameter of this macro expects a query string formatted according to the rules of the simple [wiki:TracQuery#QueryLanguage ticket query language]. This also displays the link and description of a single ticket:
     97This is displayed as:
     98  [[TicketQuery(id=123)]]
     100A more compact representation without the ticket summaries is:
     102[[TicketQuery(version=0.6|0.7&resolution=duplicate, compact)]]
     105This is displayed as:
     106  [[TicketQuery(version=0.6|0.7&resolution=duplicate, compact)]]
     108Finally, if you wish to receive only the number of defects that match the query, use the `count` parameter:
     110[[TicketQuery(version=0.6|0.7&resolution=duplicate, count)]]
     113This is displayed as:
     114  [[TicketQuery(version=0.6|0.7&resolution=duplicate, count)]]
     117See also: TracQuery, TracTickets, TracReports, TracGuide
  • wiki/pages/TitleIndex

    r37566 r37567  
     1''' Index by Title ''' | ''' [RecentChanges Index by Date] '''
  • wiki/pages/TracAccessibility

    r37566 r37567  
     1= Accessibility Support in Trac =
     3Not every user has a graphic environment with a mouse or other pointing device. Some users rely on keyboard, alternative keyboard or voice input to navigate links, activate form controls, etc. In a Trac session, users can use devices other than a pointing device by enabling keyboard shortcuts through the [/prefs/keybindings Keyboard Shortcuts] preferences panel.
     5Trac supports accessibility keys for the most common operations. The access keys differ by browser and the following work for several browsers, but see [ access in different browsers] for more details.
     6 - on Linux platforms, press any of the keys listed below in combination with the `<Alt>` key
     7 - on a Mac, use the `<Ctrl>` + `<Opt>` key instead
     8 - on Windows, you need to hit `<Shift> + <Alt> + <Key>`. This works for the most common browsers, such as Firefox, Chrome, Safari and Internet Explorer
     10== Global Access Keys ==
     12 * `1` - WikiStart
     13 * `2` - [TracTimeline Timeline]
     14 * `3` - [TracRoadmap Roadmap]
     15 * `4` - [TracSearch Search]
     16 * `6` - [TracGuide Trac Guide / Documentation]
     17 * `7` - [TracTickets New Ticket]
     18 * `9` - [/about About Trac]
     19 * `e` - Edit (wiki or report)
     20 * `r` - Preview (wiki or ticket)
     21 * `f` - Search
     25See also: TracGuide
  • wiki/pages/TracAdmin

    r37566 r37567  
     1= TracAdmin
     3[[PageOutline(2-5, Contents, floated)]]
     6Trac is distributed with a powerful command-line configuration tool. This tool can be used  to configure and customize your Trac-installation to better fit your needs.
     8Some of those operations can also be performed via the web administration module.
     10== Usage
     12For nearly every `trac-admin` command, you'll need to specify the path to the TracEnvironment that you want to administer as the first argument, for example:
     14trac-admin /path/to/projenv wiki list
     17The only exception is for the `help` command, but even in this case if you omit the environment, you'll only get a very succinct list of commands (`help` and `initenv`), the same list you'd get when invoking `trac-admin` alone.
     18Also, `trac-admin --version` will tell you about the Trac version (e.g. 0.12) corresponding to the program.
     20If you want to get a comprehensive list of the available commands and sub-commands, you need to specify an existing environment:
     22trac-admin /path/to/projenv help
     25Some commands have a more detailed help, which you can access by specifying the command's name as a subcommand for `help`:
     28trac-admin /path/to/projenv help <command>
     31=== `trac-admin <targetdir> initenv` === #initenv
     33This subcommand is very important as it's the one used to create a TracEnvironment in the specified `<targetdir>`. That directory must not exist prior to the call.
     37It supports an extra `--inherit` option, which can be used to specify a global configuration file which can be used to share settings between several environments. You can also inherit from a shared configuration afterwards, by setting the `[inherit] file` option in the `conf/trac.ini` file in your newly created environment, but the advantage of specifying the inherited configuration file at environment creation time is that only the options ''not'' already specified in the global configuration file will be written in the created environment's `conf/trac.ini` file.
     38See TracIni#GlobalConfiguration.
     40Note that in version 0.11 of Trac, `initenv` lost an extra last argument `<templatepath>`, which was used in previous versions to point to the `templates` folder. If you are using the one-liner '`trac-admin /path/to/trac/ initenv <projectname> <db> <repostype> <repospath>`' in the above and getting an error that reads ''''`Wrong number of arguments to initenv: 4`'''', then this is because you're using a `trac-admin` script from an '''older''' version of Trac.
     42== Interactive Mode
     44When passing the environment path as the only argument, `trac-admin` starts in interactive mode.
     45Commands can then be executed on the selected environment using the prompt, which offers tab-completion
     46(on non-Windows environments, and when the Python `readline` module is available) and automatic repetition of the last command issued.
     48Once you're in interactive mode, you can also get help on specific commands or subsets of commands:
     50For example, to get an explanation of the `resync` command, run:
     52> help resync
     55To get help on all the Wiki-related commands, run:
     57> help wiki
     60== Full Command Reference
     62You'll find below the detailed help for all the commands available by default in `trac-admin`. Note that this may not match the list given by `trac-admin <yourenv> help`, as the commands  pertaining to components disabled in that environment won't be available and conversely some plugins activated in the environment can add their own commands.
     67See also: TracGuide, TracBackup, TracPermissions, TracEnvironment, TracIni, [trac:TracMigrate TracMigrate]
  • wiki/pages/TracBackup

    r37566 r37567  
     1= Trac Backup
     5Backups are simply a copied snapshot of the entire [wiki:TracEnvironment project environment] directory, including the database. Backups can be created using the `hotcopy` command in [wiki:TracAdmin trac-admin].
     7'''Note''': Trac uses the `hotcopy` nomenclature to match that of [ Subversion], to make it easier to remember when managing both Trac and Subversion servers.
     9== Creating a Backup
     11To create a backup of a live TracEnvironment simply run:
     13$ trac-admin /path/to/projenv hotcopy /path/to/backupdir
     16[wiki:TracAdmin trac-admin] will lock the database while copying.
     18The resulting backup directory is safe to handle using standard file-based backup tools like `tar` or `dump`/`restore`.
     20Please note, the `hotcopy` command will not overwrite a target directory and when such exists, the operation ends with an error: `Command failed: [Errno 17] File exists:` This is discussed in [trac:ticket:3198 #3198].
     22=== Restoring a Backup
     24To restore an environment from a backup, stop the process running Trac, ie the Web server or [wiki:TracStandalone tracd], restore the contents of your backup (path/to/backupdir) to your [wiki:TracEnvironment project environment] directory and restart the service.
     26To restore a PostgreSQL database backup, use the command:
     28psql -U <user> -d <database> -f postgresql.dump
     30The `<database>` option is the same as the [TracEnvironment#DatabaseConnectionStrings database connection string] in the `[trac]` `database` option of //trac.ini//.
     33See also: TracAdmin, TracEnvironment, TracGuide, [trac:TracMigrate TracMigrate]
  • wiki/pages/TracBatchModify

    r37566 r37567  
     1= Trac Ticket Batch Modification =
     4Trac supports modifying a batch of tickets in one request from [TracQuery custom query] results .
     6To perform a batch modification, select the tickets you wish to modify and set the new field values using the section underneath the query results.
     8== List fields
     10The `Keywords` and `Cc` fields are treated as lists, where list items can be added and/or removed in addition of replacing the entire list value. All list field controls accept multiple items, such as multiple keywords or cc addresses.
     12== Excluded fields
     14Multi-line text fields are not supported, because no valid use-case has been presented for syncing them across several tickets. That restriction applies to the `Description` field as well as to any [TracTicketsCustomFields#AvailableFieldTypesandOptions custom field] of type 'textarea'. However, future versions of Trac could support in conjunction with more suitable actions like 'prepend', 'append' or 'search & replace' ([ th:#2415]).
  • wiki/pages/TracBrowser

    r37566 r37567  
     1= The Trac Repository Browser
     5The Trac repository browser can be used to browse specific revisions of directories and files stored in the repositories associated with the Trac environment.
     7At the top-level of the repository browser is the '''Repository Index''', listing all the configured repositories.
     8Each repository has a name which is used as a path prefix in a "virtual" file hierarchy encompassing all the available repositories.
     9One of the repositories can be configured with an empty name; this is the default repository. When such a default repository is present, its top-level files and directories are also listed, in a '''Default Repository''' section placed before the repository index. If the default repository is the only repository associated with the Trac environment, then the '''Repository Index''' will be omitted. This means that after upgrading a single-repository Trac of version 0.11 (or earlier) to a multi-repository Trac (0.12), the repository browser will look and feel the same, that single repository becoming automatically the "default" repository.
     11Directory entries are displayed in a list with sortable columns. The list entries can be sorted by ''Name'', ''Size'', ''Age'' or ''Author'' by clicking on the column headers. The sort order can be reversed by clicking on a given column header again.
     13The browser can be used to navigate through the directory structure by clicking on the directory names.
     14Clicking on a file name will show the contents of the file.
     15Clicking on the revision number of a file or directory will take you to the TracRevisionLog for that file.
     16Note that there's also a ''Revision Log'' navigation link that will do the same for the path currently being examined.
     17Clicking on the ''diff'' icon after revision number will display the changes made to the files modified in that revision.
     18Clicking on the ''Age'' of the file - will take you to that changeset in the timeline.
     20It's also possible to browse directories or files as they were in history, at any given repository revision. The default behavior is to display the latest revision but another revision number can easily be selected using the ''View revision'' input field at the top of the page.
     22The color bar next to the ''Age'' column gives a visual indication of the age of the last change to a file or directory, following the convention that '''[[span(style=color:#88f,blue)]]''' is oldest and '''[[span(style=color:#f88,red)]]''' is newest, but this can be [TracIni#browser-section configured].
     24At the top of the browser page, there's a ''Visit'' drop-down menu which you can use to select some interesting places in the repository, for example branches or tags.
     25This is sometimes referred to as the ''browser quickjump'' facility.
     26The precise meaning and content of this menu depends on your repository backend.
     27For Subversion, this list contains by default the top-level trunk directory and sub-directories of the top-level branches and tags directories (`/trunk`, `/branches/*`, and `/tags/*`). This can be [TracIni#svn-section configured] for more advanced cases.
     29If you're using a Javascript enabled browser, you'll be able to expand and collapse directories in-place by clicking on the arrow head at the right side of a directory. Alternatively, the [trac:TracKeys keyboard] can also be used for this:
     30 - use `j` and `k` to select the next or previous entry, starting with the first
     31 - `o` ('''o'''pen) to toggle between expanded and collapsed state of the selected
     32   directory or for visiting the selected file
     33 - `v` ('''v'''iew, '''v'''isit) and `<Enter>`, same as above
     34 - `r` can be used to force the '''r'''eload of an already expanded directory
     35 - `a` can be used to directly visit a file in '''a'''nnotate (blame) mode
     36 - `l` to view the '''l'''og for the selected entry
     37If no row has been selected using `j` or `k` these keys will operate on the entry under the mouse.
     39For the Subversion backend, some advanced additional features are available:
     40 - The `svn:needs-lock` property will be displayed.
     41 - Support for the `svn:mergeinfo` property showing the merged and eligible information.
     42 - Support for browsing the `svn:externals` property, which can be [TracIni#svn:externals-section configured].
     43 - The `svn:mime-type` property is used to select the syntax highlighter for rendering the file. For example, setting `svn:mime-type` to `text/html` will ensure the file is highlighted as HTML, regardless of the file extension. It also allows selecting the character encoding used in the file content. For example, if the file content is encoded in UTF-8, set `svn:mime-type` to `text/html;charset=utf-8`. The `charset=` specification overrides the default encoding defined in the `default_charset` option of the `[trac]` section of [TracIni#trac-section trac.ini].
     45MMM: I found this section a bit hard to understand. I changed the first item as I understood that well.
     46but I think the other items could be changed also
     47 cboos: in the meantime, I've added the ''advanced'' word as a hint this can be a bit complex...
     51See also: TracGuide, TracChangeset, TracFineGrainedPermissions
  • wiki/pages/TracCgi

    r37566 r37567  
     1= Installing Trac as CGI
     5{{{#!div class=important
     6 ''Please note that using Trac via CGI is the slowest deployment method available. It is slower than [TracModPython mod_python], [TracFastCgi FastCGI] and even [trac:TracOnWindowsIisAjp IIS/AJP] on Windows.''
     9CGI script is the entrypoint that web-server calls when a web-request to an application is made. The `trac.cgi` script can be created using the `trac-admin <env> deploy <dir>` command which automatically substitutes the required paths, see TracInstall#cgi-bin. Make sure the script is executable by your web server.
     11== Apache web-server configuration
     13In [ Apache] there are two ways to run Trac as CGI:
     15 1. Use a `ScriptAlias` directive that maps an URL to the `trac.cgi` script (recommended)
     16 1. Copy the `trac.cgi` file into the directory for CGI executables used by your web server (commonly named `cgi-bin`). You can also create a symbolic link, but in that case make sure that the `FollowSymLinks` option is enabled for the `cgi-bin` directory.
     18To make Trac available at `` add `ScriptAlias` directive to Apache configuration file, changing `trac.cgi` path to match your installation:
     20ScriptAlias /trac /path/to/www/trac/cgi-bin/trac.cgi
     23 ''Note that this directive requires enabled `mod_alias` module.''
     25If you're using Trac with a single project you need to set its location using the `TRAC_ENV` environment variable:
     27<Location "/trac">
     28  SetEnv TRAC_ENV "/path/to/projectenv"
     32Or to use multiple projects you can specify their common parent directory using the `TRAC_ENV_PARENT_DIR` variable:
     34<Location "/trac">
     35  SetEnv TRAC_ENV_PARENT_DIR "/path/to/project/parent/dir"
     39 ''Note that the `SetEnv` directive requires enabled `mod_env` module. It is also possible to set TRAC_ENV in trac.cgi. Just add the following code between "try:" and "from trac.web ...":''
     42    import os
     43    os.environ['TRAC_ENV'] = "/path/to/projectenv"
     46 '' Or for TRAC_ENV_PARENT_DIR: ''
     49    import os
     50    os.environ['TRAC_ENV_PARENT_DIR'] = "/path/to/project/parent/dir"
     53If you are using the [ Apache suEXEC] feature please see [trac:ApacheSuexec].
     55On some systems, you ''may'' need to edit the shebang line in the `trac.cgi` file to point to your real Python installation path. On a Windows system you may need to configure Windows to know how to execute a .cgi file (Explorer -> Tools -> Folder Options -> File Types -> CGI).
     57=== Using WSGI
     59You can run a [ WSGI handler] [ under CGI].  You can [wiki:TracModWSGI#Thetrac.wsgiscript write your own application function], or use the deployed trac.wsgi's application.
     61== Mapping Static Resources
     63See TracInstall#MappingStaticResources.
     65== Adding Authentication
     67See TracInstall#ConfiguringAuthentication.
     70See also:  TracGuide, TracInstall, [wiki:TracModWSGI], TracFastCgi, TracModPython
  • wiki/pages/TracChangeLog

    r37566 r37567  
     2= Change Log
     3This is a rough list of changes between released versions.
     5To see where Trac is going in future releases, see the [trac:roadmap Roadmap].
     8== 1.1.x Releases
     9// 1.1.x releases are development releases leading eventually to Trac 1.2. See them as kind of snapshots of [trac:source:trunk].
     11** No guarantees of feature and API compatibility is made from one 1.1.x release to the next. //
     13=== 1.1.6
     15//(July 17, 2015)//
     17Trac 1.1.6 contains more than a half dozen minor fixes and enhancements.
     19For more information see the [trac:wiki:TracDev/ApiChanges/1.1 API changes] and the detailed
     20release notes for [[trac:wiki:TracDev/ReleaseNotes/1.1#DevelopmentReleases | 1.1.6]] and [[trac:wiki:TracDev/ReleaseNotes/1.0#MaintenanceReleases | 1.0.7]]
     21(as 1.1.6 contains all the fixes done for 1.0.7).
     23[trac:source:/tags/trac-1.1.6 View Tag] | [trac:milestone:1.1.6 View Milestone]
     26=== 1.1.5
     28//(May 18, 2015)//
     30Highlights of the changes:
     32 - Corrected highlighting of unmodified values in //Config// section of the //About Trac// page ([trac:#6551]).
     33 - New helper methods on `DatabaseManager` class for plugins to upgrade the database ([trac:#8172]).
     34 - New `[notification-subscriber]` config section for general configuration of notification subscription defaults and `SubscriberList` macro ([trac:#11875]).
     35 - Removed dependency on `ConfigObj` for TracFineGrainedPermissions ([trac:#11982]).
     36 - `Image` macro supports InterWiki prefixes ([trac:#12025]).
     38See also the [trac:wiki:TracDev/ApiChanges/1.1 API changes] and the detailed
     39release notes for [[trac:wiki:TracDev/ReleaseNotes/1.1#DevelopmentReleases | 1.1.5]], [[trac:wiki:TracDev/ReleaseNotes/1.0#MaintenanceReleases | 1.0.6]] and [[trac:wiki:TracDev/ReleaseNotes/0.12#MaintenanceReleases | 0.12.7]]
     40(as 1.1.5 contains all the fixes done for 1.0.6 and 0.12.7).
     42[trac:source:/tags/trac-1.1.5 View Tag] | [trac:milestone:1.1.5 View Milestone]
     44=== 1.1.4
     46//(March 24, 2015)//
     48Highlights of the changes:
     50 - Performance improvements with MySQL/MariaDB ([trac:#3676]).
     51 - Click on //Permissions// Admin page table row toggles all
     52   checkboxes in the row ([trac:#11417]).
     53 - Configuration sections are written to trac.ini when enabling a
     54   component through TracAdmin or the web administration module
     55   ([trac:#11437]).
     56 - Subscription rules can be reordered by drag and drop ([trac:#11941]).
     58See also the [trac:wiki:TracDev/ApiChanges/1.1 API changes] and the detailed
     59release notes for [[trac:wiki:TracDev/ReleaseNotes/1.1#DevelopmentReleases | 1.1.4]]
     60and [[trac:wiki:TracDev/ReleaseNotes/1.0#MaintenanceReleases | 1.0.4/1.0.5]]
     61(as 1.1.4 contains all the fixes done for 1.0.4 and 1.0.5).
     63[trac:source:/tags/trac-1.1.4 View Tag] | [trac:milestone:1.1.4 View Milestone]
     65=== 1.1.3
     67//(January 13, 2015)//
     69The following list contains highlights of the changes:
     71 - The ticket creation step can be configured in the TracWorkflow and the
     72   workflow controls are present on the !NewTicket page ([trac:#2045]).
     73 - New notification system that can be extended by plugins ([trac:#3517]).
     74 - New preferences panel for notification subscriptions ([trac:#4056]).
     75 - Wiki page version comments can be edited by users with `WIKI_ADMIN` ([trac:#6573]).
     76 - Improved positioning of //Add Comment// section and //author// field
     77   on the ticket form ([trac:#10207]).
     78 - The delete confirmation pages warn if attachments will also be deleted
     79   ([trac:#11542]).
     80 - Removed support for [trac:SilverCity], Enscript and !PhpRenderer syntax
     81   highlighters ([trac:#11795]).
     82 - Combined //Date & Time// and //Language// preference panels as
     83   //Localization// ([trac:#11813]).
     84 - Groups and permissions can be used in the workflow `set_owner` attribute
     85   ([trac:#11839]).
     87See also the [trac:wiki:TracDev/ApiChanges/1.1 API changes] and the detailed release notes for [[trac:wiki:TracDev/ReleaseNotes/1.1#DevelopmentReleases | 1.1.3]] and [[trac:wiki:TracDev/ReleaseNotes/1.0#MaintenanceReleases | 1.0.3]] (as 1.1.3 contains all the fixes done
     88for 1.0.3).
     90[trac:source:/tags/trac-1.1.3 View Tag] | [trac:milestone:1.1.3 View Milestone]
     92=== 1.1.2
     94//(October 23, 2014)//
     96The following list contains highlights of the changes:
     98 - Dropped support for Python 2.5. Trac can no longer be run on Python 2.5 as incompatible changes have been made in the source code ([trac:#11600]).
     99 - The new ticket workflow action `may_set_owner` is similar to `set_owner` but the owner defaults to the existing ticket owner rather than the current user ([trac:#10018]).
     100 - The new option `[ticket]` `optional_fields` specifies ticket select fields that are treated as optional (i.e. an empty value is allowed) ([trac:#10772]).
     101 - Line number and row highlighting annotations can be specified for !WikiProcessor code blocks ([trac:#10834]).
     102 - The //default handler// can be set as a session preference ([trac:#11597]), and the default value for all users can be set from the //Basic Settings// admin page ([trac:#11519]).
     103 - Attachments can't be added to read-only wiki pages ([trac:#11244]).
     104 - Tables on the admin pages have a //Select all// checkbox in the header ([trac:#10994]).
     105 - Submit buttons are disabled if the required items are not selected ([trac:#11056]).
     106 - The Admin //Permissions// page has a //Copy Permissions// form for copying permissions between users and groups ([trac:#11099]).
     107 - The new option `[milestone]` `default_retarget_to` determines the default milestone for retargeting tickets when a milestone is deleted or closed, and can be specified from the //Milestone// admin page ([trac:#10010]).
     108 - The //retarget// select is not shown when closing or deleting a milestone which has no tickets associated with it ([trac:#11366]).
     109 - //Clear default// buttons allow the ticket system default values (e.g. `default_milestone`, `default_version`) to be cleared through the corresponding admin pages ([trac:#10772], [trac:#11300]).
     110 - The `TitleIndex` macro supports relative path prefixes when used on wiki pages ([trac:#11455]).
     111 - [trac:CommitTicketUpdater] will recognize a ticket reference that includes a trailing `#comment:N` or `#comment:description` ([trac:#11622]).
     112 - The //Tickets// column of the milestone table on the //Milestone// admin page contains links to the query page showing all tickets associated with the milestone, grouped by status ([trac:#11661]).
     113 - Authz policy can be used to restrict access to the //Report List// page using the resource id `-1` ([trac:#11697]).
     115See also the [trac:wiki:TracDev/ApiChanges/1.1 API changes] and the detailed release notes for [[trac:wiki:TracDev/ReleaseNotes/1.1#DevelopmentReleases | 1.1.2]], [[trac:wiki:TracDev/ReleaseNotes/1.0#MaintenanceReleases | 1.0.2]] and [[trac:wiki:TracDev/ReleaseNotes/0.12#MaintenanceReleases | 0.12.6]] (as 1.1.2 contains all the fixes done for 1.0.2 and 0.12.6).
     117[trac:source:/tags/trac-1.1.2 View Tag] | [trac:milestone:1.1.2 View Milestone]
     119=== 1.1.1
     121//(February 3, 2013)//
     123Trac 1.1.1 starts the 1.1.x development line leading to 1.2 with some new features and a few not-so-disruptive changes.
     125The following list contains only a few highlights:
     127 - Added support for custom ticket fields of type time ([trac:#1942])
     128 - In new tickets, custom time ticket fields may default to an absolute or relative date / time ([trac:#10853])
     129 - In TracBatchModify, custom time ticket fields can be changed with a date(time)picker popup control ([trac:#10854])
     130 - Optionally display the component of tickets in their timeline entries (`[timeline]` `ticket_show_component` setting) ([trac:#10885])
     131 - Fixed batch modification when no fields are changed ([trac:#10924])
     132 - Dynamic variables can be used in the report title and description ([trac:#10979])
     133 - jQuery upgraded to 1.8.3, jQuery UI upgraded to 1.9.2 and jQuery UI Timepicker upgraded to 1.1.1 ([trac:#10976])
     134 - Dropped support for Python 2.5, either Python 2.6 or Python 2.7 is required //(well, as it happens, 2.5 //still// works, that's a bug ;-) )//
     136See also the [trac:wiki:TracDev/ApiChanges/1.1 API changes] and the detailed release notes for [[trac:wiki:TracDev/ReleaseNotes/1.1#DevelopmentReleases | 1.1.1]], [[trac:wiki:TracDev/ReleaseNotes/1.0#MaintenanceReleases | 1.0.1]] and [[trac:wiki:TracDev/ReleaseNotes/0.12#MaintenanceReleases | 0.12.5]] (as 1.1.1 contains all the fixes done for 1.0.1 and 0.12.5).
     138[trac:source:/tags/trac-1.1.1 View Tag] | [trac:milestone:1.1.1 View Milestone]
     140== 1.0.x Releases ==
     142=== 1.0.7
     144//(July 17, 2015)//
     146Trac 1.0.7 contains more than a dozen minor fixes and enhancements, including the following highlights:
     147 - Custom `svn:keywords` definitions are expanded in Subversion 1.8 and later ([trac:#11364]).
     148 - Fixed MySQL performance regression in query with custom fields ([trac:#12113]).
     150See the detailed release notes for [[trac:wiki:TracDev/ReleaseNotes/1.0#MaintenanceReleases | 1.0.7]].
     152[trac:source:/tags/trac-1.0.7 View Tag] | [trac:milestone:1.0.7 View Milestone]
     154=== 1.0.6
     156//(May 20, 2015)//
     158Trac 1.0.6 provides more than 20 fixes and enhancements. The following are some highlights:
     159 - Hash changeset ids and branch names can be used in revision ranges ([trac:#11050])
     160 - Improved rendering performance using chunked response when `[trac]` `use_chunked_encoding` is `True` ([trac:#11802])
     161 - Improved performance of Git repositories ([trac:#11971]).
     162 - Header to send when `[trac]` `use_xsendfile` is `True` can be specified through the option `[trac]` `xsendfile_header`. X-Sendfile is supported in Nginx by specifying `X-Accel-Redirect` for the header ([trac:#11981]).
     163 - Symbolic link can be used for `conf/trac.ini` in environment directory ([trac:#12000]).
     164 - Hyphen character can be used in !WikiProcessor parameter name ([trac:#12023]).
     166See the detailed release notes for [[trac:wiki:TracDev/ReleaseNotes/1.0#MaintenanceReleases | 1.0.6]] and [[trac:wiki:TracDev/ReleaseNotes/0.12#MaintenanceReleases | 0.12.7]] (as 1.0.6 contains all the changes in 0.12.7).
     168[trac:source:/tags/trac-1.0.6 View Tag] | [trac:milestone:1.0.6 View Milestone]
     170=== 1.0.5
     172//(March 24, 2015)//
     174Trac 1.0.5 provides several fixes. The following are some highlights:
     176 - Images are not rendered in the timeline ([trac:#10751]).
     177 - Git tags are shown in the browser view ([trac:#11964]).
     178 - Added support for `journal_mode` and `synchronous` pragmas in `sqlite:` database connection string ([trac:#11967]).
     180See the detailed release notes for [[trac:wiki:TracDev/ReleaseNotes/1.0#MaintenanceReleases | 1.0.5]].
     182[trac:source:/tags/trac-1.0.5 View Tag] | [trac:milestone:1.0.5 View Milestone]
     184=== 1.0.4
     186//(February 8, 2015)//
     188Trac 1.0.4 contains a few fixes, including a fix for a regression in 1.0.3.
     190 - Workflow action labels were not displayed unless name attribute
     191   was explicitly defined ([trac:#11930]).
     193See the detailed release notes for [[trac:wiki:TracDev/ReleaseNotes/1.0#MaintenanceReleases | 1.0.4]].
     195[trac:source:/tags/trac-1.0.4 View Tag] | [trac:milestone:1.0.4 View Milestone]
     197=== 1.0.3
     199//(January 13, 2015)//
     201Trac 1.0.3 is a maintenance release containing numerous fixes and minor
     202enhancements. The following are a few of the highlights:
     204The following list contains only a few highlights:
     206 - Notification is sent when adding an attachment to a ticket ([trac:#2259]).
     207 - Stylesheets and scripts are loaded during autopreview, resulting in proper
     208   syntax highlighting when code WikiProcessors are added ([trac:#10470]) and display
     209   of Workflow graphs without explicit autopreview ([trac:#10674]).
     210 - Merge changesets are shown as differences against first parent, resulting
     211   in less noisy changesets ([trac:#10740]).
     212 - Pygments 2.0 is supported ([trac:#11796]).
     213 - Fixed error when completing the `initenv` TracAdmin command ([trac:#11797]).
     214 - Performance improvement on systems with many thousands of authenticated
     215   users due to caching of Environment.get_known_users ([trac:#11868]).
     216 - Distribution metadata of wheel package is supported and displayed on the
     217   About page ([trac:#11877]).
     218 - … and more than 3 dozen total fixes!
     220See the detailed release notes for [[trac:wiki:TracDev/ReleaseNotes/1.0#MaintenanceReleases | 1.0.3]].
     222[trac:source:/tags/trac-1.0.3 View Tag] | [trac:milestone:1.0.3 View Milestone]
     225=== 1.0.2
     227//(October 23, 2014)//
     229Trac 1.0.2 contains a number of bug fixes and minor enhancements, as well as a major update for many translations.
     231The following list contains only a few highlights:
     233 - Subversion keywords are expanded and EOL substitutions made when viewing a file in the repository browser and when downloading a file ([trac:#717]).
     234 - Notification email is sent to the old owner when a ticket is reassigned ([trac:#2311]).
     235 - Ticket change history is updated when renaming and deleting a milestone, and when retargeting tickets to another milestone ([trac:#4582], [trac:#5658]).
     236 - Numerous fixes for the Authz permissions policy in the browser/repository ([trac:#10961], [trac:#11646]), wiki ([trac:#8976], [trac:#11067]), admin ([trac:#11069]) and report ([trac:#11176]) realms.
     237 - Multiple forms submits are disallowed ([trac:#10138]).
     238 - `ConfigurationError` is raised if any of the `permission_policies` can't be loaded, preventing possible information leakage due to internal and installation errors ([trac:#10285]).
     239 - Wiki toolbars can be disabled through a configuration setting ([trac:#10837])
     240 - The number of entries in a table is shown next to heading on applicable admin pages ([trac:#11027]).
     241 - //Cancel// buttons are consistently located on all pages ([trac:#11076]).
     242 - Focus is placed on a text element when an edit page is loaded ([trac:#11084]).
     243 - The //Edit conflict// and //Merge// warning messages are always visible in side-by-side edit mode ([trac:#11102]).
     244 - Improvements to the layout of the Report ([trac:#11106], [trac:#11664]) and Ticket pages ([trac:#11471]).
     245 - Genshi 0.7 compatibility ([trac:#11218]).
     246 - Numerous minor fixes for Git repository support.
     247 - … and more than a hundred more fixes!
     249See the detailed release notes for [[trac:wiki:TracDev/ReleaseNotes/1.0#MaintenanceReleases | 1.0.2]] and [[trac:wiki:TracDev/ReleaseNotes/0.12#MaintenanceReleases | 0.12.6]] (as 1.0.2 contains all the fixes done for 0.12.6).
     251[trac:source:/tags/trac-1.0.2 View Tag] | [trac:milestone:1.0.2 View Milestone]
     254=== 1.0.1
     256//(February 1, 2013)//
     258Trac 1.0.1 contains a number of bug fixes and minor enhancements, as well as a major update for many translations.
     260The following list contains only a few highlights:
     262 - Fix zip source download for large directories in Subversion repositories ([trac:#10840])
     263 - Performance improvement for the Roadmap, by caching milestone properties ([trac:#10879])
     264 - Added a ''select all'' checkbox to table of components for each plugin on the Plugins admin panel ([trac:#9609])
     265 - Restore the ''Modify'' link at the top of the ticket page, as it was in Trac 0.12 ([trac:#10856])
     266 - `ListOption` keeps values other than empty string and None in raw list as default ([trac:#10541])
     267 - Prevent possibility of multiple identical info or warning messages being presented to the user ([trac:#10987])
     268 - The !BatchModify select-all checkboxes are toggled with tri-state behavior when the ticket checkboxes are toggled ([trac:#10992])
     269 - Update the ticket changetime to the current time when deleting a ticket comment ([trac:#10486])
     271See the detailed release notes for [[trac:wiki:TracDev/ReleaseNotes/1.0#MaintenanceReleases | 1.0.1]] and [[trac:wiki:TracDev/ReleaseNotes/0.12#MaintenanceReleases | 0.12.5]] (as 1.0.1 contains all the fixes done for 0.12.5).
     273[trac:source:/tags/trac-1.0.1 View Tag] | [trac:milestone:1.0.1 View Milestone]
     276=== '''1.0 'Cell' '''
     278//(September 7, 2012)//
     280Trac 1.0 is a major release adding refreshed user interface and improved DVCS repository support as the most visible changes.
     282The following list contains only a few highlights:
     283 - The default theme looks more modern, especially on recent browsers (no effort has been made to make it look better on older browsers like IE6 or 7)
     284 - The [TH:GitPlugin] has been donated by Herbert Valerio Riedel to the Trac project (many thanks!) and is now maintained here as an optional component
     285 - As a consequence, the Subversion support has been moved below `tracopt.versioncontrol` as well
     286 - The Git and Mercurial log view feature a visualization of the branching structure
     287 - Usability improvements for the tickets, with a better support for conflict detection and resolution
     288 - Integration of the [TH:BatchModifyPlugin], contributed by Brian Meeker (many thanks!) and is now maintained there as a default component
     289 - jQuery/UI integration, featuring a date picker for date fields
     290 - Improved integration with Pygments syntax highlighting
     291 - ... and numerous smaller features added and bugs fixed since 0.12!
     293See the full list in [trac:wiki:TracDev/ReleaseNotes/1.0 1.0].
     295[[trac:source:/tags/trac-1.0 View Tag]] | [[trac:milestone:1.0 View Milestone]]
     297== 0.12.x Releases
     299=== 0.12.7
     301//(May 20, 2015)//
     303Trac 0.12.7 fixes a minor security issue, as well as a half dozen other minor issues:
     304 - InterWiki filters links through `[wiki] safe_schemes` option if `[wiki] render_unsafe_content` is disabled ([trac:#12053]).
     306See the detailed release notes for [[trac:wiki:TracDev/ReleaseNotes/0.12#MaintenanceReleases | 0.12.7]].
     308[trac:source:/tags/trac-0.12.7 View Tag] | [trac:milestone:0.12.7 View Milestone]
     310=== 0.12.6
     312//(October 23, 2014)//
     314Trac 0.12.6 contains fixes for a few issues:
     315 - Subversion blame would fail for a path with URL-encoded characters ([trac:#10386]), a lower-case drive letter on Windows ([trac:#10514]), or a non-ascii filename with Subversion 1.7 ([trac:#11167]).
     316 - Improved performance rendering `svn:mergeinfo` properties in browser view ([trac:#8459]) and changeset view ([trac:#11219]).
     317 - Query with many custom fields would fail ([trac:#11140]).
     318 - Zip archive had a timestamp with no timezone information ([trac:#11162]).
     319 - Failure or incorrect ranges rendering log TracLinks ([trac:#11308], [trac:#11346]).
     320 - Textareas in ticket view did not wrap correctly in IE 11 ([trac:#11376]).
     321 - Emails were not being obfuscated in owner field on CSV export from ticket and query pages ([trac:#11594]).
     322 - Locale data was not being included in egg in Distribute 0.6.29 and later ([trac:#11640]).
     323 - Deleting a milestone would not delete its attachments ([trac:#11672]).
     324 - Added support for Babel 1.0 and later ([trac:#11258], [trac:#11345]).
     325 - Added support for `ConfigObj` 5.0 and later ([trac:#11498]).
     326 - … and dozens more fixes!
     328See the detailed release notes for [[trac:wiki:TracDev/ReleaseNotes/0.12#MaintenanceReleases | 0.12.6]].
     330[trac:source:/tags/trac-0.12.6 View Tag] | [trac:milestone:0.12.6 View Milestone]
     332=== 0.12.5
     334//(January 15, 2013)//
     336Trac 0.12.5 contains fixes for a few issues:
     337 - upload of .mht files ([Wikipedia:MHTML] web page archive files) now works ([trac:#9880])
     338 - more robust parsing of attachment URLs ([trac:#10280]) and uploaded file names ([trac:#10850])
     339 - lots of improvement to the date formatting code, which is now much more robust when timezone and daylight saving time computations are involved ([trac:#10768], [trac:#10863], [trac:#10864], [trac:#10912], [trac:#10920])
     340 - no longer generate invalid JSON encoded data with Python 2.4 and 2.5 ([trac:#10877])
     341 - ... and fix a couple more minor defects ([trac:#10967], [trac:#10892], [trac:#10923], [trac:#10858], [trac:#10835])
     343[trac:source:/tags/trac-0.12.5 View Tag] | [trac:milestone:0.12.5 View Milestone]
     345=== 0.12.4
     347//(September 7, 2012)//
     349Trac 0.12.4 contains only a handful of minor fixes.
     351[trac:source:/tags/trac-0.12.4 View Tag] | [trac:milestone:0.12.4 View Milestone]
     353=== 0.12.3 ===
     355//(February 6, 2012)//
     357Trac 0.12.3 contains a few minor fixes and a few minor features.
     358 - compatibility with Subversion 1.7 ([trac:#10414])
     359 - easier troubleshooting of common startup errors ([trac:#10024])
     360 - jQuery upgraded to 1.4.4 ([trac:#10001])
     361 - improve fine-grained permission handling in the source browser ([trac:#9976], [trac:#10208], [trac:#10110])
     362 - added compatibility with MySQL 5.5.3 utf8mb4 databases ([trac:#9766])
     363 - ... and dozens more fixes!
     365[trac:source:/tags/trac-0.12.3 View Tag] | [trac:milestone:0.12.3 View Milestone]
     367=== 0.12.2
     369//(January 31, 2011)//
     371Trac 0.12.2 contains a few minor fixes and a few minor features.
     373This list contains only a few highlights:
     374 - install: improved robustness of Trac installation if Babel is
     375   installed after the fact ([trac:#9439], [trac:#9595], [trac:#9961])
     376 - notifications: support for Asian character width ([trac:#4717])
     377 - roadmap: fix display of progress bar in some corner cases ([trac:#9718])
     378   and respect the overall_completion milestone group setting ([trac:#9721])
     379 - reports: reports and queries look much better, as the columns now
     380   keep the same width across groups; the absence of word wrapping in
     381   reports has been fixed ([trac:#9825])
     382 - web admin: improved layout ([trac:#8866], [trac:#9963])
     383 - web: it's now possible to log in different Trac instances sharing
     384   the same URL prefix (e.g. /project and /project-test) ([trac:#9951])
     386[trac:source:/tags/trac-0.12.2 View Tag] | [trac:milestone:0.12.2 View Milestone]
     388=== 0.12.1
     390//(October 9, 2010)//
     392Trac 0.12.1 contains a few important performance improvements, some minor fixes and a few minor features.
     394This list contains only a few highlights:
     395 - db: improve concurrency behavior ([trac:#9111])
     396 - fcgi: add an environment variable `TRAC_USE_FLUP` to control the usage of flup vs. bundled (defaults to 0, i.e. use bundled as before)
     397 - svn authz: improve compatibility with svn 1.5 format ([trac:#8289])
     398 - milestone: allow to set the time for the due date ([trac:#6369], [trac:#9582])
     399 - ticket: fixes for the CC: property ([trac:#8597], [trac:#9522])
     400 - notification: improved the formatting of ticket fields in notification e-mails ([trac:#9484], [trac:#9494])
     401 - i18n: added a configuration option to set the default language ([trac:#8117])
     402 - several fixes for upgrade ([trac:#9400], [trac:#9416], [trac:#9483], [trac:#9556])
     404[trac:source:/tags/trac-0.12.1 View Tag] | [trac:milestone:0.12.1 View Milestone]
     406=== ''' 0.12 'Babel' '''
     408//(June 13, 2010)//
     410Trac 0.12 is a major release introducing i18n and multiple repository support as the most visible changes.
     412The following list contains only a few highlights:
     413 - The user interface is translated in a dozen of languages, provided the [Babel:] package is installed
     414 - Multiple repositories can be associated to a single Trac environment; the repositories can be of heterogeneous types (svn, hg, git, darcs...)
     415 - Usability improvements for the Wiki, with a nice side-by-side edit mode with automatic preview
     416 - Richer Wiki syntax, with much improved support for tables, partial [trac:WikiCreole] compatibility and numerous smaller improvements
     417 - Usability improvements for the Ticket module, with automatic preview of comments while you type and possibility to edit or remove them later
     418 - Improved Custom Queries (time fields, multiple disjoint conditions, a.k.a. OR queries)
     419 - Timeline filtering by user
     420 - ... and numerous smaller features added and bugs fixed since 0.11!
     422[trac:source:/tags/trac-0.12 View Tag] | [trac:milestone:0.12 View Milestone]
     424== Older Releases
     426For releases prior to 0.12, see [trac:TracChangeLog@95].
  • wiki/pages/TracChangeset

    r37566 r37567  
     1= Trac Changeset Module =
     4Trac has a built-in functionality for visualizing “diffs”, or changes to files.
     6There are different kinds of ''change sets''.  Some correspond to revisions made in the repositories, others aggregate changes made in several revisions. Ultimately, any kind of difference can be shown.
     8The changeset view consists of two parts, the ''header'' and the ''diff views''.
     10== Changeset Header ==
     12The header shows an overview of the whole changeset.
     13Here you will find information such as:
     15 * Timestamp — When the changeset was commited
     16 * Author — Who commited the changeset
     17 * Message — A brief description from the author (the commit log message)
     18 * Location — Parent directory of all files affected by this changeset
     19 * Files — A list of files affected by this changeset
     21If more than one revision is involved in the set of changes being displayed, the ''Timestamp'', ''Author'' and ''Message'' fields will not be shown.
     23A colored rectangle indicates how the file is affected by the changeset:
     25 [[span(style=background:#bfb;border:1px solid #999;font-size:80%;margin-right:.5em,''  '')]] Green: Added \\
     26 [[span(style=background:#f88;border:1px solid #999;font-size:80%;margin-right:.5em,''  '')]] Red: Removed \\
     27 [[span(style=background:#fd8;border:1px solid #999;font-size:80%;margin-right:.5em,''  '')]] Yellow: Modified \\
     28 [[span(style=background:#88f;border:1px solid #999;font-size:80%;margin-right:.5em,''  '')]] Blue: Copied \\
     29 [[span(style=background:#ccc;border:1px solid #999;font-size:80%;margin-right:.5em,''  '')]] Gray: Moved \\
     30The color legend is located below the header as a reminder.
     32== Diff Views ==
     34Below the header is the main part of the changeset, the diff view. Each file is shown in a separate section, each of which contains only the regions of the file that are affected by the changeset. There are two different styles to display the diffs: ''inline'' or ''side-by-side''. You can switch between the styles using the preferences form:
     36 * The ''inline'' style shows the changed regions of a file underneath each other. A region removed from the file will be colored red, an added region will be colored green. If a region was modified, the old version is displayed above the new version. Line numbers indicate the exact position of the change in both the old and the new version of the file.
     37 * The ''side-by-side'' style shows the old version on the left and the new version on the right and this will typically require more screen width than the inline style. Added and removed regions will be colored in the same way as with the inline style (green and red), and modified regions will have a yellow background.
     39In addition, various advanced options are available in the preferences form for adjusting the display of the diffs:
     40 * You can set how many lines are displayed before and after every change; if the value ''all'' is used, then the full file will be shown.
     41 * You can toggle whether blank lines, case changes and white space changes are ignored, thereby letting you find the functional changes more quickly.
     43== The Different Ways to Get a Diff ==
     45=== Examining a Changeset ===
     47When viewing a repository check-in, such as when following a changeset [wiki:TracLinks link] or a changeset event in the [wiki:TracTimeline timeline], Trac will display the exact changes made by the check-in.
     49There will be also navigation links to the ''Previous Changeset'' to and ''Next Changeset''.
     51=== Examining Differences Between Revisions ===
     53Often you want to look at changes made on a file or on a directory spanning multiple revisions. The easiest way to get there is from the TracRevisionLog, where you can select the ''old'' and the ''new'' revisions of the file or directory, and then click the ''View changes'' button.
     55=== Examining Differences Between Branches ===
     57One of the core features of version control systems is the possibility to work simultaneously on different ''Lines of Developments'', commonly called “branches”. Trac enables you to examine the exact differences between such branches.
     59Using the '''View changes ...''' button in the TracBrowser allows you to enter ''From:'' and ''To:'' path/revision pairs. The resulting set of differences consist of the changes that should be applied to the ''From:'' content to get to the ''To:'' content.
     61For convenience, it is possible to invert the roles of the ''old'' and the ''new'' path/revision pairs by clicking the ''Reverse Diff'' link on the changeset page.
     63=== Checking the Last Change ===
     65Another way to examine changes is to use the ''Last Change'' link provided by the TracBrowser.
     67This link will take you to the last change that was made on that path. From there, you can use the ''Previous Change'' and ''Next Change'' links to traverse the change history of the file or directory.
     70See also: TracGuide, TracBrowser
  • wiki/pages/TracEnvironment

    r37566 r37567  
     1= The Trac Environment
     6Trac uses a directory structure and a database for storing project data. The directory is referred to as the environment.
     8== Creating an Environment
     10A new Trac environment is created using [TracAdmin#initenv trac-admin's initenv]:
     12$ trac-admin /path/to/myproject initenv
     15`trac-admin` will ask you for the name of the project and the database connection string, see below.
     17=== Useful Tips
     19 - Place your environment's directory on a filesystem which supports sub-second timestamps, as Trac monitors the timestamp of its configuration files and changes happening on a filesystem with too coarse-grained timestamp resolution may go undetected in Trac < 1.0.2. This is also true for the location of authentication files when using TracStandalone.
     21 - The user under which the web server runs will require file system write permission to the environment directory and all the files inside. Please remember to set the appropriate permissions. The same applies to the source code repository, although the user under which Trac runs will only require write access to a Subversion repository created with the BDB file system; for other repository types, check the corresponding plugin's documentation.
     23 - `initenv`, when using an svn repository, does not imply that trac-admin will perform `svnadmin create` for the specified repository path. You need to perform the `svnadmin create` prior to `trac-admin initenv` if you're creating a new svn repository altogether with a new Trac environment; otherwise you will see a message "Warning: couldn't index the repository" when initializing the environment.
     25 - Non-ascii environment paths are not supported.
     27 - Also, it seems that project names with spaces can be problematic for authentication, see [trac:#7163].
     29 - TracPlugins located in a [TracIni#inherit-section shared plugins folder] that is defined in an [TracIni#GlobalConfiguration inherited configuration] are currently not loaded during creation, and hence, if they need to create extra tables for example, you'll need to [TracUpgrade#UpgradetheTracEnvironment upgrade the environment] before being able to use it.
     31{{{#!div style="border: 1pt dotted; margin: 1em"
     32**Caveat:** don't confuse the //Trac environment directory// with the //source code repository directory//.
     34This is a common beginners' mistake.
     35It happens that the structure for a Trac environment is loosely modeled after the Subversion repository directory structure, but those are two disjoint entities and they are not and //must not// be located at the same place.
     38== Database Connection Strings
     40Trac supports [ SQLite], [ PostgreSQL] and [ MySQL] database backends. The default is SQLite, which is probably sufficient for most projects. The database file is then stored in the environment directory, and can easily be [wiki:TracBackup backed up] together with the rest of the environment.
     42Note that if the username or password of the connection string (if applicable) contains the `:`, `/` or `@` characters, they need to be URL encoded.
     44=== SQLite Connection String
     46The connection string for an SQLite database is:
     50where `db/trac.db` is the path to the database file within the Trac environment.
     52=== PostgreSQL Connection String
     54If you want to use PostgreSQL instead, you'll have to use a different connection string. For example, to connect to a PostgreSQL database on the same machine called `trac` for user `johndoe` with the password `letmein` use:
     59If PostgreSQL is running on a non-standard port, for example 9342, use:
     64On UNIX, you might want to select a UNIX socket for the transport, either the default socket as defined by the PGHOST environment variable:
     69or a specific one:
     74Note that with PostgreSQL you will have to create the database before running `trac-admin initenv`.
     76See the [ PostgreSQL documentation] for detailed instructions on how to administer [ PostgreSQL].
     77Generally, the following is sufficient to create a database user named `tracuser` and a database named `trac`:
     79$ createuser -U postgres -E -P tracuser
     80$ createdb -U postgres -O tracuser -E UTF8 trac
     83When running `createuser` you will be prompted for the password for the user 'tracuser'. This new user will not be a superuser, will not be allowed to create other databases and will not be allowed to create other roles. These privileges are not needed to run a Trac instance. If no password is desired for the user, simply remove the `-P` and `-E` options from the `createuser` command. Also note that the database should be created as UTF8. LATIN1 encoding causes errors, because of Trac's use of unicode. SQL_ASCII also seems to work.
     85Under some default configurations (Debian) one will have run the `createuser` and `createdb` scripts as the `postgres` user:
     87$ sudo su - postgres -c 'createuser -U postgres -S -D -R -E -P tracuser'
     88$ sudo su - postgres -c 'createdb -U postgres -O tracuser -E UTF8 trac'
     91Trac uses the `public` schema by default, but you can specify a different schema in the connection string:
     96=== MySQL Connection String
     98The format of the MySQL connection string is similar to those for PostgreSQL, with the `postgres` scheme being replaced by `mysql`. For example, to connect to a MySQL database on the same machine called `trac` for user `johndoe` with password `letmein`:
     103== Source Code Repository
     105A single environment can be connected to more than one repository. However, by default Trac is not connected to any source code repository, and the ''Browse Source'' toolbar item will not be displayed.
     107There are many different ways to connect repositories to an environment, see TracRepositoryAdmin. A single repository can be specified when the environment is created by passing the optional arguments `repository_type` and `repository_dir` to the `initenv` command.
     109== Directory Structure
     111An environment directory will usually consist of the following files and directories:
     113 * `README` - Brief description of the environment.
     114 * `VERSION` - Environment version identifier.
     115 * `files`
     116  * `attachments` - Attachments to wiki pages and tickets.
     117 * `conf`
     118  * `trac.ini` - Main configuration file. See TracIni.
     119 * `db`
     120  * `trac.db` - The SQLite database, if you are using SQLite.
     121 * `htdocs` - Directory containing web resources, which can be referenced in Genshi templates using `/chrome/site/...` URLs.
     122 * `log` - Default directory for log files, if `file` logging is enabled and a relative path is given.
     123 * `plugins` - Environment-specific [wiki:TracPlugins plugins].
     124 * `templates` - Custom Genshi environment-specific templates.
     125  * `site.html` - Method to customize header, footer, and style, described in TracInterfaceCustomization#SiteAppearance.
     128See also: TracAdmin, TracBackup, TracIni, TracGuide
  • wiki/pages/TracFastCgi

    r37566 r37567  
     1= Trac with FastCGI
     4[[PageOutline(2-5, Contents, floated)]]
     6[ FastCGI] interface allows Trac to remain resident much like with [wiki:TracModPython mod_python] or [wiki:TracModWSGI mod_wsgi]. It is faster than external CGI interfaces which must start a new process for each request.  Additionally, it is supported by much wider variety of web servers.
     8Note that unlike mod_python, FastCGI supports [ Apache SuEXEC], ie run with different permissions than the web server runs with. `mod_wsgi` supports the `WSGIDaemonProcess` with user / group parameters to achieve the same effect.
     10'''Note for Windows:''' Trac's FastCGI does not run under Windows, as Windows does not implement `Socket.fromfd`, which is used by ``. If you want to connect to IIS, you may want to try [trac:TracOnWindowsIisAjp AJP]/[trac:TracOnWindowsIisAjp ISAPI].
     12== Simple Apache configuration
     14There are two FastCGI modules commonly available for Apache: `mod_fastcgi` and
     15`mod_fcgid` (preferred). The latter is more up-to-date.
     17The following sections focus on the FCGI specific setup, see also [wiki:TracModWSGI#ConfiguringAuthentication] for configuring the authentication in Apache.
     19Regardless of which cgi module is used, be sure the web server has executable permissions on the cgi-bin folder. While FastCGI will throw specific permissions errors, mod_fcgid will throw an ambiguous error if this has not been done. Connection reset by peer: mod_fcgid: error reading data from FastCGI server.
     21=== Set up with `mod_fastcgi`
     23`mod_fastcgi` uses `FastCgiIpcDir` and `FastCgiConfig` directives that should be added to an appropriate Apache configuration file:
     25# Enable fastcgi for .fcgi files
     26# (If you're using a distro package for mod_fcgi, something like
     27# this is probably already present)
     28<IfModule mod_fastcgi.c>
     29   AddHandler fastcgi-script .fcgi
     30   FastCgiIpcDir /var/lib/apache2/fastcgi
     32LoadModule fastcgi_module /usr/lib/apache2/modules/
     34Setting `FastCgiIpcDir` is optional if the default is suitable. Note that the `LoadModule` line must be after the `IfModule` group.
     36Configure `ScriptAlias` or similar options as described in TracCgi, but
     37calling `trac.fcgi` instead of `trac.cgi`.
     39Add the following to the Apache configuration file (below the `FastCgiIpcDir` line) if you intend to set up the `TRAC_ENV` as an overall default:
     41FastCgiConfig -initial-env TRAC_ENV=/path/to/env/trac
     44Alternatively, you can serve multiple Trac projects in a directory by adding this:
     46FastCgiConfig -initial-env TRAC_ENV_PARENT_DIR=/parent/dir/of/projects
     49=== Set up with `mod_fcgid`
     51Configure `ScriptAlias` (see TracCgi for details), but call `trac.fcgi` instead of `trac.cgi`:
     53ScriptAlias /trac /path/to/www/trac/cgi-bin/trac.fcgi/
     55Note the slash at the end.
     57To set up Trac environment for `mod_fcgid` it is necessary to use `DefaultInitEnv` directive. It cannot be used in `Directory` or `Location` context, so if you need to support multiple projects, try alternative environment setup below.
     60DefaultInitEnv TRAC_ENV /path/to/env/trac/
     63=== alternative environment setup
     65A better method to specify path to the Trac environment is to embed the path into `trac.fcgi` script itself. That doesn't require configuration of the server environment variables, works for both [trac:FastCgi] modules as well as for [ lighttpd] and CGI:
     67import os
     68os.environ['TRAC_ENV'] = "/path/to/projectenv"
     72import os
     73os.environ['TRAC_ENV_PARENT_DIR'] = "/path/to/project/parent/dir"
     76With this method different projects can be supported by using different `.fcgi` scripts with different `ScriptAliases`.
     78See [ this fcgid example config] which uses a !ScriptAlias directive with trac.fcgi with a trailing / like this:
     80ScriptAlias / /srv/tracsite/cgi-bin/trac.fcgi/
     83== Simple Cherokee Configuration
     85The configuration on Cherokee's side is quite simple. You will only need to know that you can spawn Trac as an SCGI process.
     86You can either start it manually, or better yet, automatically by letting Cherokee spawn the server whenever it is down.
     87First set up an information source in cherokee-admin with a local interpreter:
     94/usr/bin/tracd —single-env —daemonize —protocol=scgi —hostname=localhost —port=4433 /path/to/project/
     97If the port was not reachable, the interpreter command would be launched. Note that, in the definition of the information source, you will have to manually launch the spawner if you use a ''Remote host'' as ''Information source'' instead of a ''Local interpreter''.
     99After doing this, we will just have to create a new rule managed by the SCGI handler to access Trac. It can be created in a new virtual server, for instance, and will only need two rules. The '''default''' one will use the SCGI handler associated to the previously created information source.
     100The second rule will be there to serve the few static files needed to correctly display the Trac interface. Create it as ''Directory rule'' for ''/common'' and just set it to the ''Static files'' handler and with a ''Document root'' that points to the appropriate files: ''$TRAC_LOCAL/htdocs/'' (where $TRAC_LOCAL is a directory defined by the user or the system administrator to place local trac resources).
     103If the tracd process fails to start up, and cherokee displays a 503 error page, you might be missing the [ python-flup] package.\\
     104Python-flup is a dependency which provides trac with SCGI capability. You can install it on debian based systems with:
     106sudo apt-get install python-flup
     109== Simple Lighttpd Configuration
     111The FastCGI front-end was developed primarily for use with alternative webservers, such as [ Lighttpd].
     113Lighttpd is a secure, fast, compliant and very flexible web-server that has been optimized for high-performance environments. It has a very low memory footprint compared to other web servers and takes care of CPU load.
     115For using `trac.fcgi`(prior to 0.11) / (0.11) with Lighttpd add the following to your lighttpd.conf:
     117#var.fcgi_binary="/usr/bin/python /path/to/" # 0.11 if installed with easy_setup, it is inside the egg directory
     118var.fcgi_binary="/path/to/cgi-bin/trac.fcgi" # 0.10 name of prior fcgi executable
     119fastcgi.server = ("/trac" =>
     121                   ("trac" =>
     122                     ("socket" => "/tmp/trac-fastcgi.sock",
     123                      "bin-path" => fcgi_binary,
     124                      "check-local" => "disable",
     125                      "bin-environment" =>
     126                        ("TRAC_ENV" => "/path/to/projenv")
     127                     )
     128                   )
     129                 )
     132Note that you will need to add a new entry to `fastcgi.server` for each separate Trac instance that you wish to run. Alternatively, you may use the `TRAC_ENV_PARENT_DIR` variable instead of `TRAC_ENV` as described above, and you may set one of the two in `trac.fcgi` instead of in `lighttpd.conf` using `bin-environment`, as in the section above on Apache configuration.
     134Note that Lighttpd has a bug related to 'SCRIPT_NAME' and 'PATH_INFO' when the uri of fastcgi.server is '/' instead of '/trac' in this example (see [trac:#2418]). This is fixed in Lighttpd 1.5, and under Lighttpd 1.4.23 or later the workaround is to add `"fix-root-scriptname" => "enable"` as a parameter of fastcgi.server.
     136For using two projects with lighttpd add the following to your `lighttpd.conf`:
     138fastcgi.server = ("/first" =>
     139                   ("first" =>
     140                    ("socket" => "/tmp/trac-fastcgi-first.sock",
     141                     "bin-path" => fcgi_binary,
     142                     "check-local" => "disable",
     143                     "bin-environment" =>
     144                       ("TRAC_ENV" => "/path/to/projenv-first")
     145                    )
     146                  ),
     147                  "/second" =>
     148                    ("second" =>
     149                    ("socket" => "/tmp/trac-fastcgi-second.sock",
     150                     "bin-path" => fcgi_binary,
     151                     "check-local" => "disable",
     152                     "bin-environment" =>
     153                       ("TRAC_ENV" => "/path/to/projenv-second")
     154                    )
     155                  )
     156                )
     159Note that field values are different. If you prefer setting the environment variables in the `.fcgi` scripts, then copy/rename `trac.fcgi`, eg to `first.fcgi` and `second.fcgi`, and reference them in the above settings.
     160Note that the above will result in different processes in any event, even if both are running from the same `trac.fcgi` script.
     163#!div class=important
     164'''Note''' It's very important the order on which server.modules are loaded, if mod_auth is not loaded '''BEFORE''' mod_fastcgi, then the server will fail to authenticate the user.
     167For authentication you should enable mod_auth in lighttpd.conf 'server.modules', select auth.backend and auth rules:
     169server.modules              = (
     171  "mod_auth",
     175auth.backend               = "htpasswd"
     177# Separated password files for each project
     178# See "Conditional Configuration" in
     181$HTTP["url"] =~ "^/first/" {
     182  auth.backend.htpasswd.userfile = "/path/to/projenv-first/htpasswd.htaccess"
     184$HTTP["url"] =~ "^/second/" {
     185  auth.backend.htpasswd.userfile = "/path/to/projenv-second/htpasswd.htaccess"
     188# Enable auth on trac URLs, see
     191auth.require = ("/first/login" =>
     192                ("method"  => "basic",
     193                 "realm"   => "First project",
     194                 "require" => "valid-user"
     195                ),
     196                "/second/login" =>
     197                ("method"  => "basic",
     198                 "realm"   => "Second project",
     199                 "require" => "valid-user"
     200                )
     201               )
     204Note that Lighttpd (v1.4.3) stops if the password file doesn't exist.
     206Note that Lighttpd doesn't support 'valid-user' in versions prior to 1.3.16.
     208Conditional configuration is also useful for mapping static resources, ie serving out images and CSS directly instead of through FastCGI:
     210# Aliasing functionality is needed
     211server.modules += ("mod_alias")
     213# Set up an alias for the static resources
     214alias.url = ("/trac/chrome/common" => "/usr/share/trac/htdocs")
     216# Use negative lookahead, matching all requests that ask for any resource under /trac, EXCEPT in
     217# /trac/chrome/common, and use FastCGI for those
     218$HTTP["url"] =~ "^/trac(?!/chrome/common)" {
     219# Even if you have other fastcgi.server declarations for applications other than Trac, do NOT use += here
     220fastcgi.server = ("/trac" =>
     221                   ("trac" =>
     222                     ("socket" => "/tmp/trac-fastcgi.sock",
     223                      "bin-path" => fcgi_binary,
     224                      "check-local" => "disable",
     225                      "bin-environment" =>
     226                        ("TRAC_ENV" => "/path/to/projenv")
     227                     )
     228                   )
     229                 )
     233The technique can be easily adapted for use with multiple projects by creating aliases for each of them, and wrapping the fastcgi.server declarations inside conditional configuration blocks.
     234Also there is another way to handle multiple projects and it's to use TRAC_ENV_PARENT_DIR instead of TRAC_ENV and use global auth, let's see an example:
     236#  This is for handling multiple projects
     237  alias.url       = ( "/trac/" => "/path/to/trac/htdocs/" )
     239  fastcgi.server += ("/projects"  =>
     240                      ("trac" =>
     241                        (
     242                          "socket" => "/tmp/trac.sock",
     243                          "bin-path" => fcgi_binary,
     244                          "check-local" => "disable",
     245                          "bin-environment" =>
     246                            ("TRAC_ENV_PARENT_DIR" => "/path/to/parent/dir/of/projects/" )
     247                        )
     248                      )
     249                    )
     250#And here starts the global auth configuration
     251  auth.backend = "htpasswd"
     252  auth.backend.htpasswd.userfile = "/path/to/unique/htpassword/file/trac.htpasswd"
     253  $HTTP["url"] =~ "^/projects/.*/login$" {
     254    auth.require = ("/" =>
     255                     (
     256                       "method"  => "basic",
     257                       "realm"   => "trac",
     258                       "require" => "valid-user"
     259                     )
     260                   )
     261  }
     264Changing date/time format also supported by lighttpd over environment variable LC_TIME:
     266fastcgi.server = ("/trac" =>
     267                   ("trac" =>
     268                     ("socket" => "/tmp/trac-fastcgi.sock",
     269                      "bin-path" => fcgi_binary,
     270                      "check-local" => "disable",
     271                      "bin-environment" =>
     272                        ("TRAC_ENV" => "/path/to/projenv",
     273                        "LC_TIME" => "ru_RU")
     274                     )
     275                   )
     276                 )
     278For details about languages specification see [trac:TracFaq TracFaq] question 2.13.
     280Other important information like the [wiki:TracInstall#MappingStaticResources mapping static resources advices] are useful for non-fastcgi specific installation aspects.
     283Relaunch Lighttpd and browse to `` to access Trac.
     285Note about running Lighttpd with reduced permissions: If nothing else helps and trac.fcgi doesn't start with Lighttpd settings `server.username = "www-data"`, `server.groupname = "www-data"`, then in the `bin-environment` section set `PYTHON_EGG_CACHE` to the home directory of `www-data` or some other directory accessible to this account for writing.
     287== Simple !LiteSpeed Configuration
     289The FastCGI front-end was developed primarily for use with alternative webservers, such as [ LiteSpeed].
     291!LiteSpeed web server is an event-driven asynchronous Apache replacement designed from the ground-up to be secure, scalable, and operate with minimal resources. !LiteSpeed can operate directly from an Apache config file and is targeted for business-critical environments.
     293 1. Please make sure you have a working install of a Trac project. Test install with "tracd" first.
     295 2. Create a Virtual Host for this setup. From now on we will refer to this vhost as !TracVhost. For this tutorial we will be assuming that your Trac project will be accessible via:
     300 3. Go "!TracVhost → External Apps" tab and create a new "External Application".
     302Name: MyTracFCGI       
     303Address: uds://tmp/lshttpd/mytracfcgi.sock
     304Max Connections: 10
     305Environment: TRAC_ENV=/fullpathto/mytracproject/ <--- path to root folder of trac project
     306Initial Request Timeout (secs): 30
     307Retry Timeout (secs): 0
     308Persistent Connection   Yes
     309Connection Keepalive Timeout: 30
     310Response Bufferring: No
     311Auto Start: Yes
     312Command: /usr/share/trac/cgi-bin/trac.fcgi  <--- path to trac.fcgi
     313Back Log: 50
     314Instances: 10
     317 4. Optional: If you need to use htpasswd based authentication. Go to "!TracVhost → Security" tab and create a new security Realm.
     320DB Type: Password File
     321Realm Name: MyTracUserDB               <--- any name you wish and referenced later
     322User DB Location: /fullpathto/htpasswd <--- path to your htpasswd file
     325If you don’t have a htpasswd file or don’t know how to create the entries within one, go to, to generate the user:password combos.
     327 5. Go to "!PythonVhost → Contexts" and create a new FCGI Context.
     330URI: /trac/                              <--- URI path to bind to python fcgi app we created   
     331Fast CGI App: [VHost Level] MyTractFCGI  <--- select the trac fcgi extapp we just created
     332Realm: TracUserDB                        <--- only if (4) is set. select realm created in (4)
     335 6. Modify `/fullpathto/mytracproject/conf/trac.ini`
     338#find/set base_rul, url, and link variables
     339base_url = <--- base url to generate correct links to
     340url =      <--- link of project
     341link =     <--- link of graphic logo
     344 7. Restart !LiteSpeed, “lswsctrl restart”, and access your new Trac project at:
     350== Simple Nginx Configuration
     352Nginx is able to communicate with FastCGI processes, but can not spawn them. So you need to start FastCGI server for Trac separately.
     354 1. Nginx configuration with basic authentication handled by Nginx - confirmed to work on 0.6.32
     355 {{{
     356    server {
     357        listen;
     358        server_name  trac.example;
     360        ssl                  on;
     361        ssl_certificate      /etc/ssl/trac.example.crt;
     362        ssl_certificate_key  /etc/ssl/trac.example.key;
     364        ssl_session_timeout  5m;
     366        ssl_protocols  SSLv2 SSLv3 TLSv1;
     367        ssl_ciphers  ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
     368        ssl_prefer_server_ciphers   on;
     370        # it makes sense to serve static resources through Nginx (or ``~ [/some/prefix]/chrome/(.*)``)
     371        location ~ /chrome/(.*) {
     372             alias /home/trac/instance/static/htdocs/$1;
     373        }
     375        # You can copy this whole location to ``location [/some/prefix](/login)``
     376        # and remove the auth entries below if you want Trac to enforce
     377        # authorization where appropriate instead of needing to authenticate
     378        # for accessing the whole site.
     379        # (Or ``~ location /some/prefix(/.*)``.)
     380        location ~ (/.*) {
     381            auth_basic            "trac realm";
     382            auth_basic_user_file /home/trac/htpasswd;
     384            # socket address
     385            fastcgi_pass   unix:/home/trac/run/instance.sock;
     387            # python - wsgi specific
     388            fastcgi_param HTTPS on;
     390            ## WSGI REQUIRED VARIABLES
     391            # WSGI application name - trac instance prefix.
     392            # (Or ``fastcgi_param  SCRIPT_NAME  /some/prefix``.)
     393            fastcgi_param  SCRIPT_NAME        "";
     394            fastcgi_param  PATH_INFO          $1;
     396            ## WSGI NEEDED VARIABLES - trac warns about them
     397            fastcgi_param  REQUEST_METHOD     $request_method;
     398            fastcgi_param  SERVER_NAME        $server_name;
     399            fastcgi_param  SERVER_PORT        $server_port;
     400            fastcgi_param  SERVER_PROTOCOL    $server_protocol;
     401            fastcgi_param  QUERY_STRING       $query_string;
     403            # For Nginx authentication to work - do not forget to comment these
     404            # lines if not using Nginx for authentication
     405            fastcgi_param  AUTH_USER          $remote_user;
     406            fastcgi_param  REMOTE_USER        $remote_user;
     408            # for ip to work
     409            fastcgi_param REMOTE_ADDR         $remote_addr;
     411            # For attchments to work
     412            fastcgi_param    CONTENT_TYPE     $content_type;
     413            fastcgi_param    CONTENT_LENGTH   $content_length;
     414        }
     415    }
     417 1. Modified trac.fcgi:
     418 {{{
     419#!/usr/bin/env python
     420import os
     421sockaddr = '/home/trac/run/instance.sock'
     422os.environ['TRAC_ENV'] = '/home/trac/instance'
     425     from trac.web.main import dispatch_request
     426     import trac.web._fcgi
     428     fcgiserv = trac.web._fcgi.WSGIServer(dispatch_request,
     429          bindAddress = sockaddr, umask = 7)
     432except SystemExit:
     433    raise
     434except Exception, e:
     435    print 'Content-Type: text/plain\r\n\r\n',
     436    print 'Oops...'
     437    print
     438    print 'Trac detected an internal error:'
     439    print
     440    print e
     441    print
     442    import traceback
     443    import StringIO
     444    tb = StringIO.StringIO()
     445    traceback.print_exc(file=tb)
     446    print tb.getvalue()
     449 1. reload nginx and launch trac.fcgi like that:
     450 {{{#!sh
     451trac@trac.example ~ $ ./
     454The above assumes that:
     455 * There is a user named 'trac' for running trac instances and keeping trac environments in its home directory
     456 * `/home/trac/instance` contains a trac environment
     457 * `/home/trac/htpasswd` contains authentication information
     458 * `/home/trac/run` is owned by the same group the nginx runs under
     459  * and if your system is Linux the `/home/trac/run` has setgid bit set (`chmod g+s run`)
     460  * and patch from ticket #T7239 is applied, or you'll have to fix the socket file permissions every time
     462Unfortunately nginx does not support variable expansion in fastcgi_pass directive.
     463Thus it is not possible to serve multiple Trac instances from one server block.
     465If you worry enough about security, run Trac instances under separate users.
     467Another way to run Trac as a FCGI external application is offered in ticket #T6224
     470See also:  TracGuide, TracInstall, [wiki:TracModWSGI ModWSGI], [wiki:TracCgi CGI], [wiki:TracModPython ModPython], [trac:TracNginxRecipe TracNginxRecipe]
  • wiki/pages/TracFineGrainedPermissions

    r37566 r37567  
     1= Fine grained permissions =
     2[[PageOutline(2-5, Contents, floated)]]
     5There is a general mechanism in place that allows custom **permission policy plugins** to grant or deny any action on any kind of Trac resource, even at the level of specific versions of such resources.
     7That mechanism is `authz_policy`, which is an optional module in `tracopt.perm.authz_policy.*`, so it is installed by default. It can be activated via the //Plugins// panel in the Trac administration module.
     9== Permission Policies ==
     11A great diversity of permission policies can be implemented and Trac comes with a few examples.
     13Which policies are currently active is determined by a configuration setting in TracIni:
     17permission_policies = ReadonlyWikiPolicy, DefaultPermissionPolicy, LegacyAttachmentPolicy
     19This lists the [#ReadonlyWikiPolicy] which controls readonly access to wiki pages, followed by the !DefaultPermissionPolicy which checks for the traditional coarse grained style permissions described in TracPermissions, and the !LegacyAttachmentPolicy which knows how to use the coarse grained permissions for checking the permissions available on attachments.
     21Among the optional choices, there is [#AuthzPolicy], a very generic permission policy, based on an Authz-style system. See
     22[trac:source:branches/1.0-stable/tracopt/perm/] for details.
     24Another popular permission policy [#AuthzSourcePolicy], re-implements the pre-0.12 support for checking fine-grained permissions limited to Subversion repositories in terms of the new system.
     26See also [trac:source:branches/1.0-stable/sample-plugins/permissions sample-plugins/permissions] for more examples.
     28=== !AuthzPolicy ===
     29==== Configuration ====
     30* Put a [ authzpolicy.conf] file somewhere, preferably on a secured location on the server, not readable for others than the webuser. If the  file contains non-ASCII characters, the UTF-8 encoding should be used.
     31* Update your `trac.ini`:
     32  1. modify the [TracIni#trac-section permission_policies] entry in the `[trac]` section:
     36permission_policies = AuthzPolicy, ReadonlyWikiPolicy, DefaultPermissionPolicy, LegacyAttachmentPolicy
     38  1. add a new `[authz_policy]` section:
     41authz_file = /some/trac/env/conf/authzpolicy.conf
     43  1. enable the plugin through [/admin/general/plugin WebAdmin] or by editing the `[components]` section:
     46tracopt.perm.authz_policy.* = enabled
     49==== Usage Notes ====
     51Note the order in which permission policies are specified: policies are implemented in the sequence provided and therefore may override earlier policy specifications.
     53A policy will return either `True`, `False` or `None` for a given permission check. `True` is returned if the policy explicitly grants the permission. `False` is returned if the policy explicitly denies the permission. `None` is returned if the policy is unable to either grant or deny the permission.
     55NOTE: Only if the return value is `None` will the ''next'' permission policy be consulted. If none of the policies explicitly grants the permission, the final result will be `False`, i.e. permission denied.
     57The `authzpolicy.conf` file is a `.ini` style configuration file:
     60john = WIKI_VIEW, !WIKI_MODIFY
     61jack = WIKI_VIEW
     62* =
     64* Each section of the config is a glob pattern used to match against a Trac resource descriptor. These descriptors are in the form:
     66<realm>:<id>@<version>[/<realm>:<id>@<version> ...]
     69Resources are ordered left to right, from parent to child. If any component is inapplicable, `*` is substituted. If the version pattern is not specified explicitly, all versions (`@*`) is added implicitly. Example: Match the WikiStart page:
     77Example: Match the attachment `wiki:WikiStart@117/attachment:FOO.JPG@*` on WikiStart:
     86* Sections are checked against the current Trac resource descriptor '''IN ORDER''' of appearance in the configuration file. '''ORDER IS CRITICAL'''.
     88* Once a section matches, the current username is matched against the keys (usernames) of the section, '''IN ORDER'''.
     89  * If a key (username) is prefixed with a `@`, it is treated as a group.
     90  * If a value (permission) is prefixed with a `!`, the permission is denied rather than granted.
     92The username will match any of 'anonymous', 'authenticated', <username> or '*', using normal Trac permission rules. || '''Note:''' Other groups which are created by user (e.g. by 'adding subjects to groups' on web interface page //Admin / Permissions//) cannot be used. See [trac:ticket:5648 #5648] for details about this missing feature. ||
     94For example, if the `authz_file` contains:
     97* = WIKI_VIEW
     100john = WIKI_VIEW
     101* = !WIKI_VIEW
     103and the default permissions are set like this:
     105john           WIKI_VIEW
     106jack           WIKI_VIEW
     107# anonymous has no WIKI_VIEW
     111  * All versions of WikiStart will be viewable by everybody, including anonymous
     112  * !PrivatePage will be viewable only by john
     113  * other pages will be viewable only by john and jack
     118admins = john, jack
     119devs = alice, bob
     122@admins = TRAC_ADMIN
     123@devs = WIKI_VIEW
     124* =
     127@admins = TRAC_ADMIN
     128* =
     132- everything is blocked (whitelist approach), but
     133- admins get all TRAC_ADMIN everywhere and
     134- devs can view wiki pages.
     136Some repository examples (Browse Source specific):
     138# A single repository:
     140john = BROWSER_VIEW, FILE_VIEW
     141# John has BROWSER_VIEW and FILE_VIEW for the entire test_repo
     143# The default repository (requires Trac 1.0.2 or later):
     145john = BROWSER_VIEW, FILE_VIEW
     146# John has BROWSER_VIEW and FILE_VIEW for the entire default repository
     148# All repositories:
     150jack = BROWSER_VIEW, FILE_VIEW
     151# Jack has BROWSER_VIEW and FILE_VIEW for all repositories
     154Very granular repository access:
     156# John has BROWSER_VIEW and FILE_VIEW access to trunk/src/some/location/ only
     158john = BROWSER_VIEW, FILE_VIEW
     160# John has BROWSER_VIEW and FILE_VIEW access to only revision 1 of all files at trunk/src/some/location only
     162john = BROWSER_VIEW, FILE_VIEW
     164# John has BROWSER_VIEW and FILE_VIEW access to all revisions of 'somefile' at trunk/src/some/location only
     166john = BROWSER_VIEW, FILE_VIEW
     168# John has BROWSER_VIEW and FILE_VIEW access to only revision 1 of 'somefile' at trunk/src/some/location only
     170john = BROWSER_VIEW, FILE_VIEW
     173Note: In order for Timeline to work/visible for John, we must add CHANGESET_VIEW to the above permission list.
     175==== Missing Features ====
     176Although possible with the !DefaultPermissionPolicy handling (see Admin panel), fine-grained permissions still miss those grouping features (see [trac:ticket:9573 #9573], [trac:ticket:5648 #5648]). Patches are partially available, see authz_policy.2.patch, part of [trac:ticket:6680 #6680].
     178You cannot do the following:
     181team1 = a, b, c
     182team2 = d, e, f
     183team3 = g, h, i
     184departmentA = team1, team2
     187Permission groups are not supported either, so you cannot do the following:
     190permission_level_1 = WIKI_VIEW, TICKET_VIEW
     191permission_level_2  = permission_level_1, WIKI_MODIFY, TICKET_MODIFY
     193@team1 = permission_level_1
     194@team2 = permission_level_2
     195@team3 = permission_level_2, TICKET_CREATE
     198=== !AuthzSourcePolicy  (mod_authz_svn-like permission policy) === #AuthzSourcePolicy
     200At the time of this writing, the old granular permissions system from Trac 0.11 and before used for restricting access to the repository has been converted to a permission policy component. But from the user's point of view, this makes little if any difference.
     202That kind of granular permission control needs a definition file, which is the one used by Subversion's mod_authz_svn.
     203More information about this file format and about its usage in Subversion is available in the [ Path-Based Authorization] section in the Server Configuration chapter of the svn book.
     208* = r
     211harry = rw
     212sally = r
     215harry =
     218 * '''/''' = ''Everyone has read access by default''
     219 * '''/branches/calc/bug-142''' = ''harry has read/write access, sally read only''
     220 * '''/branches/calc/bug-142/secret''' = ''harry has no access, sally has read access (inherited as a sub folder permission)''
     222==== Trac Configuration ====
     224To activate granular permissions you __must__ specify the {{{authz_file}}} option in the `[svn]` section of trac.ini. If this option is set to null or not specified, the permissions will not be used.
     228authz_file = /path/to/svnaccessfile
     231If you want to support the use of the `[`''modulename''`:/`''some''`/`''path''`]` syntax within the `authz_file`, add:
     234authz_module_name = modulename
     237where ''modulename'' refers to the same repository indicated by the `<name>.dir` entry in the `[repositories]` section. As an example, if the `somemodule.dir` entry in the `[repositories]` section is `/srv/active/svn/somemodule`, that would yield the following:
     239{{{ #!ini
     241authz_file = /path/to/svnaccessfile
     242authz_module_name = somemodule
     245somemodule.dir = /srv/active/svn/somemodule
     248where the svn access file, {{{/path/to/svnaccessfile}}}, contains entries such as {{{[somemodule:/some/path]}}}.
     250'''Note:''' Usernames inside the Authz file __must__ be the same as those used inside trac.
     252As of version 0.12, make sure you have ''!AuthzSourcePolicy'' included in the permission_policies list in trac.ini, otherwise the authz permissions file will be ignored.
     256permission_policies = AuthzSourcePolicy, ReadonlyWikiPolicy, DefaultPermissionPolicy, LegacyAttachmentPolicy
     259==== Subversion Configuration ====
     261The same access file is typically applied to the corresponding Subversion repository using an Apache directive like this:
     263<Location /repos>
     264  DAV svn
     265  SVNParentPath /usr/local/svn
     267  # our access control policy
     268  AuthzSVNAccessFile /path/to/svnaccessfile
     272For information about how to restrict access to entire projects in a multiple project environment see [trac:wiki:TracMultipleProjectsSVNAccess].
     274=== ReadonlyWikiPolicy
     276Since 1.1.2, the read-only attribute of wiki pages is enabled and enforced when `ReadonlyWikiPolicy` is in the list of active permission policies. The default for new Trac installations in 1.1.2 and later is:
     279permission_policies = ReadonlyWikiPolicy,
     280 DefaultPermissionPolicy,
     281 LegacyAttachmentPolicy
     284When upgrading from earlier versions of Trac, `ReadonlyWikiPolicy` will be appended to the list of `permission_policies` when upgrading the environment, provided that `permission_policies` has the default value. If any non-default `permission_polices` are active, `ReadonlyWikiPolicy` **will need to be manually added** to the list. A message will be echoed to the console when upgrading the environment, indicating if any action needs to be taken.
     286**!ReadonlyWikiPolicy must be listed //before// !DefaultPermissionPolicy**. The latter returns `True` to allow modify, delete or rename actions when the user has the respective `WIKI_*` permission, without consideration for the read-only attribute.
     288The `ReadonlyWikiPolicy` returns `False` to deny modify, delete and rename actions on wiki pages when the page has the read-only attribute set and the user does not have `WIKI_ADMIN`, regardless of `WIKI_MODIFY`, `WIKI_DELETE` and `WIKI_RENAME` permissions. It returns `None` for all other cases.
     290When active, the [#AuthzPolicy] should therefore come before `ReadonlyWikiPolicy`, allowing it to grant or deny the actions on individual resources, which is the usual ordering for `AuthzPolicy` in the `permission_policies` list.
     293permission_policies = AuthzPolicy,
     294 ReadonlyWikiPolicy,
     295 DefaultPermissionPolicy,
     296 LegacyAttachmentPolicy
     299The placement of [#AuthzSourcePolicy] relative to `ReadonlyWikiPolicy` does not matter since they don't perform checks on the same realms.
     301For all other permission policies, the user will need to decide the proper ordering. Generally, if the permission policy should be capable of overriding the check performed by `ReadonlyWikiPolicy`, it should come before `ReadonlyWikiPolicy` in the list. If the `ReadonlyWikiPolicy` should override the check performed by another permission policy, as is the case for `DefaultPermissionPolicy`, then `ReadonlyWikiPolicy` should come first.
     303== Debugging permissions
     304In trac.ini set:
     307log_file = trac.log
     308log_level = DEBUG
     309log_type = file
     312Display the trac.log to understand what checks are being performed:
     314tail -n 0 -f log/trac.log | egrep '\[perm\]|\[authz_policy\]'
     317See the sourced documentation of the plugin for more info.
     320See also: TracPermissions,
     321[ TracHacks:FineGrainedPageAuthzEditorPlugin] for a simple editor plugin.
  • wiki/pages/TracGuide

    r37566 r37567  
     1= The Trac User and Administration Guide =
     3{{{#!span style="font-size:90%"
     4//The TracGuide is meant to serve as a starting point for all documentation regarding Trac usage and development. The guide is a free document, a collaborative effort, and a part of the [ Trac Project] itself.//
     7== Introduction
     9Trac is an enhanced wiki and issue tracking system for software development projects. Trac uses a minimalistic approach to web-based software project management. It strives to help developers write great software while staying out of the way. Trac should impose as little as possible on a team's established development process and policies.
     11It provides an interface to Subversion (and other version control systems), an integrated Wiki and convenient reporting facilities.
     13Trac allows wiki markup in issue descriptions and commit messages, creating links and seamless references between bugs, tasks, changesets, files and wiki pages. A timeline shows all current and past project events in order, making the acquisition of an overview of the project and tracking progress very easy. The roadmap shows the road ahead, listing the upcoming milestones.
     14== User Guide
     15   * Using the Wiki subsystem
     16     * TracWiki — How to use the built-in Wiki.
     17     * WikiFormatting — Reference to the wiki syntax used throughout.
     18   * Using the Version Control subsystem
     19     * TracBrowser — Browsing source code with Trac.
     20     * TracChangeset — Viewing changes to source code.
     21     * TracRevisionLog — Viewing change history.
     22   * Using the Ticket subsystem
     23     * TracTickets — Using the issue tracker.
     24     * TracRoadmap — The roadmap helps tracking project progress.
     25     * TracReports — Writing and using reports.
     26     * TracQuery — Executing custom ticket queries.
     27     * TracBatchModify - Modifying a batch of tickets in one request.
     28   * Other modules and general topics
     29     * TracSearch — Full text search in all content.
     30     * TracTimeline — The timeline provides a historic perspective on a project.
     31     * TracRss — RSS content syndication in Trac.
     32     * TracAccessibility — Accessibility keys support
     35== Administrator Guide
     36   * Installation and upgrade
     37     * TracInstall — How to install and run Trac.
     38     * TracUpgrade — How to upgrade existing installations.
     39     * TracImport — Importing tickets from other bug databases.
     40     * TracPlugins — Installing and managing Trac extensions.
     41   * Configuration and customization
     42     * TracIni — Trac configuration file reference.
     43     * TracPermissions — Access control and permissions.
     44     * TracNavigation — Customize main navigation menus.
     45     * TracInterfaceCustomization — Customizing the Trac interface.
     46     * TracLogging — The Trac logging facility.
     47   * Administering the Version Control subsystem
     48     * TracRepositoryAdmin — Management of Source Code Repositories.
     49   * Administering the Ticket subsystem
     50     * TracTicketsCustomFields — Expanding tickets with customized fields.
     51     * TracNotification — Email notification.
     52     * TracWorkflow — Configurable Ticket Workflow.
     53   * Reference
     54     * TracEnvironment — All you need to know about Trac environments
     55     * TracAdmin — Administering a Trac project via the command-line.
     57== Support and Other Sources of Information ==
     59 * [trac:TracFaq Trac FAQ] — A collection of Frequently Asked Questions (on the project website).
     60 * [trac:TracDev] and [trac:TracDev/ApiDocs API docs] — Trac Developer documentation
     61 * TracSupport — How to get more information
     63If you are looking for a good place to ask a question about Trac, look no further than the [trac:MailingList MailingList]. It provides a friendly environment to discuss openly among Trac users and developers.
  • wiki/pages/TracImport

    r37566 r37567  
     1= Importing ticket data =
     4To migrate issue tickets from other issue-tracking systems or perform housekeeping actions on tickets or simply synchronize different databases, there are some tools, plug-ins and scripts available, which let you import or update tickets into Trac.
     6== !TicketImportPlugin ==
     8[ TicketImportPlugin]: this plug-in lets you import or update into Trac a series of tickets from a '''CSV file''' or (if the [ xlrd library] is installed) from an '''Excel spreadsheet'''.
     10== !ExportImportXlsPlugin ==
     12[ ExportImportXlsPlugin]: this plug-in adds an admin panel for exporting and importing tickets via '''XLS file'''. Requires the python packages xlwt/rxld.
     14== Bugzilla ==
     16[ BugzillaIssueTrackingPlugin]: integrates Bugzilla issue data into Trac keeping TracLinks. Ticket data can be imported from Bugzilla using the [trac:browser:trunk/contrib/] script, available in the contrib/ directory of the Trac distribution.
     20bugzilla2trac - Imports a bug database from Bugzilla into Trac.
     22Usage: [options]
     24Available Options:
     25  --db <MySQL dbname>              - Bugzilla's database
     26  --tracenv /path/to/trac/env      - full path to Trac db environment
     27  -h | --host <MySQL hostname>     - Bugzilla's DNS host name
     28  -u | --user <MySQL username>     - effective Bugzilla's database user
     29  -p | --passwd <MySQL password>   - Bugzilla's user password
     30  -c | --clean                     - remove current Trac tickets before importing
     31  --help | help                    - this help info
     33Additional configuration options can be defined directly in the script.
     36Currently, the following data is imported from Bugzilla:
     37  * bugs
     38  * bug activity (field changes)
     39  * bug attachments
     40  * user names and passwords (put into a htpasswd file)
     42The script provides a number of features to ease the conversion, such as:
     43  * PRODUCT_KEYWORDS: Trac has no concept of products, so the script provides the ability to attach a ticket keyword instead.
     44  * IGNORE_COMMENTS: Don't import Bugzilla comments that match a certain regexp.
     45  * STATUS_KEYWORDS: Attach ticket keywords for the Bugzilla statuses not available in Trac. By default, the 'VERIFIED' and 'RELEASED' Bugzilla statuses are translated into Trac keywords.
     47For more details on the available options, see the configuration section at the top of the script.
     49=== Known Issues ===
     52                   Don't merge this section in the default page
     56The adequate milestone for valid bugzilla2trac issue is usually ''Not applicable'', which means that fixes to the contributed script are not planned for a particular Trac release, but can happen anytime.
     58== Jira ==
     60[ JiraToTracIntegration]: provides tools to import Atlassian Jira backup files into Trac. The plug-in consists of a Python 3.1 commandline tool that:
     61  - Parses the Jira backup XML file.
     62  - Sends the imported Jira data and attachments to Trac using the [ XmlRpcPlugin].
     63  - Generates a htpasswd file containing the imported Jira users and their SHA-512 base64 encoded passwords.
     65== Mantis ==
     67[ MantisImportScript]: script to import the following data from Mantis into Trac:
     68  * bugs
     69  * bug comments
     70  * bug activity (field changes)
     71  * attachments (as long as the files live in the mantis db, not on the filesystem) .
     73== !PlanetForge ==
     75[ PlanetForgeImportExportPlugin]: this plugin exports Trac data (wiki, tickets, compoments, permissions, repositories, etc.) using the open format designed by the COCLICO project. It extends the webadmin panel and the 'trac admin ...' command. Has no 'import' feature.
     77== Scarab ==
     79[ ScarabToTracScript]: script that migrates Scarab issues to Trac tickets. Requires [ XmlRpcPlugin]
     81== Sourceforge ==
     83[ SfnToTracScript]: importer of !SourceForge's new backup file (originated from #Trac3521).
     84Also, ticket data can be imported from Sourceforge using the [trac:browser:trunk/contrib/] script, available in the contrib/ directory of the Trac distribution.
     86== Other ==
     88Since Trac uses a SQL database to store the data, you can also custom-import from other systems by examining the database tables. Just go into [ sqlite] command line to look at the tables and import them from your application.
     90=== Comma delimited file - CSV ===
     91See [] for details. This approach is particularly useful if you need to enter a large number of tickets by hand. Note that the ticket type type field, (task etc...) is also needed for this script to work with more recent Trac releases.
     92Comments on script: The script has an error on line 168: 'Ticket' needs to be 'ticket'. Also, the listed values for severity and priority are swapped.
     95See also:
     96 * to import/export wiki pages: TracAdmin,
     97 * to export tickets: TracTickets, TracQuery
  • wiki/pages/TracIni

    r37566 r37567  
     1= The Trac Configuration File
     6Trac is configured by editing the **`trac.ini`** file, located in the `<projectenv>/conf` directory. The `trac.ini` configuration file and its parent directory should be writable by the web server.
     8Trac monitors the timestamp of the file to trigger a complete environment reload and flush its caches when the timestamp changes. Most changes to the configuration will be reflected immediately, though changes to the `[components]` or `[logging]` sections will require restarting the web server. You may also need to restart the web server after creating a [#GlobalConfiguration global configuration] file when none was previously present.
     10== Global Configuration
     12Configuration can be shared among environments using one or more global configuration files. Options in the global configuration will be merged with the environment-specific options, with local options overriding global options. The global configuration file is specified as follows:
     15file = /path/to/global/trac.ini
     17Multiple files can be specified using a comma-separated list.
     19Note that you can also specify a global option file when creating a new project,  by adding the option `--inherit=/path/to/global/trac.ini` to [TracAdmin#initenv trac-admin]'s `initenv` command.  If you do not do this but nevertheless intend to use a global option file with your new environment, you will have to go through the newly generated `conf/trac.ini` file and delete the entries that will otherwise override those set in the global file.
     21There are two more entries in the [[#inherit-section| [inherit] ]] section, `templates_dir` for sharing global templates and `plugins_dir`, for sharing plugins. Those entries can themselves be specified in the shared configuration file, and in fact, configuration files can even be chained if you specify another `[inherit] file` there.
     23Note that the templates found in the `templates/` directory of the TracEnvironment have precedence over those found in `[inherit] templates_dir`. In turn, the latter have precedence over the installed templates, so be careful about what you put there. Notably, if you override a default template, refresh your modifications when you upgrade to a new version of Trac. The preferred way to perform TracInterfaceCustomization is still to write a custom plugin doing an appropriate `ITemplateStreamFilter` transformation.
     25== Reference for settings
     27This is a brief reference of available configuration options, and their default settings.
     29Documentation improvements should be discussed on the [trac:MailingList#Trac-dev trac-dev mailing list] or described in a [trac:NewTicket ticket]. Even better, [trac:TracDev/SubmittingPatches submit a patch] against the docstrings in the code.
     30{{{ #!comment
     31Please don't waste your time by editing the HTML code below, changes won't be picked up. Instead, follow the above guidance for suggesting documentation improvements.
     36See also: TracGuide, TracAdmin, TracEnvironment
  • wiki/pages/TracInstall

    r37566 r37567  
     1= Trac Installation Guide for 1.1
     4Trac is written in the Python programming language and needs a database, [ SQLite], [ PostgreSQL], or [ MySQL]. For HTML rendering, Trac uses the [ Genshi] templating system.
     6Trac can also be localized, and there is probably a translation available in your language. If you want to use the Trac interface in other languages, then make sure you have installed the optional package [#OtherPythonPackages Babel]. Pay attention to the extra steps for localization support in the [#InstallingTrac Installing Trac] section below. Lacking Babel, you will only get the default English version.
     8If you're interested in contributing new translations for other languages or enhancing the existing translations, then please have a look at [trac:wiki:TracL10N TracL10N].
     10What follows are generic instructions for installing and setting up Trac. While you may find instructions for installing Trac on specific systems at [trac:TracInstallPlatforms TracInstallPlatforms], please '''first read through these general instructions''' to get a good understanding of the tasks involved.
     12[[PageOutline(2-3,Installation Steps,inline)]]
     14== Dependencies
     15=== Mandatory Dependencies
     16To install Trac, the following software packages must be installed:
     18 * [ Python], version >= 2.6 and < 3.0
     19   (note that we dropped the support for Python 2.5 in this release)
     20 * [ setuptools], version >= 0.6
     21 * [ Genshi], version >= 0.6
     23You also need a database system and the corresponding python bindings. The database can be either SQLite, PostgreSQL or MySQL.
     25==== For the SQLite database #ForSQLite
     27As you must be using Python 2.6 or 2.7, you already have the SQLite database bindings bundled with the standard distribution of Python (the `sqlite3` module).
     29Optionally, you may install a newer version of [pypi:pysqlite pysqlite] than the one provided by the Python distribution. See [trac:PySqlite#ThePysqlite2bindings PySqlite] for details.
     31==== For the PostgreSQL database #ForPostgreSQL
     33You need to install the database and its Python bindings:
     34 * [ PostgreSQL], version 8.0 or later
     35 * [ psycopg2], version 2.0 or later
     37See [trac:DatabaseBackend#Postgresql DatabaseBackend] for details.
     39==== For the MySQL database #ForMySQL
     41Trac works well with MySQL, provided you follow the guidelines:
     43 * [ MySQL], version 5.0 or later
     44 * [ MySQLdb], version 1.2.2 or later
     46Given the caveats and known issues surrounding MySQL, read carefully the [trac:MySqlDb] page before creating the database.
     48=== Optional Dependencies
     50==== Subversion
     52[ Subversion], 1.6.x or later and the '''''corresponding''''' Python bindings.
     54There are [ pre-compiled SWIG bindings] available for various platforms. (Good luck finding precompiled SWIG bindings for any Windows package at that listing. [trac:TracSubversion] points you to [ Alagazam], which works for me under Python 2.6.)
     56For troubleshooting information, see the [trac:TracSubversion#Troubleshooting TracSubversion] page.
     58{{{#!div style="border: 1pt dotted; margin: 1em"
     60* Trac '''doesn't''' use [ PySVN], nor does it work yet with the newer `ctype`-style bindings.
     61* If using Subversion, Trac must be installed on the '''same machine'''. Remote repositories are currently [trac:ticket:493 not supported].
     64==== Git
     66[ Git] 1.5.6 or later is supported. More information is available on the [trac:TracGit] page.
     68==== Other Version Control Systems
     70Support for other version control systems is provided via third-party plugins. See [trac:PluginList#VersionControlSystems] and [trac:VersionControlSystem].
     72==== Web Server
     73A web server is optional because Trac is shipped with a server included, see the [#RunningtheStandaloneServer Running the Standalone Server] section below.
     75Alternatively you can configure Trac to run in any of the following environments:
     76 * [ Apache] with
     77   - [ mod_wsgi], see [wiki:TracModWSGI] and
     78     [ ModWSGI IntegrationWithTrac].
     79   - [ mod_python 3.5.0], see TracModPython
     80 * a [ FastCGI]-capable web server (see TracFastCgi)
     81 * an [ AJP]-capable web
     82   server (see [trac:TracOnWindowsIisAjp TracOnWindowsIisAjp])
     83 * Microsoft IIS with FastCGI and a FastCGI-to-WSGI gateway (see [trac:CookBook/Installation/TracOnWindowsIisWfastcgi IIS with FastCGI])
     84 * a CGI-capable web server (see TracCgi), '''but usage of Trac as a cgi script
     85   is highly discouraged''', better use one of the previous options.
     88==== Other Python Packages
     90 * [ Babel], version 0.9.6 or >= 1.3,
     91   needed for localization support
     92 * [ docutils], version >= 0.3.9
     93   for WikiRestructuredText.
     94 * [ Pygments] for
     95   [TracSyntaxColoring syntax highlighting].
     96 * [ pytz] to get a complete list of time zones,
     97   otherwise Trac will fall back on a shorter list from
     98   an internal time zone implementation.
     100{{{#!div style="border: 1pt dotted; margin: 1em"
     101**Attention**: The available versions of these dependencies are not necessarily interchangeable, so please pay attention to the version numbers. If you are having trouble getting Trac to work, please double-check all the dependencies before asking for help on the [trac:MailingList] or [trac:IrcChannel].
     104Please refer to the documentation of these packages to find out how they are best installed. In addition, most of the [trac:TracInstallPlatforms platform-specific instructions] also describe the installation of the dependencies. Keep in mind however that the information there ''probably concern older versions of Trac than the one you're installing''.
     106== Installing Trac
     108The [TracAdmin trac-admin] command-line tool, used to create and maintain [TracEnvironment project environments], as well as the [TracStandalone tracd] standalone server are installed along with Trac. There are several methods for installing Trac.
     110=== Using `easy_install`
     111Trac can be installed from PyPI or the Subversion repository using [ setuptools].
     113A few examples:
     115 - Install Trac 1.0:
     116   {{{#!sh
     117   easy_install Trac==1.0
     118   }}}
     119 - Install latest development version:
     120   {{{#!sh
     121   easy_install Trac==dev
     122   }}}
     123   Note that in this case you won't have the possibility to run a localized version of Trac;
     124   either use a released version or install from source
     126More information can be found on the [trac:setuptools] page.
     128{{{#!div style="border: 1pt dotted; margin: 1em"
     129**Setuptools Warning:** If the version of your setuptools is in the range 5.4 through 5.6, the environment variable `PKG_RESOURCES_CACHE_ZIP_MANIFESTS` must be set in order to avoid significant performance degradation. More information may be found in the sections on [#RunningtheStandaloneServer Running The Standalone Server] and [#RunningTraconaWebServer Running Trac on a Web Server].
     132=== Using `pip`
     133'pip' is an easy_install replacement that is very useful to quickly install python packages.
     134To get a Trac installation up and running in less than 5 minutes:
     136Assuming you want to have your entire pip installation in `/opt/user/trac`
     138 -
     139 {{{#!sh
     140pip install trac psycopg2
     143 -
     144 {{{#!sh
     145pip install trac mysql-python
     148Make sure your OS specific headers are available for pip to automatically build PostgreSQL (`libpq-dev`) or MySQL (`libmysqlclient-dev`) bindings.
     150pip will automatically resolve all dependencies (like Genshi, pygments, etc.), download the latest packages from and create a self contained installation in `/opt/user/trac`.
     152All commands (`tracd`, `trac-admin`) are available in `/opt/user/trac/bin`. This can also be leveraged for `mod_python` (using `PythonHandler` directive) and `mod_wsgi` (using `WSGIDaemonProcess` directive)
     154Additionally, you can install several Trac plugins (listed [ here]) through pip.
     156=== From source
     157Using the python-typical setup at the top of the source directory also works. You can obtain the source for a .tar.gz or .zip file corresponding to a release (e.g. `Trac-1.0.tar.gz`) from the [trac:TracDownload] page, or you can get the source directly from the repository. See [trac:TracRepositories#OfficialSubversionrepository TracRepositories] for details.
     160$ python ./ install
     163''You will need root permissions or equivalent for this step.''
     165This will byte-compile the Python source code and install it as an .egg file or folder in the `site-packages` directory
     166of your Python installation. The .egg will also contain all other resources needed by standard Trac, such as `htdocs` and `templates`.
     168If you install from source and want to make Trac available in other languages, make sure Babel is installed. Only then, perform the `install` (or simply redo the `install` once again afterwards if you realize Babel was not yet installed):
     170$ python ./ install
     172Alternatively, you can run `bdist_egg` and copy the .egg from `dist/` to the place of your choice, or you can create a Windows installer (`bdist_wininst`).
     174=== Using installer
     176On Windows, Trac can be installed using the exe installers available on the [trac:TracDownload] page. Installers are available for the 32-bit and 64-bit versions of Python. Make sure to use the installer that matches the architecture of your Python installation.
     178=== Using package manager
     180Trac may be available in your platform's package repository. Note however, that the version provided by your package manager may not be the latest release.
     182=== Advanced `easy_install` Options
     184To install Trac to a custom location, or find out about other advanced installation options, run:
     186easy_install --help
     189Also see [ Installing Python Modules] for detailed information.
     191Specifically, you might be interested in:
     193easy_install --prefix=/path/to/installdir
     195or, if installing Trac on a Mac OS X system:
     197easy_install --prefix=/usr/local --install-dir=/Library/Python/2.6/site-packages
     200{{{#!div style="border: 1pt dotted; margin: 1em"
     201**Mac OS X Note:** On Mac OS X 10.6,  running `easy_install trac` will install into `/usr/local` and `/Library/Python/2.6/site-packages` by default.
     203The `tracd` and `trac-admin` commands will be placed in `/usr/local/bin` and will install the Trac libraries and dependencies into `/Library/Python/2.6/site-packages`, which is Apple's preferred location for third-party Python application installations.
     206== Creating a Project Environment
     208A [TracEnvironment Trac environment] is the backend where Trac stores information like wiki pages, tickets, reports, settings, etc. An environment is a directory that contains a human-readable [TracIni configuration file], and other files and directories.
     210A new environment is created using [TracAdmin trac-admin]:
     212$ trac-admin /path/to/myproject initenv
     215[TracAdmin trac-admin] will prompt you for the information it needs to create the environment: the name of the project and the [TracEnvironment#DatabaseConnectionStrings database connection string]. If you're not sure what to specify for any of these options, just press `<Enter>` to use the default value.
     217Using the default database connection string will always work as long as you have SQLite installed. For the other [trac:DatabaseBackend database backends] you should plan ahead and already have a database ready to use at this point.
     219Also note that the values you specify here can be changed later using TracAdmin or directly editing the [TracIni conf/trac.ini] configuration file.
     221{{{#!div style="border: 1pt dotted; margin: 1em"
     222**Filesystem Warning:** When selecting the location of your environment, make sure that the filesystem on which the environment directory resides supports sub-second timestamps (i.e. **not** `ext2` or `ext3` on Linux, or HFS+ on OSX), as the modification time of the `conf/trac.ini` file will be monitored to decide whether an environment restart is needed or not. A too coarse-grained timestamp resolution may result in inconsistencies in Trac < 1.0.2. The best advice is to opt for a platform with sub-second timestamp resolution, regardless of the Trac version.
     225Finally, make sure the user account under which the web front-end runs will have '''write permissions''' to the environment directory and all the files inside. This will be the case if you run `trac-admin ... initenv` as this user. If not, you should set the correct user afterwards. For example on Linux, with the web server running as user `apache` and group `apache`, enter:
     227$ chown -R apache:apache /path/to/myproject
     230The actual username and groupname of the apache server may not be exactly `apache`, and are specified in the Apache configuration file by the directives `User` and `Group` (if Apache `httpd` is what you use).
     232{{{#!div class=important
     233'''Warning:''' Please only use ASCII-characters for account name and project path, unicode characters are not supported there.
     236== Deploying Trac
     238=== Running the Standalone Server
     240After having created a Trac environment, you can easily try the web interface by running the standalone server [TracStandalone tracd]:
     242$ tracd --port 8000 /path/to/myproject
     245Then, fire up a browser and visit `http://localhost:8000/`. You should get a simple listing of all environments that `tracd` knows about. Follow the link to the environment you just created, and you should see Trac in action. If you only plan on managing a single project with Trac you can have the standalone server skip the environment list by starting it like this:
     247$ tracd -s --port 8000 /path/to/myproject
     250{{{#!div style="border: 1pt dotted; margin: 1em"
     251**Setuptools Warning:** If the version of your setuptools is in the range 5.4 through 5.6, the environment variable `PKG_RESOURCES_CACHE_ZIP_MANIFESTS` must be set in order to avoid significant performance degradation. The environment variable can be set system-wide, or for just the user that runs the `tracd` process. There are several ways to accomplish this in addition to what is discussed here, and depending on the distribution of your OS.
     253To be effective system-wide a shell script with the `export` statement may be added to `/etc/profile.d`. To be effective for a user session the `export` statement may be added to `~/.profile`.
     258Alternatively, the variable can be set in the shell before executing `tracd`:
     260$ PKG_RESOURCES_CACHE_ZIP_MANIFESTS=1 tracd --port 8000 /path/to/myproject
     264=== Running Trac on a Web Server
     266Trac provides various options for connecting to a "real" web server:
     267 - [TracFastCgi FastCGI]
     268 - [wiki:TracModWSGI mod_wsgi]
     269 - [TracModPython mod_python]
     270 - //[TracCgi CGI] (should not be used, as the performance is far from optimal)//
     272Trac also supports [trac:TracOnWindowsIisAjp AJP] which may be your choice if you want to connect to IIS. Other deployment scenarios are possible: [trac:TracNginxRecipe nginx], [ uwsgi], [trac:TracOnWindowsIisIsapi Isapi-wsgi] etc.
     274==== Generating the Trac cgi-bin directory #cgi-bin
     276In order for Trac to function properly with FastCGI you need to have a `trac.fcgi` file and for mod_wsgi a `trac.wsgi` file. These are Python scripts which load the appropriate Python code. They can be generated using the `deploy` option of [TracAdmin trac-admin].
     278There is, however, a bit of a chicken-and-egg problem. The [TracAdmin trac-admin] command requires an existing environment to function, but complains if the deploy directory already exists. This is a problem, because environments are often stored in a subdirectory of the deploy. The solution is to do something like this:
     280mkdir -p /usr/share/trac/projects/my-project
     281trac-admin /usr/share/trac/projects/my-project initenv
     282trac-admin /usr/share/trac/projects/my-project deploy /tmp/deploy
     283mv /tmp/deploy/* /usr/share/trac
     285Don't forget to check that the web server has the execution right on scripts in the `/usr/share/trac/cgi-bin` directory.
     287==== Mapping Static Resources
     289Out of the box, Trac will pass static resources such as style sheets or images through itself. For anything but a tracd only based deployment, this is far from optimal as the web server could be set up to directly serve those static resources (for CGI setup, this is '''highly undesirable''' and will cause abysmal performance).
     291Web servers such as [ Apache] allow you to create “Aliases” to resources, giving them a virtual URL that doesn't necessarily reflect the layout of the servers file system. We also can map requests for static resources directly to the directory on the file system, avoiding processing these requests by Trac itself.
     293There are two primary URL paths for static resources - `/chrome/common` and `/chrome/site`. Plugins can add their own resources, usually accessible by `/chrome/<plugin>` path, so its important to override only known paths and not try to make universal `/chrome` alias for everything.
     295Note that in order to get those static resources on the filesystem, you need first to extract the relevant resources from Trac using the TracAdmin `deploy` command:
     298The target `<directory>` will then contain an `htdocs` directory with:
     299 - `site/` - a copy of the environment's directory `htdocs/`
     300 - `common/` - the static resources of Trac itself
     301 - `<plugins>/` - one directory for each resource directory managed by the plugins enabled for this environment
     303===== Example: Apache and `ScriptAlias` #ScriptAlias-example
     305Assuming the deployment has been done this way:
     307$ trac-admin /var/trac/env deploy /path/to/shared/trac
     310Add the following snippet to Apache configuration ''before'' the `ScriptAlias` or `WSGIScriptAlias` (which map all the other requests to the Trac application), changing paths to match your deployment:
     312Alias /trac/chrome/common /path/to/trac/htdocs/common
     313Alias /trac/chrome/site /path/to/trac/htdocs/site
     315<Directory "/path/to/www/trac/htdocs">
     316  Order allow,deny
     317  Allow from all
     321If using mod_python, you might want to add this too (otherwise, the alias will be ignored):
     323<Location "/trac/chrome/common/">
     324  SetHandler None
     328Note that we mapped the `/trac` part of the URL to the `trac.*cgi` script, and the path `/trac/chrome/common` is the path you have to append to that location to intercept requests to the static resources.
     330Similarly, if you have static resources in a project's `htdocs` directory (which is referenced by `/trac/chrome/site` URL in themes), you can configure Apache to serve those resources (again, put this ''before'' the `ScriptAlias` or `WSGIScriptAlias` for the .*cgi scripts, and adjust names and locations to match your installation):
     332Alias /trac/chrome/site /path/to/projectenv/htdocs
     334<Directory "/path/to/projectenv/htdocs">
     335  Order allow,deny
     336  Allow from all
     340Alternatively to aliasing `/trac/chrome/common`, you can tell Trac to generate direct links for those static resources (and only those), using the [[TracIni#trac-section| [trac] htdocs_location]] configuration setting:
     343htdocs_location =
     345Note that this makes it easy to have a dedicated domain serve those static resources (preferentially [ cookie-less]).
     347Of course, you still need to make the Trac `htdocs/common` directory available through the web server at the specified URL, for example by copying (or linking) the directory into the document root of the web server:
     349$ ln -s /path/to/trac/htdocs/common /var/www/
     352==== Setting up the Plugin Cache
     354Some Python plugins need to be extracted to a cache directory. By default the cache resides in the home directory of the current user. When running Trac on a Web Server as a dedicated user (which is highly recommended) who has no home directory, this might prevent the plugins from starting. To override the cache location you can set the `PYTHON_EGG_CACHE` environment variable. Refer to your server documentation for detailed instructions on how to set environment variables.
     356== Configuring Authentication
     358Trac uses HTTP authentication. You'll need to configure your webserver to request authentication when the `.../login` URL is hit (the virtual path of the "login" button). Trac will automatically pick the `REMOTE_USER` variable up after you provide your credentials. Therefore, all user management goes through your web server configuration. Please consult the documentation of your web server for more info.
     360The process of adding, removing, and configuring user accounts for authentication depends on the specific way you run Trac.
     362Please refer to one of the following sections:
     363 * TracStandalone#UsingAuthentication if you use the standalone server, `tracd`.
     364 * [wiki:TracModWSGI#ConfiguringAuthentication TracModWSGI#ConfiguringAuthentication] if you use the Apache web server, with any of its front end: `mod_wsgi`, `mod_python`, `mod_fcgi` or `mod_fastcgi`.
     365 * TracFastCgi if you're using another web server with FCGI support (Cherokee, Lighttpd, !LiteSpeed, nginx)
     367[trac:TracAuthenticationIntroduction] also contains some useful information for beginners.
     369== Granting admin rights to the admin user
     370Grant admin rights to user admin:
     372$ trac-admin /path/to/myproject permission add admin TRAC_ADMIN
     375This user will have an //Admin// navigation item that directs to pages for administering your Trac project.
     377== Configuring Trac
     379TracRepositoryAdmin provides information on configuring version control repositories for your project.
     381== Using Trac
     383Once you have your Trac site up and running, you should be able to create tickets, view the timeline, browse your version control repository if configured, etc.
     385Keep in mind that //anonymous// (not logged in) users can by default access only a few of the features, in particular they will have a read-only access to the resources. You will need to configure authentication and grant additional [TracPermissions permissions] to authenticated users to see the full set of features.
     387'' Enjoy! ''
     389[trac:TracTeam The Trac Team]
     392See also: [trac:TracInstallPlatforms TracInstallPlatforms], TracGuide, TracUpgrade, TracPermissions
  • wiki/pages/TracInterfaceCustomization

    r37566 r37567  
     1= Customizing the Trac Interface
     5== Introduction
     6This page gives suggestions on how to customize the look of Trac. Topics include editing the HTML templates and CSS files, but not the program code itself. The topics show users how they can modify the look of Trac to meet their specific needs. Suggestions for changes to Trac's interface applicable to all users should be filed as tickets, not listed on this page.
     8== Project Logo and Icon
     9The easiest parts of the Trac interface to customize are the logo and the site icon. Both of these can be configured with settings in [wiki:TracIni trac.ini].
     11The logo or icon image should be put in a folder named "htdocs" in your project's environment folder. ''Note: in projects created with a Trac version prior to 0.9 you will need to create this folder''.
     13 '''Note''': you can actually put the logo and icon anywhere on your server (as long as it's accessible through the web server), and use their absolute or server-relative URLs in the configuration.
     15Now configure the appropriate section of your [wiki:TracIni trac.ini]:
     17=== Logo
     18Change the `src` setting to `site/` followed by the name of your image file. The `width` and `height` settings should be modified to match your image's dimensions. The Trac chrome handler uses "`site/`" for files within the project directory `htdocs`, and "`common/`" for the common `htdocs` directory belonging to a Trac installation. Note that 'site/' is not a placeholder for your project name, it is the literal prefix that should be used. For example, if your project is named 'sandbox', and the image file is 'red_logo.gif' then the 'src' setting would be 'site/red_logo.gif', not 'sandbox/red_logo.gif'.
     22src = site/my_logo.gif
     23alt = My Project
     24width = 300
     25height = 100
     28=== Icon
     29Icons are small images displayed by your web browser next to the site's URL and in the `Bookmarks` menu. Icons should be a 32x32 image in `.gif` or `.ico` format. Change the `icon` setting to `site/` followed by the name of your icon file:
     33icon = site/my_icon.ico
     36== Custom Navigation Entries
     37The new [mainnav] and [metanav] can now be used to customize the text and link used for the navigation items, or even to disable them, but not for adding new ones.
     39In the following example, we rename the link to the Wiki start "Home", and hide the "!Help/Guide". We also make the "View Tickets" entry link to a specific report:
     42wiki.label = Home
     43tickets.href = /report/24
     46help = disabled
     49See also TracNavigation for a more detailed explanation of the mainnav and metanav terms.
     51== Site Appearance == #SiteAppearance
     53Trac is using [ Genshi] as the templating engine. Say you want to add a link to a custom stylesheet, and then your own header and footer. Save the following content as `site.html` inside your projects `templates/` directory (each Trac project can have their own `site.html`), eg `/path/to/env/templates/site.html`:
     56<html xmlns=""
     57      xmlns:py=""
     58      py:strip="">
     60  <!--! Add site-specific style sheet -->
     61  <head py:match="head" py:attrs="select('@*')">
     62    ${select('*|comment()|text()')}
     63    <link rel="stylesheet" href="${'site/style.css')}" />
     64  </head>
     66  <body py:match="body" py:attrs="select('@*')">
     67    <!--! Add site-specific header -->
     68    <div id="siteheader">
     69      <!--! Place your header content here... -->
     70    </div>
     72    ${select('*|text()')}
     74    <!--! Add site-specific footer -->
     75    <div id="sitefooter">
     76      <!--! Place your footer content here... -->
     77    </div>
     78  </body>
     82Notice that XSLT bears some similarities with Genshi templates. However, there are some Trac specific features, for example the `${'site/style.css')}` attribute references `style.css` in the environment's `htdocs/` directory. In a similar fashion `${chrome.htdocs_location}` is used to specify the common `htdocs/` directory belonging to a Trac installation. That latter location can however be overriden using the [[TracIni#trac-section|[trac] htdocs_location]] configuration setting.
     84`site.html` is one file to contain all your modifications. It usually works using the `py:match` directive (element or attribute), and it allows you to modify the page as it renders. The matches hook onto specific sections depending on what it tries to find and modify them.
     85See [ this thread] for a detailed explanation of the above example `site.html`.
     86A `site.html` can contain any number of such `py:match` sections for whatever you need to modify. This is all Genshi, so the [ docs on the exact syntax] can be found there.
     88Example snippet of adding introduction text to the new ticket form (but not shown during preview):
     91<form py:match="div[@id='content' and @class='ticket']/form" py:attrs="select('@*')">
     92  <py:if test="req.environ['PATH_INFO'] == '/newticket' and (not 'preview' in req.args)">
     93    <p>Please make sure to search for existing tickets before reporting a new one!</p>
     94  </py:if>
     95  ${select('*')}
     99This example illustrates a technique of using `req.environ['PATH_INFO']` to limit scope of changes to one view only. For instance, to make changes in `site.html` only for timeline and avoid modifying other sections - use  `req.environ['PATH_INFO'] == '/timeline'` condition in `<py:if>` test.
     101More examples snippets for `site.html` can be found at [trac:wiki:CookBook/SiteHtml CookBook/SiteHtml].
     103Example snippets for `style.css` can be found at [trac:wiki:CookBook/SiteStyleCss CookBook/SiteStyleCss].
     105Note that the `site.html`, despite its name, can be put in a shared templates directory, see the [[TracIni#inherit-section|[inherit] templates_dir]] option. This could provide easier maintainence (and a migration path from 0.10 for larger installations) as one new global `site.html` file can be made to include any existing header, footer and newticket snippets.
     107== Project List == #ProjectList
     109You can use a custom Genshi template to display the list of projects if you are using Trac with multiple projects. 
     111The following is the basic template used by Trac to display a list of links to the projects. For projects that could not be loaded, it displays an error message. You can use this as a starting point for your own index template:
     114<!DOCTYPE html
     115    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
     116    "">
     117<html xmlns=""
     118      xmlns:py=""
     119      xmlns:xi="">
     120  <head>
     121    <title>Available Projects</title>
     122  </head>
     123  <body>
     124    <h1>Available Projects</h1>
     125    <ul>
     126      <li py:for="project in projects" py:choose="">
     127        <a py:when="project.href" href="$project.href"
     128           title="$project.description">$</a>
     129        <py:otherwise>
     130          <small>$ <em>Error</em> <br /> ($project.description)</small>
     131        </py:otherwise>
     132      </li>
     133    </ul>
     134  </body>
     138Once you've created your custom template you will need to configure the webserver to tell Trac where the template is located (pls verify ... not yet changed to 0.11):
     140For [wiki:TracModWSGI mod_wsgi]:
     142os.environ['TRAC_ENV_INDEX_TEMPLATE'] = '/path/to/template.html'
     145For [wiki:TracFastCgi FastCGI]:
     147FastCgiConfig -initial-env TRAC_ENV_PARENT_DIR=/parent/dir/of/projects \
     148              -initial-env TRAC_ENV_INDEX_TEMPLATE=/path/to/template
     151For [wiki:TracModPython mod_python]:
     153PythonOption TracEnvParentDir /parent/dir/of/projects
     154PythonOption TracEnvIndexTemplate /path/to/template
     157For [wiki:TracCgi CGI]:
     159SetEnv TRAC_ENV_INDEX_TEMPLATE /path/to/template
     162For [wiki:TracStandalone], you'll need to set up the `TRAC_ENV_INDEX_TEMPLATE` environment variable in the shell used to launch tracd:
     163 - Unix
     164   {{{#!sh
     165$ export TRAC_ENV_INDEX_TEMPLATE=/path/to/template
     166   }}}
     167 - Windows
     168   {{{#!sh
     169$ set TRAC_ENV_INDEX_TEMPLATE=/path/to/template
     170   }}}
     172== Project Templates
     174The appearance of each individual Trac environment, ie instance of a project, can be customized independently of other projects, even those hosted on the same server. The recommended way is to use a `site.html` template (see [#SiteAppearance]) whenever possible. Using `site.html` means changes are made to the original templates as they are rendered, and you should not normally need to redo modifications whenever Trac is upgraded. If you do make a copy of `theme.html` or any other Trac template, you need to migrate your modifiations to the newer version. If not, new Trac features or bug fixes may not work as expected.
     176With that word of caution, any Trac template may be copied and customized. The default Trac templates are located inside the installed Trac egg (`/usr/lib/pythonVERSION/site-packages/Trac-VERSION.egg/trac/templates, .../trac/ticket/templates, .../trac/wiki/templates, ...`). The [#ProjectList] template file is called `index.html`, while the template responsible for main layout is called `theme.html`. Page assets such as images and CSS style sheets are located in the egg's `trac/htdocs` directory.
     178However, do not edit templates or site resources inside the Trac egg. Reinstalling Trac overwrites your modifications. Instead use one of these alternatives:
     179 * For a modification to one project only, copy the template to project `templates` directory.
     180 * For a modification shared by several projects, copy the template to a shared location and have each project point to this location using the `[inherit] templates_dir` trac.ini option.
     182Trac resolves requests for a template by first looking inside the project, then in any inherited templates location, and finally inside the Trac egg.
     184Trac caches templates in memory by default to improve performance. To apply a template you need to restart the web server.
     187See also TracGuide, TracIni
  • wiki/pages/TracLanguages

    r37566 r37567  
     1||=Code=||=Name=||=English name=||=Language title=||
     2||Ar||العربية||Arabic||لغات أخرى||
     3||Ast||asturianu||Asturian||Otres llingües||
     4||Az||azərbaycanca||Azeri||Başqa dillərdə||
     5||Be||беларуская||Belarusian||Іншыя мовы||
     6||Bg||български||Bulgarian||Други езици||
     7||Bn||বাংলা||Bengali||অন্যান্য ভাষাসমূহ||
     8||Bs||bosanski||Bosnian||Drugim jezicima||
     9||Ca||català||Catalan||Altres llengües||
     10||Ca-Valencia||valencià||Valencian||Altres llengües||
     11||Cs||čeština||Czech||Další jazyky||
     12||Da||dansk||Danish||Andre sprog||
     13||de||Deutsch||German||Andere Sprachen||
     14||gr||Ελληνικά||Greek||Άλλες γλώσσες||
     15||en||English||(American) English||Languages||
     16||En_AU||Australian||Australian English||Languages||
     18||Es||español||Spanish||Altres idiomas||
     19||Et||eesti||Estonian||Teistes keeltes||
     20||Eu||euskara||Basque||Beste hizkuntzak||
     21||Fa||فارسی||Persian||زبانهای دیگر||
     22||Fi||suomi||Finnish||Muilla kielillä||
     23||fr||français||French||Autres langues||
     24||Gl||galego||Galician||Outras linguas||
     25||He||עברית||Hebrew||שפות אחרות||
     26||Hi||हिन्दी||Hindi||अन्य भाषाओं||
     27||Hr||hrvatski||Croatian||Drugi jezici||
     28||Hu||magyar||Hungarian||Más nyelveken||
     29||Hy||Հայերեն||Armenian||այլ լեզուներ||
     30||Id||Bahasa Indonesia||Indonesian||Bahasa lain||
     31||Is||Íslenska||Icelandic||Á öðrum tungumálum||
     32||it||italiano||Italian||Altre lingue||
     34||Ka||ქართული||Georgian||სხვა ენებზე||
     35||Ko||한국어||Korean||다른 언어||
     37||Lt||lietuvių||Lithuanian||Kitomis kalbomis||
     38||Lv||latviešu||Latvian||Pārējās valodas||
     39||Mk||македонски||Macedonian||Други јазици||
     40||Nb||norsk bokmål||Norwegian (Bokmal)||Andre språk||
     41||nl||Nederlands||Dutch||Andere talen||
     42||pl||polski||Polish||Inne języki||
     43||Pt||português||Portuguese||Outras línguas||
     44||Pt_BR||português brasileiro||Brazilian Portuguese||Outras línguas||
     45||Ro||Română||Romanian||Alte limbi||
     46||ru||русский||Russian||Другие языки||
     47||Sq||shqip||Albanian||Gjuhët e tjera||
     48||Sk||slovenčina||Slovak||Ďalšie jazyky||
     49||Sl||slovenščina||Slovenian||Drugi jeziki||
     50||Sr||српски||Serbian||Остали језици||
     51||Sv||svenska||Swedish||Andra språk||
     52||Th||ไทย||Thai||ภาษาอื่น ๆ||
     53||Tr||Türkçe||Turkish||Diğer diller||
     54||Uk||українська||Ukrainian||Інші мови||
     55||Uz||ўзбек тили||Uzbek||Boshqa tillarda||
     56||vn||Tiếng Việt||Vietnamese||Ngôn ngữ khác||
     57||Zh_CN||简体中文||Chinese (Simplified)||其他语言||
     58||Zh_TW||正體中文||Chinese (Traditional)||其他語言||
  • wiki/pages/TracLinks

    r37566 r37567  
     1= Trac Links =
     4TracLinks are a fundamental feature of Trac, because they allow easy hyperlinking between the various entities in the system—such as tickets, reports, changesets, Wiki pages, milestones, and source files—from anywhere WikiFormatting is used.
     6TracLinks are generally of the form '''type:id''' (where ''id'' represents the
     7number, name or path of the item) though some frequently used kinds of items
     8also have short-hand notations.
     10== Where to use TracLinks ==
     11You can use TracLinks in:
     13 * Source code (Subversion) commit messages
     14 * Wiki pages
     15 * Full descriptions for tickets, reports and milestones
     17and any other text fields explicitly marked as supporting WikiFormatting.
     19== Overview ==
     21||= Wiki Markup =||= Display =||
     23 Wiki pages :: `CamelCase` or `wiki:CamelCase`
     24 Parent page :: `[..]`
     25 Tickets :: `#1` or `ticket:1`
     26 Ticket comments :: `comment:1:ticket:2`
     27 Reports :: `{1}` or `report:1`
     28 Milestones :: `milestone:1.0`
     29 Attachment :: `attachment:example.tgz` (for current page attachment), `attachment:attachment.1073.diff:ticket:944` (absolute path)
     30 Changesets :: `r1`, `[1]`, `changeset:1` or (restricted) `[1/trunk]`, `changeset:1/trunk`, `[1/repository]`
     31 Revision log :: `r1:3`, `[1:3]` or `log:@1:3`, `log:trunk@1:3`, `[2:5/trunk]`
     32 Diffs :: `diff:@1:3`, `diff:plugins/0.12/mercurial-plugin@9128:9953`,
     33          `diff:tags/trac-0.9.2/wiki-default//tags/trac-0.9.3/wiki-default`
     34          or `diff:trunk/trac@3538//sandbox/vc-refactoring@3539`
     35 Files :: `source:trunk/COPYING`, `source:/trunk/COPYING@200` (at version 200), `source:/trunk/COPYING@200#L25` (at version 200, line 25)
     38 Wiki pages :: CamelCase or wiki:CamelCase
     39 Parent page :: [..]
     40 Tickets :: #1 or ticket:1
     41 Ticket comments :: comment:1:ticket:2
     42 Reports :: {1} or report:1
     43 Milestones :: milestone:1.0
     44 Attachment :: attachment:example.tgz (for current page attachment), attachment:attachment.1073.diff:ticket:944 (absolute path)
     45 Changesets :: r1, [1], changeset:1 or (restricted) [1/trunk], changeset:1/trunk, [1/repository]
     46 Revision log :: r1:3, [1:3] or log:@1:3, log:trunk@1:3, [2:5/trunk]
     47 Diffs :: diff:@1:3, diff:plugins/0.12/mercurial-plugin@9128:9953,
     48          diff:tags/trac-0.9.2/wiki-default//tags/trac-0.9.3/wiki-default
     49          or diff:trunk/trac@3538//sandbox/vc-refactoring@3539
     50 Files :: source:trunk/COPYING, source:/trunk/COPYING@200 (at version 200), source:/trunk/COPYING@200#L25 (at version 200, line 25)
     53'''Note:''' The wiki:CamelCase form is rarely used, but it can be convenient to refer to
     54pages whose names do not follow WikiPageNames rules, i.e., single words,
     55non-alphabetic characters, etc. See WikiPageNames for more about features specific
     56to links to Wiki page names.
     59{{{#!table class=""
     60|||| Trac links using the full (non-shorthand) notation can also be given a custom link title like this: ||
     63[ticket:1 This is a link to ticket number one] or
     64[[ticket:1|This is another link to ticket number one]].
     68[ticket:1 This is a link to ticket number one] or
     69[[ticket:1|This is another link to ticket number one]].
     72|||| If the title is omitted, only the id (the part after the colon) is displayed:  ||
     75[ticket:1] or [[ticket:2]]
     79[ticket:1] or [[ticket:2]]
     82|||| `wiki` is the default if the namespace part of a full link is omitted:  ||
     85[SandBox the sandbox] or
     86[[SandBox|the sandbox]]
     90[SandBox the sandbox] or
     91[[SandBox|the sandbox]]
     94|||| The short form ''realm:target'' can also be wrapped within a <...> pair, [[br]] which allow for arbitrary characters (i.e. anything but >)  ||
     105TracLinks are a very simple idea, but actually allow quite a complex network of information. In practice, it's very intuitive and simple to use, and we've found the "link trail" extremely helpful to better understand what's happening in a project or why a particular change was made.
     108== Advanced use of TracLinks ==
     110=== Relative links ===
     112To create a link to a [trac:SubWiki SubWiki]-page just use a '/':
     114 WikiPage/SubWikiPage or ./SubWikiPage
     117To link from a [trac:SubWiki SubWiki] page to a parent, simply use a '..':
     119  [..] or [[..]]
     121  [..] or [[..]]
     123To link from a [trac:SubWiki SubWiki] page to a [=#sibling sibling] page, use a '../':
     125  [../Sibling see next sibling] or [[../Sibling|see next sibling]]
     127  [../Sibling see next sibling] or [[../Sibling|see next sibling]]
     129But in practice you often won't need to add the `../` prefix to link to a sibling page.
     130For resolving the location of a wiki link, it's the target page closest in the hierarchy
     131to the page where the link is written which will be selected. So for example, within
     132a sub-hierarchy, a sibling page will be targeted in preference to a toplevel page.
     133This makes it easy to copy or move pages to a sub-hierarchy by [[WikiNewPage#renaming|renaming]] without having to adapt the links.
     135In order to link explicitly to a [=#toplevel toplevel] Wiki page,
     136use the `wiki:/` prefix. Be careful **not** to use the `/` prefix alone, as this corresponds to the [#Server-relativelinks] syntax and with such a link you will lack the `/wiki/` part in the resulting URL. A link such as `[../newticket]` will stay in the wiki namespace and therefore link to a sibling page.
     138=== Link anchors ===
     140To create a link to a specific anchor in a page, use '#':
     142 [#Linkanchors Link anchors] or [[#Linkanchors|Link anchors]]
     144  [#Linkanchors Link anchors] or [[#Linkanchors|Link anchors]]
     146Hint: when you move your mouse over the title of a section, a '¶' character will be displayed. This is a link to that specific section and you can use this to copy the `#...` part inside a relative link to an anchor.
     148To create a link to the first or last occurrence of a term on a page, use a ''pseudo anchor'' starting with '#/' or '#?':
     150 [#/Milestone first occurrence of Milestone] or
     151 [#?Milestone last occurrence of Milestone]
     153 [#/Milestone first occurrence of Milestone] or
     154 [#?Milestone last occurrence of Milestone]
     155This will also highlight all other matches on the linked page. By default only case sensitive matches are considered. To include case insensitive matches append '/i':
     157 [#/Milestone/i first occurrence of Milestone or milestone] or
     158 [#?Milestone/i last occurrence of Milestone or milestone]
     160 [#/Milestone/i first occurrence of Milestone or milestone] or
     161 [#?Milestone/i last occurrence of Milestone or milestone]
     163''(since Trac 1.0)''
     165Such anchors can be very useful for linking to specific lines in a file in the source browser:
     167 [trac:source:tags/trac-0.12/trac/wiki/ Line 127] or
     168 [trac:source:tags/trac-0.12/trac/ticket/ Line 47]
     170 [trac:source:tags/trac-0.12/trac/wiki/ Line 127] or
     171 [trac:source:tags/trac-0.12/trac/ticket/ Line 47]
     172(Hint: The line numbers displayed in the source browser are links to anchors on the respective lines.)
     174Since such links become outdated when the file changes, it can be useful to link using a '#/' pseudo anchor instead:
     176 [trac:source:trunk/trac/wiki/ IWikiSyntaxProvider] or
     177 [trac:source:trunk/trac/ ISystemInfoProvider]
     179 [trac:source:trunk/trac/wiki/ IWikiSyntaxProvider] or
     180 [trac:source:trunk/trac/ ISystemInfoProvider]
     182=== InterWiki links ===
     184Other prefixes can be defined freely and made to point to resources in other Web applications. The definition of those prefixes as well as the URLs of the corresponding Web applications is defined in a special Wiki page, the InterMapTxt page. Note that while this could be used to create links to other Trac environments, there's a more specialized way to register other Trac environments which offers greater flexibility.
     186=== InterTrac links ===
     188This can be seen as a kind of InterWiki link specialized for targeting other Trac projects.
     190Any type of Trac link can be written in one Trac environment and actually refer to resources in another Trac environment. All that is required is to prefix the Trac link with the name of the other Trac environment followed by a colon. The other Trac environment must be registered on the InterTrac page.
     192A distinctive advantage of InterTrac links over InterWiki links is that the shorthand form of Trac links (e.g. `{}`, `r`, `#`) can also be used. For example if T was set as an alias for Trac, links to Trac tickets can be written #T234, links to Trac changesets can be written [trac 1508].
     193See InterTrac for the complete details.
     195=== Server-relative links ===
     197It is often useful to be able to link to objects in your project that
     198have no built-in Trac linking mechanism, such as static resources, `newticket`,
     199a shared `/register` page on the server, etc.
     201To link to resources inside the project, use either an absolute path from the project root,
     202or a relative link from the URL of the current page (''Changed in 0.11''):
     205[/newticket Create a new ticket] or [[//newticket|Create a new ticket]]
     206[/ home] or [[/|home]]
     209Display: [/newticket Create a new ticket] or [[//newticket|Create a new ticket]]
     210[/ home] or [[/|home]]
     212To link to another location on the server (possibly outside the project but on the same host), use the `//` prefix (''Changed in 0.11''):
     215[//register Register Here] or [[//register|Register Here]]
     218Display: [//register Register Here] or [[//register|Register Here]]
     220=== Quoting space in TracLinks ===
     222Immediately after a TracLinks prefix, targets containing space characters should
     223be enclosed in a pair of quotes or double quotes.
     225 * !wiki:"The whitespace convention"
     226 * !attachment:'the file.txt' or
     227 * !attachment:"the file.txt"
     228 * !attachment:"the file.txt:ticket:123"
     230Note that by using [trac:WikiCreole] style links, it's quite natural to write links containing spaces:
     231 * ![[The whitespace convention]]
     232 * ![[attachment:the file.txt]]
     234=== Escaping Links ===
     236To prevent parsing of a !TracLink, you can escape it by preceding it with a '!' (exclamation mark).
     238 !NoLinkHere.
     239 ![42] is not a link either.
     243 !NoLinkHere.
     244 ![42] is not a link either.
     247=== Parameterized Trac links ===
     249Many Trac resources have more than one way to be rendered, depending on some extra parameters. For example, a Wiki page can accept a `version` or a `format` parameter, a report can make use of dynamic variables, etc.
     251Trac links can support an arbitrary set of parameters, written in the same way as they would be for the corresponding URL. Some examples:
     252 - `wiki:WikiStart?format=txt`
     253 - `ticket:1?version=1`
     254 - `[/newticket?component=module1 create a ticket for module1]`
     255 - `[/newticket?summary=Add+short+description+here create a ticket with URL with spaces]`
     258== TracLinks Reference ==
     259The following sections describe the individual link types in detail, as well as notes on advanced usage of links.
     261=== attachment: links ===
     263The link syntax for attachments is as follows:
     264 * !attachment:the_file.txt creates a link to the attachment the_file.txt of the current object
     265 * !attachment:the_file.txt:wiki:MyPage creates a link to the attachment the_file.txt of the !MyPage wiki page
     266 * !attachment:the_file.txt:ticket:753 creates a link to the attachment the_file.txt of the ticket 753
     268Note that the older way, putting the filename at the end, is still supported: !attachment:ticket:753:the_file.txt.
     270If you'd like to create a direct link to the content of the attached file instead of a link to the attachment page, simply use `raw-attachment:` instead of `attachment:`.
     272This can be useful for pointing directly to an HTML document, for example. Note that for this use case, you'd have to allow the web browser to render the content by setting `[attachment] render_unsafe_content = yes` (see TracIni#attachment-section). Caveat: only do that in environments for which you're 100% confident you can trust the people who are able to attach files, as otherwise this would open up your site to [wikipedia:Cross-site_scripting cross-site scripting] attacks.
     274See also [#export:links].
     276=== comment: links ===
     278When you're inside a given ticket, you can simply write e.g. !comment:3 to link to the third change comment.
     279It is possible to link to a comment of a specific ticket from anywhere using one of the following syntax:
     280 - `comment:3:ticket:123`
     281 - `ticket:123#comment:3` (note that you can't write `#123#!comment:3`!)
     282It is also possible to link to the ticket's description using one of the following syntax:
     283 - `comment:description` (within the ticket)
     284 - `comment:description:ticket:123`
     285 - `ticket:123#comment:description`
     287=== htdocs: links ===
     289Use `htdocs:path/to/file` to reference files in the `htdocs` directory of the Trac environment, the [TracEnvironment#DirectoryStructure web resource directory].
     291=== query: links ===
     293See TracQuery#UsingTracLinks and [#ticket:links].
     295=== search: links ===
     297See TracSearch#SearchLinks
     299=== ticket: links ===
     300 ''alias:'' `bug:`
     302Besides the obvious `ticket:id` form, it is also possible to specify a list of tickets or even a range of tickets instead of the `id`. This generates a link to a custom query view containing this fixed set of tickets.
     305 - `ticket:5000-6000`
     306 - `ticket:1,150`
     308=== timeline: links ===
     310Links to the timeline can be created by specifying a date in the ISO:8601 format. The date can be optionally followed by a time specification. The time is interpreted as being UTC time, but if you don't want to compute the UTC time, you can specify a local time followed by your timezone offset relative to UTC.
     313 - `timeline:2008-01-29`
     314 - `timeline:2008-01-29T15:48`
     315 - `timeline:2008-01-29T15:48Z`
     316 - `timeline:2008-01-29T16:48+01`
     317 - `timeline:2008-01-29T16:48+0100`
     318 - `timeline:2008-01-29T16:48+01:00`
     320=== wiki: links ===
     322See WikiPageNames and [#QuotingspaceinTracLinks quoting space in TracLinks] above. It is possible to create a link to a specific page revision using the syntax WikiStart@1.
     324=== Version Control related links ===
     326It should be noted that multiple repository support works by creating a kind of virtual namespace for versioned files in which the toplevel folders correspond to the repository names. Therefore, in presence of multiple repositories, a ''/path'' specification in the syntax of links detailed below should start with the name of the repository. If omitted, the default repository is used. In case a toplevel folder of the default repository has the same name as a repository, the latter "wins". One can always access such folder by fully qualifying it (the default repository can be an alias of a named repository, or conversely, it is always possible to create an alias for the default repository, ask your Trac administrator).
     328For example, `source:/trunk/COPYING` targets the path `/trunk/COPYING` in the default repository, whereas `source:/projectA/trunk/COPYING` targets the path `/trunk/COPYING` in the repository named `projectA`. This can be the same file if `'projectA'` is an alias to the default repository or if `''` (the default repository) is an alias to `'projectA'`.
     330==== source: links ====
     331 ''aliases:'' `browser:`, `repos:`
     333The default behavior for a `source:/some/path link` is to open the browser in that directory directory
     334if the path points to a directory or to show the latest content of the file.
     336It's also possible to link directly to a specific revision of a file like this:
     337 - `source:/some/file@123` - link to the file's revision 123
     338 - `source:/some/file@head` - link explicitly to the latest revision of the file
     340If the revision is specified, one can even link to a specific line number:
     341 - `source:/some/file@123#L10`
     342 - `source:/tag/0.10@head#L10`
     344Finally, one can also highlight an arbitrary set of lines:
     345 - `source:/some/file@123:10-20,100,103#L99` - highlight lines 10 to 20, and lines 100 and 103, and target line 99
     346 - or without version number (the `@` is still needed): `source:/some/file@:10-20,100,103#L99`. Version can be omitted when the path is pointing to a source file that will no longer change (like `source:/tags/...`), otherwise it's better to specify which lines of //which version// of the file you're talking about
     348Note that in presence of multiple repositories, the name of the repository is simply integrated in the path you specify for `source:` (e.g. `source:reponame/trunk/README`). ''(since 0.12)''
     350==== export: links ====
     352To force the download of a file in the repository, as opposed to displaying it in the browser, use the `export` link.  Several forms are available:
     353 * `export:/some/file` - get the HEAD revision of the specified file
     354 * `export:123:/some/file` - get revision 123 of the specified file
     355 * `export:/some/file@123` - get revision 123 of the specified file
     357This can be very useful for displaying XML or HTML documentation with correct stylesheets and images, in case that has been checked in into the repository. Note that for this use case, you'd have to allow the web browser to render the content by setting `[browser] render_unsafe_content = yes` (see TracIni#browser-section), otherwise Trac will force the files to be downloaded as attachments for security concerns.
     359If the path is to a directory in the repository instead of a specific file, the source browser will be used to display the directory (identical to the result of `source:/some/dir`).
     361==== log: links ====
     363The `log:` links are used to display revision ranges. In its simplest form, it can link to the latest revisions of the specified path, but it can also support displaying an arbitrary set of revisions.
     364 - `log:/` - the latest revisions starting at the root of the repository
     365 - `log:/trunk/tools` - the latest revisions in `trunk/tools`
     366 - `log:/trunk/tools@10000` - the revisions in `trunk/tools` starting from  revision 10000
     367 - `log:@20788,20791:20795` - list revision 20788 and the revisions from 20791 to 20795
     368 - `log:/trunk/tools@20788,20791:20795` - list revision 20788 and the revisions from 20791 to 20795 which affect the given path
     370There are short forms for revision ranges as well:
     371 - `[20788,20791:20795]`
     372 - `[20788,20791:20795/trunk/tools]`
     373 - `r20791:20795` (but not `r20788,20791:20795` nor `r20791:20795/trunk`)
     375Finally, note that in all of the above, a revision range can be written either as `x:y` or `x-y`.
     377In the presence of multiple repositories, the name of the repository should be specified as the first part of the path, e.g. `log:repos/branches` or `[20-40/repos]`.
     380See also: WikiFormatting, TracWiki, WikiPageNames, InterTrac, InterWiki
  • wiki/pages/TracLogging

    r37566 r37567  
     1= Trac Logging
     4Trac supports logging of system messages using the standard [ logging module] that comes with Python.
     6Logging is configured in the `[logging]` section in [wiki:TracIni#logging-section trac.ini].
     8== Supported Logging Methods
     10The log method is set using the `log_type` option in [wiki:TracIni#logging-section trac.ini], which takes any of the following values:
     12 '''none'':: Suppress all log messages.
     13 '''file''':: Log messages to a file, specified with the `log_file` option in [wiki:TracIni#logging-section trac.ini]. Relative paths in `log_file` are resolved relative to the `log` directory of the environment.
     14 '''stderr''':: Output all log entries to console ([wiki:TracStandalone tracd] only).
     15 '''syslog''':: (UNIX) Send all log messages to the local syslogd via named pipe `/dev/log`. By default, syslog will write them to the file /var/log/messages.
     16 '''eventlog''':: (Windows) Use the system's NT Event Log for Trac logging.
     18== Log Levels
     20The verbosity level of logged messages can be set using the `log_level` option in [wiki:TracIni#logging-section trac.ini]. The log level defines the minimum level of urgency required for a message to be logged, and those levels are:
     22 '''CRITICAL''':: Log only the most critical (typically fatal) errors.
     23 '''ERROR''':: Log failures, bugs and errors.
     24 '''WARN''':: Log warnings, non-interrupting events.
     25 '''INFO''':: Diagnostic information, log information about all processing.
     26 '''DEBUG''':: Trace messages, profiling, etc.
     28Additionally, you can  enable logging of SQL statements at debug level. This is turned off by default, as it's very verbose. Set `[trac] debug_sql = yes` in TracIni to activate.
     30== Log Format
     32The output format for log entries can be specified through the `log_format` option in [wiki:TracIni#logging-section trac.ini]. The format is a string which can contain any of the [ Python logging Formatter variables]. Additonally, the following Trac-specific variables can be used:
     33 '''$(basename)s''':: The last path component of the current environment.
     34 '''$(path)s''':: The absolute path for the current environment.
     35 '''$(project)s''':: The originating project's name.
     37Note that variables are identified using a dollar sign (`$(...)s`) instead of percent sign (`%(...)s`).
     39The default format is:
     41log_format = Trac[$(module)s] $(levelname)s: $(message)s
     44In a multi-project environment where all logs are sent to the same place (e.g. `syslog`), it makes sense to add the project name. In this example we use `basename` since that can generally be used to identify a project:
     46log_format = Trac[$(basename)s:$(module)s] $(levelname)s: $(message)s
     50See also: TracIni, TracGuide, TracEnvironment
  • wiki/pages/TracModPython

    r37566 r37567  
     3= Trac and mod_python
     5Mod_python is an [ Apache] module that embeds the Python interpreter within the server, so that web-based applications in Python will run many times faster than traditional CGI and will have the ability to retain database connections.
     6Trac supports [ mod_python], which speeds up Trac's response times considerably, especially compared to [TracCgi CGI], and permits use of many Apache features not possible with [wiki:TracStandalone tracd]/mod_proxy.
     8These instructions are for Apache 2. If you are using Apache 1.3, you may have some luck with [trac:wiki:TracModPython2.7 TracModPython2.7], but that is a deprecated setup.
     12== Simple configuration: single project == #Simpleconfiguration
     14If you just installed mod_python, you may have to add a line to load the module in the Apache configuration:
     16LoadModule python_module modules/
     19'''Note''': The exact path to the module depends on how the HTTPD installation is laid out.
     21On Debian using apt-get:
     23apt-get install libapache2-mod-python libapache2-mod-python-doc
     26Still on Debian, after you have installed mod_python, you must enable the modules in apache2, equivalent to the above Load Module directive:
     28a2enmod python
     31On Fedora use, using yum:
     33yum install mod_python
     36You can test your mod_python installation by adding the following to your httpd.conf. You should remove this when you are done testing for security reasons. Note: mod_python.testhandler is only available in mod_python 3.2+.
     38<Location /mpinfo>
     39   SetHandler mod_python
     40   PythonInterpreter main_interpreter
     41   PythonHandler mod_python.testhandler
     42   Order allow,deny
     43   Allow from all
     47A simple setup of Trac on mod_python looks like this:
     49<Location /projects/myproject>
     50   SetHandler mod_python
     51   PythonInterpreter main_interpreter
     52   PythonHandler trac.web.modpython_frontend
     53   PythonOption TracEnv /var/trac/myproject
     54   PythonOption TracUriRoot /projects/myproject
     55   Order allow,deny
     56   Allow from all
     60The option '''`TracUriRoot`''' may or may not be necessary in your setup. Try your configuration without it; if the URLs produced by Trac look wrong, if Trac does not seem to recognize URLs correctly, or you get an odd "No handler matched request to..." error, add the '''`TracUriRoot`''' option. You will notice that the `Location` and '''`TracUriRoot`''' have the same path.
     62The options available are:
     64# For a single project
     65PythonOption TracEnv /var/trac/myproject
     67# For multiple projects
     68PythonOption TracEnvParentDir /var/trac/myprojects
     70# For the index of multiple projects
     71PythonOption TracEnvIndexTemplate /srv/www/htdocs/trac/project_list_template.html
     73# A space delimitted list, with a "," between key and value pairs.
     74PythonOption TracTemplateVars key1,val1 key2,val2
     76# Useful to get the date in the wanted order
     77PythonOption TracLocale en_GB.UTF8
     79# See description above       
     80PythonOption TracUriRoot /projects/myproject
     83=== Python Egg Cache
     85Compressed Python eggs like Genshi are normally extracted into a directory named `.python-eggs` in the users home directory. Since Apache's home usually is not writeable, an alternate egg cache directory can be specified like this:
     87PythonOption PYTHON_EGG_CACHE /var/trac/myprojects/egg-cache
     90Or you can uncompress the Genshi egg to resolve problems extracting from it.
     92=== Configuring Authentication
     94See corresponding section in the [wiki:TracModWSGI#ConfiguringAuthentication] page.
     96== Advanced Configuration
     98=== Setting the Python Egg Cache
     100If the Egg Cache isn't writeable by your Web server, you'll either have to change the permissions, or point Python to a location where Apache can write. This can manifest itself as a `500 internal server error` and/or a complaint in the syslog.
     103<Location /projects/myproject>
     104  ...
     105  PythonOption PYTHON_EGG_CACHE /tmp
     106  ...
     110=== Setting the !PythonPath
     112If the Trac installation isn't installed in your Python path, you will have to tell Apache where to find the Trac mod_python handler  using the `PythonPath` directive:
     114<Location /projects/myproject>
     115  ...
     116  PythonPath "sys.path + ['/path/to/trac']"
     117  ...
     121Be careful about using the !PythonPath directive, and ''not'' `SetEnv PYTHONPATH`, as the latter won't work.
     123=== Setting up multiple projects
     125The Trac mod_python handler supports a configuration option similar to Subversion's `SvnParentPath`, called `TracEnvParentDir`:
     127<Location /projects>
     128  SetHandler mod_python
     129  PythonInterpreter main_interpreter
     130  PythonHandler trac.web.modpython_frontend
     131  PythonOption TracEnvParentDir /var/trac
     132  PythonOption TracUriRoot /projects
     136When you request the `/projects` URL, you will get a listing of all subdirectories of the directory you set as `TracEnvParentDir` that look like Trac environment directories. Selecting any project in the list will bring you to the corresponding Trac environment.
     138If you don't want to have the subdirectory listing as your projects home page you can use a
     140<LocationMatch "/.+/">
     143This will instruct Apache to use mod_python for all locations different from root while having the possibility of placing a custom home page for root in your !DocumentRoot folder.
     145You can also use the same authentication realm for all of the projects using a `<LocationMatch>` directive:
     147<LocationMatch "/projects/[^/]+/login">
     148  AuthType Basic
     149  AuthName "Trac"
     150  AuthUserFile /var/trac/.htpasswd
     151  Require valid-user
     155=== Virtual Host Configuration
     157Below is the sample configuration required to set up your Trac as a virtual server, ie when you access it at the URLs like
     161<VirtualHost *>
     162    DocumentRoot /var/www/myproject
     163    ServerName
     164    <Location />
     165        SetHandler mod_python
     166        PythonInterpreter main_interpreter
     167        PythonHandler trac.web.modpython_frontend
     168        PythonOption TracEnv /var/trac/myproject
     169        PythonOption TracUriRoot /
     170    </Location>
     171    <Location /login>
     172        AuthType Basic
     173        AuthName "MyCompany Trac Server"
     174        AuthUserFile /var/trac/myproject/.htpasswd
     175        Require valid-user
     176    </Location>
     180This does not seem to work in all cases. What you can do if it does not:
     181 * Try using `<LocationMatch>` instead of `<Location>`.
     182 * `<Location />` may, in your server setup, refer to the complete host instead of simple the root of the server. This means that everything (including the login directory referenced below) will be sent to Python and authentication does not work, ie you get the infamous Authentication information missing error. If this is the case, try using a sub-directory for Trac instead of the root, ie /web/ and /web/login instead of / and /login.
     183 * Depending on apache's `NameVirtualHost` configuration, you may need to use `<VirtualHost *:80>` instead of `<VirtualHost *>`.
     185For a virtual host that supports multiple projects replace `TracEnv /var/trac/myproject` with `TracEnvParentDir /var/trac`.
     187'''Note''': !DocumentRoot should not point to your Trac project env. As Asmodai wrote on #trac: "suppose there's a webserver bug that allows disclosure of !DocumentRoot they could then leech the entire Trac environment".
     189== Troubleshooting
     191If you get server error pages, you can either check the Apache error log, or enable the `PythonDebug` option:
     193<Location /projects/myproject>
     194  ...
     195  PythonDebug on
     199For multiple projects, try restarting the server as well.
     201=== Login Not Working
     203If you've used `<Location />` directive, it will override any other directives, as well as `<Location /login>`.
     204The workaround is to use negation expression as follows (for multi project setups):
     206#this one for other pages
     207<Location ~ "/*(?!login)">
     208   SetHandler mod_python
     209   PythonHandler trac.web.modpython_frontend
     210   PythonOption TracEnvParentDir /projects
     211   PythonOption TracUriRoot /
     214#this one for login page
     215<Location ~ "/[^/]+/login">
     216   SetHandler mod_python
     217   PythonHandler trac.web.modpython_frontend
     218   PythonOption TracEnvParentDir /projects
     219   PythonOption TracUriRoot /
     221   #remove these if you don't want to force SSL
     222   RewriteEngine On
     223   RewriteCond %{HTTPS} off
     224   RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
     226   AuthType Basic
     227   AuthName "Trac"
     228   AuthUserFile /projects/.htpasswd
     229   Require valid-user
     233=== Expat-related segmentation faults === #expat
     235This problem will most certainly hit you on Unix when using Python 2.4.
     236In Python 2.4, some version of [ Expat] (an XML parser library written in C) is used and if Apache is using another version, this results in segmentation faults.
     237As Trac 0.11 is using Genshi, which will indirectly use Expat, that problem can now hit you even if everything was working fine before with Trac 0.10. This problem has not been reported for Python 2.5+, so best to upgrade.
     239=== Form submission problems
     241If you're experiencing problems submitting some of the forms in Trac (a common problem is that you get redirected to the start page after submission), check whether your {{{DocumentRoot}}} contains a folder or file with the same path that you mapped the mod_python handler to. For some reason, mod_python gets confused when it is mapped to a location that also matches a static resource.
     243=== Problem with virtual host configuration
     245If the <Location /> directive is used, setting the `DocumentRoot` may result in a ''403 (Forbidden)'' error. Either remove the `DocumentRoot` directive, or make sure that accessing the directory it points is allowed, in a corresponding `<Directory>` block.
     247Using <Location /> together with `SetHandler` resulted in having everything handled by mod_python, which leads to not being able to download any CSS or images/icons. Use <Location /trac> `SetHandler None` </Location> to circumvent the problem, though this may not be the most elegant solution.
     249=== Problem with zipped egg
     251It's possible that your version of mod_python will not import modules from zipped eggs. If you encounter an `ImportError: No module named trac` in your Apache logs but you think everything is where it should be, this might be your problem. Look in your site-packages directory; if the Trac module appears as a ''file'' rather than a ''directory'', then this might be your problem. To rectify this, try installing Trac using the `--always-unzip` option:
     254easy_install --always-unzip
     257=== Using .htaccess
     259Although it may seem trivial to rewrite the above configuration as a directory in your document root with a `.htaccess` file, this does not work. Apache will append a "/" to any Trac URLs, which interferes with its correct operation.
     261It may be possible to work around this with mod_rewrite, but I failed to get this working. In all, it is more hassle than it is worth.
     263This also works out-of-box, with following trivial config:
     265SetHandler mod_python
     266PythonInterpreter main_interpreter
     267PythonHandler trac.web.modpython_frontend
     268PythonOption TracEnv /system/path/to/this/directory
     269PythonOption TracUriRoot /path/on/apache
     271AuthType Basic
     272AuthName "ProjectName"
     273AuthUserFile /path/to/.htpasswd
     274Require valid-user
     277The `TracUriRoot` is obviously the path you need to enter to the browser to get to Trac, eg `domain.tld/projects/trac`.
     279=== Additional .htaccess help
     281If you are using the .htaccess method you may have additional problems if your Trac directory is inheriting .htaccess directives from another. This may also help to add to your .htaccess file:
     284<IfModule mod_rewrite.c>
     285  RewriteEngine Off
     289=== Platform specific issues
     290==== Win32 Issues
     292If you run Trac with mod_python < 3.2 on Windows, uploading attachments will '''not''' work. This problem is resolved in mod_python 3.1.4 or later, so please upgrade mod_python to fix this.
     294==== OS X issues
     296When using mod_python on OS X you will not be able to restart Apache using `apachectl restart`. This is apparently fixed in mod_python 3.2, so please upgrade mod_python to fix this.
     298==== SELinux issues
     300If Trac reports something like: `Cannot get shared lock on db.lock`, then the security context on the repository may need to be set:
     303chcon -R -h -t httpd_sys_content_t PATH_TO_REPOSITORY
     306See also [ How do I set repository permissions correctly?]
     308==== FreeBSD issues
     310The FreeBSD ports have both the new and old versions of mod_python and SQLite, but earlier versions of pysqlite and mod_python won't integrate:
     311 * pysqlite requires threaded support in Python
     312 * mod_python requires a threadless install.
     314Apache2 does not automatically support threads on FreeBSD. You could force thread support when running `./configure` for Apache, using `--enable-threads`, but this isn´t recommended.
     315The best option [ seems to be] adding to /usr/local/apache2/bin/ennvars the line:
     318export LD_PRELOAD=/usr/lib/
     321==== Fedora 7 Issues
     323Make sure you install the 'python-sqlite2' package as it seems to be required for TracModPython, but not for tracd.
     325=== Subversion issues
     327If you get the following Trac error `Unsupported version control system "svn"` only under mod_python, though it works well on the command-line and even with TracStandalone, chances are that you forgot to add the path to the Python bindings with the [TracModPython#ConfiguringPythonPath PythonPath] directive. A better way is to add a link to the bindings in the Python `site-packages` directory, or create a `.pth` file in that directory.
     329If this is not the case, it's possible that you are using Subversion libraries that are binary incompatible with the Apache ones and an incompatibility of the `apr` libraries is usually the cause. In that case, you also won't be able to use the svn modules for Apache (`mod_dav_svn`).
     331You also need a recent version of `mod_python` in order to avoid a runtime error ({{{argument number 2: a 'apr_pool_t *' is expected}}}) due to the default usage of multiple sub-interpreters. Version 3.2.8 ''should'' work, though it's probably better to use the workaround described in [trac:#3371 #3371], in order to force the use of the main interpreter:
     333PythonInterpreter main_interpreter
     336This is also the recommended workaround for other issues seen when using the Python bindings for Subversion within mod_python ([trac:#2611 #2611], [trac:#3455 #3455]). See in particular Graham Dumpleton's comment in [trac:comment:9:ticket:3455 #3455] explaining the issue.
     338=== Page layout issues
     340If the formatting of the Trac pages look weird, chances are that the style sheets governing the page layout are not handled properly by the web server. Try adding the following lines to your Apache configuration:
     342Alias /myproject/css "/usr/share/trac/htdocs/css"
     343<Location /myproject/css>
     344    SetHandler None
     348'''Note''': For the above configuration to have any effect it must be put after the configuration of your project root location, ie {{{<Location /myproject />}}}.
     350Also, setting `PythonOptimize On` seems to mess up the page headers and footers, in addition to hiding the documentation for macros and plugins (see #Trac8956). Considering how little effect the option has, leave it `Off`.
     352=== HTTPS issues
     354If you want to run Trac fully under https you might find that it tries to redirect to plain http. In this case just add the following line to your Apache configuration:
     356<VirtualHost *>
     357    DocumentRoot /var/www/myproject
     358    ServerName
     359    SetEnv HTTPS 1
     360    ....
     364=== Segmentation fault with php5-mhash or other php5 modules
     366You may encounter segfaults (reported on Debian etch) if php5-mhash module is installed. Try to remove it to see if this solves the problem. See [ Debian bug report].
     368Some people also have troubles when using PHP5 compiled with its own third party libraries instead of system libraries. Check [ Django segmentation fault].
     371See also: TracGuide, TracInstall, [wiki:TracModWSGI ModWSGI], [wiki:TracFastCgi FastCGI], [trac:TracNginxRecipe]
  • wiki/pages/TracModWSGI

    r37566 r37567  
     1= Trac and mod_wsgi
     3[ mod_wsgi] is an Apache module for running WSGI-compatible Python applications directly on top of the Apache webserver. The mod_wsgi adapter is written completely in C and provides very good performance.
     7== The `trac.wsgi` script
     9Trac can be run on top of mod_wsgi with the help of an application script, which is just a Python file saved with a `.wsgi` extension.
     11A robust and generic version of this file can be created using the `trac-admin <env> deploy <dir>` command which automatically substitutes the required paths, see TracInstall#cgi-bin. The script should be sufficient for most installations and users not wanting more information can proceed to [#Mappingrequeststothescript configuring Apache].
     13If you are using Trac with multiple projects, you can specify their common parent directory using the `TRAC_ENV_PARENT_DIR` in trac.wsgi:
     15def application(environ, start_request):
     16    # Add this to config when you have multiple projects                                             
     17    environ.setdefault('trac.env_parent_dir', '/usr/share/trac/projects') 
     18    ..
     21=== A very basic script
     22In its simplest form, the script could be:
     25import os
     27os.environ['TRAC_ENV'] = '/usr/local/trac/mysite'
     28os.environ['PYTHON_EGG_CACHE'] = '/usr/local/trac/mysite/eggs'
     30import trac.web.main
     31application = trac.web.main.dispatch_request
     34The `TRAC_ENV` variable should naturally be the directory for your Trac environment, and the `PYTHON_EGG_CACHE` should be a directory where Python can temporarily extract Python eggs. If you have several Trac environments in a directory, you can also use `TRAC_ENV_PARENT_DIR` instead of `TRAC_ENV`.
     36On Windows:
     37 - If run under the user's session, the Python Egg cache can be found in `%AppData%\Roaming`, for example:
     39os.environ['PYTHON_EGG_CACHE'] = r'C:\Users\Administrator\AppData\Roaming\Python-Eggs'
     41 - If run under a Window service, you should create a directory for Python Egg cache:
     43os.environ['PYTHON_EGG_CACHE'] = r'C:\Trac-Python-Eggs'
     46=== A more elaborate script
     48If you are using multiple `.wsgi` files (for example one per Trac environment) you must ''not'' use `os.environ['TRAC_ENV']` to set the path to the Trac environment. Using this method may lead to Trac delivering the content of another Trac environment, as the variable may be filled with the path of a previously viewed Trac environment.
     50To solve this problem, use the following `.wsgi` file instead:
     52import os
     54os.environ['PYTHON_EGG_CACHE'] = '/usr/local/trac/mysite/eggs'
     56import trac.web.main
     57def application(environ, start_response):
     58  environ['trac.env_path'] = '/usr/local/trac/mysite'
     59  return trac.web.main.dispatch_request(environ, start_response)
     62For clarity, you should give this file a `.wsgi` extension. You should probably put the file in its own directory, since you will expose it to Apache.
     64If you have installed Trac and Python eggs in a path different from the standard one, you should add that path by adding the following code at the top of the wsgi script:
     67import site
     71Change it according to the path you installed the Trac libs at.
     73== Mapping requests to the script
     75After preparing your .wsgi script, add the following to your Apache configuration file, typically `httpd.conf`:
     78WSGIScriptAlias /trac /usr/local/trac/mysite/apache/mysite.wsgi
     80<Directory /usr/local/trac/mysite/apache>
     81    WSGIApplicationGroup %{GLOBAL}
     82    Order deny,allow
     83    Allow from all
     87Here, the script is in a subdirectory of the Trac environment.
     89If you followed the directions [TracInstall#cgi-bin Generating the Trac cgi-bin directory], your Apache configuration file should look like following:
     92WSGIScriptAlias /trac /usr/share/trac/cgi-bin/trac.wsgi
     94<Directory /usr/share/trac/cgi-bin>
     95    WSGIApplicationGroup %{GLOBAL}
     96    Order deny,allow
     97    Allow from all
     101In order to let Apache run the script, access to the directory in which the script resides is opened up to all of Apache. Additionally, the `WSGIApplicationGroup` directive ensures that Trac is always run in the first Python interpreter created by mod_wsgi. This is necessary because the Subversion Python bindings, which are used by Trac, don't always work in other sub-interpreters and may cause requests to hang or cause Apache to crash. After adding this configuration, restart Apache, and then it should work.
     103To test the setup of Apache, mod_wsgi and Python itself (ie. without involving Trac and dependencies), this simple wsgi application can be used to make sure that requests gets served (use as only content in your `.wsgi` script):
     106def application(environ, start_response):
     107        start_response('200 OK',[('Content-type','text/html')])
     108        return ['<html><body>Hello World!</body></html>']
     111For more information about using the mod_wsgi specific directives, see the [ mod_wsgi's wiki] and more specifically the [ IntegrationWithTrac] page.
     113== Configuring Authentication
     115The following sections describe different methods for setting up authentication. See also [ Authentication, Authorization and Access Control] in the Apache guide.
     117=== Using Basic Authentication
     119The simplest way to enable authentication with Apache is to create a password file. Use the `htpasswd` program as follows:
     121$ htpasswd -c /somewhere/trac.htpasswd admin
     122New password: <type password>
     123Re-type new password: <type password again>
     124Adding password for user admin
     127After the first user, you don't need the "-c" option anymore:
     129$ htpasswd /somewhere/trac.htpasswd john
     130New password: <type password>
     131Re-type new password: <type password again>
     132Adding password for user john
     135  ''See the man page for `htpasswd` for full documentation.''
     137After you've created the users, you can set their permissions using TracPermissions.
     139Now, you need to enable authentication against the password file in the Apache configuration:
     141<Location "/trac/login">
     142  AuthType Basic
     143  AuthName "Trac"
     144  AuthUserFile /somewhere/trac.htpasswd
     145  Require valid-user
     149If you are hosting multiple projects, you can use the same password file for all of them:
     151<LocationMatch "/trac/[^/]+/login">
     152  AuthType Basic
     153  AuthName "Trac"
     154  AuthUserFile /somewhere/trac.htpasswd
     155  Require valid-user
     158Note that neither a file nor a directory named 'login' needs to exist.[[BR]]
     159See also the [ mod_auth_basic] documentation.
     161=== Using Digest Authentication
     163For better security, it is recommended that you either enable SSL or at least use the “digest” authentication scheme instead of “Basic”.
     165You have to create your `.htpasswd` file with the `htdigest` command instead of `htpasswd`, as follows:
     167$ htdigest -c /somewhere/trac.htpasswd trac admin
     170The "trac" parameter above is the "realm", and will have to be reused in the Apache configuration in the !AuthName directive:
     173<Location "/trac/login">
     174  AuthType Digest
     175  AuthName "trac"
     176  AuthDigestDomain /trac
     177  AuthUserFile /somewhere/trac.htpasswd
     178  Require valid-user
     182For multiple environments, you can use the same `LocationMatch` as described with the previous method.
     184'''Note: `Location` cannot be used inside .htaccess files, but must instead live within the main httpd.conf file. If you are on a shared server, you therefore will not be able to provide this level of granularity. '''
     186Don't forget to activate the mod_auth_digest. For example, on a Debian 4.0r1 (etch) system:
     188  LoadModule auth_digest_module /usr/lib/apache2/modules/
     191See also the [ mod_auth_digest] documentation.
     193=== Using LDAP Authentication
     195Configuration for [ mod_ldap] authentication in Apache is more involved (httpd 2.2.x and OpenLDAP: slapd 2.3.19).
     1971. You need to load the following modules in Apache httpd.conf:
     199  LoadModule ldap_module modules/
     200  LoadModule authnz_ldap_module modules/
     2021. Your httpd.conf also needs to look something like:
     204<Location /trac/>
     205  # (if you're using it, mod_python specific settings go here)
     206  Order deny,allow
     207  Deny from all
     208  Allow from
     209  AuthType Basic
     210  AuthName "Trac"
     211  AuthBasicProvider "ldap"
     212  AuthLDAPURL "ldap://,dc=co,dc=ke?uid?sub?(objectClass=inetOrgPerson)"
     213  authzldapauthoritative Off
     214  Require valid-user
     2171. You can use the LDAP interface as a way to authenticate to a Microsoft Active Directory. Use the following as your LDAP URL:
     219  AuthLDAPURL "ldap://,DC=com?sAMAccountName?sub?(objectClass=user)"
     221 You will also need to provide an account for Apache to use when checking credentials. As this password will be listed in plaintext in the config, you need to use an account specifically for this task:
     223  AuthLDAPBindDN
     224  AuthLDAPBindPassword "password"
     226 The whole section looks like:
     228<Location /trac/>
     229  # (if you're using it, mod_python specific settings go here)
     230  Order deny,allow
     231  Deny from all
     232  Allow from
     233  AuthType Basic
     234  AuthName "Trac"
     235  AuthBasicProvider "ldap"
     236  AuthLDAPURL "ldap://,DC=com?sAMAccountName?sub?(objectClass=user)"
     237  AuthLDAPBindDN
     238  AuthLDAPBindPassword "the_password"
     239  authzldapauthoritative Off
     240  # require valid-user
     241  Require ldap-group CN=Trac Users,CN=Users,DC=company,DC=com
     245Note 1: This is the case where the LDAP search will get around the multiple OUs, conecting to the Global Catalog Server portion of AD. Note the port is 3268, not the normal LDAP 389. The GCS is basically a "flattened" tree which allows searching for a user without knowing to which OU they belong.
     247Note 2: You can also require the user be a member of a certain LDAP group, instead of just having a valid login:
     249  Require ldap-group CN=Trac Users,CN=Users,DC=example,DC=com
     252See also:
     253 - [ mod_authnz_ldap], documentation for mod_authnz_ldap.   
     254 - [ mod_ldap], documentation for mod_ldap, which provides connection pooling and a shared cache.
     255 - [ TracHacks:LdapPlugin] for storing TracPermissions in LDAP.
     257=== Using SSPI Authentication
     259If you are using Apache on Windows, you can use mod_auth_sspi to provide single-sign-on. Download the module from the !SourceForge [ mod-auth-sspi project] and then add the following to your !VirtualHost:
     261<Location /trac/login>
     262  AuthType SSPI
     263  AuthName "Trac Login"
     264  SSPIAuth On
     265  SSPIAuthoritative On
     266  SSPIDomain MyLocalDomain
     267  SSPIOfferBasic On
     268  SSPIOmitDomain Off
     269  SSPIBasicPreferred On
     270  Require valid-user
     274Using the above, usernames in Trac will be of the form `DOMAIN\username`, so you may have to re-add permissions and such. If you do not want the domain to be part of the username, set `SSPIOmitDomain On` instead.
     276Some common problems with SSPI authentication: [trac:#1055], [trac:#1168] and [trac:#3338].
     278See also [trac:TracOnWindows/Advanced].
     280=== Using Apache authentication with the Account Manager plugin's Login form ===
     282To begin with, see the basic instructions for using the Account Manager plugin's [ Login module] and its [ HttpAuthStore authentication module].
     284'''Note:''' If is difficult to get !HttpAuthStore to work with WSGI when using any Account Manager version prior to acct_mgr-0.4. Upgrading is recommended.
     286Here is an example (from the !HttpAuthStore link) using acct_mgr-0.4 for hosting a single project:
     289; be sure to enable the component
     290acct_mgr.http.HttpAuthStore = enabled
     293; configure the plugin to use a page that is secured with http authentication
     294authentication_url = /authFile
     295password_store = HttpAuthStore
     297This will generally be matched with an Apache config like:
     299<Location /authFile>
     300   …HTTP authentication configuration…
     301   Require valid-user
     304Note that '''authFile''' need not exist (unless you are using Account Manager older than 0.4). See the !HttpAuthStore link above for examples where multiple Trac projects are hosted on a server.
     306=== Example: Apache/mod_wsgi with Basic Authentication, Trac being at the root of a virtual host
     308Per the mod_wsgi documentation linked to above, here is an example Apache configuration that:
     309 - serves the Trac instance from a virtualhost subdomain
     310 - uses Apache basic authentication for Trac authentication.
     312If you want your Trac to be served from e.g. !, then from the folder e.g. `/home/trac-for-my-proj`, if you used the command `trac-admin the-env initenv` to create a folder `the-env`, and you used `trac-admin the-env deploy the-deploy` to create a folder `the-deploy`, then first:
     314Create the htpasswd file:
     316cd /home/trac-for-my-proj/the-env
     317htpasswd -c htpasswd firstuser
     318### and add more users to it as needed:
     319htpasswd htpasswd seconduser
     321Keep the file above your document root for security reasons.
     323Create this file e.g. (ubuntu) `/etc/apache2/sites-enabled/` with the following content:
     326<Directory /home/trac-for-my-proj/the-deploy/cgi-bin/trac.wsgi>
     327  WSGIApplicationGroup %{GLOBAL}
     328  Order deny,allow
     329  Allow from all
     332<VirtualHost *:80>
     333  ServerName
     334  DocumentRoot /home/trac-for-my-proj/the-env/htdocs/
     335  WSGIScriptAlias / /home/trac-for-my-proj/the-deploy/cgi-bin/trac.wsgi
     336  <Location '/'>
     337    AuthType Basic
     338    AuthName "Trac"
     339    AuthUserFile /home/trac-for-my-proj/the-env/htpasswd
     340    Require valid-user
     341  </Location>
     346Note: for subdomains to work you would probably also need to alter `/etc/hosts` and add A-Records to your host's DNS.
     348== Troubleshooting
     350=== Use a recent version
     352Please use either version 1.6, 2.4 or later of `mod_wsgi`. Versions prior to 2.4 in the 2.X branch have problems with some Apache configurations that use WSGI file wrapper extension. This extension is used in Trac to serve up attachments and static media files such as style sheets. If you are affected by this problem, attachments will appear to be empty and formatting of HTML pages will appear not to work due to style sheet files not loading properly. Another frequent symptom is that binary attachment downloads are truncated. See mod_wsgi tickets [ #100] and [ #132].
     354''Note: using mod_wsgi 2.5 and Python 2.6.1 gave an Internal Server Error on my system (Apache 2.2.11 and Trac Upgrading to Python 2.6.2 (as suggested [ here]) solved this for me[[BR]]-- Graham Shanks''
     356If you plan to use `mod_wsgi` in embedded mode on Windows or with the MPM worker on Linux, then you will need version 3.4 or greater. See [trac:#10675] for details.
     358=== Getting Trac to work nicely with SSPI and 'Require Group'
     360If you have set Trac up on Apache, Win32 and configured SSPI, but added a 'Require group' option to your apache configuration, then the SSPIOmitDomain option is probably not working. If it is not working, your usernames in Trac probably look like 'DOMAIN\user' rather than 'user'.
     362This WSGI script 'fixes' that:
     364import os
     365import trac.web.main
     367os.environ['TRAC_ENV'] = '/usr/local/trac/mysite'
     368os.environ['PYTHON_EGG_CACHE'] = '/usr/local/trac/mysite/eggs'
     370def application(environ, start_response):
     371    if "\\" in environ['REMOTE_USER']:
     372        environ['REMOTE_USER'] = environ['REMOTE_USER'].split("\\", 1)[1]
     373    return trac.web.main.dispatch_request(environ, start_response)
     376=== Trac with PostgreSQL
     378When using the mod_wsgi adapter with multiple Trac instances and PostgreSQL (or MySQL?) as the database, the server ''may'' create a lot of open database connections and thus PostgreSQL processes.
     380A somewhat brutal workaround is to disable connection pooling in Trac. This is done by setting `poolable = False` in `trac.db.postgres_backend` on the `PostgreSQLConnection` class.
     382But it is not necessary to edit the source of Trac. The following lines in `trac.wsgi` will also work:
     385import trac.db.postgres_backend
     386trac.db.postgres_backend.PostgreSQLConnection.poolable = False
     392import trac.db.mysql_backend
     393trac.db.mysql_backend.MySQLConnection.poolable = False
     396Now Trac drops the connection after serving a page and the connection count on the database will be kept low.
     398//This is not a recommended approach though. See also the notes at the bottom of the [ mod_wsgi's IntegrationWithTrac] wiki page.//
     400=== Other resources
     402For more troubleshooting tips, see also the [TracModPython#Troubleshooting mod_python troubleshooting] section, as most Apache-related issues are quite similar, plus discussion of potential [ application issues] when using mod_wsgi. The wsgi page also has a [ Integration With Trac] document.
     405See also: TracGuide, TracInstall, [wiki:TracFastCgi FastCGI], [wiki:TracModPython ModPython], [trac:TracNginxRecipe TracNginxRecipe]
  • wiki/pages/TracNavigation

    r37566 r37567  
     1= Trac Navigation
     3The main and meta navigation entries can be customized in some basic ways. The `[mainnav]` and `[metanav]` configuration sections can be used to customize the navigation item text and link, change the ordering of the navigation items, or even disable them.
     5=== `[mainnav]` #mainnav-bar
     6`[mainnav]` corresponds to the '''main navigation bar''', the one containing entries such as ''Wiki'', ''Timeline'', ''Roadmap'', ''Browse Source'' and so on. This navigation bar is meant to access the default page of the main modules enabled in Trac that are accessible for the current user.
     9** [=#Example Example] **
     11In the following example we rename the link to WikiStart //Home//, and make the //View Tickets// entry link to a specific report.
     14wiki.label = Home
     15tickets.href = /report/24
     18=== `[metanav]` #metanav-bar
     19`[metanav]` corresponds to the '''meta navigation bar''', by default positioned above the main navigation bar and below the ''Search'' box. It contains the ''Login'', ''Logout'', ''!Help/Guide'' etc. entries. This navigation bar is meant to access some global information about the Trac project and the current user.
     21There is one special entry in the  `[metanav]` section: `logout.redirect` is the page the user sees after hitting the logout button.  The ''!Help/Guide'' link is also hidden in the following example.
     22[[comment(see also #Trac3808)]]
     24** Example **
     28help = disabled
     29logout.redirect = wiki/Logout
     33=== URL Formats
     34Possible URL formats for `.href` or `.redirect`:
     35|| '''config''' || '''redirect to''' ||
     36|| `wiki/Logout` || `/projects/env/wiki/Logout` ||
     37|| `http://hostname/` || `http://hostname/` ||
     38|| `/projects` || `/projects` ||
     41=== Ordering #nav-order
     42The `order` attribute specifies the order in which the navigation items are displayed. This can be particularly useful for plugins that add navigation items.
     44Non-negative floating point values may be used for the `order` attribute. The navigation items will be arranged from left to right in increasing order. Navigation items without an `order` attribute are sorted alphabetically by name.
     46The default values are:
     49browser.order = 4
     50newticket.order = 6
     51roadmap.order = 3
     52search.order = 7
     53tickets.order = 5
     54timeline.order = 2
     55wiki.order = 1
     58about.order = 5
     59help.order = 4
     60login.order = 1
     61logout.order = 2
     62prefs.order = 3
     65=== Context Navigation #ctxtnav-bar
     67Note that it is still not possible to customize the '''contextual navigation bar''', ie the one usually placed below the main navigation bar.
     70See also: TracInterfaceCustomization, and the [ TracHacks:NavAddPlugin] or [ TracHacks:MenusPlugin] (still needed for adding entries)
  • wiki/pages/TracNotification

    r37566 r37567  
     1= Email Notification of Ticket Changes
     4Trac supports notification of ticket changes via email.
     6Email notification is useful to keep users up-to-date on tickets/issues of interest, and also provides a convenient way to post all ticket changes to a dedicated mailing list. For example, this is how the [ Trac-tickets] mailing list is set up.
     8Disabled by default, notification can be activated and configured in [wiki:TracIni trac.ini].
     10== Receiving Notification Mails
     11When reporting a new ticket or adding a comment, enter a valid email address or your Trac username in the ''reporter'', ''assigned to/owner'' or ''cc'' field. Trac will automatically send you an email when changes are made to the ticket, depending on how notification is configured.
     13=== How to use your username to receive notification mails
     15To receive notification mails, you can either enter a full email address or your Trac username. To get notified with a simple username or login, you need to specify a valid email address in the ''Preferences'' page.
     17Alternatively, a default domain name ('''`smtp_default_domain`''') can be set in the TracIni file, see [#ConfigurationOptions Configuration Options] below. In this case, the default domain will be appended to the username, which can be useful for an "Intranet" kind of installation.
     19When using apache and mod_kerb for authentication against Kerberos / Active Directory, usernames take the form ('''`username@EXAMPLE.LOCAL`'''). To avoid this being interpreted as an email address, add the Kerberos domain to  ('''`ignore_domains`''').
     21=== Ticket attachment notifications
     23Since 1.0.3 Trac will send notifications when a ticket attachment is added or deleted. Usually attachment notifications will be enabled in an environment by default. To disable the attachment notifications for an environment the `TicketAttachmentNotifier` component must be disabled:
     26trac.ticket.notification.TicketAttachmentNotifier = disabled
     29== Configuring SMTP Notification
     31'''Important:''' For TracNotification to work correctly, the `[trac] base_url` option must be set in [wiki:TracIni trac.ini].
     33=== Configuration Options
     34These are the available options for the `[notification]` section in trac.ini:
     38=== Example Configuration (SMTP)
     41smtp_enabled = true
     42smtp_server =
     43smtp_from =
     44smtp_replyto =
     45smtp_always_cc =,
     48=== Example Configuration (`sendmail`)
     51smtp_enabled = true
     52email_sender = SendmailEmailSender
     53sendmail_path = /usr/sbin/sendmail
     54smtp_from =
     55smtp_replyto =
     56smtp_always_cc =,
     59=== Subscriber Configuration
     60The default subscriptions are configured in the `[notification-subscriber]` section in trac.ini:
     64Each user can override these defaults in his ''Notifications'' preferences.
     66For example to unsubscribe from notifications for one's own changes and comments, the rule "Never notify: I update a ticket" should be added above other subscription rules.
     68=== Customizing the e-mail subject
     69The e-mail subject can be customized with the `ticket_subject_template` option, which contains a [ Genshi text template] snippet. The default value is:
     71$prefix #$ $summary
     73The following variables are available in the template:
     75 * `env`: The project environment (see [trac:source:/trunk/trac/]).
     76 * `prefix`: The prefix defined in `smtp_subject_prefix`.
     77 * `summary`: The ticket summary, with the old value if the summary was edited.
     78 * `ticket`: The ticket model object (see [trac:source:/trunk/trac/ticket/]). Individual ticket fields can be addressed by appending the field name separated by a dot, eg `$ticket.milestone`.
     80=== Customizing the e-mail content
     82The notification e-mail content is generated based on `ticket_notify_email.txt` in `trac/ticket/templates`. You can add your own version of this template by adding a `ticket_notify_email.txt` to the templates directory of your environment. The default looks like this:
     87{% choose %}\
     88{%   when True %}\
     90{%   end %}\
     91{%   otherwise %}\
     92{%     if changes_body %}\
     93${_('Changes (by %(author)s):',}
     96{%     end %}\
     97{%     if changes_descr %}\
     98{%       if not changes_body and not change.comment and %}\
     99${_('Description changed by %(author)s:',}
     100{%       end %}\
     103{%     end %}\
     104{%     if change.comment %}\
     106${changes_body and _('Comment:') or _('Comment (by %(author)s):',}
     109{%     end %}\
     110{%   end %}\
     111{% end %}\
     114${_('Ticket URL: <%(link)s>',}
     115$ <${project.url or abs_href()}>
     119== Sample Email
     121#42: testing
     123       Id:  42             |      Status:  assigned               
     124Component:  report system  |    Modified:  Fri Apr  9 00:04:31 2004
     125 Severity:  major          |   Milestone:  0.9                     
     126 Priority:  lowest         |     Version:  0.6                     
     127    Owner:  anonymous      |    Reporter:               
     130  * component:  changeset view => search system
     131  * priority:  low => highest
     132  * owner:  jonas => anonymous
     133  * cc: =>
     135  * status:  new => assigned
     138I'm interested too!
     141Ticket URL: <>
     142My Project <>
     145== Customizing e-mail content for MS Outlook
     147MS Outlook normally presents plain text e-mails with a variable-width font, and as a result the ticket properties table will most certainly look like a mess in MS Outlook. This can be fixed with some customization of the [#Customizingthee-mailcontent e-mail template].
     149Replace the following second row in the template:
     154with this (requires Python 2.6 or later):
     157{% with
     158   pv = [(a[0].strip(), a[1].strip()) for a in [b.split(':') for b in
     159         [c.strip() for c in
     160          ticket_props.replace('|', '\n').splitlines()[1:-1]] if ':' in b]];
     161   sel = ['Reporter', 'Owner', 'Type', 'Status', 'Priority', 'Milestone',
     162          'Component', 'Severity', 'Resolution', 'Keywords'] %}\
     163${'\n'.join('%s\t%s' % (format(p[0]+':', ' <12'), p[1]) for p in pv if p[0] in sel)}
     164{% end %}\
     168The table of ticket properties is replaced with a list of a selection of the properties. A tab character separates the name and value in such a way that most people should find this more pleasing than the default table when using MS Outlook.
     169{{{#!div style="margin: 1em 1.75em; border:1px dotted"
     171#42: testing<br />
     172--------------------------------------------------------------------------<br />
     173<table cellpadding=0>
     180<tr><td>Component:</td><td>report system</td></tr>
     182<tr><td>Resolution:</td><td> </td></tr>
     183<tr><td>Keywords:</td><td> </td></tr>
     185--------------------------------------------------------------------------<br />
     186Changes:<br />
     187<br />
     188&nbsp;&nbsp;* component: &nbsp;changeset view =&gt; search system<br />
     189&nbsp;&nbsp;* priority: &nbsp;low =&gt; highest<br />
     190&nbsp;&nbsp;* owner: &nbsp;jonas =&gt; anonymous<br />
     191&nbsp;&nbsp;* cc: &nbsp; =&gt;<br />
     192&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;,<br />
     193&nbsp;&nbsp;* status: &nbsp;new =&gt; assigned<br />
     194<br />
     195Comment:<br />
     196I'm interested too!<br />
     197<br />
     198--<br />
     199Ticket URL: &lt;;<br />
     200My Project &lt;;<br />
     204**Important**: Only those ticket fields that are listed in `sel` are part of the HTML mail. If you have defined custom ticket fields which are to be part of the mail, then they have to be added to `sel`. Example:
     206   sel = ['Reporter', ..., 'Keywords', 'Custom1', 'Custom2']
     209However, the solution is still a workaround to an automatically HTML-formatted e-mail.
     211== Using GMail as the SMTP relay host
     213Use the following configuration snippet:
     216smtp_enabled = true
     217use_tls = true
     218mime_encoding = base64
     219smtp_server =
     220smtp_port = 587
     221smtp_user = user
     222smtp_password = password
     225where ''user'' and ''password'' match an existing GMail account, ie the ones you use to log in on [].
     227Alternatively, you can use `smtp_port = 25`.[[br]]
     228You should not use `smtp_port = 465`. Doing so may deadlock your ticket submission. Port 465 is reserved for the SMTPS protocol, which is not supported by Trac. See [trac:comment:2:ticket:7107 #7107] for details.
     230== Troubleshooting
     232If you cannot get the notification working, first make sure the log is activated and have a look at the log to find if an error message has been logged. See TracLogging for help about the log feature.
     234Notification errors are not reported through the web interface, so the user who submits a change or a new ticket never gets notified about a notification failure. The Trac administrator needs to look at the log to find the error trace.
     236=== ''Permission denied'' error
     238Typical error message:
     240  ...
     241  File ".../", line 303, in connect
     242    raise socket.error, msg
     243  error: (13, 'Permission denied')
     246This error usually comes from a security settings on the server: many Linux distributions do not allow the web server (Apache, ...) to post email messages to the local SMTP server.
     248Many users get confused when their manual attempts to contact the SMTP server succeed:
     250telnet localhost 25
     252This is because a regular user may connect to the SMTP server, but the web server cannot:
     254sudo -u www-data telnet localhost 25
     257In such a case, you need to configure your server so that the web server is authorized to post to the SMTP server. The actual settings depend on your Linux distribution and current security policy. You may find help in the Trac [trac:MailingList MailingList] archive.
     259Relevant ML threads:
     260 * SELinux:
     262For SELinux in Fedora 10:
     264$ setsebool -P httpd_can_sendmail 1
     267=== ''Suspected spam'' error
     269Some SMTP servers may reject the notification email sent by Trac.
     271The default Trac configuration uses Base64 encoding to send emails to the recipients. The whole body of the email is encoded, which sometimes trigger ''false positive'' spam detection on sensitive email servers. In such an event, change the default encoding to "quoted-printable" using the `mime_encoding` option.
     273Quoted printable encoding works better with languages that use one of the Latin charsets. For Asian charsets, stick with the Base64 encoding.
     276See also: TracTickets, TracIni, TracGuide, [trac:TracDev/NotificationApi]
  • wiki/pages/TracPermissions

    r37566 r37567  
     1= Trac Permissions
     4Trac uses a simple, case sensitive, permission system to control what users can and can't access.
     6Permission privileges are managed using the [TracAdmin trac-admin] tool or the ''General / Permissions'' panel in the ''Admin'' tab of the web interface.
     8In addition to the default permission policy described in this page, it is possible to activate additional permission policies by enabling plugins and listing them in the `[trac] permission_policies` configuration entry in the TracIni. See TracFineGrainedPermissions for more details.
     10Non-authenticated users accessing the system are assigned the name "anonymous". Assign permissions to the "anonymous" user to set privileges for anonymous/guest users. The parts of Trac that a user does not have the privileges for will not be displayed in the navigation.
     11In addition to these privileges, users can be granted additional individual rights in effect when authenticated and logged into the system. All logged in users belong to the virtual group "authenticated", which inherits permissions from "anonymous".
     13== Graphical Admin Tab
     15To access this tab, a user must have one of the following permissions: `TRAC_ADMIN`, `PERMISSION_ADMIN`, `PERMISSION_GRANT`, `PERMISSION_REVOKE`. The permissions can be granted using the `trac-admin` command (more on `trac-admin` below):
     17  $ trac-admin /path/to/projenv permission add bob TRAC_ADMIN
     20Then, the user `bob` will be able to see the Admin tab, and can then access the permissions menu. This menu will allow you to perform all the following actions, but from the browser without requiring root access to the server (just the correct permissions for your user account). '''Use at least one lowercase character in user names, as all-uppercase names are reserved for permissions.'''
     22 1. [[Image(htdocs:../common/guide/admin.png)]]
     23 1. [[Image(htdocs:../common/guide/admin-permissions.png)]]
     24 1. [[Image(htdocs:../common/guide/admin-permissions-TICKET_ADMIN.png)]]
     26An easy way to quickly secure a new Trac install is to run the above command on the anonymous user, install the [ AccountManagerPlugin], create a new admin account graphically and then remove the TRAC_ADMIN permission from the anonymous user.
     28From the graphical admin tab, users with `PERMISSION_GRANT` will only be allowed to grant permissions that they possess, and users with `PERMISSION_REVOKE` will only be allowed to revoke permissions that they possess. For example, a user cannot grant `MILESTONE_ADMIN` unless they have `PERMISSION_GRANT` and `MILESTONE_ADMIN`, and they cannot revoke `MILESTONE_ADMIN` unless they have `PERMISSION_REVOKE` and `MILESTONE_ADMIN`. `PERMISSION_ADMIN` just grants the user both `PERMISSION_GRANT` and `PERMISSION_REVOKE`, and users with `TRAC_ADMIN` can grant or revoke any permission.
     30== Available Privileges
     32To enable all privileges for a user, use the `TRAC_ADMIN` permission. Having `TRAC_ADMIN` is like being `root` on a *NIX system: it will allow you to perform any operation.
     34Otherwise, individual privileges can be assigned to users for the various different functional areas of Trac ('''note that the privilege names are case-sensitive'''):
     36=== Repository Browser
     38|| `BROWSER_VIEW` || View directory listings in the [wiki:TracBrowser repository browser] ||
     39|| `LOG_VIEW` || View revision logs of files and directories in the [wiki:TracBrowser repository browser] ||
     40|| `FILE_VIEW` || View files in the [wiki:TracBrowser repository browser] ||
     41|| `CHANGESET_VIEW` || View [wiki:TracChangeset repository check-ins] ||
     43=== Ticket System
     45|| `TICKET_VIEW` || View existing [wiki:TracTickets tickets] and perform [wiki:TracQuery ticket queries] ||
     46|| `TICKET_CREATE` || Create new [wiki:TracTickets tickets] ||
     47|| `TICKET_APPEND` || Add comments or attachments to [wiki:TracTickets tickets] ||
     48|| `TICKET_CHGPROP` || Modify [wiki:TracTickets ticket] properties (priority, assignment, keywords, etc.) with the following exceptions: edit description field, add/remove other users from cc field when logged in, and set email to pref ||
     49|| `TICKET_MODIFY` || Includes both `TICKET_APPEND` and `TICKET_CHGPROP`, and in addition allows resolving [wiki:TracTickets tickets]. Tickets can be assigned to users through a [TracTickets#Assign-toasDrop-DownList drop-down list] when the list of possible owners has been restricted. ||
     50|| `TICKET_EDIT_CC` || Full modify cc field ||
     51|| `TICKET_EDIT_DESCRIPTION` || Modify description field ||
     52|| `TICKET_EDIT_COMMENT` || Modify another user's comments. Any user can modify their own comments by default. ||
     53|| `TICKET_BATCH_MODIFY` || [wiki:TracBatchModify Batch modify] tickets ||
     54|| `TICKET_ADMIN` || All `TICKET_*` permissions, deletion of ticket attachments and modification of the reporter field, which grants ability to create a ticket on behalf of another user (it will appear that another user created the ticket). It also allows managing ticket properties through the web administration module. ||
     56Attention: the "view tickets" button appears with the `REPORT_VIEW` permission.
     58=== Roadmap
     60|| `MILESTONE_VIEW` || View milestones and assign tickets to milestones. ||
     61|| `MILESTONE_CREATE` || Create a new milestone ||
     62|| `MILESTONE_MODIFY` || Modify existing milestones ||
     63|| `MILESTONE_DELETE` || Delete milestones ||
     64|| `MILESTONE_ADMIN` || All `MILESTONE_*` permissions ||
     65|| `ROADMAP_VIEW` || View the [wiki:TracRoadmap roadmap] page, is not (yet) the same as MILESTONE_VIEW, see [trac:#4292 #4292] ||
     66|| `ROADMAP_ADMIN` || to be removed with [trac:#3022 #3022], replaced by MILESTONE_ADMIN ||
     68=== Reports
     70|| `REPORT_VIEW` || View [wiki:TracReports reports], i.e. the "view tickets" link. ||
     71|| `REPORT_SQL_VIEW` || View the underlying SQL query of a [wiki:TracReports report] ||
     72|| `REPORT_CREATE` || Create new [wiki:TracReports reports] ||
     73|| `REPORT_MODIFY` || Modify existing [wiki:TracReports reports] ||
     74|| `REPORT_DELETE` || Delete [wiki:TracReports reports] ||
     75|| `REPORT_ADMIN` || All `REPORT_*` permissions ||
     77=== Wiki System
     79|| `WIKI_VIEW` || View existing [wiki:TracWiki wiki] pages ||
     80|| `WIKI_CREATE` || Create new [wiki:TracWiki wiki] pages ||
     81|| `WIKI_MODIFY` || Change [wiki:TracWiki wiki] pages ||
     82|| `WIKI_RENAME` || Rename [wiki:TracWiki wiki] pages ||
     83|| `WIKI_DELETE` || Delete [wiki:TracWiki wiki] pages and attachments ||
     84|| `WIKI_ADMIN` || All `WIKI_*` permissions, plus the management of ''readonly'' pages. ||
     86=== Permissions
     88|| `PERMISSION_GRANT` || add/grant a permission ||
     89|| `PERMISSION_REVOKE` || remove/revoke a permission ||
     90|| `PERMISSION_ADMIN` || All `PERMISSION_*` permissions ||
     92=== Others
     94|| `TIMELINE_VIEW` || View the [wiki:TracTimeline timeline] page ||
     95|| `SEARCH_VIEW` || View and execute [wiki:TracSearch search] queries ||
     96|| `CONFIG_VIEW` || Enables additional pages on ''About Trac'' that show the current configuration or the list of installed plugins ||
     97|| `EMAIL_VIEW` || Shows email addresses even if [wiki:TracIni#trac-section trac show_email_addresses] configuration option is false ||
     99== Creating New Privileges
     101To create custom permissions, for example to be used in a custom workflow, enable the optional [trac:ExtraPermissionsProvider tracopt.perm.config_perm_provider.ExtraPermissionsProvider] component in the "Plugins" admin panel, and add the desired permissions to the `[extra-permissions]` section in your [wiki:TracIni#extra-permissions-section trac.ini]. For more information, please refer to the documentation  on the [wiki:TracIni#extra-permissions-section TracIni] page after enabling the component.
     103== Granting Privileges
     105You grant privileges to users using [wiki:TracAdmin trac-admin]. The current set of privileges can be listed with the following command:
     107  $ trac-admin /path/to/projenv permission list
     110This command will allow the user ''bob'' to delete reports:
     112  $ trac-admin /path/to/projenv permission add bob REPORT_DELETE
     115The `permission add` command also accepts multiple privilege names:
     117  $ trac-admin /path/to/projenv permission add bob REPORT_DELETE WIKI_CREATE
     120Or add all privileges:
     122  $ trac-admin /path/to/projenv permission add bob TRAC_ADMIN
     125== Permission Groups
     127There are two built-in groups, "authenticated" and "anonymous".
     128Any user who has not logged in is automatically in the "anonymous" group.
     129Any user who has logged in is also in the "authenticated" group.
     130The "authenticated" group inherits permissions from the "anonymous" group.
     131For example, if the "anonymous" group has permission WIKI_MODIFY,
     132it is not necessary to add the WIKI_MODIFY permission to the "authenticated" group as well.
     134Custom groups may be defined that inherit permissions from the two built-in groups.
     136Permissions can be grouped together to form roles such as ''developer'', ''admin'', etc.
     138  $ trac-admin /path/to/projenv permission add developer WIKI_ADMIN
     139  $ trac-admin /path/to/projenv permission add developer REPORT_ADMIN
     140  $ trac-admin /path/to/projenv permission add developer TICKET_MODIFY
     141  $ trac-admin /path/to/projenv permission add bob developer
     142  $ trac-admin /path/to/projenv permission add john developer
     145Group membership can be checked by doing a {{{permission list}}} with no further arguments; the resulting output will include group memberships. '''Use at least one lowercase character in group names, as all-uppercase names are reserved for permissions'''.
     147== Adding a New Group and Permissions
     148Permission groups can be created by assigning a user to a group you wish to create, then assign permissions to that group.
     150The following will add ''bob'' to the new group called ''beta_testers'' and then will assign WIKI_ADMIN permissions to that group. (Thus, ''bob'' will inherit the WIKI_ADMIN permission)
     152   $ trac-admin /path/to/projenv permission add bob beta_testers
     153   $ trac-admin /path/to/projenv permission add beta_testers WIKI_ADMIN
     157== Removing Permissions
     159Permissions can be removed using the 'remove' command. For example:
     161This command will prevent the user ''bob'' from deleting reports:
     163  $ trac-admin /path/to/projenv permission remove bob REPORT_DELETE
     166Just like `permission add`, this command accepts multiple privilege names.
     168You can also remove all privileges for a specific user:
     170  $ trac-admin /path/to/projenv permission remove bob '*'
     173Or one privilege for all users:
     175  $ trac-admin /path/to/projenv permission remove '*' REPORT_ADMIN
     178== Default Permissions
     180By default on a new Trac installation, the `anonymous` user will have ''view'' access to everything in Trac, but will not be able to create or modify anything.
     181On the other hand, the `authenticated` users will have the permissions to ''create and modify tickets and wiki pages''.
     187 FILE_VIEW
     188 LOG_VIEW
     191 REPORT_VIEW
     193 SEARCH_VIEW
     194 TICKET_VIEW
     196 WIKI_VIEW
     203 WIKI_CREATE
     204 WIKI_MODIFY 
     207See also: TracAdmin, TracGuide and TracFineGrainedPermissions
  • wiki/pages/TracPlugins

    r37566 r37567  
     3= Trac plugins
     5Trac is extensible with [trac:PluginList plugins]. Plugin functionality is based on the [trac:TracDev/ComponentArchitecture component architecture], with special cases described in the [trac:TracDev/PluginDevelopment plugin development] page.
     7== Plugin discovery
     9From the user's point of view, a plugin is either a standalone .py file or an .egg package. Trac looks for plugins in Python's `site-packages` directory, the [TracIni#GlobalConfiguration global shared] `plugins` directory and the [TracEnvironment project environment] `plugins` directory. Components defined in globally-installed plugins must be explicitly enabled in the [[TracIni#components-section| [components] ]] section of the `trac.ini` file. Components defined in the `plugins` directory of the project environment are enabled, unless explicitly disabled in the `[components]` section of the `trac.ini` file.
     11== Requirements for Trac eggs
     13To use egg-based plugins in Trac, you need to have [ setuptools] (version >= 0.6) installed.
     15To install `setuptools`, download the bootstrap module [] and execute it as follows:
     18$ python
     21If the `` script fails to install the setuptools release, you can download it from [pypi:setuptools PyPI] and install it manually.
     23Plugins can also consist of a single `.py` file dropped directly into either the project's or the shared `plugins` directory.
     25== Installing a Trac plugin
     27=== For a single project
     29Plugins are typically packaged as [ Python eggs]. That means they are .zip archives with the file extension `.egg`.
     31If you have downloaded a source distribution of a plugin, and want to build the `.egg` file:
     33 * Unpack the source. It should provide ``.
     34 * Run:
     35 {{{#!sh
     36$ python bdist_egg
     39You should now have an *.egg file. Examine the output of running Python to find where this was created.
     41Once you have the plugin archive, copy it into the `plugins` directory of the [wiki:TracEnvironment project environment]. Also, make sure that the web server has sufficient permissions to read the plugin egg. Then restart the web server. If you are running as a [wiki:TracStandalone "tracd" standalone server], restart tracd, ie kill the process and run again.
     43To uninstall a plugin installed this way, remove the egg from the `plugins` directory and restart the web server.
     45'''Note''': the Python version that the egg is built with ''must'' match the Python version with which Trac is run. For example, if you are running Trac under Python 2.6, but have upgraded your standalone Python to 2.7, the eggs won't be recognized.
     47'''Note''': in a multi-project setup, a pool of Python interpreter instances will be dynamically allocated to projects based on need; since plugins occupy a place in Python's module system, the first version of any given plugin to be loaded will be used for all projects. In other words, you cannot use different versions of a single plugin in two projects of a multi-project setup. It may be safer to install plugins for all projects (see below), and then enable them selectively on a project-by-project basis.
     49=== For all projects
     51==== With an .egg file
     53Some plugins, such as [trac:SpamFilter SpamFilter], are downloadable as an `.egg` file that can be installed with `easy_install` or `pip`:
     55$ easy_install TracSpamFilter
     56$ pip install TracSpamFilter
     59If `easy_install` is not on your system, see the Requirements section above to install it. Windows users will need to add the `Scripts` directory of their Python installation (for example, `C:\Python27\Scripts`) to their `PATH` environment variable, or use the full path to `easy_install` (for example, `C:\Python27\Scripts\`). See [ easy_install Windows notes] for more information.
     61`pip` is included in Python 2.7.9. In earlier versions of Python it can be installed through the package manager of your OS (e.g. `apt-get install python-pip`) or using the [].
     63If Trac reports permission errors after installing a zipped egg, and you would rather not bother providing an egg cache directory writable by the web server, you can get around it by simply unzipping the egg. Just pass `--always-unzip` to `easy_install`:
     65$ easy_install --always-unzip TracSpamFilter-0.4.1_r10106-py2.6.egg
     67You should end up with a directory having the same name as the zipped egg, complete with `.egg` extension, and containing its uncompressed contents.
     69Trac also searches for plugins installed in the shared plugins directory, see TracIni#GlobalConfiguration. This is a convenient way to share the installation of plugins across several, but not all, environments.
     71==== From source
     73`easy_install` makes installing from source a snap. Just give it the URL to either a Subversion repository or a tarball/zip of the source:
     75$ easy_install
     78==== Enabling the plugin
     80Unlike plugins installed per environment, you'll have to explicitly enable globally installed plugins via [wiki:TracIni trac.ini]. This also applies to plugins installed in the shared plugins directory, ie the path specified in the `[inherit] plugins_dir` configuration option.
     82This is done in the `[components]` section of the configuration file `trac.ini`. For example:
     85tracspamfilter.* = enabled
     88The name of the option is the Python package of the plugin. This should be specified in the documentation of the plugin, but can also be easily discovered by looking at the source: look for a top-level directory that contains a file named ``.
     90After installing the plugin, you must restart your web server.
     92==== Uninstalling
     94Neither `easy_install` nor `python` have an uninstall feature. However, it is usually trivial to remove a globally installed egg and reference:
     96 1. Do `easy_install -m [plugin name]` to remove references from `$PYTHONLIB/site-packages/easy-install.pth` when the plugin installed by setuptools.
     97 1. Delete executables from `/usr/bin`, `/usr/local/bin`, or `C:\\Python*\Scripts`. To find what executables are involved, refer to the `[console-script]` section of ``.
     98 1. Delete the .egg file or folder from where it's installed, usually inside `$PYTHONLIB/site-packages/`.
     99 1. Restart the web server.
     101If you are uncertain about the location of the egg file, you can try to locate it by replacing `myplugin` with whatever namespace the plugin uses (as used when enabling the plugin):
     103>>> import myplugin
     104>>> print myplugin.__file__
     108== Setting up the plugin cache
     110Some plugins will need to be extracted by the Python egg's runtime (`pkg_resources`), so that their contents are actual files on the file system. The directory in which they are extracted defaults to `.python-eggs` in the home directory of the current user, which may or may not be a problem. You can, however, override the default location using the `PYTHON_EGG_CACHE` environment variable.
     112To do this from the Apache configuration, use the `SetEnv` directive:
     114SetEnv PYTHON_EGG_CACHE /path/to/dir
     117This works whether you're using the [wiki:TracCgi CGI] or the [wiki:TracModPython mod_python] front-end. Put this directive next to where you set the path to the [wiki:TracEnvironment Trac environment], ie in the same `<Location>` block.
     119For example for CGI:
     121 <Location /trac>
     122   SetEnv TRAC_ENV /path/to/projenv
     123   SetEnv PYTHON_EGG_CACHE /path/to/dir
     124 </Location>
     127Or for mod_python:
     129 <Location /trac>
     130   SetHandler mod_python
     131   ...
     132   SetEnv PYTHON_EGG_CACHE /path/to/dir
     133 </Location>
     136'''Note''': !SetEnv requires the `mod_env` module, which needs to be activated for Apache. In this case the !SetEnv directive can also be used in the `mod_python` Location block.
     138For [wiki:TracFastCgi FastCGI], you'll need to `-initial-env` option, or whatever is provided by your web server for setting environment variables.
     140'''Note''': if you already use -initial-env to set the project directory for either a single project or parent, you will need to add an additional -initial-env directive to the !FastCgiConfig directive:
     143FastCgiConfig -initial-env TRAC_ENV=/var/lib/trac -initial-env PYTHON_EGG_CACHE=/var/lib/trac/plugin-cache
     146=== About hook scripts
     148If you have set up some Subversion hook scripts that call the Trac engine, such as the post-commit hook script provided in the `/contrib` directory, make sure you define the `PYTHON_EGG_CACHE` environment variable within these scripts as well.
     150== Web-based plugin administration
     152The [trac:WebAdmin] interface offers limited support for plugin configuration through the web to users with `TRAC_ADMIN` permission:
     154* en/disabling installed plugins
     155* installing plugins by uploading them as eggs
     157If you wish to disable the second function for security reasons, add the following to your `trac.ini` file:
     160trac.admin.web_ui.PluginAdminPanel = disabled
     162This disables the whole panel, so the first function will no longer be available either.
     164== Troubleshooting
     166=== Is setuptools properly installed?
     168Try this from the command line:
     170$ python -c "import pkg_resources"
     173If you get '''no output''', setuptools '''is''' installed. Otherwise, you'll need to install it before plugins will work in Trac.
     175=== Did you get the correct version of the Python egg?
     177Python eggs have the Python version encoded in their filename. For example, `MyPlugin-1.0-py2.5.egg` is an egg for Python 2.5, and will '''not''' be loaded if you're running a different Python version (such as 2.4 or 2.6).
     179Also, verify that the egg file you downloaded is indeed a .zip archive. If you downloaded it from a Trac site, chances are you downloaded the HTML preview page instead.
     181=== Is the plugin enabled?
     183If you install a plugin globally, ie ''not'' inside the `plugins` directory of the Trac project environment, you must explicitly enable it in [TracIni trac.ini]. Make sure that:
     185 * you actually added the necessary line(s) to the `[components]` section.
     186 * the package/module names are correct and do not contain typos.
     187 * the value is "enabled", not "enable" or "Enable".
     188 * the section name is "components", not "component".
     190=== Check the permissions on the .egg file
     192Trac must be able to read the .egg file.
     194=== Check the log files
     196Enable [wiki:TracLogging logging] and set the log level to `DEBUG`, then watch the log file for messages about loading plugins.
     198=== Verify you have the proper permissions
     200Some plugins require you have special permissions in order to use them. [trac:WebAdmin WebAdmin], for example, requires the user to have `TRAC_ADMIN` permissions for it to show up on the navigation bar.
     202=== Is the wrong version of the plugin loading?
     204If you put your plugins inside plugins directories, and certainly if you have more than one project, you need to make sure that the correct version of the plugin is loading. Here are some basic rules:
     206 * Only one version of the plugin can be loaded for each running Trac server, ie each Python process. The Python namespaces and module list will be shared, and it cannot handle duplicates. Whether a plugin is `enabled` or `disabled` makes no difference.
     207 * A globally installed plugin (typically ` install`) will override any version in the global or project plugins directories. A plugin from the global plugins directory will be located ''before'' any project plugins directory.
     208 * If your Trac server hosts more than one project (as with `TRAC_ENV_PARENT_DIR` setups), having two versions of a plugin in two different projects will give unpredicatable results. Only one of them will load, and the one loaded will be shared by both projects. Trac will load the first plugin found, usually from the project that receives the first request.
     209 * Having more than one version listed inside Python site-packages is fine, ie installed with ` install`, because setuptools will make sure you get the version installed most recently. However, don't store more than one version inside a global or project plugins directory: neither the version number nor the installed date will matter at all. There is no way to determine which one will be located first when Trac searches the directory for plugins.
     211=== If all of the above failed
     213Okay, so the logs don't mention plugins, the egg is readable, the Python version is correct, ''and'' the egg has been installed globally (and is enabled in trac.ini)... and it ''still'' doesn't work or give any error messages or any other indication as to why. Hop on the [trac:IrcChannel IrcChannel] and ask away!
     216See also TracGuide, [trac:PluginList plugin list], [trac:TracDev/ComponentArchitecture component architecture].
  • wiki/pages/TracQuery

    r37566 r37567  
     1= Trac Ticket Queries
     4In addition to [wiki:TracReports reports], Trac provides support for ''custom ticket queries'', which can be used to display tickets that meet specified criteria.
     6To configure and execute a custom query, switch to the ''View Tickets'' module from the navigation bar, and select the ''Custom Query'' link.
     8== Filters
     10When you first go to the query page, the default filter will display tickets relevant to you:
     11 * If logged in then all open tickets, it will display open tickets assigned to you.
     12 * If not logged in but you have specified a name or email address in the preferences, then it will display all open tickets where your email (or name if email not defined) is in the CC list.
     13 * If not logged in and no name/email is defined in the preferences, then all open issues are displayed.
     15Current filters can be removed by clicking the button to the left with the minus sign on the label. New filters are added from the pulldown lists at the bottom corners of the filters box; 'And' conditions on the left, 'Or' conditions on the right.  Filters with either a text box or a pulldown menu of options can be added multiple times to perform an ''Or'' on the criteria.
     17You can use the fields just below the filters box to group the results based on a field, or display the full description for each ticket.
     19After you have edited your filters, click the ''Update'' button to refresh your results.
     21== Navigating Tickets
     23Clicking on one of the query results will take you to that ticket. You can navigate through the results by clicking the ''Next Ticket'' or ''Previous Ticket'' links just below the main menu bar, or click the ''Back to Query'' link to return to the query page. 
     25You can safely edit any of the tickets and continue to navigate through the results using the ''!Next/Previous/Back to Query'' links after saving your results. When you return to the query ''any tickets which were edited'' will be displayed with italicized text. If one of the tickets was edited such that [[html(<span style="color: grey">it no longer matches the query criteria </span>)]], the text will also be greyed. Lastly, if '''a new ticket matching the query criteria has been created''', it will be shown in bold.
     27The query results can be refreshed and cleared of these status indicators by clicking the ''Update'' button again.
     29== Saving Queries
     31Trac allows you to save the query as a named query accessible from the reports module. To save a query ensure that you have ''Updated'' the view and then click the ''Save query'' button displayed beneath the results.
     32You can also save references to queries in Wiki content, as described below.
     34'''Note:''' one way to easily build queries like the ones below, you can build and test the queries in the Custom report module and when ready - click ''Save query''. This will build the query string for you. All you need to do is remove the extra line breaks.
     36'''Note:''' you must have the '''REPORT_CREATE''' permission in order to save queries to the list of default reports. The ''Save query'' button will only appear if you are logged in as a user that has been granted this permission. If your account does not have permission to create reports, you can still use the methods below to save a query.
     38=== Using TracLinks
     40You may want to save some queries so that you can come back to them later. You can do this by making a link to the query from any Wiki page.
     42[query:status=new|assigned|reopened&version=1.0 Active tickets against 1.0]
     45Which is displayed as:
     46  [query:status=new|assigned|reopened&version=1.0 Active tickets against 1.0]
     48This uses a very simple query language to specify the criteria, see [wiki:TracQuery#QueryLanguage Query Language].
     50Alternatively, you can copy the query string of a query and paste that into the Wiki link, including the leading `?` character:
     52[query:?status=new&status=assigned&status=reopened&group=owner Assigned tickets by owner]
     55Which is displayed as:
     56  [query:?status=new&status=assigned&status=reopened&group=owner Assigned tickets by owner]
     58=== Customizing the ''table'' format
     60You can also customize the columns displayed in the table format (''format=table'') by using ''col=<field>''. You can specify multiple fields and what order they are displayed in by placing pipes (`|`) between the columns:
     65This is displayed as:
     68==== Full rows
     70In ''table'' format you can also have full rows by using ''rows=<field>'':
     75This is displayed as:
     78== Query Language
     80`query:` TracLinks and the `[[TicketQuery]]` macro both use a mini “query language” for specifying query filters. Filters are separated by ampersands (`&`). Each filter consists of the ticket field name, an operator and one or more values. More than one value are separated by a pipe (`|`), meaning that the filter matches any of the values. To include a literal `&` or `|` in a value, escape the character with a backslash (`\`).
     82The available operators are:
     83|| '''`=`''' || the field content exactly matches one of the values ||
     84|| '''`~=`''' || the field content contains one or more of the values ||
     85|| '''`^=`''' || the field content starts with one of the values ||
     86|| '''`$=`''' || the field content ends with one of the values ||
     88All of these operators can also be negated:
     89|| '''`!=`''' || the field content matches none of the values ||
     90|| '''`!~=`''' || the field content does not contain any of the values ||
     91|| '''`!^=`''' || the field content does not start with any of the values ||
     92|| '''`!$=`''' || the field content does not end with any of the values ||
     94The date fields `created` and `modified` can be constrained by using the `=` operator and specifying a value containing two dates separated by two dots (`..`). Either end of the date range can be left empty, meaning that the corresponding end of the range is open. The date parser understands a few natural date specifications like "3 weeks ago", "last month" and "now", as well as Bugzilla-style date specifications like "1d", "2w", "3m" or "4y" for 1 day, 2 weeks, 3 months and 4 years, respectively. Spaces in date specifications can be omitted to avoid having to quote the query string.
     95|| '''`created=2007-01-01..2008-01-01`''' || query tickets created in 2007 ||
     96|| '''`created=lastmonth..thismonth`''' || query tickets created during the previous month ||
     97|| '''`modified=1weekago..`''' || query tickets that have been modified in the last week ||
     98|| '''`modified=..30daysago`''' || query tickets that have been inactive for the last 30 days ||
     101See also: TracTickets, TracReports, TracGuide, TicketQuery
  • wiki/pages/TracReports

    r37566 r37567  
     1= Trac Reports =
     4The Trac reports module provides a simple, yet powerful reporting facility
     5to present information about tickets in the Trac database.
     7Rather than have its own report definition format, TracReports relies on standard SQL
     8`SELECT` statements for custom report definition.
     10  '''Note:''' ''The report module is being phased out in its current form because it seriously limits the ability of the Trac team to make adjustments to the underlying database schema. We believe that the [wiki:TracQuery query module] is a good replacement that provides more flexibility and better usability. While there are certain reports that cannot yet be handled by the query module, we intend to further enhance it so that at some point the reports module can be completely removed. This also means that there will be no major enhancements to the report module anymore.''
     12  ''You can already completely replace the reports module by the query module simply by disabling the former in [wiki:TracIni trac.ini]:''
     13  {{{
     14  [components]
     15* = disabled
     16  }}}
     17  ''This will make the query module the default handler for the “View Tickets” navigation item. We encourage you to try this configuration and report back what kind of features of reports you are missing, if any.''
     19A report consists of these basic parts:
     20 * '''ID''' — Unique (sequential) identifier
     21 * '''Title''' — Descriptive title
     22 * '''Description''' — A brief description of the report, in WikiFormatting text.
     23 * '''Report Body''' — List of results from report query, formatted according to the methods described below.
     24 * '''Footer''' — Links to alternative download formats for this report.
     26== Changing Sort Order ==
     27Simple reports - ungrouped reports to be specific - can be changed to be sorted by any column simply by clicking the column header.
     29If a column header is a hyperlink (red), click the column you would like to sort by. Clicking the same header again reverses the order.
     31== Changing Report Numbering ==
     32There may be instances where you need to change the ID of the report, perhaps to organize the reports better. At present this requires changes to the trac database. The ''report'' table has the following schema:
     33 * id integer PRIMARY KEY
     34 * author text
     35 * title text
     36 * query text
     37 * description text
     38Changing the ID changes the shown order and number in the ''Available Reports'' list and the report's perma-link. This is done by running something like:
     40update report set id=5 where id=3;
     42Keep in mind that the integrity has to be maintained (i.e., ID has to be unique, and you don't want to exceed the max, since that's managed by SQLite someplace).
     44You may also need to update or remove the report number stored in the report or query.
     46== Navigating Tickets ==
     47Clicking on one of the report results will take you to that ticket. You can navigate through the results by clicking the ''Next Ticket'' or ''Previous Ticket'' links just below the main menu bar, or click the ''Back to Report'' link to return to the report page.
     49You can safely edit any of the tickets and continue to navigate through the results using the ''!Next/Previous/Back to Report'' links after saving your results, but when you return to the report, there will be no hint about what has changed, as would happen if you were navigating a list of tickets obtained from a query (see TracQuery#NavigatingTickets).
     51== Alternative Download Formats ==
     52Aside from the default HTML view, reports can also be exported in a number of alternative formats.
     53At the bottom of the report page, you will find a list of available data formats. Click the desired link to
     54download the alternative report format.
     56=== Comma-delimited - CSV (Comma Separated Values) ===
     57Export the report as plain text, each row on its own line, columns separated by a single comma (',').
     58'''Note:''' The output is fully escaped so carriage returns, line feeds, and commas will be preserved in the output.
     60=== Tab-delimited ===
     61Like above, but uses tabs (\t) instead of comma.
     63=== RSS - XML Content Syndication ===
     64All reports support syndication using XML/RSS 2.0. To subscribe to an RSS feed, click the orange 'XML' icon at the bottom of the page. See TracRss for general information on RSS support in Trac.
     68== Creating Custom Reports ==
     70''Creating a custom report requires a comfortable knowledge of SQL.''
     72'''Note that you need to set up [TracPermissions#Reports permissions] in order to see the buttons for adding or editing reports.'''
     74A report is basically a single named SQL query, executed and presented by
     75Trac.  Reports can be viewed and created from a custom SQL expression directly
     76in the web interface.
     78Typically, a report consists of a SELECT-expression from the 'ticket' table,
     79using the available columns and sorting the way you want it.
     81== Ticket columns ==
     82The ''ticket'' table has the following columns:
     83 * id
     84 * type
     85 * time
     86 * changetime
     87 * component
     88 * severity 
     89 * priority
     90 * owner
     91 * reporter
     92 * cc
     93 * version
     94 * milestone
     95 * status
     96 * resolution
     97 * summary
     98 * description
     99 * keywords
     101See TracTickets for a detailed description of the column fields.
     103Example: '''All active tickets, sorted by priority and time'''
     105SELECT id AS ticket, status, severity, priority, owner,
     106       time AS created, summary FROM ticket
     107  WHERE status IN ('new', 'assigned', 'reopened')
     108  ORDER BY priority, time
     111Dynamic variables can also be used in the report title and description (since 1.1.1).
     113== Advanced Reports: Dynamic Variables ==
     114For more flexible reports, Trac supports the use of ''dynamic variables'' in report SQL statements.
     115In short, dynamic variables are ''special'' strings that are replaced by custom data before query execution.
     117=== Using Variables in a Query ===
     118The syntax for dynamic variables is simple, any upper case word beginning with '$' is considered a variable.
     122SELECT id AS ticket,summary FROM ticket WHERE priority=$PRIORITY
     125To assign a value to $PRIORITY when viewing the report, you must define it as an argument in the report URL, leaving out the leading '$'.
     132To use multiple variables, separate them with an '&'.
     140=== !Special/Constant Variables ===
     141There is one dynamic variable whose value is set automatically (the URL does not have to be changed) to allow practical reports.
     143 * $USER — Username of logged in user.
     145Example (''List all tickets assigned to me''):
     147SELECT id AS ticket,summary FROM ticket WHERE owner=$USER
     152== Advanced Reports: Custom Formatting ==
     153Trac is also capable of more advanced reports, including custom layouts,
     154result grouping and user-defined CSS styles. To create such reports, we'll use
     155specialized SQL statements to control the output of the Trac report engine.
     157=== Special Columns ===
     158To format reports, TracReports looks for 'magic' column names in the query
     159result. These 'magic' names are processed and affect the layout and style of the
     160final report.
     162=== Automatically formatted columns ===
     163 * '''ticket''' — Ticket ID number. Becomes a hyperlink to that ticket.
     164 * '''id''' — same as '''ticket''' above when '''realm''' is not set
     165 * '''realm''' — together with '''id''', can be used to create links to other resources than tickets (e.g. a realm of ''wiki'' and an ''id'' to a page name will create a link to that wiki page)
     166   - for some kind of resources, it may be necessary to specify their ''parent'' resources (e.g. for ''changeset'', which ''repos'') and this can be achieved using the '''parent_realm''' and '''parent_id''' columns
     167 * '''created, modified, date, time''' — Format cell as a date and/or time.
     168 * '''description''' — Ticket description field, parsed through the wiki engine.
     172SELECT id AS ticket, created, status, summary FROM ticket
     175Those columns can also be defined but marked as hidden, see [#column-syntax below].
     177See trac:wiki/CookBook/Configuration/Reports for some example of creating reports for realms other than ''ticket''.
     179=== Custom formatting columns ===
     180Columns whose names begin and end with 2 underscores (Example: '''`__color__`''') are
     181assumed to be ''formatting hints'', affecting the appearance of the row.
     183 * '''`__group__`''' — Group results based on values in this column. Each group will have its own header and table.
     184 * '''`__grouplink__`''' — Make the header of each group a link to the specified URL. The URL is taken from the first row of each group.
     185 * '''`__color__`''' — Should be a numeric value ranging from 1 to 5 to select a pre-defined row color. Typically used to color rows by issue priority.
     188<div style="margin-left:7.5em">Defaults:
     189<span style="border: none; color: #333; background: transparent;  font-size: 85%; background: #fdc; border-color: #e88; color: #a22">Color 1</span>
     190<span style="border: none; color: #333; background: transparent;  font-size: 85%; background: #ffb; border-color: #eea; color: #880">Color 2</span>
     191<span style="border: none; color: #333; background: transparent;  font-size: 85%; background: #fbfbfb; border-color: #ddd; color: #444">Color 3</span>
     192<span style="border: none; color: #333; background: transparent; font-size: 85%; background: #e7ffff; border-color: #cee; color: #099">Color 4</span>
     193<span style="border: none; color: #333; background: transparent;  font-size: 85%; background: #e7eeff; border-color: #cde; color: #469">Color 5</span>
     196 * '''`__style__`''' — A custom CSS style expression to use on the `<tr>` element of the current row.
     197 * '''`__class__`''' — Zero or more space-separated CSS class names to be set on the `<tr>` element of the current row. These classes are added to the class name derived from `__color__` and the odd / even indicator.
     199'''Example:''' ''List active tickets, grouped by milestone, group header linked to milestone page, colored by priority''
     201SELECT p.value AS __color__,
     202     t.milestone AS __group__,
     203     '../milestone/' || t.milestone AS __grouplink__,
     204     (CASE owner WHEN 'daniel' THEN 'font-weight: bold; background: red;' ELSE '' END) AS __style__,
     205 AS ticket, summary
     206  FROM ticket t,enum p
     207  WHERE t.status IN ('new', 'assigned', 'reopened')
     208    AND AND p.type='priority'
     209  ORDER BY t.milestone, p.value, t.severity, t.time
     212'''Note:''' A table join is used to match ''ticket'' priorities with their
     213numeric representation from the ''enum'' table.
     215=== Changing layout of report rows === #column-syntax
     216By default, all columns on each row are display on a single row in the HTML
     217report, possibly formatted according to the descriptions above. However, it's
     218also possible to create multi-line report entries.
     220 * '''`column_`''' — ''Break row after this''. By appending an underscore ('_') to the column name, the remaining columns will be continued on a second line.
     222 * '''`_column_`''' — ''Full row''. By adding an underscore ('_') both at the beginning and the end of a column name, the data will be shown on a separate row.
     224 * '''`_column`''' — ''Hide data''. Prepending an underscore ('_') to a column name instructs Trac to hide the contents from the HTML output. This is useful for information to be visible only if downloaded in other formats (like CSV or RSS/XML).
     225   This can be used to hide any kind of column, even important ones required for identifying the resource, e.g. `id as _id` will hide the '''Id''' column but the link to the ticket will be present.
     227'''Example:''' ''List active tickets, grouped by milestone, colored by priority, with  description and multi-line layout''
     230SELECT p.value AS __color__,
     231       t.milestone AS __group__,
     232       (CASE owner
     233          WHEN 'daniel' THEN 'font-weight: bold; background: red;'
     234          ELSE '' END) AS __style__,
     235 AS ticket, summary AS summary_,             -- ## Break line here
     236       component,version, severity, milestone, status, owner,
     237       time AS created, changetime AS modified,         -- ## Dates are formatted
     238       description AS _description_,                    -- ## Uses a full row
     239       changetime AS _changetime, reporter AS _reporter -- ## Hidden from HTML output
     240  FROM ticket t,enum p
     241  WHERE t.status IN ('new', 'assigned', 'reopened')
     242    AND AND p.type='priority'
     243  ORDER BY t.milestone, p.value, t.severity, t.time
     246=== Reporting on custom fields ===
     248If you have added custom fields to your tickets (see TracTicketsCustomFields), you can write a SQL query to cover them. You'll need to make a join on the ticket_custom table, but this isn't especially easy.
     250If you have tickets in the database ''before'' you declare the extra fields in trac.ini, there will be no associated data in the ticket_custom table. To get around this, use SQL's "LEFT OUTER JOIN" clauses. See [trac:TracIniReportCustomFieldSample TracIniReportCustomFieldSample] for some examples.
     252=== A note about SQL rewriting #rewriting
     254Beyond the relatively trivial replacement of dynamic variables, the SQL query is also altered in order to support two features of the reports:
     255 1. [#sort-order changing the sort order]
     256 2. pagination support (limitation of the number of result rows displayed on each page)
     257In order to support the first feature, the sort column is inserted in the `ORDER BY` clause in the first position or in the second position if a `__group__` column is specified (an `ORDER BY` clause is created if needed). In order to support pagination, a `LIMIT ... OFFSET ...` clause is appended.
     258The query might be too complex for the automatic rewrite to work correctly, resulting in an erroneous query. In this case you still have the possibility to control exactly how the rewrite is done by manually inserting the following tokens:
     259 - `@SORT_COLUMN@`, the place where the name of the selected sort column will be inserted,
     260 - `@LIMIT_OFFSET@`, the place where the pagination support clause will be added
     261Note that if you write them after an SQL comment, `--`, you'll effectively disable rewriting if this is what you want!
     263Let's take an example, consider the following SQL query:
     265-- ## 4: Assigned, Active Tickets by Owner ## --
     268-- List assigned tickets, group by ticket owner, sorted by priority.
     271SELECT p.value AS __color__,
     272   owner AS __group__,
     273   id AS ticket, summary, component, milestone, t.type AS type, severity, time AS created,
     274   changetime AS _changetime, description AS _description,
     275   reporter AS _reporter
     276  FROM ticket t,enum p
     277  WHERE status = 'assigned'
     278AND AND p.type='priority'
     279  ORDER BY __group__, p.value, severity, time
     282The automatic rewrite will be the following (4 rows per page, page 2, sorted by `component`):
     284SELECT p.value AS __color__,
     285   owner AS __group__,
     286   id AS ticket, summary, component, milestone, t.type AS type, severity, time AS created,
     287   changetime AS _changetime, description AS _description,
     288   reporter AS _reporter
     289  FROM ticket t,enum p
     290  WHERE status = 'assigned'
     291AND AND p.type='priority'
     292  ORDER BY __group__ ASC, `component` ASC,  __group__, p.value, severity, time
     293 LIMIT 4 OFFSET 4
     296The equivalent SQL query with the rewrite tokens would have been:
     298SELECT p.value AS __color__,
     299   owner AS __group__,
     300   id AS ticket, summary, component, milestone, t.type AS type, severity, time AS created,
     301   changetime AS _changetime, description AS _description,
     302   reporter AS _reporter
     303  FROM ticket t,enum p
     304  WHERE status = 'assigned'
     305AND AND p.type='priority'
     306  ORDER BY __group__, @SORT_COLUMN@, p.value, severity, time
     310If you want to always sort first by priority and only then by the user selected sort column, simply use the following `ORDER BY` clause:
     312  ORDER BY __group__, p.value, @SORT_COLUMN@, severity, time
     316See also: TracTickets, TracQuery, TracGuide, [ Query Language Understood by SQLite]
  • wiki/pages/TracRepositoryAdmin

    r37566 r37567  
     1= Repository Administration
     4== Quick start #QuickStart
     6 * Enable the repository connector(s) for the version control system(s) that you will use.
     7 * Add repositories through the //Repositories// admin panel, with `trac-admin` or in the `[repositories]` section of [wiki:TracIni#repositories-section trac.ini].
     8 * Set up a call to `trac-admin $ENV changeset added $REPO $REV` in the post-commit hook of each repository. Additionally, add a call to `trac-admin $ENV changeset modified $REPO $REV` in the post-revprop-change hook of repositories allowing revision property changes.
     9 * Make sure the user under which your hooks are run has write access to the Trac environment, or use a tool like `sudo` to temporarily elevate privileges.
     11== Enabling the components
     13Support for version control systems is provided by optional components distributed with Trac, which are disabled by default //(since 1.0)//. Subversion and Git must be explicitly enabled if you wish to use them.
     15The version control systems can be enabled by adding the following to the `[components]` section of your [TracIni#components-section trac.ini], or enabling the components in the //Plugins// admin panel.
     18tracopt.versioncontrol.svn.* = enabled
     22tracopt.versioncontrol.git.* = enabled
     25== Specifying repositories #Repositories
     26Trac supports multiple repositories per environment, and the repositories may be for different version control system types. Each repository must be defined in a repository configuration provider, the two supported by default are the [#ReposDatabase database store] and the [#ReposTracIni trac.ini configuration file]. A repository should not be defined in multiple configuration providers.
     28It is possible to define aliases of repositories, that act as "pointers" to real repositories. This can be useful when renaming a repository, to avoid breaking links to the old name.
     30A number of attributes can be associated with each repository. The attributes define the repository's location, type, name and how it is displayed in the source browser. The following attributes are supported:
     32||='''Attribute''' =||='''Description''' =||
     33||`alias` ||\
     34||A repository having an `alias` attribute is an alias to a real repository. All TracLinks referencing the alias resolve to the aliased repository. Note that multiple indirection is not supported, so an alias must always point to a real repository. The `alias` and `dir` attributes are mutually exclusive. ||
     35||`description` ||\
     36||The text specified in the `description` attribute is displayed below the top-level entry for the repository in the source browser. It supports WikiFormatting. ||
     37||`dir` ||\
     38||The `dir` attribute specifies the location of the repository in the filesystem. It corresponds to the value previously specified in the option `[trac] repository_dir`. The `alias` and `dir` attributes are mutually exclusive. ||
     39||`hidden` ||When set to `true`, the repository is hidden from the repository index page in the source browser. Browsing the repository is still possible, and links referencing the repository remain valid. ||
     40||`sync_per_request`||When set to `true` the repository will be synced on every request. This is not recommended, instead a post-commit hook should be configured to provide [#ExplicitSync explicit synchronization] and `sync_per_request` should be set to `false`.||
     41||`type` ||The `type` attribute sets the type of version control system used by the repository. Trac supports Subversion and Git out-of-the-box, and plugins add support for many other systems. If `type` is not specified, it defaults to the value of the `[trac] repository_type` option. ||
     42||`url` ||The `url` attribute specifies the root URL to be used for checking out from the repository. When specified, a "Repository URL" link is added to the context navigation links in the source browser, that can be copied into the tool used for creating the working copy. ||
     44A repository `name` and one of `alias` or `dir` attributes are mandatory. All others are optional.
     46For some version control systems, it is possible to specify not only the path to the repository in the `dir` attribute, but also a ''scope'' within the repository. Trac will then only show information related to the files and changesets below that scope. The Subversion backend for Trac supports this. For other types, check the corresponding plugin's documentation.
     48After adding a repository, the cache for that repository must be re-synchronized once with the `trac-admin $ENV repository resync` command.
     50 `repository resync <repos>`::
     51   Re-synchronize Trac with a repository.
     54=== In `trac.ini` #ReposTracIni
     55Repositories and repository attributes can be specified in the `[repositories]` section of [wiki:TracIni#repositories-section trac.ini]. Every attribute consists of a key structured as `{name}.{attribute}` and the corresponding value separated with an equal sign (`=`). The name of the default repository is empty.
     57The main advantage of specifying repositories in `trac.ini` is that they can be inherited from a global configuration (see the [wiki:TracIni#GlobalConfiguration global configuration] section of TracIni). One drawback is that, due to limitations in the `ConfigParser` class used to parse `trac.ini`, the repository name is always all-lowercase.
     59The following example defines two Subversion repositories named `project` and `lib`, and an alias to `project` as the default repository. This is a typical use case where a Trac environment previously had a single repository (the `project` repository), and was converted to multiple repositories. The alias ensures that links predating the change continue to resolve to the `project` repository.
     62project.dir = /var/repos/project
     63project.description = This is the ''main'' project repository.
     64project.type = svn
     65project.url =
     66project.hidden = true
     68lib.dir = /var/repos/lib
     69lib.description = This is the secondary library code.
     70lib.type = svn
     71lib.url =
     73.alias = project
     75Note that `name.alias = target` makes `name` an alias for the `target` repo, not the other way around.
     77=== In the database #ReposDatabase
     78Repositories can also be specified in the database, using either the "Repositories" admin panel under "Version Control", or the `trac-admin $ENV repository` commands.
     80The admin panel shows the list of all repositories defined in the Trac environment. It allows adding repositories and aliases, editing repository attributes and removing repositories. Note that repositories defined in `trac.ini` are displayed but cannot be edited.
     82The following [wiki:TracAdmin trac-admin] commands can be used to perform repository operations from the command line.
     84 `repository add <repos> <dir> [type]`::
     85   Add a repository `<repos>` located at `<dir>`, and optionally specify its type.
     87 `repository alias <name> <target>`::
     88   Create an alias `<name>` for the repository `<target>`.
     90 `repository remove <repos>`::
     91   Remove the repository `<repos>`.
     93 `repository set <repos> <key> <value>`::
     94   Set the attribute `<key>` to `<value>` for the repository `<repos>`.
     96Note that the default repository has an empty name, so it will likely need to be quoted when running `trac-admin` from a shell. Alternatively, the name "`(default)`" can be used instead, for example when running `trac-admin` in interactive mode.
     98== Repository caching
     100The Subversion and Git repository connectors support caching, which improves the performance browsing the repository, viewing logs and viewing changesets. Cached repositories must be [#Synchronization synchronized]; either explicit or implicit synchronization can be used. When searching changesets, only cached repositories are searched.
     102Subversion repositories are cached unless the type is `direct-svnfs`. Git repositories are cached when `[git]` [wiki:TracIni#git-section cached_repository] is `true`.
     104== Repository synchronization #Synchronization
     105Prior to 0.12, Trac synchronized its cache with the repository on every HTTP request. This approach is not very efficient and not practical anymore with multiple repositories. For this reason, explicit synchronization through post-commit hooks was added.
     107There is also new functionality in the form of a repository listener extension point ''(IRepositoryChangeListener)'' that is triggered by the post-commit hook when a changeset is added or modified, and can be used by plugins to perform actions on commit.
     109=== Mercurial Repositories
     110Please note that at the time of writing, no initial resynchronization or any hooks are necessary for Mercurial repositories - see [trac:#9485] for more information.
     112=== Explicit synchronization #ExplicitSync
     113This is the preferred method of repository synchronization. It requires setting the `sync_per_request` attribute to `false`, and adding a call to `trac-admin` in the `post-commit` hook of each repository. Additionally, if a repository allows changing revision metadata, a call to `trac-admin` must be added to the `post-revprop-change` hook as well.
     115 `changeset added <repos> <rev> [...]`::
     116   Notify Trac that one or more changesets have been added to a repository.
     118 `changeset modified <repos> <rev> [...]`::
     119   Notify Trac that metadata on one or more changesets in a repository has been modified.
     121The `<repos>` argument can be either a repository name (use "`(default)`" for the default repository) or the path to the repository.
     123Note that you may have to set the environment variable `PYTHON_EGG_CACHE` to the same value as was used for the web server configuration before calling `trac-admin`, if you changed it from its default location. See [wiki:TracPlugins Trac Plugins] for more information.
     125==== Subversion
     127The following examples are complete post-commit and post-revprop-change scripts for Subversion. They should be edited for the specific environment, marked executable (where applicable) and placed in the `hooks` directory of each repository. On Unix (`post-commit`):
     130export PYTHON_EGG_CACHE="/path/to/dir"
     131/usr/bin/trac-admin /path/to/env changeset added "$1" "$2"
     133Note: Check with `whereis trac-admin`, whether `trac-admin` is really installed under `/usr/bin/` or maybe under `/usr/local/bin/` and adapt the path.
     134On Windows (`post-commit.cmd`):
     136@C:\Python26\Scripts\trac-admin.exe C:\path\to\env changeset added "%1" "%2"
     139The post-revprop-change hook for Subversion is very similar. On Unix (`post-revprop-change`):
     142export PYTHON_EGG_CACHE="/path/to/dir"
     143/usr/bin/trac-admin /path/to/env changeset modified "$1" "$2"
     145On Windows (`post-revprop-change.cmd`):
     147@C:\Python26\Scripts\trac-admin.exe C:\path\to\env changeset modified "%1" "%2"
     150The Unix variants above assume that the user running the Subversion commit has write access to the Trac environment, which is the case in the standard configuration where both the repository and Trac are served by the web server. If you access the repository through another means, for example `svn+ssh://`, you may have to run `trac-admin` with different privileges, for example by using `sudo`.
     152Note that calling `trac-admin` in your Subversion hooks can slow down the commit and log editing operations on the client side. You might want to use the [trac:source:trunk/contrib/trac-svn-hook contrib/trac-svn-hook] script which starts `trac-admin` in an asynchronous way. The script also comes with a number of safety checks and usage advices which should make it easier to set up and test your hooks. There's no equivalent `trac-svn-hook.bat` for Windows yet, but the script can be run by Cygwin's bash.
     154See the [ section about hooks] in the Subversion book for more information. Other repository types will require different hook setups.
     156==== Git
     158Git hooks can be used in the same way for explicit syncing of Git repositories.  If your git repository is one that gets committed to directly on the machine that hosts trac, add the following to the `hooks/post-commit` file in your git repo (note: this will do nothing if you only update the repo by pushing to it):
     161REV=$(git rev-parse HEAD)
     162trac-admin /path/to/env changeset added <repos> $REV
     165Alternately, if your repository is one that only gets pushed to, add the following to the `hooks/post-receive` file in the repo:
     168tracenv=/path/to/env     # change with your Trac environment's path
     169repos=                   # change with your repository's name
     170while read oldrev newrev refname; do
     171    if [ "$oldrev" = 0000000000000000000000000000000000000000 ]; then
     172        git rev-list --reverse "$newrev" --
     173    else
     174        git rev-list --reverse "$newrev" "^$oldrev" --
     175    fi | xargs trac-admin "$tracenv" changeset added "$repos"
     179The `<repos>` argument can be either a repository name (use "`(default)`" for the default repository) or the path to the repository.
     181==== Mercurial
     183For Mercurial, add the following entries to the `.hgrc` file of each repository accessed by Trac (if [trac:TracMercurial] is installed in a Trac `plugins` directory, download [trac:source:mercurial-plugin/tracext/hg/] and place it somewhere accessible):
     186; If mercurial-plugin is installed globally
     187commit = python:tracext.hg.hooks.add_changesets
     188changegroup = python:tracext.hg.hooks.add_changesets
     190; If mercurial-plugin is installed in a Trac plugins directory
     191commit = python:/path/to/
     192changegroup = python:/path/to/
     195env = /path/to/env
     196trac-admin = /path/to/trac-admin
     199=== Per-request synchronization #PerRequestSync
     200If the post-commit hooks are not available, the environment can be set up for per-request synchronization. In that case, the `sync_per_request` attribute for each repository in the database and in [wiki:TracIni#trac-section trac.ini] must be set to `false`.
     202Note that in this case, the changeset listener extension point is not called, and therefore plugins using it will not work correctly.
     204== Automatic changeset references in tickets
     206You can automatically add a reference to the changeset as a ticket comment whenever changes are committed to the repository. The description of the commit needs to contain one of the following formulas:
     207 * '''`Refs #123`''' - to reference this changeset in `#123` ticket
     208 * '''`Fixes #123`''' - to reference this changeset and close `#123` ticket with the default status ''fixed''
     210This functionality requires installing a post-commit hook as described in [#ExplicitSync], and enabling the optional commit updater components by adding the following line to the `[components]` section of your [wiki:TracIni#components-section trac.ini], or enabling the components in the //Plugins// admin panel.
     212tracopt.ticket.commit_updater.* = enabled
     214For more information, see the documentation of the `CommitTicketUpdater` component in the //Plugins// admin panel and the [trac:CommitTicketUpdater] page.
     216== Troubleshooting
     218=== My trac-post-commit-hook doesn't work anymore #trac-post-commit-hook
     220You must now use the optional components from `tracopt.ticket.commit_updater.*`, which you can activate through the Plugins panel in the Administrative part of the web interface, or by directly modifying the [TracIni#components-section "[components]"] section in the trac.ini. Be sure to use [#ExplicitSync explicit synchronization] as explained above.
  • wiki/pages/TracRevisionLog

    r37566 r37567  
     1= Viewing Revision Logs =
     4When you browse the repository, it is always possible to view the ''Revision Log'' that corresponds to the repository path. This displays a list of the most recent changesets in which the current path or any other path below it has been modified.
     6== The Revision Log Form ==
     8It is possible to set the revision at which the revision log should start, using the ''View log starting at'' field. An empty value or a value of ''head'' is interpreted as the newest changeset.
     10It is also possible to specify the revision at which the log should stop, using the ''Back to'' field. By default it is empty,
     11which means the revision log will show the latest 100 revisions.
     13Also, there are three modes of operation of the revision log.
     15By default, the revision log ''stops on copy'', which means that whenever an ''Add'', ''Copy'' or ''Rename'' operation is detected, no older revision will be shown. That's very convenient when working with branches, as one only sees the history corresponding to what has been done on the branch.
     17It is also possible to indicate that one wants to see what happened before a ''Copy'' or ''Rename'' change, by selecting the
     18''Follow copies'' mode. This will cross all copies or renames changes.
     19Each time the name of the path changes, there will be an additional indentation level. That way, the changes on the different paths are easily grouped together visually.
     21It is even possible to go past an ''Add'' change, in order to see if there has been a ''Delete'' change on that path, before
     22that ''Add''. This mode corresponds to the mode called ''Show only adds, moves and deletes''. This operation can be quite resource intensive and therefore take some time to be shown on screen.
     24Finally, there's also a checkbox ''Show full log messages'', which controls whether the full content of the commit log message
     25should be displayed for each change, or only a shortened version of it.
     27== The Revision Log Information ==
     29For each revision log entry, the following columns are displayed:
     30 1. The first column contains a pair of radio buttons and should be used
     31    for selecting the ''old'' and the ''new'' revisions that will be
     32    used for [wiki:TracRevisionLog#viewingtheactualchanges viewing the actual changes].
     33 1. A color code (similar to the one used for the
     34    [wiki:TracChangeset#ChangesetHeader changesets]) indicating kind of change.
     35    Clicking on this column refreshes the revision log so that it restarts
     36    with this change.
     37 1. The '''Revision''' number, displayed as `@xyz`.
     38    This is a link to the TracBrowser, using the displayed revision as the base line.
     39 Next to it, you can see a little "wheel" icon [[Image(htdocs:../common/changeset.png)]],  which is clickable and leads to the TracChangeset view for that revision.
     40 1. The '''Date''' at which the change was made.
     41    The date is displayed as the time elapsed from the date of the revision. The time
     42    elapsed is displayed as the number of hours, days, weeks, months, or years.
     43 1. The '''Author''' of the change.
     44 1. The '''Log Message''', which contains either the truncated or full commit
     45    log message, depending on the value of the ''Show full log messages''
     46    checkbox in the form above.
     49== Inspecting Changes Between Revisions ==
     51The ''View changes...'' buttons (placed above and below the list of changes, on the left side) will show the set of differences
     52corresponding to the aggregated changes starting from the ''old'' revision (first radio-button) to the ''new'' revision (second
     53radio-button), in the TracChangeset view.
     55Note that the ''old'' revision doesn't need to be actually ''older'' than the ''new'' revision: it simply gives a base
     56for the diff. It's therefore entirely possible to easily generate a ''reverse diff'', for reverting what has been done
     57in the given range of revisions.
     59Finally, if the two revisions are identical, the corresponding changeset will be shown. This has the same effect as clicking on the !ChangeSet number.
     61== Alternative Formats ==
     63=== The !ChangeLog Text ===
     65At the bottom of the page, there's a ''!ChangeLog'' link that will show the range of revisions as currently shown, but as a simple text, matching the usual conventions for !ChangeLog files.
     67=== RSS Support ===
     69The revision log also provides a RSS feed to monitor the changes. To subscribe to a RSS feed for a file or directory, open its
     70revision log in the browser and click the orange 'XML' icon at the bottom of the page. For more information on RSS support in Trac, see TracRss.
     73See also: TracBrowser, TracChangeset, TracGuide
  • wiki/pages/TracRoadmap

    r37566 r37567  
     1= The Trac Roadmap
     4The roadmap provides a view on the [wiki:TracTickets ticket system] that helps planning and managing the future development of a project.
     6== The Roadmap View
     8A roadmap is a list of future milestones. The roadmap can be filtered to show or hide ''completed milestones'' and ''milestones with no due date''. In the case that both ''show completed milestones'' and ''hide milestones with no due date'' are selected, ''completed'' milestones with no due date will be shown.
     10== The Milestone View
     12A milestone is a future timeframe in which tickets are expected to be solved. You can add a description to milestones (using WikiFormatting) describing main objectives, for example. In addition, tickets targeted for a milestone are aggregated, and the ratio between active and resolved tickets is displayed as a milestone progress bar. It is possible to further [trac:TracRoadmapCustomGroups customise the ticket grouping] and have multiple ticket statuses shown on the progress bar.
     14It is possible to drill down into this simple statistic by viewing the individual milestone pages. By default, the active/resolved ratio will be grouped and displayed by component. You can also regroup the status by other criteria, such as ticket owner or severity. Ticket numbers are linked to [wiki:TracQuery custom queries] listing corresponding tickets.
     16== Roadmap Administration
     18With appropriate permissions it is possible to add, modify and remove milestones using either the web interface (roadmap and milestone pages), web administration interface or by using `trac-admin`.
     20'''Note:''' Milestone descriptions can not currently be edited using 'trac-admin'.
     22== iCalendar Support
     24The Roadmap supports the [ iCalendar] format to keep track of planned milestones and related tickets from your favorite calendar software. Many calendar applications support the iCalendar specification including
     25 * [ Apple iCal] for Mac OS X
     26 * the cross-platform [ Mozilla Calendar]
     27 * [ Chandler]
     28 * [ Korganizer], the calendar application of the [ KDE] project
     29 * [ Evolution]
     30 * [ Microsoft Outlook] can also read iCalendar files and appears as a new static calendar in Outlook
     31 * [ Google Calendar]
     33To subscribe to the roadmap, copy the iCalendar link from the roadmap (found at the bottom of the page) and choose the "Subscribe to remote calendar" action (or similar) of your calendar application, and insert the URL just copied.
     35'''Note:''' For tickets to be included in the calendar as tasks, you need to be logged in when copying the link. You will only see tickets assigned to yourself and associated with a milestone.
     37'''Note:''' To include the milestones in Google Calendar you might need to rewrite the URL.
     39RewriteEngine on
     40RewriteRule ([^/.]+)/roadmap/([^/.]+)/ics /$1/roadmap?user=$2&format=ics
     43More information about iCalendar can be found at [ Wikipedia].
     45See also: TracTickets, TracReports, TracQuery, [trac:TracRoadmapCustomGroups]
  • wiki/pages/TracRss

    r37566 r37567  
     1= Using RSS with Trac
     4Several of the Trac modules support content syndication using the RSS ([ Really Simple Syndication]) XML format. RSS pushes out updates to Trac whenever they occur and to whoever has subscribed to it. Using the RSS subscription feature in Trac, you can easily monitor progress of the project, a set of issues or even changes to a single file.
     6Trac supports RSS feeds in:
     8 * TracTimeline — Use the RSS feed to '''subscribe to project events'''. Monitor overall project progress in your favorite RSS reader.
     9 * TracTickets, TracReports, and TracQuery — Allows syndication of report and ticket query results. Be notified about important and relevant issue tickets.
     10 * TracBrowser and TracRevisionLog — Syndication of file changes. Stay up to date with changes to a specific file or directory.
     12== How to access RSS data
     13Anywhere in Trac where RSS is available, you should find a small orange '''RSS''' icon, typically at the bottom of the page:
     15<a rel="nofollow" style="padding-left: 20px; background: url(../../chrome/common/feed.png) left center no-repeat;  border: none;"><span style="color: #666;padding: 0 0 2px; font-size: 11px;">RSS feed</span></a>
     17Clicking the icon will access the RSS feed for that specific resource.
     19'''Note:''' Different modules provide different data in their RSS feeds. Usually the syndicated information corresponds to the current view. For example, if you click the RSS link on a report page, the feed will be based on that report. It might be explained by thinking of the RSS feeds as an ''alternate view of the data currently displayed''.
     21Since Trac 1.0 an RSS feed can be retrieved from a Trac site that requires authentication. Hover over the RSS icon, right click and //copy link address//.
     23== Links
     24 * ''Specifications:''
     25   * — RSS 2.0 Specification.
     27 * ''Multi-platform RSS readers:''
     28   * — Open source, Eclipse-based, RSS reader for Linux, Mac and Windows systems that supports https and authenticated feeds.
     30 * ''Linux/BSD/*n*x systems:''
     31   * — Open source GTK2 RSS Reader for Linux.
     32   * [ Akregator] — Open source KDE RSS Reader, part of KDE-PIM.
     34 * ''Mac OS X systems:''
     35   * — An excellent RSS reader for Mac OS X, has both free and paid versions.
     36   * — An RSS reader for Max OS X that supports https, even with self signed certificates, and authenticated feeds.
     37   * — Open source Feed Reader for Mac OS X with smart folders support.
     39 * ''Windows systems:''
     40   * — Free and powerful RSS Reader for MS Windows.
     41   * — A free RSS Reader written in .NET for MS Windows.
     43 * ''Firefox:''
     44   * — Mozilla Firefox features plenty [ add-ons] for supporting RSS.
     47See also: TracGuide, TracTimeline, TracReports, TracBrowser
  • wiki/pages/TracSearch

    r37566 r37567  
     1= Using Search
     3Trac has built-in search functionality to search for occurrences of keywords and substrings in wiki pages, tickets and changeset properties, such as author, revision and log messages.
     5Apart from the [search: Search module], you will also find a small search field above the navigation bar at all time. It provides convenient access to the search module from all pages.
     7The search results show the most recent modifications ranked first rather than the most relevant result.
     9== Quick searches
     10For quick access to project resources, the quick-search field at the top of every page can be used to enter a [TracLinks wiki link], which will take you directly to the resource identified by that link:
     12 * ![42] -- Opens change set 42
     13 * !#42 -- Opens ticket number 42
     14 * !{1} -- Opens report 1
     15 * /trunk -- Opens the browser for the `trunk` directory in the default repository
     16 * /repos1/trunk -- Opens the browser for the `trunk` directory in the `repos1` repository
     18== Advanced
     20=== Disabling Quickjump
     21To disable the Quickjump feature for a keyword start the query with an exclamation mark (`!`): use `!TracGuide` to search for occurrences of the literal word !TracGuide.
     23=== Search Links
     24From the Wiki, it is possible to link to a specific search, using `search:` links:
     25 * `search:?q=crash` will search for the string "crash"
     26 * `search:?q=trac+link&wiki=on` will search for "trac" and "link" in wiki pages only
     29See also: TracGuide, TracLinks, TracQuery
  • wiki/pages/TracStandalone

    r37566 r37567  
     1= Tracd
     3Tracd is a lightweight standalone Trac web server.
     4It can be used in a variety of situations, from a test or development server to a multiprocess setup behind another web server used as a load balancer.
     6== Pros
     8 * Fewer dependencies: You don't need to install apache or any other web-server.
     9 * Fast: Should be almost as fast as the [wiki:TracModPython mod_python] version (and much faster than the [wiki:TracCgi CGI]), even more so since version 0.12 where the HTTP/1.1 version of the protocol is enabled by default
     10 * Automatic reloading: For development, Tracd can be used in ''auto_reload'' mode, which will automatically restart the server whenever you make a change to the code (in Trac itself or in a plugin).
     12== Cons
     14 * Fewer features: Tracd implements a very simple web-server and is not as configurable or as scalable as Apache httpd.
     15 * No native HTTPS support: [ sslwrap] can be used instead,
     16   or [trac:wiki:STunnelTracd stunnel -- a tutorial on how to use stunnel with tracd] or Apache with mod_proxy.
     18== Usage examples
     20A single project on port 8080. (http://localhost:8080/)
     22 $ tracd -p 8080 /path/to/project
     24Strictly speaking this will make your Trac accessible to everybody from your network rather than ''localhost only''. To truly limit it use the `--hostname` option.
     26 $ tracd --hostname=localhost -p 8080 /path/to/project
     28With more than one project. (http://localhost:8080/project1/ and http://localhost:8080/project2/)
     30 $ tracd -p 8080 /path/to/project1 /path/to/project2
     33You can't have the last portion of the path identical between the projects since Trac uses that name to keep the URLs of the
     34different projects unique. So if you use `/project1/path/to` and `/project2/path/to`, you will only see the second project.
     36An alternative way to serve multiple projects is to specify a parent directory in which each subdirectory is a Trac project, using the `-e` option. The example above could be rewritten:
     38 $ tracd -p 8080 -e /path/to
     41To exit the server on Windows, be sure to use `CTRL-BREAK` -- using `CTRL-C` will leave a Python process running in the background.
     43== Installing as a Windows Service
     45=== Option 1
     46To install as a Windows service, get the [ SRVANY] utility and run:
     48 C:\path\to\instsrv.exe tracd C:\path\to\srvany.exe
     49 reg add HKLM\SYSTEM\CurrentControlSet\Services\tracd\Parameters /v Application /d "\"C:\path\to\python.exe\" \"C:\path\to\python\scripts\\" <your tracd parameters>"
     50 net start tracd
     53'''DO NOT''' use {{{tracd.exe}}}.  Instead register {{{python.exe}}} directly with {{{}}} as a parameter.  If you use {{{tracd.exe}}}, it will spawn the python process without SRVANY's knowledge.  This python process will survive a {{{net stop tracd}}}.
     55If you want tracd to start automatically when you boot Windows, do:
     57 sc config tracd start= auto
     60The spacing here is important.
     63Once the service is installed, it might be simpler to run the Registry Editor rather than use the `reg add` command documented above.  Navigate to:[[BR]]
     66Three (string) parameters are provided:
     67||!AppDirectory ||C:\Python26\ ||
     68||Application ||python.exe ||
     69||!AppParameters ||scripts\ -p 8080 ... ||
     71Note that, if the !AppDirectory is set as above, the paths of the executable ''and'' of the script name and parameter values are relative to the directory.  This makes updating Python a little simpler because the change can be limited, here, to a single point.
     72(This is true for the path to the .htpasswd file, as well, despite the documentation calling out the /full/path/to/htpasswd; however, you may not wish to store that file under the Python directory.)
     75For Windows 7 User, srvany.exe may not be an option, so you can use [ WINSERV] utility and run:
     77"C:\path\to\winserv.exe" install tracd -displayname "tracd" -start auto "C:\path\to\python.exe" c:\path\to\python\scripts\ <your tracd parameters>"
     78net start tracd
     81=== Option 2
     83Use [ WindowsServiceScript], available at [ Trac Hacks]. Installs, removes, starts, stops, etc. your Trac service.
     85=== Option 3
     87also cygwin's cygrunsrv.exe can be used:
     89$ cygrunsrv --install tracd --path /cygdrive/c/Python27/Scripts/tracd.exe --args '--port 8000 --env-parent-dir E:\IssueTrackers\Trac\Projects'
     90$ net start tracd
     93== Using Authentication
     95Tracd allows you to run Trac without the need for Apache, but you can take advantage of Apache's password tools (`htpasswd` and `htdigest`) to easily create a password file in the proper format for tracd to use in authentication. (It is also possible to create the password file without `htpasswd` or `htdigest`; see below for alternatives)
     97Make sure you place the generated password files on a filesystem which supports sub-second timestamps, as Trac will monitor their modified time and changes happening on a filesystem with too coarse-grained timestamp resolution (like `ext2` or `ext3` on Linux, or HFS+ on OSX).
     99Tracd provides support for both Basic and Digest authentication. Digest is considered more secure. The examples below use Digest; to use Basic authentication, replace `--auth` with `--basic-auth` in the command line.
     101The general format for using authentication is:
     103 $ tracd -p port --auth="base_project_dir,password_file_path,realm" project_path
     106 * '''base_project_dir''': the base directory of the project specified as follows:
     107   * when serving multiple projects: ''relative'' to the `project_path`
     108   * when serving only a single project (`-s`): the name of the project directory
     109 Don't use an absolute path here as this won't work. ''Note:'' This parameter is case-sensitive even for environments on Windows.
     110 * '''password_file_path''': path to the password file
     111 * '''realm''': the realm name (can be anything)
     112 * '''project_path''': path of the project
     114 * **`--auth`** in the above means use Digest authentication, replace `--auth` with `--basic-auth` if you want to use Basic auth.  Although Basic authentication does not require a "realm", the command parser does, so the second comma is required, followed directly by the closing quote for an empty realm name.
     119 $ tracd -p 8080 \
     120   --auth="project1,/path/to/passwordfile," /path/to/project1
     123Of course, the password file can be be shared so that it is used for more than one project:
     125 $ tracd -p 8080 \
     126   --auth="project1,/path/to/passwordfile," \
     127   --auth="project2,/path/to/passwordfile," \
     128   /path/to/project1 /path/to/project2
     131Another way to share the password file is to specify "*" for the project name:
     133 $ tracd -p 8080 \
     134   --auth="*,/path/to/users.htdigest," \
     135   /path/to/project1 /path/to/project2
     138=== Basic Authorization: Using a htpasswd password file
     139This section describes how to use `tracd` with Apache .htpasswd files.
     141  Note: It is necessary (at least with Python 2.6) to install the fcrypt package in order to
     142  decode some htpasswd formats.  Trac source code attempt an `import crypt` first, but there
     143  is no such package for Python 2.6. Only `SHA-1` passwords (since Trac 1.0) work without this module.
     145To create a .htpasswd file use Apache's `htpasswd` command (see [#GeneratingPasswordsWithoutApache below] for a method to create these files without using Apache):
     147 $ sudo htpasswd -c /path/to/env/.htpasswd username
     149then for additional users:
     151 $ sudo htpasswd /path/to/env/.htpasswd username2
     154Then to start `tracd` run something like this:
     156 $ tracd -p 8080 --basic-auth="project,/fullpath/environmentname/.htpasswd,realmname" /path/to/project
     159For example:
     161 $ tracd -p 8080 --basic-auth="project,/srv/tracenv/testenv/.htpasswd,My Test Env" /path/to/project
     163''Note:'' You might need to pass "-m" as a parameter to htpasswd on some platforms (OpenBSD).
     165=== Digest authentication: Using a htdigest password file
     167If you have Apache available, you can use the htdigest command to generate the password file. Type 'htdigest' to get some usage instructions, or read [ this page] from the Apache manual to get precise instructions.  You'll be prompted for a password to enter for each user that you create.  For the name of the password file, you can use whatever you like, but if you use something like `users.htdigest` it will remind you what the file contains. As a suggestion, put it in your <projectname>/conf folder along with the [TracIni trac.ini] file.
     169Note that you can start tracd without the `--auth` argument, but if you click on the ''Login'' link you will get an error.
     171=== Generating Passwords Without Apache
     173Basic Authorization can be accomplished via this [ online HTTP Password generator] which also supports `SHA-1`.  Copy the generated password-hash line to the .htpasswd file on your system. Note that Windows Python lacks the "crypt" module that is the default hash type for htpasswd. Windows Python can grok MD5 password hashes just fine and you should use MD5.
     175Trac also provides `htpasswd` and `htdigest` scripts in `contrib`:
     177$ ./contrib/ -cb htpasswd user1 user1
     178$ ./contrib/ -b htpasswd user2 user2
     182$ ./contrib/ -cb htdigest trac user1 user1
     183$ ./contrib/ -b htdigest trac user2 user2
     186==== Using `md5sum`
     187It is possible to use `md5sum` utility to generate digest-password file:
     193echo ${user}:${realm}:$(printf "${user}:${realm}:${password}" | md5sum - | sed -e 's/\s\+-//') > ${path_to_file}
     196== Reference
     198Here's the online help, as a reminder (`tracd --help`):
     200Usage: tracd [options] [projenv] ...
     203  --version             show program's version number and exit
     204  -h, --help            show this help message and exit
     205  -a DIGESTAUTH, --auth=DIGESTAUTH
     206                        [projectdir],[htdigest_file],[realm]
     207  --basic-auth=BASICAUTH
     208                        [projectdir],[htpasswd_file],[realm]