Changeset 37566

04/25/16 00:39:13 (7 years ago)

[titan] autoupdate wiki files

251 edited


  • wiki/pages/SandBox

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

    r37351 r37566  
    1 = !TicketQuery Wiki Macro
    3 The !TicketQuery macro lets you display information on tickets within wiki pages.
    4 The query language used by the `[[TicketQuery]]` macro is described in [TracQuery#UsingtheTicketQueryMacro TracQuery] page.
    6 == Usage
    8 [[MacroList(TicketQuery)]]
    10 == Example
    12 ||= **Example** =||= **Result** =||= **Macro** =||
    13 |-----------------------------------------------------------
    14 ||=Number of [query:status=new&milestone= Triage tickets]: =||\
    15 || **[[TicketQuery(status=new&milestone=,count)]]**||\
    16 || `[[TicketQuery(status=new&milestone=,count)]]` ||
    17 |-----------------------------------------------------------
    18 ||=Number of new tickets: =||\
    19 || **[[TicketQuery(status=new,count)]]**||\
    20 || `[[TicketQuery(status=new,count)]]` ||
    21 |-----------------------------------------------------------
    22 ||=Number of reopened tickets: =||\
    23 || **[[TicketQuery(status=reopened,count)]]**||\
    24 || `[[TicketQuery(status=reopened,count)]]` ||
    25 |-----------------------------------------------------------
    26 ||=Number of assigned tickets: =||\
    27 || **[[TicketQuery(status=assigned,count)]]**||\
    28 || `[[TicketQuery(status=assigned,count)]]` ||
    29 |-----------------------------------------------------------
    30 ||=Number of invalid tickets: =||\
    31 || **[[TicketQuery(status=closed,resolution=invalid,count)]]**||\
    32 || `[[TicketQuery(status=closed,resolution=invalid,count)]]` ||
    33 |-----------------------------------------------------------
    34 ||=Number of worksforme tickets: =||\
    35 || **[[TicketQuery(status=closed,resolution=worksforme,count)]]**||\
    36 || `[[TicketQuery(status=closed,resolution=worksforme,count)]]` ||
    37 |-----------------------------------------------------------
    38 ||=Number of duplicate tickets: =||\
    39 || **[[TicketQuery(status=closed,resolution=duplicate,count)]]**||\
    40 || `[[TicketQuery(status=closed,resolution=duplicate,count)]]` ||
    41 |-----------------------------------------------------------
    42 ||=Number of wontfix tickets: =||\
    43 || **[[TicketQuery(status=closed,resolution=wontfix,count)]]**||\
    44 || `[[TicketQuery(status=closed,resolution=wontfix,count)]]` ||
    45 |-----------------------------------------------------------
    46 ||=Number of fixed tickets: =||\
    47 || **[[TicketQuery(status=closed,resolution=fixed,count)]]**||\
    48 || `[[TicketQuery(status=closed,resolution=fixed,count)]]` ||
    49 |-----------------------------------------------------------
    50 ||=Total number of tickets: =||\
    51 || **[[TicketQuery(count)]]**||\
    52 || `[[TicketQuery(count)]]` ||
    53 |-----------------------------------------------------------
    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)]]` ||
    57 |-----------------------------------------------------------
    58 ||=Number of tickets created this month: =||\
    59 || **[[TicketQuery(created=thismonth..,count)]]**||\
    60 || `[[TicketQuery(created=thismonth..,count)]]` ||
    61 |-----------------------------------------------------------
    62 ||=Last 3 modified tickets: =||\
    63 ||**[[TicketQuery(max=3,order=modified,desc=1,compact)]]**||\
    64 || `[[TicketQuery(max=3,order=modified,desc=1,compact)]]` ||
    65 |-----------------------------------------------------------
    66 {{{#!th rowspan=2, style="text-align: left;"
    67 Details of ticket #1:
    68 }}}
    69 {{{#!td style="border-bottom: 0;"
    70 }}}
    71 {{{#!td
    72 `[[TicketQuery(id=1,col=id|owner|reporter,rows=summary,table)]]`
    73 }}}
    74 |-
    75 {{{#!td colspan=2, style="border-top: 0;"
    76 [[TicketQuery(id=1,col=id|owner|reporter,rows=summary,table)]]
    77 }}}
    78 |-----------------------------------------------------------
    80 == Using the `[[TicketQuery]]` Macro
    82 The [trac:TicketQuery TicketQuery] macro lets you display lists of tickets matching certain criteria anywhere you can use WikiFormatting.
    84 Example:
    85 {{{
    86 [[TicketQuery(version=0.6|0.7&resolution=duplicate)]]
    87 }}}
    89 This is displayed as:
    90   [[TicketQuery(version=0.6|0.7&resolution=duplicate)]]
    92 Just 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:
    93 {{{
    94 [[TicketQuery(id=123)]]
    95 }}}
    97 This is displayed as:
    98   [[TicketQuery(id=123)]]
    100 A more compact representation without the ticket summaries is:
    101 {{{
    102 [[TicketQuery(version=0.6|0.7&resolution=duplicate, compact)]]
    103 }}}
    105 This is displayed as:
    106   [[TicketQuery(version=0.6|0.7&resolution=duplicate, compact)]]
    108 Finally, if you wish to receive only the number of defects that match the query, use the `count` parameter:
    109 {{{
    110 [[TicketQuery(version=0.6|0.7&resolution=duplicate, count)]]
    111 }}}
    113 This is displayed as:
    114   [[TicketQuery(version=0.6|0.7&resolution=duplicate, count)]]
    116 ----
    117 See also: TracQuery, TracTickets, TracReports, TracGuide
  • wiki/pages/TitleIndex

    r26484 r37566  
    1 ''' Index by Title ''' | ''' [RecentChanges Index by Date] '''
    3 [[TitleIndex(format=group,min=4)]]
  • wiki/pages/TracAccessibility

    r37343 r37566  
    1 = Accessibility Support in Trac =
    3 Not 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.
    5 Trac 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
    24 ----
    25 See also: TracGuide
  • wiki/pages/TracAdmin

    r37343 r37566  
    1 = TracAdmin
    3 [[PageOutline(2-5, Contents, floated)]]
    4 [[TracGuideToc]]
    6 Trac 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.
    8 Some of those operations can also be performed via the web administration module.
    10 == Usage
    12 For 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:
    13 {{{
    14 trac-admin /path/to/projenv wiki list
    15 }}}
    17 The 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.
    18 Also, `trac-admin --version` will tell you about the Trac version (e.g. 0.12) corresponding to the program.
    20 If you want to get a comprehensive list of the available commands and sub-commands, you need to specify an existing environment:
    21 {{{
    22 trac-admin /path/to/projenv help
    23 }}}
    25 Some commands have a more detailed help, which you can access by specifying the command's name as a subcommand for `help`:
    27 {{{
    28 trac-admin /path/to/projenv help <command>
    29 }}}
    31 === `trac-admin <targetdir> initenv` === #initenv
    33 This 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.
    35 [[TracAdminHelp(initenv)]]
    37 It 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.
    38 See TracIni#GlobalConfiguration.
    40 Note 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
    44 When passing the environment path as the only argument, `trac-admin` starts in interactive mode.
    45 Commands 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.
    48 Once you're in interactive mode, you can also get help on specific commands or subsets of commands:
    50 For example, to get an explanation of the `resync` command, run:
    51 {{{
    52 > help resync
    53 }}}
    55 To get help on all the Wiki-related commands, run:
    56 {{{
    57 > help wiki
    58 }}}
    60 == Full Command Reference
    62 You'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.
    64 [[TracAdminHelp()]]
    66 ----
    67 See also: TracGuide, TracBackup, TracPermissions, TracEnvironment, TracIni, [trac:TracMigrate TracMigrate]
  • wiki/pages/TracBackup

    r37343 r37566  
    1 = Trac Backup
    3 [[TracGuideToc]]
    5 Backups 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
    11 To create a backup of a live TracEnvironment simply run:
    12 {{{#!sh
    13 $ trac-admin /path/to/projenv hotcopy /path/to/backupdir
    14 }}}
    16 [wiki:TracAdmin trac-admin] will lock the database while copying.
    18 The resulting backup directory is safe to handle using standard file-based backup tools like `tar` or `dump`/`restore`.
    20 Please 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
    24 To 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.
    26 To restore a PostgreSQL database backup, use the command:
    27 {{{#!sh
    28 psql -U <user> -d <database> -f postgresql.dump
    29 }}}
    30 The `<database>` option is the same as the [TracEnvironment#DatabaseConnectionStrings database connection string] in the `[trac]` `database` option of //trac.ini//.
    32 ----
    33 See also: TracAdmin, TracEnvironment, TracGuide, [trac:TracMigrate TracMigrate]
  • wiki/pages/TracBatchModify

    r37343 r37566  
    1 = Trac Ticket Batch Modification =
    2 [[TracGuideToc]]
    4 Trac supports modifying a batch of tickets in one request from [TracQuery custom query] results .
    6 To 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
    10 The `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
    14 Multi-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

    r37343 r37566  
    1 = The Trac Repository Browser
    3 [[TracGuideToc]]
    5 The Trac repository browser can be used to browse specific revisions of directories and files stored in the repositories associated with the Trac environment.
    7 At the top-level of the repository browser is the '''Repository Index''', listing all the configured repositories.
    8 Each repository has a name which is used as a path prefix in a "virtual" file hierarchy encompassing all the available repositories.
    9 One 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.
    11 Directory 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.
    13 The browser can be used to navigate through the directory structure by clicking on the directory names.
    14 Clicking on a file name will show the contents of the file.
    15 Clicking on the revision number of a file or directory will take you to the TracRevisionLog for that file.
    16 Note that there's also a ''Revision Log'' navigation link that will do the same for the path currently being examined.
    17 Clicking on the ''diff'' icon after revision number will display the changes made to the files modified in that revision.
    18 Clicking on the ''Age'' of the file - will take you to that changeset in the timeline.
    20 It'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.
    22 The 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].
    24 At 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.
    25 This is sometimes referred to as the ''browser quickjump'' facility.
    26 The precise meaning and content of this menu depends on your repository backend.
    27 For 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.
    29 If 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
    37 If no row has been selected using `j` or `k` these keys will operate on the entry under the mouse.
    39 For 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].
    44 {{{#!comment
    45 MMM: I found this section a bit hard to understand. I changed the first item as I understood that well.
    46 but 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...
    48 }}}
    50 ----
    51 See also: TracGuide, TracChangeset, TracFineGrainedPermissions
  • wiki/pages/TracCgi

    r37343 r37566  
    1 = Installing Trac as CGI
    2 [[TracGuideToc]]
    3 [[PageOutline]]
    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.''
    7 }}}
    9 CGI 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
    13 In [ 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.
    18 To make Trac available at `` add `ScriptAlias` directive to Apache configuration file, changing `trac.cgi` path to match your installation:
    19 {{{#!apache
    20 ScriptAlias /trac /path/to/www/trac/cgi-bin/trac.cgi
    21 }}}
    23  ''Note that this directive requires enabled `mod_alias` module.''
    25 If you're using Trac with a single project you need to set its location using the `TRAC_ENV` environment variable:
    26 {{{#!apache
    27 <Location "/trac">
    28   SetEnv TRAC_ENV "/path/to/projectenv"
    29 </Location>
    30 }}}
    32 Or to use multiple projects you can specify their common parent directory using the `TRAC_ENV_PARENT_DIR` variable:
    33 {{{#!apache
    34 <Location "/trac">
    35   SetEnv TRAC_ENV_PARENT_DIR "/path/to/project/parent/dir"
    36 </Location>
    37 }}}
    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 ...":''
    41 {{{#!python
    42     import os
    43     os.environ['TRAC_ENV'] = "/path/to/projectenv"
    44 }}}
    46  '' Or for TRAC_ENV_PARENT_DIR: ''
    48 {{{#!python
    49     import os
    50     os.environ['TRAC_ENV_PARENT_DIR'] = "/path/to/project/parent/dir"
    51 }}}
    53 If you are using the [ Apache suEXEC] feature please see [trac:ApacheSuexec].
    55 On 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
    59 You 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
    63 See TracInstall#MappingStaticResources.
    65 == Adding Authentication
    67 See TracInstall#ConfiguringAuthentication.
    69 ----
    70 See also:  TracGuide, TracInstall, [wiki:TracModWSGI], TracFastCgi, TracModPython
  • wiki/pages/TracChangeLog

    r37351 r37566  
    1 [[PageOutline(2-3)]]
    2 = Change Log
    3 This is a rough list of changes between released versions.
    5 To 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)//
    17 Trac 1.1.6 contains more than a half dozen minor fixes and enhancements.
    19 For more information see the [trac:wiki:TracDev/ApiChanges/1.1 API changes] and the detailed
    20 release 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)//
    30 Highlights 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]).
    38 See also the [trac:wiki:TracDev/ApiChanges/1.1 API changes] and the detailed
    39 release 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)//
    48 Highlights 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]).
    58 See also the [trac:wiki:TracDev/ApiChanges/1.1 API changes] and the detailed
    59 release notes for [[trac:wiki:TracDev/ReleaseNotes/1.1#DevelopmentReleases | 1.1.4]]
    60 and [[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)//
    69 The 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]).
    87 See 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
    88 for 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)//
    96 The 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]).
    115 See 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)//
    123 Trac 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.
    125 The 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 ;-) )//
    136 See 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)//
    146 Trac 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]).
    150 See 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)//
    158 Trac 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]).
    166 See 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)//
    174 Trac 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]).
    180 See 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)//
    188 Trac 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]).
    193 See 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)//
    201 Trac 1.0.3 is a maintenance release containing numerous fixes and minor
    202 enhancements. The following are a few of the highlights:
    204 The 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!
    220 See 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)//
    229 Trac 1.0.2 contains a number of bug fixes and minor enhancements, as well as a major update for many translations.
    231 The 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!
    249 See 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)//
    258 Trac 1.0.1 contains a number of bug fixes and minor enhancements, as well as a major update for many translations.
    260 The 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])
    271 See 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)//
    280 Trac 1.0 is a major release adding refreshed user interface and improved DVCS repository support as the most visible changes.
    282 The 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!
    293 See 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)//
    303 Trac 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]).
    306 See 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)//
    314 Trac 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!
    328 See 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)//
    336 Trac 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)//
    349 Trac 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)//
    357 Trac 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)//
    371 Trac 0.12.2 contains a few minor fixes and a few minor features.
    373 This 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)//
    392 Trac 0.12.1 contains a few important performance improvements, some minor fixes and a few minor features.
    394 This 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)//
    410 Trac 0.12 is a major release introducing i18n and multiple repository support as the most visible changes.
    412 The 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
    426 For releases prior to 0.12, see [trac:TracChangeLog@95].
  • wiki/pages/TracChangeset

    r37343 r37566  
    1 = Trac Changeset Module =
    2 [[TracGuideToc]]
    4 Trac has a built-in functionality for visualizing “diffs”, or changes to files.
    6 There 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.
    8 The changeset view consists of two parts, the ''header'' and the ''diff views''.
    10 == Changeset Header ==
    12 The header shows an overview of the whole changeset.
    13 Here 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
    21 If more than one revision is involved in the set of changes being displayed, the ''Timestamp'', ''Author'' and ''Message'' fields will not be shown.
    23 A 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 \\
    30 The color legend is located below the header as a reminder.
    32 == Diff Views ==
    34 Below 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.
    39 In 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 ===
    47 When 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.
    49 There will be also navigation links to the ''Previous Changeset'' to and ''Next Changeset''.
    51 === Examining Differences Between Revisions ===
    53 Often 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 ===
    57 One 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.
    59 Using 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.
    61 For 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 ===
    65 Another way to examine changes is to use the ''Last Change'' link provided by the TracBrowser.
    67 This 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.
    69 ----
    70 See also: TracGuide, TracBrowser
  • wiki/pages/TracEnvironment

    r37343 r37566  
    1 = The Trac Environment
    3 [[TracGuideToc]]
    4 [[PageOutline(2-5)]]
    6 Trac uses a directory structure and a database for storing project data. The directory is referred to as the environment.
    8 == Creating an Environment
    10 A new Trac environment is created using [TracAdmin#initenv trac-admin's initenv]:
    11 {{{#!sh
    12 $ trac-admin /path/to/myproject initenv
    13 }}}
    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//.
    34 This is a common beginners' mistake.
    35 It 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.
    36 }}}
    38 == Database Connection Strings
    40 Trac 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.
    42 Note 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
    46 The connection string for an SQLite database is:
    47 {{{
    48 sqlite:db/trac.db
    49 }}}
    50 where `db/trac.db` is the path to the database file within the Trac environment.
    52 === PostgreSQL Connection String
    54 If 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:
    55 {{{
    56 postgres://johndoe:letmein@localhost/trac
    57 }}}
    59 If PostgreSQL is running on a non-standard port, for example 9342, use:
    60 {{{
    61 postgres://johndoe:letmein@localhost:9342/trac
    62 }}}
    64 On UNIX, you might want to select a UNIX socket for the transport, either the default socket as defined by the PGHOST environment variable:
    65 {{{
    66 postgres://user:password@/database
    67 }}}
    69 or a specific one:
    70 {{{
    71 postgres://user:password@/database?host=/path/to/socket/dir
    72 }}}
    74 Note that with PostgreSQL you will have to create the database before running `trac-admin initenv`.
    76 See the [ PostgreSQL documentation] for detailed instructions on how to administer [ PostgreSQL].
    77 Generally, the following is sufficient to create a database user named `tracuser` and a database named `trac`:
    78 {{{#!sh
    79 $ createuser -U postgres -E -P tracuser
    80 $ createdb -U postgres -O tracuser -E UTF8 trac
    81 }}}
    83 When 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.
    85 Under some default configurations (Debian) one will have run the `createuser` and `createdb` scripts as the `postgres` user:
    86 {{{#!sh
    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'
    89 }}}
    91 Trac uses the `public` schema by default, but you can specify a different schema in the connection string:
    92 {{{
    93 postgres://user:pass@server/database?schema=yourschemaname
    94 }}}
    96 === MySQL Connection String
    98 The 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`:
    99 {{{
    100 mysql://johndoe:letmein@localhost:3306/trac
    101 }}}
    103 == Source Code Repository
    105 A 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.
    107 There 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
    111 An 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.
    127 ----
    128 See also: TracAdmin, TracBackup, TracIni, TracGuide
  • wiki/pages/TracFastCgi

    r37343 r37566  
    1 = Trac with FastCGI
    3 [[TracGuideToc]]
    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.
    8 Note 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
    14 There are two FastCGI modules commonly available for Apache: `mod_fastcgi` and
    15 `mod_fcgid` (preferred). The latter is more up-to-date.
    17 The following sections focus on the FCGI specific setup, see also [wiki:TracModWSGI#ConfiguringAuthentication] for configuring the authentication in Apache.
    19 Regardless 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:
    24 {{{
    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
    31 </IfModule>
    32 LoadModule fastcgi_module /usr/lib/apache2/modules/
    33 }}}
    34 Setting `FastCgiIpcDir` is optional if the default is suitable. Note that the `LoadModule` line must be after the `IfModule` group.
    36 Configure `ScriptAlias` or similar options as described in TracCgi, but
    37 calling `trac.fcgi` instead of `trac.cgi`.
    39 Add the following to the Apache configuration file (below the `FastCgiIpcDir` line) if you intend to set up the `TRAC_ENV` as an overall default:
    40 {{{
    41 FastCgiConfig -initial-env TRAC_ENV=/path/to/env/trac
    42 }}}
    44 Alternatively, you can serve multiple Trac projects in a directory by adding this:
    45 {{{
    46 FastCgiConfig -initial-env TRAC_ENV_PARENT_DIR=/parent/dir/of/projects
    47 }}}
    49 === Set up with `mod_fcgid`
    51 Configure `ScriptAlias` (see TracCgi for details), but call `trac.fcgi` instead of `trac.cgi`:
    52 {{{
    53 ScriptAlias /trac /path/to/www/trac/cgi-bin/trac.fcgi/
    54 }}}
    55 Note the slash at the end.
    57 To 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.
    59 {{{
    60 DefaultInitEnv TRAC_ENV /path/to/env/trac/
    61 }}}
    63 === alternative environment setup
    65 A 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:
    66 {{{
    67 import os
    68 os.environ['TRAC_ENV'] = "/path/to/projectenv"
    69 }}}
    70 or:
    71 {{{
    72 import os
    73 os.environ['TRAC_ENV_PARENT_DIR'] = "/path/to/project/parent/dir"
    74 }}}
    76 With this method different projects can be supported by using different `.fcgi` scripts with different `ScriptAliases`.
    78 See [ this fcgid example config] which uses a !ScriptAlias directive with trac.fcgi with a trailing / like this:
    79 {{{
    80 ScriptAlias / /srv/tracsite/cgi-bin/trac.fcgi/
    81 }}}
    83 == Simple Cherokee Configuration
    85 The configuration on Cherokee's side is quite simple. You will only need to know that you can spawn Trac as an SCGI process.
    86 You can either start it manually, or better yet, automatically by letting Cherokee spawn the server whenever it is down.
    87 First set up an information source in cherokee-admin with a local interpreter:
    89 {{{
    90 Host:
    91 localhost:4433
    93 Interpreter:
    94 /usr/bin/tracd —single-env —daemonize —protocol=scgi —hostname=localhost —port=4433 /path/to/project/
    95 }}}
    97 If 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''.
    99 After 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.
    100 The 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).
    102 Note:\\
    103 If the tracd process fails to start up, and cherokee displays a 503 error page, you might be missing the [ python-flup] package.\\
    104 Python-flup is a dependency which provides trac with SCGI capability. You can install it on debian based systems with:
    105 {{{
    106 sudo apt-get install python-flup
    107 }}}
    109 == Simple Lighttpd Configuration
    111 The FastCGI front-end was developed primarily for use with alternative webservers, such as [ Lighttpd].
    113 Lighttpd 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.
    115 For using `trac.fcgi`(prior to 0.11) / (0.11) with Lighttpd add the following to your lighttpd.conf:
    116 {{{
    117 #var.fcgi_binary="/usr/bin/python /path/to/" # 0.11 if installed with easy_setup, it is inside the egg directory
    118 var.fcgi_binary="/path/to/cgi-bin/trac.fcgi" # 0.10 name of prior fcgi executable
    119 fastcgi.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                  )
    130 }}}
    132 Note 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.
    134 Note 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.
    136 For using two projects with lighttpd add the following to your `lighttpd.conf`:
    137 {{{
    138 fastcgi.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                 )
    157 }}}
    159 Note 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.
    160 Note that the above will result in different processes in any event, even if both are running from the same `trac.fcgi` script.
    162 {{{
    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.
    165 }}}
    167 For authentication you should enable mod_auth in lighttpd.conf 'server.modules', select auth.backend and auth rules:
    168 {{{
    169 server.modules              = (
    170 ...
    171   "mod_auth",
    172 ...
    173 )
    175 auth.backend               = "htpasswd"
    177 # Separated password files for each project
    178 # See "Conditional Configuration" in
    179 #
    181 $HTTP["url"] =~ "^/first/" {
    182   auth.backend.htpasswd.userfile = "/path/to/projenv-first/htpasswd.htaccess"
    183 }
    184 $HTTP["url"] =~ "^/second/" {
    185   auth.backend.htpasswd.userfile = "/path/to/projenv-second/htpasswd.htaccess"
    186 }
    188 # Enable auth on trac URLs, see
    189 #
    191 auth.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                )
    203 }}}
    204 Note that Lighttpd (v1.4.3) stops if the password file doesn't exist.
    206 Note that Lighttpd doesn't support 'valid-user' in versions prior to 1.3.16.
    208 Conditional configuration is also useful for mapping static resources, ie serving out images and CSS directly instead of through FastCGI:
    209 {{{
    210 # Aliasing functionality is needed
    211 server.modules += ("mod_alias")
    213 # Set up an alias for the static resources
    214 alias.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
    220 fastcgi.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                  )
    230 }
    231 }}}
    233 The 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.
    234 Also 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:
    235 {{{
    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   }
    262 }}}
    264 Changing date/time format also supported by lighttpd over environment variable LC_TIME:
    265 {{{
    266 fastcgi.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                  )
    277 }}}
    278 For details about languages specification see [trac:TracFaq TracFaq] question 2.13.
    280 Other important information like the [wiki:TracInstall#MappingStaticResources mapping static resources advices] are useful for non-fastcgi specific installation aspects.
    281 ]
    283 Relaunch Lighttpd and browse to `` to access Trac.
    285 Note 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
    289 The 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:
    296 {{{
    298 }}}
    300  3. Go "!TracVhost → External Apps" tab and create a new "External Application".
    301 {{{
    302 Name: MyTracFCGI       
    303 Address: uds://tmp/lshttpd/mytracfcgi.sock
    304 Max Connections: 10
    305 Environment: TRAC_ENV=/fullpathto/mytracproject/ <--- path to root folder of trac project
    306 Initial Request Timeout (secs): 30
    307 Retry Timeout (secs): 0
    308 Persistent Connection   Yes
    309 Connection Keepalive Timeout: 30
    310 Response Bufferring: No
    311 Auto Start: Yes
    312 Command: /usr/share/trac/cgi-bin/trac.fcgi  <--- path to trac.fcgi
    313 Back Log: 50
    314 Instances: 10
    315 }}}
    317  4. Optional: If you need to use htpasswd based authentication. Go to "!TracVhost → Security" tab and create a new security Realm.
    319 {{{
    320 DB Type: Password File
    321 Realm Name: MyTracUserDB               <--- any name you wish and referenced later
    322 User DB Location: /fullpathto/htpasswd <--- path to your htpasswd file
    323 }}}
    325 If 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.
    329 {{{
    330 URI: /trac/                              <--- URI path to bind to python fcgi app we created   
    331 Fast CGI App: [VHost Level] MyTractFCGI  <--- select the trac fcgi extapp we just created
    332 Realm: TracUserDB                        <--- only if (4) is set. select realm created in (4)
    333 }}}
    335  6. Modify `/fullpathto/mytracproject/conf/trac.ini`
    337 {{{
    338 #find/set base_rul, url, and link variables
    339 base_url = <--- base url to generate correct links to
    340 url =      <--- link of project
    341 link =     <--- link of graphic logo
    342 }}}
    344  7. Restart !LiteSpeed, “lswsctrl restart”, and access your new Trac project at:
    346 {{{
    348 }}}
    350 == Simple Nginx Configuration
    352 Nginx 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     }
    416 }}}
    417  1. Modified trac.fcgi:
    418  {{{
    419 #!/usr/bin/env python
    420 import os
    421 sockaddr = '/home/trac/run/instance.sock'
    422 os.environ['TRAC_ENV'] = '/home/trac/instance'
    424 try:
    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)
    432 except SystemExit:
    433     raise
    434 except 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()
    448 }}}
    449  1. reload nginx and launch trac.fcgi like that:
    450  {{{#!sh
    451 trac@trac.example ~ $ ./
    452 }}}
    454 The 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
    462 Unfortunately nginx does not support variable expansion in fastcgi_pass directive.
    463 Thus it is not possible to serve multiple Trac instances from one server block.
    465 If you worry enough about security, run Trac instances under separate users.
    467 Another way to run Trac as a FCGI external application is offered in ticket #T6224
    469 ----
    470 See also:  TracGuide, TracInstall, [wiki:TracModWSGI ModWSGI], [wiki:TracCgi CGI], [wiki:TracModPython ModPython], [trac:TracNginxRecipe TracNginxRecipe]
  • wiki/pages/TracFineGrainedPermissions

    r37343 r37566  
    1 = Fine grained permissions =
    2 [[PageOutline(2-5, Contents, floated)]]
    3 [[TracGuideToc]]
    5 There 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.
    7 That 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 ==
    11 A great diversity of permission policies can be implemented and Trac comes with a few examples.
    13 Which policies are currently active is determined by a configuration setting in TracIni:
    15 {{{#!ini
    16 [trac]
    17 permission_policies = ReadonlyWikiPolicy, DefaultPermissionPolicy, LegacyAttachmentPolicy
    18 }}}
    19 This 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.
    21 Among 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.
    24 Another 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.
    26 See 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:
    33 {{{#!ini
    34 [trac]
    35 ...
    36 permission_policies = AuthzPolicy, ReadonlyWikiPolicy, DefaultPermissionPolicy, LegacyAttachmentPolicy
    37 }}}
    38   1. add a new `[authz_policy]` section:
    39 {{{#!ini
    40 [authz_policy]
    41 authz_file = /some/trac/env/conf/authzpolicy.conf
    42 }}}
    43   1. enable the plugin through [/admin/general/plugin WebAdmin] or by editing the `[components]` section:
    44 {{{#!ini
    45 [components]
    46 tracopt.perm.authz_policy.* = enabled
    47 }}}
    49 ==== Usage Notes ====
    51 Note the order in which permission policies are specified: policies are implemented in the sequence provided and therefore may override earlier policy specifications.
    53 A 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.
    55 NOTE: 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.
    57 The `authzpolicy.conf` file is a `.ini` style configuration file:
    58 {{{#!ini
    59 [wiki:PrivatePage@*]
    60 john = WIKI_VIEW, !WIKI_MODIFY
    61 jack = WIKI_VIEW
    62 * =
    63 }}}
    64 * Each section of the config is a glob pattern used to match against a Trac resource descriptor. These descriptors are in the form:
    65 {{{
    66 <realm>:<id>@<version>[/<realm>:<id>@<version> ...]
    67 }}}
    69 Resources 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:
    70 {{{#!ini
    71 [wiki:*]
    72 [wiki:WikiStart*]
    73 [wiki:WikiStart@*]
    74 [wiki:WikiStart]
    75 }}}
    77 Example: Match the attachment `wiki:WikiStart@117/attachment:FOO.JPG@*` on WikiStart:
    78 {{{#!ini
    79 [wiki:*]
    80 [wiki:WikiStart*]
    81 [wiki:WikiStart@*]
    82 [wiki:WikiStart@*/attachment:*]
    83 [wiki:WikiStart@117/attachment:FOO.JPG]
    84 }}}
    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.
    92 The 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. ||
    94 For example, if the `authz_file` contains:
    95 {{{#!ini
    96 [wiki:WikiStart@*]
    97 * = WIKI_VIEW
    99 [wiki:PrivatePage@*]
    100 john = WIKI_VIEW
    101 * = !WIKI_VIEW
    102 }}}
    103 and the default permissions are set like this:
    104 {{{
    105 john           WIKI_VIEW
    106 jack           WIKI_VIEW
    107 # anonymous has no WIKI_VIEW
    108 }}}
    110 Then:
    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
    115 Groups:
    116 {{{#!ini
    117 [groups]
    118 admins = john, jack
    119 devs = alice, bob
    121 [wiki:Dev@*]
    122 @admins = TRAC_ADMIN
    123 @devs = WIKI_VIEW
    124 * =
    126 [*]
    127 @admins = TRAC_ADMIN
    128 * =
    129 }}}
    131 Then:
    132 - everything is blocked (whitelist approach), but
    133 - admins get all TRAC_ADMIN everywhere and
    134 - devs can view wiki pages.
    136 Some repository examples (Browse Source specific):
    137 {{{#!ini
    138 # A single repository:
    139 [repository:test_repo@*]
    140 john = 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):
    144 [repository:@*]
    145 john = BROWSER_VIEW, FILE_VIEW
    146 # John has BROWSER_VIEW and FILE_VIEW for the entire default repository
    148 # All repositories:
    149 [repository:*@*]
    150 jack = BROWSER_VIEW, FILE_VIEW
    151 # Jack has BROWSER_VIEW and FILE_VIEW for all repositories
    152 }}}
    154 Very granular repository access:
    155 {{{#!ini
    156 # John has BROWSER_VIEW and FILE_VIEW access to trunk/src/some/location/ only
    157 [repository:test_repo@*/source:trunk/src/some/location/*@*]
    158 john = 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
    161 [repository:test_repo@*/source:trunk/src/some/location/*@1]
    162 john = BROWSER_VIEW, FILE_VIEW
    164 # John has BROWSER_VIEW and FILE_VIEW access to all revisions of 'somefile' at trunk/src/some/location only
    165 [repository:test_repo@*/source:trunk/src/some/location/somefile@*]
    166 john = 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
    169 [repository:test_repo@*/source:trunk/src/some/location/somefile@1]
    170 john = BROWSER_VIEW, FILE_VIEW
    171 }}}
    173 Note: In order for Timeline to work/visible for John, we must add CHANGESET_VIEW to the above permission list.
    175 ==== Missing Features ====
    176 Although 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].
    178 You cannot do the following:
    179 {{{#!ini
    180 [groups]
    181 team1 = a, b, c
    182 team2 = d, e, f
    183 team3 = g, h, i
    184 departmentA = team1, team2
    185 }}}
    187 Permission groups are not supported either, so you cannot do the following:
    188 {{{#!ini
    189 [groups]
    190 permission_level_1 = WIKI_VIEW, TICKET_VIEW
    191 permission_level_2  = permission_level_1, WIKI_MODIFY, TICKET_MODIFY
    192 [*]
    193 @team1 = permission_level_1
    194 @team2 = permission_level_2
    195 @team3 = permission_level_2, TICKET_CREATE
    196 }}}
    198 === !AuthzSourcePolicy  (mod_authz_svn-like permission policy) === #AuthzSourcePolicy
    200 At 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.
    202 That kind of granular permission control needs a definition file, which is the one used by Subversion's mod_authz_svn.
    203 More 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.
    205 Example:
    206 {{{#!ini
    207 [/]
    208 * = r
    210 [/branches/calc/bug-142]
    211 harry = rw
    212 sally = r
    214 [/branches/calc/bug-142/secret]
    215 harry =
    216 }}}
    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 ====
    224 To 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.
    226 {{{#!ini
    227 [svn]
    228 authz_file = /path/to/svnaccessfile
    229 }}}
    231 If you want to support the use of the `[`''modulename''`:/`''some''`/`''path''`]` syntax within the `authz_file`, add:
    233 {{{#!ini
    234 authz_module_name = modulename
    235 }}}
    237 where ''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
    240 [svn]
    241 authz_file = /path/to/svnaccessfile
    242 authz_module_name = somemodule
    243 ...
    244 [repositories]
    245 somemodule.dir = /srv/active/svn/somemodule
    246 }}}
    248 where 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.
    252 As 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.
    254 {{{#!ini
    255 [trac]
    256 permission_policies = AuthzSourcePolicy, ReadonlyWikiPolicy, DefaultPermissionPolicy, LegacyAttachmentPolicy
    257 }}}
    259 ==== Subversion Configuration ====
    261 The same access file is typically applied to the corresponding Subversion repository using an Apache directive like this:
    262 {{{#!apache
    263 <Location /repos>
    264   DAV svn
    265   SVNParentPath /usr/local/svn
    267   # our access control policy
    268   AuthzSVNAccessFile /path/to/svnaccessfile
    269 </Location>
    270 }}}
    272 For information about how to restrict access to entire projects in a multiple project environment see [trac:wiki:TracMultipleProjectsSVNAccess].
    274 === ReadonlyWikiPolicy
    276 Since 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:
    277 {{{
    278 [trac]
    279 permission_policies = ReadonlyWikiPolicy,
    280  DefaultPermissionPolicy,
    281  LegacyAttachmentPolicy
    282 }}}
    284 When 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.
    288 The `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.
    290 When 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.
    291 {{{
    292 [trac]
    293 permission_policies = AuthzPolicy,
    294  ReadonlyWikiPolicy,
    295  DefaultPermissionPolicy,
    296  LegacyAttachmentPolicy
    297 }}}
    299 The placement of [#AuthzSourcePolicy] relative to `ReadonlyWikiPolicy` does not matter since they don't perform checks on the same realms.
    301 For 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
    304 In trac.ini set:
    305 {{{#!ini
    306 [logging]
    307 log_file = trac.log
    308 log_level = DEBUG
    309 log_type = file
    310 }}}
    312 Display the trac.log to understand what checks are being performed:
    313 {{{#!sh
    314 tail -n 0 -f log/trac.log | egrep '\[perm\]|\[authz_policy\]'
    315 }}}
    317 See the sourced documentation of the plugin for more info.
    319 ----
    320 See also: TracPermissions,
    321 [ TracHacks:FineGrainedPageAuthzEditorPlugin] for a simple editor plugin.
  • wiki/pages/TracGuide

    r37343 r37566  
    1 = The Trac User and Administration Guide =
    2 [[TracGuideToc]]
    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.//
    5 }}}
    7 == Introduction
    9 Trac 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.
    11 It provides an interface to Subversion (and other version control systems), an integrated Wiki and convenient reporting facilities.
    13 Trac 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
    63 If 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

    r37343 r37566  
    1 = Importing ticket data =
    2 [[PageOutline]]
    4 To 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.
    18 {{{
    19 $
    20 bugzilla2trac - Imports a bug database from Bugzilla into Trac.
    22 Usage: [options]
    24 Available 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
    33 Additional configuration options can be defined directly in the script.
    34 }}}
    36 Currently, 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)
    42 The 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.
    47 For more details on the available options, see the configuration section at the top of the script.
    49 === Known Issues ===
    50 {{{
    51 #!comment
    52                    Don't merge this section in the default page
    53 }}}
    54 [[TicketQuery(keywords=~bugzilla,status=!closed)]]
    56 The 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).
    84 Also, 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 ==
    88 Since 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 ===
    91 See [] 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.
    92 Comments 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.
    94 ----
    95 See also:
    96  * to import/export wiki pages: TracAdmin,
    97  * to export tickets: TracTickets, TracQuery
  • wiki/pages/TracIni

    r37343 r37566  
    1 = The Trac Configuration File
    3 [[TracGuideToc]]
    4 [[PageOutline]]
    6 Trac 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.
    8 Trac 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
    12 Configuration 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:
    13 {{{#!ini
    14 [inherit]
    15 file = /path/to/global/trac.ini
    16 }}}
    17 Multiple files can be specified using a comma-separated list.
    19 Note 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.
    21 There 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.
    23 Note 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
    27 This is a brief reference of available configuration options, and their default settings.
    29 Documentation 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
    31 Please 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.
    32 }}}
    33 [[TracIni]]
    35 ----
    36 See also: TracGuide, TracAdmin, TracEnvironment
  • wiki/pages/TracInstall

    r37343 r37566  
    1 = Trac Installation Guide for 1.1
    2 [[TracGuideToc]]
    4 Trac is written in the Python programming language and needs a database, [ SQLite], [ PostgreSQL], or [ MySQL]. For HTML rendering, Trac uses the [ Genshi] templating system.
    6 Trac 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.
    8 If 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].
    10 What 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
    16 To 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
    23 You 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
    27 As 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).
    29 Optionally, 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
    33 You need to install the database and its Python bindings:
    34  * [ PostgreSQL], version 8.0 or later
    35  * [ psycopg2], version 2.0 or later
    37 See [trac:DatabaseBackend#Postgresql DatabaseBackend] for details.
    39 ==== For the MySQL database #ForMySQL
    41 Trac works well with MySQL, provided you follow the guidelines:
    43  * [ MySQL], version 5.0 or later
    44  * [ MySQLdb], version 1.2.2 or later
    46 Given 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.
    54 There 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.)
    56 For troubleshooting information, see the [trac:TracSubversion#Troubleshooting TracSubversion] page.
    58 {{{#!div style="border: 1pt dotted; margin: 1em"
    59 **Note:**
    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].
    62 }}}
    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
    70 Support for other version control systems is provided via third-party plugins. See [trac:PluginList#VersionControlSystems] and [trac:VersionControlSystem].
    72 ==== Web Server
    73 A web server is optional because Trac is shipped with a server included, see the [#RunningtheStandaloneServer Running the Standalone Server] section below.
    75 Alternatively 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].
    102 }}}
    104 Please 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
    108 The [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`
    111 Trac can be installed from PyPI or the Subversion repository using [ setuptools].
    113 A 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
    126 More 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].
    130 }}}
    132 === Using `pip`
    133 'pip' is an easy_install replacement that is very useful to quickly install python packages.
    134 To get a Trac installation up and running in less than 5 minutes:
    136 Assuming you want to have your entire pip installation in `/opt/user/trac`
    138  -
    139  {{{#!sh
    140 pip install trac psycopg2
    141 }}}
    142 or
    143  -
    144  {{{#!sh
    145 pip install trac mysql-python
    146 }}}
    148 Make sure your OS specific headers are available for pip to automatically build PostgreSQL (`libpq-dev`) or MySQL (`libmysqlclient-dev`) bindings.
    150 pip will automatically resolve all dependencies (like Genshi, pygments, etc.), download the latest packages from and create a self contained installation in `/opt/user/trac`.
    152 All 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)
    154 Additionally, you can install several Trac plugins (listed [ here]) through pip.
    156 === From source
    157 Using 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.
    159 {{{#!sh
    160 $ python ./ install
    161 }}}
    163 ''You will need root permissions or equivalent for this step.''
    165 This will byte-compile the Python source code and install it as an .egg file or folder in the `site-packages` directory
    166 of your Python installation. The .egg will also contain all other resources needed by standard Trac, such as `htdocs` and `templates`.
    168 If 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):
    169 {{{#!sh
    170 $ python ./ install
    171 }}}
    172 Alternatively, 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
    176 On 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
    180 Trac 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
    184 To install Trac to a custom location, or find out about other advanced installation options, run:
    185 {{{#!sh
    186 easy_install --help
    187 }}}
    189 Also see [ Installing Python Modules] for detailed information.
    191 Specifically, you might be interested in:
    192 {{{#!sh
    193 easy_install --prefix=/path/to/installdir
    194 }}}
    195 or, if installing Trac on a Mac OS X system:
    196 {{{#!sh
    197 easy_install --prefix=/usr/local --install-dir=/Library/Python/2.6/site-packages
    198 }}}
    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.
    203 The `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.
    204 }}}
    206 == Creating a Project Environment
    208 A [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.
    210 A new environment is created using [TracAdmin trac-admin]:
    211 {{{#!sh
    212 $ trac-admin /path/to/myproject initenv
    213 }}}
    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.
    217 Using 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.
    219 Also 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.
    223 }}}
    225 Finally, 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:
    226 {{{#!sh
    227 $ chown -R apache:apache /path/to/myproject
    228 }}}
    230 The 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.
    234 }}}
    236 == Deploying Trac
    238 === Running the Standalone Server
    240 After having created a Trac environment, you can easily try the web interface by running the standalone server [TracStandalone tracd]:
    241 {{{#!sh
    242 $ tracd --port 8000 /path/to/myproject
    243 }}}
    245 Then, 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:
    246 {{{#!sh
    247 $ tracd -s --port 8000 /path/to/myproject
    248 }}}
    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.
    253 To 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`.
    254 {{{#!sh
    256 }}}
    258 Alternatively, the variable can be set in the shell before executing `tracd`:
    259 {{{#!sh
    260 $ PKG_RESOURCES_CACHE_ZIP_MANIFESTS=1 tracd --port 8000 /path/to/myproject
    261 }}}
    262 }}}
    264 === Running Trac on a Web Server
    266 Trac 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)//
    272 Trac 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
    276 In 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].
    278 There 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:
    279 {{{#!sh
    280 mkdir -p /usr/share/trac/projects/my-project
    281 trac-admin /usr/share/trac/projects/my-project initenv
    282 trac-admin /usr/share/trac/projects/my-project deploy /tmp/deploy
    283 mv /tmp/deploy/* /usr/share/trac
    284 }}}
    285 Don'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
    289 Out 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).
    291 Web 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.
    293 There 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.
    295 Note 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:
    296 [[TracAdminHelp(deploy)]]
    298 The 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
    305 Assuming the deployment has been done this way:
    306 {{{#!sh
    307 $ trac-admin /var/trac/env deploy /path/to/shared/trac
    308 }}}
    310 Add 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:
    311 {{{#!apache
    312 Alias /trac/chrome/common /path/to/trac/htdocs/common
    313 Alias /trac/chrome/site /path/to/trac/htdocs/site
    315 <Directory "/path/to/www/trac/htdocs">
    316   Order allow,deny
    317   Allow from all
    318 </Directory>
    319 }}}
    321 If using mod_python, you might want to add this too (otherwise, the alias will be ignored):
    322 {{{#!apache
    323 <Location "/trac/chrome/common/">
    324   SetHandler None
    325 </Location>
    326 }}}
    328 Note 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.
    330 Similarly, 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):
    331 {{{#!apache
    332 Alias /trac/chrome/site /path/to/projectenv/htdocs
    334 <Directory "/path/to/projectenv/htdocs">
    335   Order allow,deny
    336   Allow from all
    337 </Directory>
    338 }}}
    340 Alternatively 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:
    341 {{{#!ini
    342 [trac]
    343 htdocs_location =
    344 }}}
    345 Note that this makes it easy to have a dedicated domain serve those static resources (preferentially [ cookie-less]).
    347 Of 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:
    348 {{{#!sh
    349 $ ln -s /path/to/trac/htdocs/common /var/www/
    350 }}}
    352 ==== Setting up the Plugin Cache
    354 Some 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
    358 Trac 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.
    360 The process of adding, removing, and configuring user accounts for authentication depends on the specific way you run Trac.
    362 Please 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
    370 Grant admin rights to user admin:
    371 {{{#!sh
    372 $ trac-admin /path/to/myproject permission add admin TRAC_ADMIN
    373 }}}
    375 This user will have an //Admin// navigation item that directs to pages for administering your Trac project.
    377 == Configuring Trac
    379 TracRepositoryAdmin provides information on configuring version control repositories for your project.
    381 == Using Trac
    383 Once 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.
    385 Keep 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]
    391 ----
    392 See also: [trac:TracInstallPlatforms TracInstallPlatforms], TracGuide, TracUpgrade, TracPermissions
  • wiki/pages/TracInterfaceCustomization

    r37343 r37566  
    1 = Customizing the Trac Interface
    2 [[TracGuideToc]]
    3 [[PageOutline]]
    5 == Introduction
    6 This 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
    9 The 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].
    11 The 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.
    15 Now configure the appropriate section of your [wiki:TracIni trac.ini]:
    17 === Logo
    18 Change 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'.
    20 {{{#!ini
    21 [header_logo]
    22 src = site/my_logo.gif
    23 alt = My Project
    24 width = 300
    25 height = 100
    26 }}}
    28 === Icon
    29 Icons 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:
    31 {{{#!ini
    32 [project]
    33 icon = site/my_icon.ico
    34 }}}
    36 == Custom Navigation Entries
    37 The 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.
    39 In 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:
    40 {{{#!ini
    41 [mainnav]
    42 wiki.label = Home
    43 tickets.href = /report/24
    45 [metanav]
    46 help = disabled
    47 }}}
    49 See also TracNavigation for a more detailed explanation of the mainnav and metanav terms.
    51 == Site Appearance == #SiteAppearance
    53 Trac 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`:
    55 {{{#!xml
    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>
    79 </html>
    80 }}}
    82 Notice 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.
    85 See [ this thread] for a detailed explanation of the above example `site.html`.
    86 A `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.
    88 Example snippet of adding introduction text to the new ticket form (but not shown during preview):
    90 {{{#!xml
    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('*')}
    96 </form>
    97 }}}
    99 This 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.
    101 More examples snippets for `site.html` can be found at [trac:wiki:CookBook/SiteHtml CookBook/SiteHtml].
    103 Example snippets for `style.css` can be found at [trac:wiki:CookBook/SiteStyleCss CookBook/SiteStyleCss].
    105 Note 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
    109 You can use a custom Genshi template to display the list of projects if you are using Trac with multiple projects. 
    111 The 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:
    113 {{{#!text/html
    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>
    135 </html>
    136 }}}
    138 Once 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):
    140 For [wiki:TracModWSGI mod_wsgi]:
    141 {{{#!python
    142 os.environ['TRAC_ENV_INDEX_TEMPLATE'] = '/path/to/template.html'
    143 }}}
    145 For [wiki:TracFastCgi FastCGI]:
    146 {{{#!apache
    147 FastCgiConfig -initial-env TRAC_ENV_PARENT_DIR=/parent/dir/of/projects \
    148               -initial-env TRAC_ENV_INDEX_TEMPLATE=/path/to/template
    149 }}}
    151 For [wiki:TracModPython mod_python]:
    152 {{{#!apache
    153 PythonOption TracEnvParentDir /parent/dir/of/projects
    154 PythonOption TracEnvIndexTemplate /path/to/template
    155 }}}
    157 For [wiki:TracCgi CGI]:
    158 {{{#!apache
    159 SetEnv TRAC_ENV_INDEX_TEMPLATE /path/to/template
    160 }}}
    162 For [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
    174 The 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.
    176 With 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.
    178 However, 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.
    182 Trac resolves requests for a template by first looking inside the project, then in any inherited templates location, and finally inside the Trac egg.
    184 Trac caches templates in memory by default to improve performance. To apply a template you need to restart the web server.
    186 ----
    187 See also TracGuide, TracIni
  • wiki/pages/TracLanguages

    r37351 r37566  
    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||
    17 ||En_GB||British||British||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||
    33 ||Ja||日本語||Japanese||他の言語||
    34 ||Ka||ქართული||Georgian||სხვა ენებზე||
    35 ||Ko||한국어||Korean||다른 언어||
    36 ||Km||ភាសាខ្មែរ||Khmer||ភាសាផ្សេងទៀត||
    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

    r37343 r37566  
    1 = Trac Links =
    2 [[TracGuideToc]]
    4 TracLinks 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.
    6 TracLinks are generally of the form '''type:id''' (where ''id'' represents the
    7 number, name or path of the item) though some frequently used kinds of items
    8 also have short-hand notations.
    10 == Where to use TracLinks ==
    11 You can use TracLinks in:
    13  * Source code (Subversion) commit messages
    14  * Wiki pages
    15  * Full descriptions for tickets, reports and milestones
    17 and any other text fields explicitly marked as supporting WikiFormatting.
    19 == Overview ==
    21 ||= Wiki Markup =||= Display =||
    22 {{{#!td
    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)
    36 }}}
    37 {{{#!td
    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)
    51 }}}
    53 '''Note:''' The wiki:CamelCase form is rarely used, but it can be convenient to refer to
    54 pages whose names do not follow WikiPageNames rules, i.e., single words,
    55 non-alphabetic characters, etc. See WikiPageNames for more about features specific
    56 to 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: ||
    61 {{{#!td
    62 {{{
    63 [ticket:1 This is a link to ticket number one] or
    64 [[ticket:1|This is another link to ticket number one]].
    65 }}}
    66 }}}
    67 {{{#!td
    68 [ticket:1 This is a link to ticket number one] or
    69 [[ticket:1|This is another link to ticket number one]].
    70 }}}
    71 |--------------------------------------------------------------------------------------
    72 |||| If the title is omitted, only the id (the part after the colon) is displayed:  ||
    73 {{{#!td
    74 {{{
    75 [ticket:1] or [[ticket:2]]
    76 }}}
    77 }}}
    78 {{{#!td
    79 [ticket:1] or [[ticket:2]]
    80 }}}
    81 |--------------------------------------------------------------------------------------
    82 |||| `wiki` is the default if the namespace part of a full link is omitted:  ||
    83 {{{#!td
    84 {{{
    85 [SandBox the sandbox] or
    86 [[SandBox|the sandbox]]
    87 }}}
    88 }}}
    89 {{{#!td
    90 [SandBox the sandbox] or
    91 [[SandBox|the sandbox]]
    92 }}}
    93 |--------------------------------------------------------------------------------------
    94 |||| The short form ''realm:target'' can also be wrapped within a <...> pair, [[br]] which allow for arbitrary characters (i.e. anything but >)  ||
    95 {{{#!td
    96 {{{
    97 <wiki:Strange(page@!)>
    98 }}}
    99 }}}
    100 {{{#!td
    101 <wiki:Strange(page@!)>
    102 }}}
    103 }}}
    105 TracLinks 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 ===
    112 To create a link to a [trac:SubWiki SubWiki]-page just use a '/':
    113 {{{
    114  WikiPage/SubWikiPage or ./SubWikiPage
    115 }}}
    117 To link from a [trac:SubWiki SubWiki] page to a parent, simply use a '..':
    118 {{{
    119   [..] or [[..]]
    120 }}}
    121   [..] or [[..]]
    123 To link from a [trac:SubWiki SubWiki] page to a [=#sibling sibling] page, use a '../':
    124 {{{
    125   [../Sibling see next sibling] or [[../Sibling|see next sibling]]
    126 }}}
    127   [../Sibling see next sibling] or [[../Sibling|see next sibling]]
    129 But in practice you often won't need to add the `../` prefix to link to a sibling page.
    130 For resolving the location of a wiki link, it's the target page closest in the hierarchy
    131 to the page where the link is written which will be selected. So for example, within
    132 a sub-hierarchy, a sibling page will be targeted in preference to a toplevel page.
    133 This makes it easy to copy or move pages to a sub-hierarchy by [[WikiNewPage#renaming|renaming]] without having to adapt the links.
    135 In order to link explicitly to a [=#toplevel toplevel] Wiki page,
    136 use 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 ===
    140 To create a link to a specific anchor in a page, use '#':
    141 {{{
    142  [#Linkanchors Link anchors] or [[#Linkanchors|Link anchors]]
    143 }}}
    144   [#Linkanchors Link anchors] or [[#Linkanchors|Link anchors]]
    146 Hint: 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.
    148 To create a link to the first or last occurrence of a term on a page, use a ''pseudo anchor'' starting with '#/' or '#?':
    149 {{{
    150  [#/Milestone first occurrence of Milestone] or
    151  [#?Milestone last occurrence of Milestone]
    152 }}}
    153  [#/Milestone first occurrence of Milestone] or
    154  [#?Milestone last occurrence of Milestone]
    155 This 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':
    156 {{{
    157  [#/Milestone/i first occurrence of Milestone or milestone] or
    158  [#?Milestone/i last occurrence of Milestone or milestone]
    159 }}}
    160  [#/Milestone/i first occurrence of Milestone or milestone] or
    161  [#?Milestone/i last occurrence of Milestone or milestone]
    163 ''(since Trac 1.0)''
    165 Such anchors can be very useful for linking to specific lines in a file in the source browser:
    166 {{{
    167  [trac:source:tags/trac-0.12/trac/wiki/ Line 127] or
    168  [trac:source:tags/trac-0.12/trac/ticket/ Line 47]
    169 }}}
    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.)
    174 Since such links become outdated when the file changes, it can be useful to link using a '#/' pseudo anchor instead:
    175 {{{
    176  [trac:source:trunk/trac/wiki/ IWikiSyntaxProvider] or
    177  [trac:source:trunk/trac/ ISystemInfoProvider]
    178 }}}
    179  [trac:source:trunk/trac/wiki/ IWikiSyntaxProvider] or
    180  [trac:source:trunk/trac/ ISystemInfoProvider]
    182 === InterWiki links ===
    184 Other 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 ===
    188 This can be seen as a kind of InterWiki link specialized for targeting other Trac projects.
    190 Any 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.
    192 A 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].
    193 See InterTrac for the complete details.
    195 === Server-relative links ===
    197 It is often useful to be able to link to objects in your project that
    198 have no built-in Trac linking mechanism, such as static resources, `newticket`,
    199 a shared `/register` page on the server, etc.
    201 To link to resources inside the project, use either an absolute path from the project root,
    202 or a relative link from the URL of the current page (''Changed in 0.11''):
    204 {{{
    205 [/newticket Create a new ticket] or [[//newticket|Create a new ticket]]
    206 [/ home] or [[/|home]]
    207 }}}
    209 Display: [/newticket Create a new ticket] or [[//newticket|Create a new ticket]]
    210 [/ home] or [[/|home]]
    212 To link to another location on the server (possibly outside the project but on the same host), use the `//` prefix (''Changed in 0.11''):
    214 {{{
    215 [//register Register Here] or [[//register|Register Here]]
    216 }}}
    218 Display: [//register Register Here] or [[//register|Register Here]]
    220 === Quoting space in TracLinks ===
    222 Immediately after a TracLinks prefix, targets containing space characters should
    223 be enclosed in a pair of quotes or double quotes.
    224 Examples:
    225  * !wiki:"The whitespace convention"
    226  * !attachment:'the file.txt' or
    227  * !attachment:"the file.txt"
    228  * !attachment:"the file.txt:ticket:123"
    230 Note 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 ===
    236 To prevent parsing of a !TracLink, you can escape it by preceding it with a '!' (exclamation mark).
    237 {{{
    238  !NoLinkHere.
    239  ![42] is not a link either.
    240 }}}
    242 Display:
    243  !NoLinkHere.
    244  ![42] is not a link either.
    247 === Parameterized Trac links ===
    249 Many 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.
    251 Trac 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 ==
    259 The following sections describe the individual link types in detail, as well as notes on advanced usage of links.
    261 === attachment: links ===
    263 The 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
    268 Note that the older way, putting the filename at the end, is still supported: !attachment:ticket:753:the_file.txt.
    270 If 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:`.
    272 This 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.
    274 See also [#export:links].
    276 === comment: links ===
    278 When you're inside a given ticket, you can simply write e.g. !comment:3 to link to the third change comment.
    279 It 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`!)
    282 It 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 ===
    289 Use `htdocs:path/to/file` to reference files in the `htdocs` directory of the Trac environment, the [TracEnvironment#DirectoryStructure web resource directory].
    291 === query: links ===
    293 See TracQuery#UsingTracLinks and [#ticket:links].
    295 === search: links ===
    297 See TracSearch#SearchLinks
    299 === ticket: links ===
    300  ''alias:'' `bug:`
    302 Besides 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.
    304 Example:
    305  - `ticket:5000-6000`
    306  - `ticket:1,150`
    308 === timeline: links ===
    310 Links 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.
    312 Examples:
    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 ===
    322 See 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 ===
    326 It 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).
    328 For 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:`
    333 The default behavior for a `source:/some/path link` is to open the browser in that directory directory
    334 if the path points to a directory or to show the latest content of the file.
    336 It'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
    340 If 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`
    344 Finally, 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
    348 Note 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 ====
    352 To 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
    357 This 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.
    359 If 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 ====
    363 The `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
    370 There 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`)
    375 Finally, note that in all of the above, a revision range can be written either as `x:y` or `x-y`.
    377 In 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]`.
    379 ----
    380 See also: WikiFormatting, TracWiki, WikiPageNames, InterTrac, InterWiki
  • wiki/pages/TracLogging

    r37343 r37566  
    1 = Trac Logging
    2 [[TracGuideToc]]
    4 Trac supports logging of system messages using the standard [ logging module] that comes with Python.
    6 Logging is configured in the `[logging]` section in [wiki:TracIni#logging-section trac.ini].
    8 == Supported Logging Methods
    10 The 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
    20 The 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.
    28 Additionally, 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
    32 The 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.
    37 Note that variables are identified using a dollar sign (`$(...)s`) instead of percent sign (`%(...)s`).
    39 The default format is:
    40 {{{#!ini
    41 log_format = Trac[$(module)s] $(levelname)s: $(message)s
    42 }}}
    44 In 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:
    45 {{{#!ini
    46 log_format = Trac[$(basename)s:$(module)s] $(levelname)s: $(message)s
    47 }}}
    49 ----
    50 See also: TracIni, TracGuide, TracEnvironment
  • wiki/pages/TracModPython

    r37343 r37566  
    1 [[TracGuideToc]]
    3 = Trac and mod_python
    5 Mod_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.
    6 Trac 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.
    8 These 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.
    10 [[PageOutline(2-3,Overview,inline)]]
    12 == Simple configuration: single project == #Simpleconfiguration
    14 If you just installed mod_python, you may have to add a line to load the module in the Apache configuration:
    15 {{{#!apache
    16 LoadModule python_module modules/
    17 }}}
    19 '''Note''': The exact path to the module depends on how the HTTPD installation is laid out.
    21 On Debian using apt-get:
    22 {{{#!sh
    23 apt-get install libapache2-mod-python libapache2-mod-python-doc
    24 }}}
    26 Still on Debian, after you have installed mod_python, you must enable the modules in apache2, equivalent to the above Load Module directive:
    27 {{{#!sh
    28 a2enmod python
    29 }}}
    31 On Fedora use, using yum:
    32 {{{#!sh
    33 yum install mod_python
    34 }}}
    36 You 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+.
    37 {{{#!apache
    38 <Location /mpinfo>
    39    SetHandler mod_python
    40    PythonInterpreter main_interpreter
    41    PythonHandler mod_python.testhandler
    42    Order allow,deny
    43    Allow from all
    44 </Location>
    45 }}}
    47 A simple setup of Trac on mod_python looks like this:
    48 {{{#!apache
    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
    57 </Location>
    58 }}}
    60 The 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.
    62 The options available are:
    63 {{{#!apache
    64 # For a single project
    65 PythonOption TracEnv /var/trac/myproject
    67 # For multiple projects
    68 PythonOption TracEnvParentDir /var/trac/myprojects
    70 # For the index of multiple projects
    71 PythonOption TracEnvIndexTemplate /srv/www/htdocs/trac/project_list_template.html
    73 # A space delimitted list, with a "," between key and value pairs.
    74 PythonOption TracTemplateVars key1,val1 key2,val2
    76 # Useful to get the date in the wanted order
    77 PythonOption TracLocale en_GB.UTF8
    79 # See description above       
    80 PythonOption TracUriRoot /projects/myproject
    81 }}}
    83 === Python Egg Cache
    85 Compressed 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:
    86 {{{#!apache
    87 PythonOption PYTHON_EGG_CACHE /var/trac/myprojects/egg-cache
    88 }}}
    90 Or you can uncompress the Genshi egg to resolve problems extracting from it.
    92 === Configuring Authentication
    94 See corresponding section in the [wiki:TracModWSGI#ConfiguringAuthentication] page.
    96 == Advanced Configuration
    98 === Setting the Python Egg Cache
    100 If 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.
    102 {{{#!apache
    103 <Location /projects/myproject>
    104   ...
    105   PythonOption PYTHON_EGG_CACHE /tmp
    106   ...
    107 </Location>
    108 }}}
    110 === Setting the !PythonPath
    112 If 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:
    113 {{{#!apache
    114 <Location /projects/myproject>
    115   ...
    116   PythonPath "sys.path + ['/path/to/trac']"
    117   ...
    118 </Location>
    119 }}}
    121 Be careful about using the !PythonPath directive, and ''not'' `SetEnv PYTHONPATH`, as the latter won't work.
    123 === Setting up multiple projects
    125 The Trac mod_python handler supports a configuration option similar to Subversion's `SvnParentPath`, called `TracEnvParentDir`:
    126 {{{#!apache
    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
    133 </Location>
    134 }}}
    136 When 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.
    138 If you don't want to have the subdirectory listing as your projects home page you can use a
    139 {{{#!apache
    140 <LocationMatch "/.+/">
    141 }}}
    143 This 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.
    145 You can also use the same authentication realm for all of the projects using a `<LocationMatch>` directive:
    146 {{{#!apache
    147 <LocationMatch "/projects/[^/]+/login">
    148   AuthType Basic
    149   AuthName "Trac"
    150   AuthUserFile /var/trac/.htpasswd
    151   Require valid-user
    152 </LocationMatch>
    153 }}}
    155 === Virtual Host Configuration
    157 Below is the sample configuration required to set up your Trac as a virtual server, ie when you access it at the URLs like
    158 ``:
    160 {{{#!apache
    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>
    177 </VirtualHost>
    178 }}}
    180 This 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 *>`.
    185 For 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
    191 If you get server error pages, you can either check the Apache error log, or enable the `PythonDebug` option:
    192 {{{#!apache
    193 <Location /projects/myproject>
    194   ...
    195   PythonDebug on
    196 </Location>
    197 }}}
    199 For multiple projects, try restarting the server as well.
    201 === Login Not Working
    203 If you've used `<Location />` directive, it will override any other directives, as well as `<Location /login>`.
    204 The workaround is to use negation expression as follows (for multi project setups):
    205 {{{#!apache
    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 /
    212 </Location>
    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
    230 </Location>
    231 }}}
    233 === Expat-related segmentation faults === #expat
    235 This problem will most certainly hit you on Unix when using Python 2.4.
    236 In 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.
    237 As 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
    241 If 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
    245 If 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.
    247 Using <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
    251 It'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:
    253 {{{#!sh
    254 easy_install --always-unzip
    255 }}}
    257 === Using .htaccess
    259 Although 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.
    261 It 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.
    263 This also works out-of-box, with following trivial config:
    264 {{{#!apache
    265 SetHandler mod_python
    266 PythonInterpreter main_interpreter
    267 PythonHandler trac.web.modpython_frontend
    268 PythonOption TracEnv /system/path/to/this/directory
    269 PythonOption TracUriRoot /path/on/apache
    271 AuthType Basic
    272 AuthName "ProjectName"
    273 AuthUserFile /path/to/.htpasswd
    274 Require valid-user
    275 }}}
    277 The `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
    281 If 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:
    283 {{{#!apache
    284 <IfModule mod_rewrite.c>
    285   RewriteEngine Off
    286 </IfModule>
    287 }}}
    289 === Platform specific issues
    290 ==== Win32 Issues
    292 If 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
    296 When 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
    300 If Trac reports something like: `Cannot get shared lock on db.lock`, then the security context on the repository may need to be set:
    302 {{{#!sh
    303 chcon -R -h -t httpd_sys_content_t PATH_TO_REPOSITORY
    304 }}}
    306 See also [ How do I set repository permissions correctly?]
    308 ==== FreeBSD issues
    310 The 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.
    314 Apache2 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.
    315 The best option [ seems to be] adding to /usr/local/apache2/bin/ennvars the line:
    317 {{{#!sh
    318 export LD_PRELOAD=/usr/lib/
    319 }}}
    321 ==== Fedora 7 Issues
    323 Make sure you install the 'python-sqlite2' package as it seems to be required for TracModPython, but not for tracd.
    325 === Subversion issues
    327 If 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.
    329 If 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`).
    331 You 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:
    332 {{{#!apache
    333 PythonInterpreter main_interpreter
    334 }}}
    336 This 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
    340 If 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:
    341 {{{#!apache
    342 Alias /myproject/css "/usr/share/trac/htdocs/css"
    343 <Location /myproject/css>
    344     SetHandler None
    345 </Location>
    346 }}}
    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 />}}}.
    350 Also, 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
    354 If 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:
    355 {{{#!apache
    356 <VirtualHost *>
    357     DocumentRoot /var/www/myproject
    358     ServerName
    359     SetEnv HTTPS 1
    360     ....
    361 </VirtualHost>
    362 }}}
    364 === Segmentation fault with php5-mhash or other php5 modules
    366 You 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].
    368 Some people also have troubles when using PHP5 compiled with its own third party libraries instead of system libraries. Check [ Django segmentation fault].
    370 ----
    371 See also: TracGuide, TracInstall, [wiki:TracModWSGI ModWSGI], [wiki:TracFastCgi FastCGI], [trac:TracNginxRecipe]
  • wiki/pages/TracModWSGI

    r37343 r37566  
    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.
    5 [[PageOutline(2-3,Overview,inline)]]
    7 == The `trac.wsgi` script
    9 Trac 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.
    11 A 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].
    13 If you are using Trac with multiple projects, you can specify their common parent directory using the `TRAC_ENV_PARENT_DIR` in trac.wsgi:
    14 {{{#!python
    15 def 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     ..
    19 }}}
    21 === A very basic script
    22 In its simplest form, the script could be:
    24 {{{#!python
    25 import os
    27 os.environ['TRAC_ENV'] = '/usr/local/trac/mysite'
    28 os.environ['PYTHON_EGG_CACHE'] = '/usr/local/trac/mysite/eggs'
    30 import trac.web.main
    31 application = trac.web.main.dispatch_request
    32 }}}
    34 The `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`.
    36 On Windows:
    37  - If run under the user's session, the Python Egg cache can be found in `%AppData%\Roaming`, for example:
    38 {{{#!python
    39 os.environ['PYTHON_EGG_CACHE'] = r'C:\Users\Administrator\AppData\Roaming\Python-Eggs'
    40 }}}
    41  - If run under a Window service, you should create a directory for Python Egg cache:
    42 {{{#!python
    43 os.environ['PYTHON_EGG_CACHE'] = r'C:\Trac-Python-Eggs'
    44 }}}
    46 === A more elaborate script
    48 If 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.
    50 To solve this problem, use the following `.wsgi` file instead:
    51 {{{#!python
    52 import os
    54 os.environ['PYTHON_EGG_CACHE'] = '/usr/local/trac/mysite/eggs'
    56 import trac.web.main
    57 def application(environ, start_response):
    58   environ['trac.env_path'] = '/usr/local/trac/mysite'
    59   return trac.web.main.dispatch_request(environ, start_response)
    60 }}}
    62 For 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.
    64 If 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:
    66 {{{#!python
    67 import site
    68 site.addsitedir('/usr/local/trac/lib/python2.4/site-packages')
    69 }}}
    71 Change it according to the path you installed the Trac libs at.
    73 == Mapping requests to the script
    75 After preparing your .wsgi script, add the following to your Apache configuration file, typically `httpd.conf`:
    77 {{{#!apache
    78 WSGIScriptAlias /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
    84 </Directory>
    85 }}}
    87 Here, the script is in a subdirectory of the Trac environment.
    89 If you followed the directions [TracInstall#cgi-bin Generating the Trac cgi-bin directory], your Apache configuration file should look like following:
    91 {{{#!apache
    92 WSGIScriptAlias /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
    98 </Directory>
    99 }}}
    101 In 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.
    103 To 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):
    105 {{{#!python
    106 def application(environ, start_response):
    107         start_response('200 OK',[('Content-type','text/html')])
    108         return ['<html><body>Hello World!</body></html>']
    109 }}}
    111 For more information about using the mod_wsgi specific directives, see the [ mod_wsgi's wiki] and more specifically the [ IntegrationWithTrac] page.
    113 == Configuring Authentication
    115 The following sections describe different methods for setting up authentication. See also [ Authentication, Authorization and Access Control] in the Apache guide.
    117 === Using Basic Authentication
    119 The simplest way to enable authentication with Apache is to create a password file. Use the `htpasswd` program as follows:
    120 {{{#!sh
    121 $ htpasswd -c /somewhere/trac.htpasswd admin
    122 New password: <type password>
    123 Re-type new password: <type password again>
    124 Adding password for user admin
    125 }}}
    127 After the first user, you don't need the "-c" option anymore:
    128 {{{#!sh
    129 $ htpasswd /somewhere/trac.htpasswd john
    130 New password: <type password>
    131 Re-type new password: <type password again>
    132 Adding password for user john
    133 }}}
    135   ''See the man page for `htpasswd` for full documentation.''
    137 After you've created the users, you can set their permissions using TracPermissions.
    139 Now, you need to enable authentication against the password file in the Apache configuration:
    140 {{{#!apache
    141 <Location "/trac/login">
    142   AuthType Basic
    143   AuthName "Trac"
    144   AuthUserFile /somewhere/trac.htpasswd
    145   Require valid-user
    146 </Location>
    147 }}}
    149 If you are hosting multiple projects, you can use the same password file for all of them:
    150 {{{#!apache
    151 <LocationMatch "/trac/[^/]+/login">
    152   AuthType Basic
    153   AuthName "Trac"
    154   AuthUserFile /somewhere/trac.htpasswd
    155   Require valid-user
    156 </LocationMatch>
    157 }}}
    158 Note that neither a file nor a directory named 'login' needs to exist.[[BR]]
    159 See also the [ mod_auth_basic] documentation.
    161 === Using Digest Authentication
    163 For better security, it is recommended that you either enable SSL or at least use the “digest” authentication scheme instead of “Basic”.
    165 You have to create your `.htpasswd` file with the `htdigest` command instead of `htpasswd`, as follows:
    166 {{{#!sh
    167 $ htdigest -c /somewhere/trac.htpasswd trac admin
    168 }}}
    170 The "trac" parameter above is the "realm", and will have to be reused in the Apache configuration in the !AuthName directive:
    172 {{{#!apache
    173 <Location "/trac/login">
    174   AuthType Digest
    175   AuthName "trac"
    176   AuthDigestDomain /trac
    177   AuthUserFile /somewhere/trac.htpasswd
    178   Require valid-user
    179 </Location>
    180 }}}
    182 For 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. '''
    186 Don't forget to activate the mod_auth_digest. For example, on a Debian 4.0r1 (etch) system:
    187 {{{#!apache
    188   LoadModule auth_digest_module /usr/lib/apache2/modules/
    189 }}}
    191 See also the [ mod_auth_digest] documentation.
    193 === Using LDAP Authentication
    195 Configuration for [ mod_ldap] authentication in Apache is more involved (httpd 2.2.x and OpenLDAP: slapd 2.3.19).
    197 1. You need to load the following modules in Apache httpd.conf:
    198 {{{#!apache
    199   LoadModule ldap_module modules/
    200   LoadModule authnz_ldap_module modules/
    201 }}}
    202 1. Your httpd.conf also needs to look something like:
    203 {{{#!apache
    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
    215 </Location>
    216 }}}
    217 1. You can use the LDAP interface as a way to authenticate to a Microsoft Active Directory. Use the following as your LDAP URL:
    218 {{{#!apache
    219   AuthLDAPURL "ldap://,DC=com?sAMAccountName?sub?(objectClass=user)"
    220 }}}
    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:
    222 {{{#!apache
    223   AuthLDAPBindDN
    224   AuthLDAPBindPassword "password"
    225 }}}
    226  The whole section looks like:
    227 {{{#!apache
    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
    242 </Location>
    243 }}}
    245 Note 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.
    247 Note 2: You can also require the user be a member of a certain LDAP group, instead of just having a valid login:
    248 {{{#!apache
    249   Require ldap-group CN=Trac Users,CN=Users,DC=example,DC=com
    250 }}}
    252 See 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
    259 If 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:
    260 {{{#!apache
    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
    271 </Location>
    272 }}}
    274 Using 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.
    276 Some common problems with SSPI authentication: [trac:#1055], [trac:#1168] and [trac:#3338].
    278 See also [trac:TracOnWindows/Advanced].
    280 === Using Apache authentication with the Account Manager plugin's Login form ===
    282 To 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.
    286 Here is an example (from the !HttpAuthStore link) using acct_mgr-0.4 for hosting a single project:
    287 {{{#!ini
    288 [components]
    289 ; be sure to enable the component
    290 acct_mgr.http.HttpAuthStore = enabled
    292 [account-manager]
    293 ; configure the plugin to use a page that is secured with http authentication
    294 authentication_url = /authFile
    295 password_store = HttpAuthStore
    296 }}}
    297 This will generally be matched with an Apache config like:
    298 {{{#!apache
    299 <Location /authFile>
    300    …HTTP authentication configuration…
    301    Require valid-user
    302 </Location>
    303 }}}
    304 Note 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
    308 Per 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.
    312 If 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:
    314 Create the htpasswd file:
    315 {{{#!sh
    316 cd /home/trac-for-my-proj/the-env
    317 htpasswd -c htpasswd firstuser
    318 ### and add more users to it as needed:
    319 htpasswd htpasswd seconduser
    320 }}}
    321 Keep the file above your document root for security reasons.
    323 Create this file e.g. (ubuntu) `/etc/apache2/sites-enabled/` with the following content:
    325 {{{#!apache
    326 <Directory /home/trac-for-my-proj/the-deploy/cgi-bin/trac.wsgi>
    327   WSGIApplicationGroup %{GLOBAL}
    328   Order deny,allow
    329   Allow from all
    330 </Directory>
    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>
    342 </VirtualHost>
    344 }}}
    346 Note: 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
    352 Please 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''
    356 If 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'
    360 If 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'.
    362 This WSGI script 'fixes' that:
    363 {{{#!python
    364 import os
    365 import trac.web.main
    367 os.environ['TRAC_ENV'] = '/usr/local/trac/mysite'
    368 os.environ['PYTHON_EGG_CACHE'] = '/usr/local/trac/mysite/eggs'
    370 def 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)
    374 }}}
    376 === Trac with PostgreSQL
    378 When 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.
    380 A 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.
    382 But it is not necessary to edit the source of Trac. The following lines in `trac.wsgi` will also work:
    384 {{{#!python
    385 import trac.db.postgres_backend
    386 trac.db.postgres_backend.PostgreSQLConnection.poolable = False
    387 }}}
    389 or
    391 {{{#!python
    392 import trac.db.mysql_backend
    393 trac.db.mysql_backend.MySQLConnection.poolable = False
    394 }}}
    396 Now 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
    402 For 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.
    404 ----
    405 See also: TracGuide, TracInstall, [wiki:TracFastCgi FastCGI], [wiki:TracModPython ModPython], [trac:TracNginxRecipe TracNginxRecipe]
  • wiki/pages/TracNavigation

    r37343 r37566  
    1 = Trac Navigation
    3 The 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] **
    11 In the following example we rename the link to WikiStart //Home//, and make the //View Tickets// entry link to a specific report.
    12 {{{#!ini
    13 [mainnav]
    14 wiki.label = Home
    15 tickets.href = /report/24
    16 }}}
    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.
    21 There 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 **
    26 {{{#!ini
    27 [metanav]
    28 help = disabled
    29 logout.redirect = wiki/Logout
    30 }}}
    33 === URL Formats
    34 Possible 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
    42 The `order` attribute specifies the order in which the navigation items are displayed. This can be particularly useful for plugins that add navigation items.
    44 Non-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.
    46 The default values are:
    47 {{{#!ini
    48 [mainnav]
    49 browser.order = 4
    50 newticket.order = 6
    51 roadmap.order = 3
    52 search.order = 7
    53 tickets.order = 5
    54 timeline.order = 2
    55 wiki.order = 1
    57 [metanav]
    58 about.order = 5
    59 help.order = 4
    60 login.order = 1
    61 logout.order = 2
    62 prefs.order = 3
    63 }}}
    65 === Context Navigation #ctxtnav-bar
    67 Note that it is still not possible to customize the '''contextual navigation bar''', ie the one usually placed below the main navigation bar.
    69 ----
    70 See also: TracInterfaceCustomization, and the [ TracHacks:NavAddPlugin] or [ TracHacks:MenusPlugin] (still needed for adding entries)
  • wiki/pages/TracNotification

    r37343 r37566  
    1 = Email Notification of Ticket Changes
    2 [[TracGuideToc]]
    4 Trac supports notification of ticket changes via email.
    6 Email 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.
    8 Disabled by default, notification can be activated and configured in [wiki:TracIni trac.ini].
    10 == Receiving Notification Mails
    11 When 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
    15 To 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.
    17 Alternatively, 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.
    19 When 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
    23 Since 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:
    24 {{{#!ini
    25 [components]
    26 trac.ticket.notification.TicketAttachmentNotifier = disabled
    27 }}}
    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
    34 These are the available options for the `[notification]` section in trac.ini:
    36 [[TracIni(notification)]]
    38 === Example Configuration (SMTP)
    39 {{{#!ini
    40 [notification]
    41 smtp_enabled = true
    42 smtp_server =
    43 smtp_from =
    44 smtp_replyto =
    45 smtp_always_cc =,
    46 }}}
    48 === Example Configuration (`sendmail`)
    49 {{{#!ini
    50 [notification]
    51 smtp_enabled = true
    52 email_sender = SendmailEmailSender
    53 sendmail_path = /usr/sbin/sendmail
    54 smtp_from =
    55 smtp_replyto =
    56 smtp_always_cc =,
    57 }}}
    59 === Subscriber Configuration
    60 The default subscriptions are configured in the `[notification-subscriber]` section in trac.ini:
    62 [[TracIni(notification-subscriber)]]
    64 Each user can override these defaults in his ''Notifications'' preferences.
    66 For 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
    69 The e-mail subject can be customized with the `ticket_subject_template` option, which contains a [ Genshi text template] snippet. The default value is:
    70 {{{#!genshi
    71 $prefix #$ $summary
    72 }}}
    73 The 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
    82 The 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:
    84 {{{#!genshi
    85 $ticket_body_hdr
    86 $ticket_props
    87 {% choose %}\
    88 {%   when True %}\
    89 $ticket.description
    90 {%   end %}\
    91 {%   otherwise %}\
    92 {%     if changes_body %}\
    93 ${_('Changes (by %(author)s):',}
    95 $changes_body
    96 {%     end %}\
    97 {%     if changes_descr %}\
    98 {%       if not changes_body and not change.comment and %}\
    99 ${_('Description changed by %(author)s:',}
    100 {%       end %}\
    101 $changes_descr
    102 --
    103 {%     end %}\
    104 {%     if change.comment %}\
    106 ${changes_body and _('Comment:') or _('Comment (by %(author)s):',}
    108 $change.comment
    109 {%     end %}\
    110 {%   end %}\
    111 {% end %}\
    113 --
    114 ${_('Ticket URL: <%(link)s>',}
    115 $ <${project.url or abs_href()}>
    116 $project.descr
    117 }}}
    119 == Sample Email
    120 {{{
    121 #42: testing
    122 ---------------------------+------------------------------------------------
    123        Id:  42             |      Status:  assigned               
    124 Component:  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:               
    128 ---------------------------+------------------------------------------------
    129 Changes:
    130   * component:  changeset view => search system
    131   * priority:  low => highest
    132   * owner:  jonas => anonymous
    133   * cc: =>
    135   * status:  new => assigned
    137 Comment:
    138 I'm interested too!
    140 --
    141 Ticket URL: <>
    142 My Project <>
    143 }}}
    145 == Customizing e-mail content for MS Outlook
    147 MS 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].
    149 Replace the following second row in the template:
    150 {{{
    151 $ticket_props
    152 }}}
    154 with this (requires Python 2.6 or later):
    155 {{{
    156 --------------------------------------------------------------------------
    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 %}\
    165 --------------------------------------------------------------------------
    166 }}}
    168 The 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"
    170 {{{#!html
    171 #42: testing<br />
    172 --------------------------------------------------------------------------<br />
    173 <table cellpadding=0>
    174 <tr><td>Reporter:</td><td></td></tr>
    175 <tr><td>Owner:</td><td>anonymous</td></tr>
    176 <tr><td>Type:</td><td>defect</td></tr>
    177 <tr><td>Status:</td><td>assigned</td></tr>
    178 <tr><td>Priority:</td><td>lowest</td></tr>
    179 <tr><td>Milestone:</td><td>0.9</td></tr>
    180 <tr><td>Component:</td><td>report system</td></tr>
    181 <tr><td>Severity:</td><td>major</td></tr>
    182 <tr><td>Resolution:</td><td> </td></tr>
    183 <tr><td>Keywords:</td><td> </td></tr>
    184 </table>
    185 --------------------------------------------------------------------------<br />
    186 Changes:<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 />
    195 Comment:<br />
    196 I'm interested too!<br />
    197 <br />
    198 --<br />
    199 Ticket URL: &lt;;<br />
    200 My Project &lt;;<br />
    201 }}}
    202 }}}
    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:
    205 {{{
    206    sel = ['Reporter', ..., 'Keywords', 'Custom1', 'Custom2']
    207 }}}
    209 However, the solution is still a workaround to an automatically HTML-formatted e-mail.
    211 == Using GMail as the SMTP relay host
    213 Use the following configuration snippet:
    214 {{{#!ini
    215 [notification]
    216 smtp_enabled = true
    217 use_tls = true
    218 mime_encoding = base64
    219 smtp_server =
    220 smtp_port = 587
    221 smtp_user = user
    222 smtp_password = password
    223 }}}
    225 where ''user'' and ''password'' match an existing GMail account, ie the ones you use to log in on [].
    227 Alternatively, you can use `smtp_port = 25`.[[br]]
    228 You 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
    232 If 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.
    234 Notification 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
    238 Typical error message:
    239 {{{#!sh
    240   ...
    241   File ".../", line 303, in connect
    242     raise socket.error, msg
    243   error: (13, 'Permission denied')
    244 }}}
    246 This 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.
    248 Many users get confused when their manual attempts to contact the SMTP server succeed:
    249 {{{#!sh
    250 telnet localhost 25
    251 }}}
    252 This is because a regular user may connect to the SMTP server, but the web server cannot:
    253 {{{#!sh
    254 sudo -u www-data telnet localhost 25
    255 }}}
    257 In 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.
    259 Relevant ML threads:
    260  * SELinux:
    262 For SELinux in Fedora 10:
    263 {{{#!sh
    264 $ setsebool -P httpd_can_sendmail 1
    265 }}}
    267 === ''Suspected spam'' error
    269 Some SMTP servers may reject the notification email sent by Trac.
    271 The 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.
    273 Quoted printable encoding works better with languages that use one of the Latin charsets. For Asian charsets, stick with the Base64 encoding.
    275 ----
    276 See also: TracTickets, TracIni, TracGuide, [trac:TracDev/NotificationApi]
  • wiki/pages/TracPermissions

    r37343 r37566  
    1 = Trac Permissions
    2 [[TracGuideToc]]
    4 Trac uses a simple, case sensitive, permission system to control what users can and can't access.
    6 Permission privileges are managed using the [TracAdmin trac-admin] tool or the ''General / Permissions'' panel in the ''Admin'' tab of the web interface.
    8 In 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.
    10 Non-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.
    11 In 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
    15 To 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):
    16 {{{
    17   $ trac-admin /path/to/projenv permission add bob TRAC_ADMIN
    18 }}}
    20 Then, 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)]]
    26 An 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.
    28 From 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
    32 To 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.
    34 Otherwise, 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. ||
    56 Attention: 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
    101 To 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
    105 You grant privileges to users using [wiki:TracAdmin trac-admin]. The current set of privileges can be listed with the following command:
    106 {{{
    107   $ trac-admin /path/to/projenv permission list
    108 }}}
    110 This command will allow the user ''bob'' to delete reports:
    111 {{{
    112   $ trac-admin /path/to/projenv permission add bob REPORT_DELETE
    113 }}}
    115 The `permission add` command also accepts multiple privilege names:
    116 {{{
    117   $ trac-admin /path/to/projenv permission add bob REPORT_DELETE WIKI_CREATE
    118 }}}
    120 Or add all privileges:
    121 {{{
    122   $ trac-admin /path/to/projenv permission add bob TRAC_ADMIN
    123 }}}
    125 == Permission Groups
    127 There are two built-in groups, "authenticated" and "anonymous".
    128 Any user who has not logged in is automatically in the "anonymous" group.
    129 Any user who has logged in is also in the "authenticated" group.
    130 The "authenticated" group inherits permissions from the "anonymous" group.
    131 For example, if the "anonymous" group has permission WIKI_MODIFY,
    132 it is not necessary to add the WIKI_MODIFY permission to the "authenticated" group as well.
    134 Custom groups may be defined that inherit permissions from the two built-in groups.
    136 Permissions can be grouped together to form roles such as ''developer'', ''admin'', etc.
    137 {{{
    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
    143 }}}
    145 Group 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
    148 Permission groups can be created by assigning a user to a group you wish to create, then assign permissions to that group.
    150 The 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)
    151 {{{
    152    $ trac-admin /path/to/projenv permission add bob beta_testers
    153    $ trac-admin /path/to/projenv permission add beta_testers WIKI_ADMIN
    155 }}}
    157 == Removing Permissions
    159 Permissions can be removed using the 'remove' command. For example:
    161 This command will prevent the user ''bob'' from deleting reports:
    162 {{{
    163   $ trac-admin /path/to/projenv permission remove bob REPORT_DELETE
    164 }}}
    166 Just like `permission add`, this command accepts multiple privilege names.
    168 You can also remove all privileges for a specific user:
    169 {{{
    170   $ trac-admin /path/to/projenv permission remove bob '*'
    171 }}}
    173 Or one privilege for all users:
    174 {{{
    175   $ trac-admin /path/to/projenv permission remove '*' REPORT_ADMIN
    176 }}}
    178 == Default Permissions
    180 By 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.
    181 On the other hand, the `authenticated` users will have the permissions to ''create and modify tickets and wiki pages''.
    183 '''anonymous'''
    184 {{{
    187  FILE_VIEW
    188  LOG_VIEW
    191  REPORT_VIEW
    193  SEARCH_VIEW
    194  TICKET_VIEW
    196  WIKI_VIEW
    197 }}}
    199 '''authenticated'''
    200 {{{
    203  WIKI_CREATE
    204  WIKI_MODIFY 
    205 }}}
    206 ----
    207 See also: TracAdmin, TracGuide and TracFineGrainedPermissions
  • wiki/pages/TracPlugins

    r37343 r37566  
    1 [[PageOutline(2-5,Contents,pullout)]]
    3 = Trac plugins
    5 Trac 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
    9 From 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
    13 To use egg-based plugins in Trac, you need to have [ setuptools] (version >= 0.6) installed.
    15 To install `setuptools`, download the bootstrap module [] and execute it as follows:
    17 {{{#!sh
    18 $ python
    19 }}}
    21 If the `` script fails to install the setuptools release, you can download it from [pypi:setuptools PyPI] and install it manually.
    23 Plugins 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
    29 Plugins are typically packaged as [ Python eggs]. That means they are .zip archives with the file extension `.egg`.
    31 If 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
    37 }}}
    39 You should now have an *.egg file. Examine the output of running Python to find where this was created.
    41 Once 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.
    43 To 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
    53 Some plugins, such as [trac:SpamFilter SpamFilter], are downloadable as an `.egg` file that can be installed with `easy_install` or `pip`:
    54 {{{#!sh
    55 $ easy_install TracSpamFilter
    56 $ pip install TracSpamFilter
    57 }}}
    59 If `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 [].
    63 If 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`:
    64 {{{#!sh
    65 $ easy_install --always-unzip TracSpamFilter-0.4.1_r10106-py2.6.egg
    66 }}}
    67 You should end up with a directory having the same name as the zipped egg, complete with `.egg` extension, and containing its uncompressed contents.
    69 Trac 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:
    74 {{{#!sh
    75 $ easy_install
    76 }}}
    78 ==== Enabling the plugin
    80 Unlike 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.
    82 This is done in the `[components]` section of the configuration file `trac.ini`. For example:
    83 {{{#!ini
    84 [components]
    85 tracspamfilter.* = enabled
    86 }}}
    88 The 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 ``.
    90 After installing the plugin, you must restart your web server.
    92 ==== Uninstalling
    94 Neither `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.
    101 If 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):
    102 {{{#!pycon
    103 >>> import myplugin
    104 >>> print myplugin.__file__
    105 /opt/local/python24/lib/site-packages/myplugin-0.4.2-py2.4.egg/myplugin/__init__.pyc
    106 }}}
    108 == Setting up the plugin cache
    110 Some 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.
    112 To do this from the Apache configuration, use the `SetEnv` directive:
    113 {{{#!apache
    114 SetEnv PYTHON_EGG_CACHE /path/to/dir
    115 }}}
    117 This 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.
    119 For example for CGI:
    120 {{{#!apache
    121  <Location /trac>
    122    SetEnv TRAC_ENV /path/to/projenv
    123    SetEnv PYTHON_EGG_CACHE /path/to/dir
    124  </Location>
    125 }}}
    127 Or for mod_python:
    128 {{{#!apache
    129  <Location /trac>
    130    SetHandler mod_python
    131    ...
    132    SetEnv PYTHON_EGG_CACHE /path/to/dir
    133  </Location>
    134 }}}
    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.
    138 For [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:
    142 {{{#!apache
    143 FastCgiConfig -initial-env TRAC_ENV=/var/lib/trac -initial-env PYTHON_EGG_CACHE=/var/lib/trac/plugin-cache
    144 }}}
    146 === About hook scripts
    148 If 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
    152 The [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
    157 If you wish to disable the second function for security reasons, add the following to your `trac.ini` file:
    158 {{{#!ini
    159 [components]
    160 trac.admin.web_ui.PluginAdminPanel = disabled
    161 }}}
    162 This disables the whole panel, so the first function will no longer be available either.
    164 == Troubleshooting
    166 === Is setuptools properly installed?
    168 Try this from the command line:
    169 {{{#!sh
    170 $ python -c "import pkg_resources"
    171 }}}
    173 If 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?
    177 Python 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).
    179 Also, 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?
    183 If 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
    192 Trac must be able to read the .egg file.
    194 === Check the log files
    196 Enable [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
    200 Some 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?
    204 If 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
    213 Okay, 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!
    215 ----
    216 See also TracGuide, [trac:PluginList plugin list], [trac:TracDev/ComponentArchitecture component architecture].
  • wiki/pages/TracQuery

    r37343 r37566  
    1 = Trac Ticket Queries
    2 [[TracGuideToc]]
    4 In addition to [wiki:TracReports reports], Trac provides support for ''custom ticket queries'', which can be used to display tickets that meet specified criteria.
    6 To configure and execute a custom query, switch to the ''View Tickets'' module from the navigation bar, and select the ''Custom Query'' link.
    8 == Filters
    10 When 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.
    15 Current 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.
    17 You 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.
    19 After you have edited your filters, click the ''Update'' button to refresh your results.
    21 == Navigating Tickets
    23 Clicking 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. 
    25 You 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.
    27 The query results can be refreshed and cleared of these status indicators by clicking the ''Update'' button again.
    29 == Saving Queries
    31 Trac 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.
    32 You 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
    40 You 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.
    41 {{{
    42 [query:status=new|assigned|reopened&version=1.0 Active tickets against 1.0]
    43 }}}
    45 Which is displayed as:
    46   [query:status=new|assigned|reopened&version=1.0 Active tickets against 1.0]
    48 This uses a very simple query language to specify the criteria, see [wiki:TracQuery#QueryLanguage Query Language].
    50 Alternatively, you can copy the query string of a query and paste that into the Wiki link, including the leading `?` character:
    51 {{{
    52 [query:?status=new&status=assigned&status=reopened&group=owner Assigned tickets by owner]
    53 }}}
    55 Which is displayed as:
    56   [query:?status=new&status=assigned&status=reopened&group=owner Assigned tickets by owner]
    58 === Customizing the ''table'' format
    60 You 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:
    61 {{{
    62 [[TicketQuery(max=3,status=closed,order=id,desc=1,format=table,col=resolution|summary|owner|reporter)]]
    63 }}}
    65 This is displayed as:
    66 [[TicketQuery(max=3,status=closed,order=id,desc=1,format=table,col=resolution|summary|owner|reporter)]]
    68 ==== Full rows
    70 In ''table'' format you can also have full rows by using ''rows=<field>'':
    71 {{{
    72 [[TicketQuery(max=3,status=closed,order=id,desc=1,format=table,col=resolution|summary|owner|reporter,rows=description)]]
    73 }}}
    75 This is displayed as:
    76 [[TicketQuery(max=3,status=closed,order=id,desc=1,format=table,col=resolution|summary|owner|reporter,rows=description)]]
    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 (`\`).
    82 The 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 ||
    88 All 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 ||
    94 The 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 ||
    100 ----
    101 See also: TracTickets, TracReports, TracGuide, TicketQuery
  • wiki/pages/TracReports

    r37343 r37566  
    1 = Trac Reports =
    2 [[TracGuideToc]]
    4 The Trac reports module provides a simple, yet powerful reporting facility
    5 to present information about tickets in the Trac database.
    7 Rather 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.''
    19 A 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 ==
    27 Simple reports - ungrouped reports to be specific - can be changed to be sorted by any column simply by clicking the column header.
    29 If 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 ==
    32 There 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
    38 Changing 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:
    39 {{{
    40 update report set id=5 where id=3;
    41 }}}
    42 Keep 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).
    44 You may also need to update or remove the report number stored in the report or query.
    46 == Navigating Tickets ==
    47 Clicking 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.
    49 You 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 ==
    52 Aside from the default HTML view, reports can also be exported in a number of alternative formats.
    53 At the bottom of the report page, you will find a list of available data formats. Click the desired link to
    54 download the alternative report format.
    56 === Comma-delimited - CSV (Comma Separated Values) ===
    57 Export 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 ===
    61 Like above, but uses tabs (\t) instead of comma.
    63 === RSS - XML Content Syndication ===
    64 All 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.
    66 ----
    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.'''
    74 A report is basically a single named SQL query, executed and presented by
    75 Trac.  Reports can be viewed and created from a custom SQL expression directly
    76 in the web interface.
    78 Typically, a report consists of a SELECT-expression from the 'ticket' table,
    79 using the available columns and sorting the way you want it.
    81 == Ticket columns ==
    82 The ''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
    101 See TracTickets for a detailed description of the column fields.
    103 Example: '''All active tickets, sorted by priority and time'''
    104 {{{
    105 SELECT 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
    109 }}}
    111 Dynamic variables can also be used in the report title and description (since 1.1.1).
    113 == Advanced Reports: Dynamic Variables ==
    114 For more flexible reports, Trac supports the use of ''dynamic variables'' in report SQL statements.
    115 In short, dynamic variables are ''special'' strings that are replaced by custom data before query execution.
    117 === Using Variables in a Query ===
    118 The syntax for dynamic variables is simple, any upper case word beginning with '$' is considered a variable.
    120 Example:
    121 {{{
    122 SELECT id AS ticket,summary FROM ticket WHERE priority=$PRIORITY
    123 }}}
    125 To assign a value to $PRIORITY when viewing the report, you must define it as an argument in the report URL, leaving out the leading '$'.
    127 Example:
    128 {{{
    130 }}}
    132 To use multiple variables, separate them with an '&'.
    134 Example:
    135 {{{
    137 }}}
    140 === !Special/Constant Variables ===
    141 There 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.
    145 Example (''List all tickets assigned to me''):
    146 {{{
    147 SELECT id AS ticket,summary FROM ticket WHERE owner=$USER
    148 }}}
    152 == Advanced Reports: Custom Formatting ==
    153 Trac is also capable of more advanced reports, including custom layouts,
    154 result grouping and user-defined CSS styles. To create such reports, we'll use
    155 specialized SQL statements to control the output of the Trac report engine.
    157 === Special Columns ===
    158 To format reports, TracReports looks for 'magic' column names in the query
    159 result. These 'magic' names are processed and affect the layout and style of the
    160 final 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.
    170 '''Example:'''
    171 {{{
    172 SELECT id AS ticket, created, status, summary FROM ticket
    173 }}}
    175 Those columns can also be defined but marked as hidden, see [#column-syntax below].
    177 See trac:wiki/CookBook/Configuration/Reports for some example of creating reports for realms other than ''ticket''.
    179 === Custom formatting columns ===
    180 Columns whose names begin and end with 2 underscores (Example: '''`__color__`''') are
    181 assumed 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.
    186 {{{
    187 #!html
    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>
    194 </div>
    195 }}}
    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''
    200 {{{
    201 SELECT 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
    210 }}}
    212 '''Note:''' A table join is used to match ''ticket'' priorities with their
    213 numeric representation from the ''enum'' table.
    215 === Changing layout of report rows === #column-syntax
    216 By default, all columns on each row are display on a single row in the HTML
    217 report, possibly formatted according to the descriptions above. However, it's
    218 also 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''
    229 {{{
    230 SELECT 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
    244 }}}
    246 === Reporting on custom fields ===
    248 If 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.
    250 If 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
    254 Beyond 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)
    257 In 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.
    258 The 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
    261 Note that if you write them after an SQL comment, `--`, you'll effectively disable rewriting if this is what you want!
    263 Let's take an example, consider the following SQL query:
    264 {{{
    265 -- ## 4: Assigned, Active Tickets by Owner ## --
    267 --
    268 -- List assigned tickets, group by ticket owner, sorted by priority.
    269 --
    271 SELECT 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'
    278 AND AND p.type='priority'
    279   ORDER BY __group__, p.value, severity, time
    280 }}}
    282 The automatic rewrite will be the following (4 rows per page, page 2, sorted by `component`):
    283 {{{
    284 SELECT 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'
    291 AND AND p.type='priority'
    292   ORDER BY __group__ ASC, `component` ASC,  __group__, p.value, severity, time
    293  LIMIT 4 OFFSET 4
    294 }}}
    296 The equivalent SQL query with the rewrite tokens would have been:
    297 {{{
    298 SELECT 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'
    305 AND AND p.type='priority'
    306   ORDER BY __group__, @SORT_COLUMN@, p.value, severity, time
    307 @LIMIT_OFFSET@
    308 }}}
    310 If you want to always sort first by priority and only then by the user selected sort column, simply use the following `ORDER BY` clause:
    311 {{{
    312   ORDER BY __group__, p.value, @SORT_COLUMN@, severity, time
    313 }}}
    315 ----
    316 See also: TracTickets, TracQuery, TracGuide, [ Query Language Understood by SQLite]
  • wiki/pages/TracRepositoryAdmin

    r37343 r37566  
    1 = Repository Administration
    2 [[PageOutline(2-3)]]
    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
    13 Support 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.
    15 The 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.
    17 {{{#!ini
    18 tracopt.versioncontrol.svn.* = enabled
    19 }}}
    21 {{{#!ini
    22 tracopt.versioncontrol.git.* = enabled
    23 }}}
    25 == Specifying repositories #Repositories
    26 Trac 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.
    28 It 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.
    30 A 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. ||
    44 A repository `name` and one of `alias` or `dir` attributes are mandatory. All others are optional.
    46 For 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.
    48 After 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
    55 Repositories 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.
    57 The 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.
    59 The 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.
    60 {{{#!ini
    61 [repositories]
    62 project.dir = /var/repos/project
    63 project.description = This is the ''main'' project repository.
    64 project.type = svn
    65 project.url =
    66 project.hidden = true
    68 lib.dir = /var/repos/lib
    69 lib.description = This is the secondary library code.
    70 lib.type = svn
    71 lib.url =
    73 .alias = project
    74 }}}
    75 Note that `name.alias = target` makes `name` an alias for the `target` repo, not the other way around.
    77 === In the database #ReposDatabase
    78 Repositories can also be specified in the database, using either the "Repositories" admin panel under "Version Control", or the `trac-admin $ENV repository` commands.
    80 The 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.
    82 The 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>`.
    96 Note 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
    100 The 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.
    102 Subversion 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
    105 Prior 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.
    107 There 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
    110 Please 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
    113 This 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.
    121 The `<repos>` argument can be either a repository name (use "`(default)`" for the default repository) or the path to the repository.
    123 Note 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
    127 The 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`):
    128 {{{#!sh
    129 #!/bin/sh
    130 export PYTHON_EGG_CACHE="/path/to/dir"
    131 /usr/bin/trac-admin /path/to/env changeset added "$1" "$2"
    132 }}}
    133 Note: Check with `whereis trac-admin`, whether `trac-admin` is really installed under `/usr/bin/` or maybe under `/usr/local/bin/` and adapt the path.
    134 On Windows (`post-commit.cmd`):
    135 {{{#!bat
    136 @C:\Python26\Scripts\trac-admin.exe C:\path\to\env changeset added "%1" "%2"
    137 }}}
    139 The post-revprop-change hook for Subversion is very similar. On Unix (`post-revprop-change`):
    140 {{{#!sh
    141 #!/bin/sh
    142 export PYTHON_EGG_CACHE="/path/to/dir"
    143 /usr/bin/trac-admin /path/to/env changeset modified "$1" "$2"
    144 }}}
    145 On Windows (`post-revprop-change.cmd`):
    146 {{{#!bat
    147 @C:\Python26\Scripts\trac-admin.exe C:\path\to\env changeset modified "%1" "%2"
    148 }}}
    150 The 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`.
    152 Note 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.
    154 See the [ section about hooks] in the Subversion book for more information. Other repository types will require different hook setups.
    156 ==== Git
    158 Git 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):
    159 {{{#!sh
    160 #!/bin/sh
    161 REV=$(git rev-parse HEAD)
    162 trac-admin /path/to/env changeset added <repos> $REV
    163 }}}
    165 Alternately, if your repository is one that only gets pushed to, add the following to the `hooks/post-receive` file in the repo:
    166 {{{#!sh
    167 #!/bin/sh
    168 tracenv=/path/to/env     # change with your Trac environment's path
    169 repos=                   # change with your repository's name
    170 while 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"
    176 done
    177 }}}
    179 The `<repos>` argument can be either a repository name (use "`(default)`" for the default repository) or the path to the repository.
    181 ==== Mercurial
    183 For 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):
    184 {{{#!ini
    185 [hooks]
    186 ; If mercurial-plugin is installed globally
    187 commit = python:tracext.hg.hooks.add_changesets
    188 changegroup = python:tracext.hg.hooks.add_changesets
    190 ; If mercurial-plugin is installed in a Trac plugins directory
    191 commit = python:/path/to/
    192 changegroup = python:/path/to/
    194 [trac]
    195 env = /path/to/env
    196 trac-admin = /path/to/trac-admin
    197 }}}
    199 === Per-request synchronization #PerRequestSync
    200 If 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`.
    202 Note 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
    206 You 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''
    210 This 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.
    211 {{{#!ini
    212 tracopt.ticket.commit_updater.* = enabled
    213 }}}
    214 For 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
    220 You 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

    r37343 r37566  
    1 = Viewing Revision Logs =
    2 [[TracGuideToc]]
    4 When 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 ==
    8 It 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.
    10 It is also possible to specify the revision at which the log should stop, using the ''Back to'' field. By default it is empty,
    11 which means the revision log will show the latest 100 revisions.
    13 Also, there are three modes of operation of the revision log.
    15 By 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.
    17 It 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.
    19 Each 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.
    21 It is even possible to go past an ''Add'' change, in order to see if there has been a ''Delete'' change on that path, before
    22 that ''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.
    24 Finally, there's also a checkbox ''Show full log messages'', which controls whether the full content of the commit log message
    25 should be displayed for each change, or only a shortened version of it.
    27 == The Revision Log Information ==
    29 For 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 ==
    51 The ''View changes...'' buttons (placed above and below the list of changes, on the left side) will show the set of differences
    52 corresponding to the aggregated changes starting from the ''old'' revision (first radio-button) to the ''new'' revision (second
    53 radio-button), in the TracChangeset view.
    55 Note that the ''old'' revision doesn't need to be actually ''older'' than the ''new'' revision: it simply gives a base
    56 for the diff. It's therefore entirely possible to easily generate a ''reverse diff'', for reverting what has been done
    57 in the given range of revisions.
    59 Finally, 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 ===
    65 At 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 ===
    69 The revision log also provides a RSS feed to monitor the changes. To subscribe to a RSS feed for a file or directory, open its
    70 revision 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.
    72 ----
    73 See also: TracBrowser, TracChangeset, TracGuide
  • wiki/pages/TracRoadmap

    r37343 r37566  
    1 = The Trac Roadmap
    2 [[TracGuideToc]]
    4 The 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
    8 A 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
    12 A 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.
    14 It 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
    18 With 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
    24 The 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]
    33 To 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.
    38 {{{
    39 RewriteEngine on
    40 RewriteRule ([^/.]+)/roadmap/([^/.]+)/ics /$1/roadmap?user=$2&format=ics
    41 }}}
    43 More information about iCalendar can be found at [ Wikipedia].
    44 ----
    45 See also: TracTickets, TracReports, TracQuery, [trac:TracRoadmapCustomGroups]
  • wiki/pages/TracRss

    r37343 r37566  
    1 = Using RSS with Trac
    2 [[TracGuideToc]]
    4 Several 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.
    6 Trac 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
    13 Anywhere in Trac where RSS is available, you should find a small orange '''RSS''' icon, typically at the bottom of the page:
    14 {{{#!html
    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>
    16 }}}
    17 Clicking 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''.
    21 Since 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.
    46 ----
    47 See also: TracGuide, TracTimeline, TracReports, TracBrowser
  • wiki/pages/TracSearch

    r37343 r37566  
    1 = Using Search
    3 Trac 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.
    5 Apart 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.
    7 The search results show the most recent modifications ranked first rather than the most relevant result.
    9 == Quick searches
    10 For 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
    21 To 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
    24 From 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
    28 ----
    29 See also: TracGuide, TracLinks, TracQuery
  • wiki/pages/TracStandalone

    r37343 r37566  
    1 = Tracd
    3 Tracd is a lightweight standalone Trac web server.
    4 It 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
    20 A single project on port 8080. (http://localhost:8080/)
    21 {{{#!sh
    22  $ tracd -p 8080 /path/to/project
    23 }}}
    24 Strictly speaking this will make your Trac accessible to everybody from your network rather than ''localhost only''. To truly limit it use the `--hostname` option.
    25 {{{#!sh
    26  $ tracd --hostname=localhost -p 8080 /path/to/project
    27 }}}
    28 With more than one project. (http://localhost:8080/project1/ and http://localhost:8080/project2/)
    29 {{{#!sh
    30  $ tracd -p 8080 /path/to/project1 /path/to/project2
    31 }}}
    33 You can't have the last portion of the path identical between the projects since Trac uses that name to keep the URLs of the
    34 different projects unique. So if you use `/project1/path/to` and `/project2/path/to`, you will only see the second project.
    36 An 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:
    37 {{{#!sh
    38  $ tracd -p 8080 -e /path/to
    39 }}}
    41 To 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
    46 To install as a Windows service, get the [ SRVANY] utility and run:
    47 {{{#!cmd
    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
    51 }}}
    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}}}.
    55 If you want tracd to start automatically when you boot Windows, do:
    56 {{{#!cmd
    57  sc config tracd start= auto
    58 }}}
    60 The spacing here is important.
    62 {{{#!div
    63 Once 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]]
    64 `HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\tracd\Parameters`
    66 Three (string) parameters are provided:
    67 ||!AppDirectory ||C:\Python26\ ||
    68 ||Application ||python.exe ||
    69 ||!AppParameters ||scripts\ -p 8080 ... ||
    71 Note 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.)
    73 }}}
    75 For Windows 7 User, srvany.exe may not be an option, so you can use [ WINSERV] utility and run:
    76 {{{#!cmd
    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>"
    78 net start tracd
    79 }}}
    81 === Option 2
    83 Use [ WindowsServiceScript], available at [ Trac Hacks]. Installs, removes, starts, stops, etc. your Trac service.
    85 === Option 3
    87 also cygwin's cygrunsrv.exe can be used:
    88 {{{#!sh
    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
    91 }}}
    93 == Using Authentication
    95 Tracd 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)
    97 Make 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).
    99 Tracd 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.
    101 The general format for using authentication is:
    102 {{{#!sh
    103  $ tracd -p port --auth="base_project_dir,password_file_path,realm" project_path
    104 }}}
    105 where:
    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.
    116 Examples:
    118 {{{#!sh
    119  $ tracd -p 8080 \
    120    --auth="project1,/path/to/passwordfile," /path/to/project1
    121 }}}
    123 Of course, the password file can be be shared so that it is used for more than one project:
    124 {{{#!sh
    125  $ tracd -p 8080 \
    126    --auth="project1,/path/to/passwordfile," \
    127    --auth="project2,/path/to/passwordfile," \
    128    /path/to/project1 /path/to/project2
    129 }}}
    131 Another way to share the password file is to specify "*" for the project name:
    132 {{{#!sh
    133  $ tracd -p 8080 \
    134    --auth="*,/path/to/users.htdigest," \
    135    /path/to/project1 /path/to/project2
    136 }}}
    138 === Basic Authorization: Using a htpasswd password file
    139 This 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.
    145 To create a .htpasswd file use Apache's `htpasswd` command (see [#GeneratingPasswordsWithoutApache below] for a method to create these files without using Apache):
    146 {{{#!sh
    147  $ sudo htpasswd -c /path/to/env/.htpasswd username
    148 }}}
    149 then for additional users:
    150 {{{#!sh
    151  $ sudo htpasswd /path/to/env/.htpasswd username2
    152 }}}
    154 Then to start `tracd` run something like this:
    155 {{{#!sh
    156  $ tracd -p 8080 --basic-auth="project,/fullpath/environmentname/.htpasswd,realmname" /path/to/project
    157 }}}
    159 For example:
    160 {{{#!sh
    161  $ tracd -p 8080 --basic-auth="project,/srv/tracenv/testenv/.htpasswd,My Test Env" /path/to/project
    162 }}}
    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
    167 If 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.
    169 Note 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
    173 Basic 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.
    175 Trac also provides `htpasswd` and `htdigest` scripts in `contrib`:
    176 {{{#!sh
    177 $ ./contrib/ -cb htpasswd user1 user1
    178 $ ./contrib/ -b htpasswd user2 user2
    179 }}}
    181 {{{#!sh
    182 $ ./contrib/ -cb htdigest trac user1 user1
    183 $ ./contrib/ -b htdigest trac user2 user2
    184 }}}
    186 ==== Using `md5sum`
    187 It is possible to use `md5sum` utility to generate digest-password file:
    188 {{{#!sh
    189 user=
    190 realm=
    191 password=
    192 path_to_file=
    193 echo ${user}:${realm}:$(printf "${user}:${realm}:${password}" | md5sum - | sed -e 's/\s\+-//') > ${path_to_file}
    194 }}}
    196 == Reference
    198 Here's the online help, as a reminder (`tracd --help`):
    199 {{{
    200 Usage: tracd [options] [projenv] ...
    202 Options:
    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],[real