# wiki

name: TracAdmin
author: trac
ipnr: 127.0.0.1
text:
  = TracAdmin

  [[PageOutline(2-5, Contents, pullout)]]
  [[TracGuideToc]]

  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.

  Some of the configurations can also be performed via the web administration module.

  == Usage

  For nearly every `trac-admin` command, the first argument must be the path to the TracEnvironment:
  {{{#!sh
  $ trac-admin /path/to/projenv wiki list
  }}}

  The only exception is for the `help` command, but even in this case, if you omit the environment you will only get a very succinct list of commands (`help` and `initenv`), the same list you would get when invoking `trac-admin` alone.
  `trac-admin --version` will tell you about the Trac version (e.g. 1.2) corresponding to the program.

  To get a comprehensive list of the available command and sub-command, specify the path to an environment:
  {{{#!sh
  $ trac-admin /path/to/projenv help
  }}}

  Some commands have more detailed help, which you can access by specifying the command's name as a subcommand for `help`:
  {{{#!sh
  $ trac-admin /path/to/projenv help <command>
  }}}

  When an error occurs in a `trac-admin` command the return value will be `2` and error messages are printed to `stderr`.

  === `trac-admin <targetdir> initenv` #initenv

  This subcommand is very important as is the one used to create a TracEnvironment in the specified `<targetdir>`. That directory must not exist prior to the call.

  [[TracAdminHelp(initenv)]]

  It supports the `--inherit` option, which specifies a global configuration file for sharing 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. The advantage of specifying the inherited configuration file at environment creation time is that only the options ''not'' specified in the global configuration file will be written to the environment's `conf/trac.ini` file.
  See TracIni#GlobalConfiguration.

  == Interactive Mode

  `trac-admin` starts in interactive mode when the environment path is the only argument.
  Commands can then be executed on the selected environment using the prompt, which offers tab-completion
  for non-Windows environments, and when the Python `readline` module is available. It also offers automatic repetition of the last command issued.

  Once you are in interactive mode, you can also get help on specific commands or subsets of commands:

  For example, to get an explanation of the `resync` command, run:
  {{{#!sh
  $ help resync
  }}}

  To get help on all the Wiki-related commands, run:
  {{{#!sh
  $ help wiki
  }}}

  == Full Command Reference

  You will 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 may add their own commands.

  [[TracAdminHelp()]]

  ----
  See also: TracBackup, TracEnvironment, TracIni, [trac:TracMigrate TracMigrate]


name: TracChangeLog
author: trac
ipnr: 127.0.0.1
text:
  [[PageOutline(2-3)]]
  = Change Log
  This is a rough list of changes between released versions.

  To see where Trac is going in future releases, see the [trac:roadmap Roadmap].


  == 1.3.x Releases

  This series of releases correspond to the development branch i.e. [trac:source:trunk trunk], in preparation for the future 1.4.x stable releases.

  See [trac:wiki:1.3/TracChangeLog#a1.3.xReleases 1.3.x Releases].


  == 1.2.x Releases

  This series correspond to the current stable release branch, i.e. [trac:source:branches/1.2-stable branches/1.2-stable].

  === 1.2.2

  //(June 21, 2017)//

  Trac 1.2.2 provides close to 2 dozen minor fixes and enhancements.
  The following are some highlights:

  * Invalid logging configuration changes made through the
    //Logging// admin page won't disable a Trac instance ([trac:#8790]).
  * Fix for regression that prevented
    [https://trac-hacks.org/wiki/PermRedirectPlugin PermRedirectPlugin]
    from redirecting ([trac:#12818])

  See the detailed release notes for [[trac:wiki:TracDev/ReleaseNotes/1.2#MaintenanceReleases | 1.2.2]] and [[trac:wiki:TracDev/ReleaseNotes/1.0#MaintenanceReleases | 1.0.14]] through [[trac:wiki:TracDev/ReleaseNotes/1.0#MaintenanceReleases | 1.0.15]] (as 1.2.2 also contains the changes in 1.0.14 and 1.0.15).

  [trac:source:/tags/trac-1.2.2 View Tag] | [trac:milestone:1.2.2 View Milestone]

  === 1.2.1

  //(March 29, 2017)//

  Trac 1.2.1, the first maintenance release in the 1.2.x series,
  provides more than 30 minor fixes and enhancements.
  The following are some highlights:

  * [WikiMacros#TracIni-macro TracIni macro] generates anchors for each option ([trac:#9401])
   and allows specifying exact options and sections to be rendered
   ([trac:#12633])
  * Several fixes for the enhanced Trac notification system
   ([trac:#11928], [trac:#12658], [trac:#12700])
  * Improved usability of ticket comment //Reply// and
   //Edit// buttons ([trac:#12671])
  * Restored missing ticket change conflict markers
   ([trac:#12730])

  See the detailed release notes for [[trac:wiki:TracDev/ReleaseNotes/1.2#MaintenanceReleases | 1.2.1]] and [[trac:wiki:TracDev/ReleaseNotes/1.0#MaintenanceReleases | 1.0.14]] (as 1.2.1 also contains the changes in 1.0.14).

  [trac:source:/tags/trac-1.2.1 View Tag] | [trac:milestone:1.2.1 View Milestone]

  === **1.2 'Hermes'**

  //(November 5, 2016)//

  Trac 1.2 is the first major release of Trac in more than 4 years.

  The following are some highlights from the release:

  * Extensible notification system ([trac:#3517])
  * Notification preference panel ([trac:#4056])
  * Usernames replaced with full names ([trac:#7339])
  * Restyled ticket changelog ([trac:#11835])
  * Workflow controls on the //New Ticket// page ([trac:#2045])
  * Editable wiki page version comments ([trac:#6573])
  * Datetime custom fields ([trac:#1942])

  For more information see the [trac:wiki:TracDev/ApiChanges/1.2 API changes] and the detailed
  release notes for [[trac:wiki:TracDev/ReleaseNotes/1.2|1.2]] and [[trac:wiki:TracDev/ReleaseNotes/1.0#MaintenanceReleases | 1.0.8 through 1.0.13]]
  (as 1.2 contains all the fixes done for 1.0.8 through 1.0.13).

  [trac:source:/tags/trac-1.2 View Tag] | [trac:milestone:1.2 View Milestone]

  == 1.1.x Releases
  // 1.1.x releases were development releases leading to Trac 1.2. See them as kind of snapshots of [trac:source:trunk].

  ** No guarantees of feature and API compatibility is made from one 1.1.x release to the next. //

  === 1.2rc1

  //(September 14, 2016)//

  The first Trac 1.2 release candidate is the culmination of nearly 4 years of development.

  Highlights of the changes since 1.1.6:

   - Pygments lexer options can be specified as [WikiProcessors WikiProcessor] arguments and defaults can be set in the environment configuration ([trac:#5654]).
   - Usernames are replaced with full names when `[trac]` `show_full_names` is true ([trac:#7339]).
   - Enum tables on the Ticket Admin pages can be reordered by drag and drop. ([trac:#11682]).
   - Ticket changelog is restyled and has a new //Show comments// preference ([trac:#11835]).
   - Authentication cookies can be shared across subdomains when `[trac]` `auth_cookie_domain` is configured ([trac:#12251]).

  For more information see the [trac:wiki:TracDev/ApiChanges/1.1 API changes] and the detailed
  release notes for [[trac:wiki:TracDev/ReleaseNotes/1.1#DevelopmentReleases | 1.2rc1]] and [[trac:wiki:TracDev/ReleaseNotes/1.0#MaintenanceReleases | 1.0.8 through 1.0.13]]
  (as 1.2rc1 contains all the fixes done for 1.0.8 through 1.0.13).

  [trac:source:/tags/trac-1.2rc1 View Tag] | [trac:milestone:1.2 View Milestone]

  === 1.1.6

  //(July 17, 2015)//

  Trac 1.1.6 contains more than a half dozen minor fixes and enhancements.

  For more information see the [trac:wiki:TracDev/ApiChanges/1.1 API changes] and the detailed
  release notes for [[trac:wiki:TracDev/ReleaseNotes/1.1#DevelopmentReleases | 1.1.6]] and [[trac:wiki:TracDev/ReleaseNotes/1.0#MaintenanceReleases | 1.0.7]]
  (as 1.1.6 contains all the fixes done for 1.0.7).

  [trac:source:/tags/trac-1.1.6 View Tag] | [trac:milestone:1.1.6 View Milestone]


  === 1.1.5

  //(May 18, 2015)//

  Highlights of the changes:

   - Corrected highlighting of unmodified values in //Config// section of the //About Trac// page ([trac:#6551]).
   - New helper methods on `DatabaseManager` class for plugins to upgrade the database ([trac:#8172]).
   - New `[notification-subscriber]` config section for general configuration of notification subscription defaults and `SubscriberList` macro ([trac:#11875]).
   - Removed dependency on `ConfigObj` for TracFineGrainedPermissions ([trac:#11982]).
   - `Image` macro supports InterWiki prefixes ([trac:#12025]).

  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.5]], [[trac:wiki:TracDev/ReleaseNotes/1.0#MaintenanceReleases | 1.0.6]] and [[trac:wiki:TracDev/ReleaseNotes/0.12#MaintenanceReleases | 0.12.7]]
  (as 1.1.5 contains all the fixes done for 1.0.6 and 0.12.7).

  [trac:source:/tags/trac-1.1.5 View Tag] | [trac:milestone:1.1.5 View Milestone]

  === 1.1.4

  //(March 24, 2015)//

  Highlights of the changes:

   - Performance improvements with MySQL/MariaDB ([trac:#3676]).
   - Click on //Permissions// Admin page table row toggles all
     checkboxes in the row ([trac:#11417]).
   - Configuration sections are written to trac.ini when enabling a
     component through TracAdmin or the web administration module
     ([trac:#11437]).
   - Subscription rules can be reordered by drag and drop ([trac:#11941]).

  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.4]]
  and [[trac:wiki:TracDev/ReleaseNotes/1.0#MaintenanceReleases | 1.0.4/1.0.5]]
  (as 1.1.4 contains all the fixes done for 1.0.4 and 1.0.5).

  [trac:source:/tags/trac-1.1.4 View Tag] | [trac:milestone:1.1.4 View Milestone]

  === 1.1.3

  //(January 13, 2015)//

  The following list contains highlights of the changes:

   - The ticket creation step can be configured in the TracWorkflow and the
     workflow controls are present on the !NewTicket page ([trac:#2045]).
   - New notification system that can be extended by plugins ([trac:#3517]).
   - New preferences panel for notification subscriptions ([trac:#4056]).
   - Wiki page version comments can be edited by users with `WIKI_ADMIN` ([trac:#6573]).
   - Improved positioning of //Add Comment// section and //author// field
     on the ticket form ([trac:#10207]).
   - The delete confirmation pages warn if attachments will also be deleted
     ([trac:#11542]).
   - Removed support for [trac:SilverCity], Enscript and !PhpRenderer syntax
     highlighters ([trac:#11795]).
   - Combined //Date & Time// and //Language// preference panels as
     //Localization// ([trac:#11813]).
   - Groups and permissions can be used in the workflow `set_owner` attribute
     ([trac:#11839]).

  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 
  for 1.0.3).

  [trac:source:/tags/trac-1.1.3 View Tag] | [trac:milestone:1.1.3 View Milestone]

  === 1.1.2

  //(October 23, 2014)//

  The following list contains highlights of the changes:

   - 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]).
   - 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]).
   - The new option `[ticket]` `optional_fields` specifies ticket select fields that are treated as optional (i.e. an empty value is allowed) ([trac:#10772]).
   - Line number and row highlighting annotations can be specified for !WikiProcessor code blocks ([trac:#10834]).
   - 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]).
   - Attachments can't be added to read-only wiki pages ([trac:#11244]).
   - Tables on the admin pages have a //Select all// checkbox in the header ([trac:#10994]).
   - Submit buttons are disabled if the required items are not selected ([trac:#11056]).
   - The Admin //Permissions// page has a //Copy Permissions// form for copying permissions between users and groups ([trac:#11099]).
   - 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]).
   - The //retarget// select is not shown when closing or deleting a milestone which has no tickets associated with it ([trac:#11366]).
   - //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]).
   - The `TitleIndex` macro supports relative path prefixes when used on wiki pages ([trac:#11455]).
   - [trac:CommitTicketUpdater] will recognize a ticket reference that includes a trailing `#comment:N` or `#comment:description` ([trac:#11622]).
   - 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]).
   - Authz policy can be used to restrict access to the //Report List// page using the resource id `-1` ([trac:#11697]).

  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).

  [trac:source:/tags/trac-1.1.2 View Tag] | [trac:milestone:1.1.2 View Milestone]

  === 1.1.1

  //(February 3, 2013)//

  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.

  The following list contains only a few highlights:

   - Added support for custom ticket fields of type time ([trac:#1942])
   - In new tickets, custom time ticket fields may default to an absolute or relative date / time ([trac:#10853])
   - In TracBatchModify, custom time ticket fields can be changed with a date(time)picker popup control ([trac:#10854])
   - Optionally display the component of tickets in their timeline entries (`[timeline]` `ticket_show_component` setting) ([trac:#10885])
   - Fixed batch modification when no fields are changed ([trac:#10924])
   - Dynamic variables can be used in the report title and description ([trac:#10979])
   - jQuery upgraded to 1.8.3, jQuery UI upgraded to 1.9.2 and jQuery UI Timepicker upgraded to 1.1.1 ([trac:#10976])
   - 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 ;-) )//

  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).

  [trac:source:/tags/trac-1.1.1 View Tag] | [trac:milestone:1.1.1 View Milestone]

  == 1.0.x Releases

  === 1.0.15

  //(June 16, 2017)//

  Trac 1.0.15 adds an option `[wiki]` `safe_origins`, for whitelisting URIs considered //safe cross-origin//.

  [trac:source:/tags/trac-1.0.15 View Tag] | [trac:milestone:1.0.15 View Milestone]

  === 1.0.14

  //(June 9, 2017)//

  Trac 1.0.14 provides more than 3 dozen bug fixes and minor
  enhancements. The following are some highlights:

   - Improved Git performance ([trac:#12545], [trac:#12694]).
   - Reduced memory usage exporting a zip file ([trac:#12765]).
   - Fixed batch modify not working for list fields
     (regression in 1.0.11) ([trac:#12585]).
   - Performance improvements to the Roadmap and Milestone 
     admin pages when there are many milestones and tickets
     ([trac:#12609]).
   - SECURITY: Possible XSS via reStructuredText link.
   - SECURITY: Injection of password prompt using Image
     macro or reStructuredText image.

  [trac:source:/tags/trac-1.0.14 View Tag] | [trac:milestone:1.0.14 View Milestone]

  === 1.0.13

  //(September 11, 2016)//

  Trac 1.0.13 provides around a dozen bug fixes and minor
  enhancements. The following are some highlights:

   - Use locale environment variables to negotiate locale 
     on console ([trac:#12418]).
   - Fixed using incorrect revisions when downloading a zip
     file via browser page from Git repository ([trac:#12557]).

  [trac:source:/tags/trac-1.0.13 View Tag] | [trac:milestone:1.0.13 View Milestone]

  === 1.0.12

  //(July 4, 2016)//

  Trac 1.0.12 provides around 20 bug fixes and minor enhancements. The following are some highlights:

   - Reconnect to PostgreSQL server after restarting it
     ([trac:#4984]).
   - Workflow actions on the batch modify form are sorted
     by the default attribute ([trac:#12447]).
   - Fixed Pygments stylesheet not found when style name
     contained a dash ([trac:#12505]).
   - Fixed incorrect parsing of projects list file by
     `GitwebProjectsRepositoryProvider` ([trac:#12518]).
   - `TracIni` macro displays option documentation as 
     multi-line rather than one-liner ([trac:#12522]).
   - Fixed regression with `GitConnector` leading to
     `IOError: Too many open files` ([trac:#12524]).

  [trac:source:/tags/trac-1.0.12 View Tag] | [trac:milestone:1.0.12 View Milestone]

  === 1.0.11

  //(May 7, 2016)//

  Trac 1.0.11 provides more than 30 bug fixes and minor
  enhancements. As in 1.0.10, an area of focus has been to
  eliminate tracebacks in the logs due to invalid requests.
  The following are some additional highlights:

   - Fixed resetting //Oldest first// after auto-preview of
     ticket change log ([trac:#12381]).
   - Trac is now distributed as wheel package ([trac:#12391]).
   - Fixed database exceptions in query system when 
     ''milestones/versions/enums'' are not defined and a custom
     field of the same name is added ([trac:#12399]).
   - Custom field //milestone// was not shown when
     standard //milestone// field was hidden ([trac:#12400]).
   - Query system now sorts by `enum.value` rather than
     `ticket.type` for `order=type` ([trac:#12402]). 
   - Added support for Babel 2.3.2 (2.3.0 and 2.3.1 should
     not be used)  ([trac:#12445]).

  [trac:source:/tags/trac-1.0.11 View Tag] | [trac:milestone:1.0.11 View Milestone]

  === 1.0.10

  //(February 20, 2016)//

  Trac 1.0.10 provides more than 30 bug fixes and minor enhancements. Two areas of focus
  have been fixing test failures on Windows and eliminating tracebacks in the logs due to
  invalid requests.

  See the detailed release notes for [[trac:wiki:TracDev/ReleaseNotes/1.0#MaintenanceReleases | 1.0.10]].

  [trac:source:/tags/trac-1.0.10 View Tag] | [trac:milestone:1.0.10 View Milestone]

  === 1.0.9

  //(September 10, 2015)//

  Trac 1.0.9 provides more than a dozen minor fixes and enhancements, including significantly reduced memory usage by the Git repository connector.

  See the detailed release notes for [[trac:wiki:TracDev/ReleaseNotes/1.0#MaintenanceReleases | 1.0.9]].

  [trac:source:/tags/trac-1.0.9 View Tag] | [trac:milestone:1.0.9 View Milestone]

  === 1.0.8

  //(July 24, 2015)//

  Trac 1.0.8 fixes a regression introduced in Trac 1.0.7: the session
  for an authenticated username containing non-alphanumeric characters
  could not be retrieved, resulting in the user being denied access to
  every realm and resource ([trac:#12129]).

  See the detailed release notes for [[trac:wiki:TracDev/ReleaseNotes/1.0#MaintenanceReleases | 1.0.8]].

  [trac:source:/tags/trac-1.0.8 View Tag] | [trac:milestone:1.0.8 View Milestone]

  === 1.0.7

  //(July 17, 2015)//

  Trac 1.0.7 contains more than a dozen minor fixes and enhancements, including the following highlights:
   - Custom `svn:keywords` definitions are expanded in Subversion 1.8 and later ([trac:#11364]).
   - Fixed MySQL performance regression in query with custom fields ([trac:#12113]).

  See the detailed release notes for [[trac:wiki:TracDev/ReleaseNotes/1.0#MaintenanceReleases | 1.0.7]].

  [trac:source:/tags/trac-1.0.7 View Tag] | [trac:milestone:1.0.7 View Milestone]

  === 1.0.6

  //(May 20, 2015)//

  Trac 1.0.6 provides more than 20 fixes and enhancements. The following are some highlights:
   - Hash changeset ids and branch names can be used in revision ranges ([trac:#11050])
   - Improved rendering performance using chunked response when `[trac]` `use_chunked_encoding` is `True` ([trac:#11802])
   - Improved performance of Git repositories ([trac:#11971]).
   - 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]).
   - Symbolic link can be used for `conf/trac.ini` in environment directory ([trac:#12000]).
   - Hyphen character can be used in !WikiProcessor parameter name ([trac:#12023]).

  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 also contains the changes in 0.12.7).

  [trac:source:/tags/trac-1.0.6 View Tag] | [trac:milestone:1.0.6 View Milestone]

  === 1.0.5

  //(March 24, 2015)//

  Trac 1.0.5 provides several fixes. The following are some highlights:

   - Images are not rendered in the timeline ([trac:#10751]).
   - Git tags are shown in the browser view ([trac:#11964]).
   - Added support for `journal_mode` and `synchronous` pragmas
     in `sqlite:` database connection string ([trac:#11967]).

  See the detailed release notes for [[trac:wiki:TracDev/ReleaseNotes/1.0#MaintenanceReleases | 1.0.5]].

  [trac:source:/tags/trac-1.0.5 View Tag] | [trac:milestone:1.0.5 View Milestone]

  === 1.0.4

  //(February 8, 2015)//

  Trac 1.0.4 contains a few fixes, including a fix for a regression in 1.0.3.

   - Workflow action labels were not displayed unless name attribute
     was explicitly defined ([trac:#11930]).

  See the detailed release notes for [[trac:wiki:TracDev/ReleaseNotes/1.0#MaintenanceReleases | 1.0.4]].

  [trac:source:/tags/trac-1.0.4 View Tag] | [trac:milestone:1.0.4 View Milestone]

  === 1.0.3

  //(January 13, 2015)//

  Trac 1.0.3 is a maintenance release containing numerous fixes and minor
  enhancements. The following are a few of the highlights:

  The following list contains only a few highlights:

   - Notification is sent when adding an attachment to a ticket ([trac:#2259]).
   - Stylesheets and scripts are loaded during autopreview, resulting in proper
     syntax highlighting when code WikiProcessors are added ([trac:#10470]) and display
     of Workflow graphs without explicit autopreview ([trac:#10674]).
   - Merge changesets are shown as differences against first parent, resulting
     in less noisy changesets ([trac:#10740]).
   - Pygments 2.0 is supported ([trac:#11796]).
   - Fixed error when completing the `initenv` TracAdmin command ([trac:#11797]).
   - Performance improvement on systems with many thousands of authenticated
     users due to caching of Environment.get_known_users ([trac:#11868]).
   - Distribution metadata of wheel package is supported and displayed on the
     About page ([trac:#11877]).
   - … and more than 3 dozen total fixes!

  See the detailed release notes for [[trac:wiki:TracDev/ReleaseNotes/1.0#MaintenanceReleases | 1.0.3]].

  [trac:source:/tags/trac-1.0.3 View Tag] | [trac:milestone:1.0.3 View Milestone]


  === 1.0.2

  //(October 23, 2014)//

  Trac 1.0.2 contains a number of bug fixes and minor enhancements, as well as a major update for many translations.

  The following list contains only a few highlights:

   - Subversion keywords are expanded and EOL substitutions made when viewing a file in the repository browser and when downloading a file ([trac:#717]). 
   - Notification email is sent to the old owner when a ticket is reassigned ([trac:#2311]).
   - Ticket change history is updated when renaming and deleting a milestone, and when retargeting tickets to another milestone ([trac:#4582], [trac:#5658]).
   - 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.
   - Multiple forms submits are disallowed ([trac:#10138]).
   - `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]).
   - Wiki toolbars can be disabled through a configuration setting ([trac:#10837])
   - The number of entries in a table is shown next to heading on applicable admin pages ([trac:#11027]).
   - //Cancel// buttons are consistently located on all pages ([trac:#11076]).
   - Focus is placed on a text element when an edit page is loaded ([trac:#11084]).
   - The //Edit conflict// and //Merge// warning messages are always visible in side-by-side edit mode ([trac:#11102]).
   - Improvements to the layout of the Report ([trac:#11106], [trac:#11664]) and Ticket pages ([trac:#11471]).
   - Genshi 0.7 compatibility ([trac:#11218]).
   - Numerous minor fixes for Git repository support.
   - … and more than a hundred more fixes!

  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).

  [trac:source:/tags/trac-1.0.2 View Tag] | [trac:milestone:1.0.2 View Milestone]


  === 1.0.1

  //(February 1, 2013)//

  Trac 1.0.1 contains a number of bug fixes and minor enhancements, as well as a major update for many translations.

  The following list contains only a few highlights:

   - Fix zip source download for large directories in Subversion repositories ([trac:#10840])
   - Performance improvement for the Roadmap, by caching milestone properties ([trac:#10879])
   - Added a ''select all'' checkbox to table of components for each plugin on the Plugins admin panel ([trac:#9609])
   - Restore the ''Modify'' link at the top of the ticket page, as it was in Trac 0.12 ([trac:#10856])
   - `ListOption` keeps values other than empty string and None in raw list as default ([trac:#10541])
   - Prevent possibility of multiple identical info or warning messages being presented to the user ([trac:#10987])
   - The !BatchModify select-all checkboxes are toggled with tri-state behavior when the ticket checkboxes are toggled ([trac:#10992])
   - Update the ticket changetime to the current time when deleting a ticket comment ([trac:#10486])

  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).

  [trac:source:/tags/trac-1.0.1 View Tag] | [trac:milestone:1.0.1 View Milestone]


  === '''1.0 'Cell' '''

  //(September 7, 2012)//

  Trac 1.0 is a major release adding refreshed user interface and improved DVCS repository support as the most visible changes.

  The following list contains only a few highlights:
   - 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) 
   - 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
   - As a consequence, the Subversion support has been moved below `tracopt.versioncontrol` as well
   - The Git and Mercurial log view feature a visualization of the branching structure 
   - Usability improvements for the tickets, with a better support for conflict detection and resolution
   - Integration of the [TH:BatchModifyPlugin], contributed by Brian Meeker (many thanks!) and is now maintained there as a default component
   - jQuery/UI integration, featuring a date picker for date fields
   - Improved integration with Pygments syntax highlighting
   - ... and numerous smaller features added and bugs fixed since 0.12!

  See the full list in [trac:wiki:TracDev/ReleaseNotes/1.0 1.0].

  [[trac:source:/tags/trac-1.0 View Tag]] | [[trac:milestone:1.0 View Milestone]]

  == 0.12.x Releases

  === 0.12.7

  //(July 12, 2015)//

  Trac 0.12.7 fixes a minor security issue, as well as a half dozen other minor issues:
   - InterWiki filters links through `[wiki] safe_schemes` option if `[wiki] render_unsafe_content` is disabled ([trac:#12053]).

  See the detailed release notes for [[trac:wiki:TracDev/ReleaseNotes/0.12#MaintenanceReleases | 0.12.7]].

  [trac:source:/tags/trac-0.12.7 View Tag] | [trac:milestone:0.12.7 View Milestone]

  === 0.12.6

  //(October 23, 2014)//

  Trac 0.12.6 contains fixes for a few issues:
   - 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]).
   - Improved performance rendering `svn:mergeinfo` properties in browser view ([trac:#8459]) and changeset view ([trac:#11219]).
   - Query with many custom fields would fail ([trac:#11140]).
   - Zip archive had a timestamp with no timezone information ([trac:#11162]).
   - Failure or incorrect ranges rendering log TracLinks ([trac:#11308], [trac:#11346]).
   - Textareas in ticket view did not wrap correctly in IE 11 ([trac:#11376]).
   - Emails were not being obfuscated in owner field on CSV export from ticket and query pages ([trac:#11594]).
   - Locale data was not being included in egg in Distribute 0.6.29 and later ([trac:#11640]).
   - Deleting a milestone would not delete its attachments ([trac:#11672]).
   - Added support for Babel 1.0 and later ([trac:#11258], [trac:#11345]).
   - Added support for `ConfigObj` 5.0 and later ([trac:#11498]).
   - … and dozens more fixes!

  See the detailed release notes for [[trac:wiki:TracDev/ReleaseNotes/0.12#MaintenanceReleases | 0.12.6]].

  [trac:source:/tags/trac-0.12.6 View Tag] | [trac:milestone:0.12.6 View Milestone]

  === 0.12.5

  //(January 15, 2013)//

  Trac 0.12.5 contains fixes for a few issues:
   - upload of .mht files ([Wikipedia:MHTML] web page archive files) now works ([trac:#9880])
   - more robust parsing of attachment URLs ([trac:#10280]) and uploaded file names ([trac:#10850])
   - 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])
   - no longer generate invalid JSON encoded data with Python 2.4 and 2.5 ([trac:#10877])
   - ... and fix a couple more minor defects ([trac:#10967], [trac:#10892], [trac:#10923], [trac:#10858], [trac:#10835])

  [trac:source:/tags/trac-0.12.5 View Tag] | [trac:milestone:0.12.5 View Milestone]

  === 0.12.4 

  //(September 7, 2012)//

  Trac 0.12.4 contains only a handful of minor fixes.

  [trac:source:/tags/trac-0.12.4 View Tag] | [trac:milestone:0.12.4 View Milestone]

  === 0.12.3 ===

  //(February 6, 2012)//

  Trac 0.12.3 contains a few minor fixes and a few minor features.
   - compatibility with Subversion 1.7 ([trac:#10414])
   - easier troubleshooting of common startup errors ([trac:#10024])
   - jQuery upgraded to 1.4.4 ([trac:#10001])
   - improve fine-grained permission handling in the source browser ([trac:#9976], [trac:#10208], [trac:#10110])
   - added compatibility with MySQL 5.5.3 utf8mb4 databases ([trac:#9766])
   - ... and dozens more fixes!

  [trac:source:/tags/trac-0.12.3 View Tag] | [trac:milestone:0.12.3 View Milestone]

  === 0.12.2

  //(January 31, 2011)//

  Trac 0.12.2 contains a few minor fixes and a few minor features.

  This list contains only a few highlights:
   - install: improved robustness of Trac installation if Babel is
     installed after the fact ([trac:#9439], [trac:#9595], [trac:#9961])
   - notifications: support for Asian character width ([trac:#4717])
   - roadmap: fix display of progress bar in some corner cases ([trac:#9718])
     and respect the overall_completion milestone group setting ([trac:#9721])
   - reports: reports and queries look much better, as the columns now
     keep the same width across groups; the absence of word wrapping in
     reports has been fixed ([trac:#9825])
   - web admin: improved layout ([trac:#8866], [trac:#9963])
   - web: it's now possible to log in different Trac instances sharing
     the same URL prefix (e.g. /project and /project-test) ([trac:#9951])

  [trac:source:/tags/trac-0.12.2 View Tag] | [trac:milestone:0.12.2 View Milestone]

  === 0.12.1

  //(October 9, 2010)//

  Trac 0.12.1 contains a few important performance improvements, some minor fixes and a few minor features.

  This list contains only a few highlights:
   - db: improve concurrency behavior ([trac:#9111])
   - fcgi: add an environment variable `TRAC_USE_FLUP` to control the usage of flup vs. bundled _fcgi.py (defaults to 0, i.e. use bundled as before)
   - svn authz: improve compatibility with svn 1.5 format ([trac:#8289])
   - milestone: allow to set the time for the due date ([trac:#6369], [trac:#9582])
   - ticket: fixes for the CC: property ([trac:#8597], [trac:#9522])
   - notification: improved the formatting of ticket fields in notification e-mails ([trac:#9484], [trac:#9494])
   - i18n: added a configuration option to set the default language ([trac:#8117])
   - several fixes for upgrade ([trac:#9400], [trac:#9416], [trac:#9483], [trac:#9556])

  [trac:source:/tags/trac-0.12.1 View Tag] | [trac:milestone:0.12.1 View Milestone]

  === ''' 0.12 'Babel' '''

  //(June 13, 2010)//

  Trac 0.12 is a major release introducing i18n and multiple repository support as the most visible changes.

  The following list contains only a few highlights:
   - The user interface is translated in a dozen of languages, provided the [Babel:] package is installed
   - Multiple repositories can be associated to a single Trac environment; the repositories can be of heterogeneous types (svn, hg, git, darcs...)
   - Usability improvements for the Wiki, with a nice side-by-side edit mode with automatic preview
   - Richer Wiki syntax, with much improved support for tables, partial [trac:WikiCreole] compatibility and numerous smaller improvements
   - Usability improvements for the Ticket module, with automatic preview of comments while you type and possibility to edit or remove them later
   - Improved Custom Queries (time fields, multiple disjoint conditions, a.k.a. OR queries)
   - Timeline filtering by user
   - ... and numerous smaller features added and bugs fixed since 0.11!

  [trac:source:/tags/trac-0.12 View Tag] | [trac:milestone:0.12 View Milestone]

  == Older Releases

  For releases prior to 0.12, see [trac:TracChangeLog@95].


name: CamelCase
author: trac
ipnr: 127.0.0.1
text:
  = !CamelCase

  New wiki links are automatically created when concatenating capitalized words, such that for example the words 'Camel' and 'Case' concatenated form a link to this CamelCase page. 

  !CamelCase is the original wiki convention for creating hyperlinks, with the additional requirement that the capital letters are followed by a lower-case letter; hence "AlabamA" and "ABc" will not be links.

  == Customizing the Wiki behavior

  While Trac remains faithful to the original Wiki style, it also provides a number of ways to accommodate users with different preferences:
   * To prevent the creation of a link for the CamelCase word, prefix the word with an exclamation mark (`!`): `!CamelCase`.
   * By default a CamelCase word with no corresponding Wiki page will be rendered as a gray link followed by a question mark. This is useful for example when the CamelCase style is used to name code artefacts like class names, and a Wiki page is expected to exist to document each class. The behavior can be configured through the [TracIni#wiki-ignore_missing_pages-option "[wiki] ignore_missing_pages"] option in TracIni.
   * To automatically insert space characters between the words of a CamelCase link when rendering the link, enable [TracIni#wiki-split_page_names-option "[wiki] split_page_names"] of TracIni.
   * Creation of explicit Wiki links is also easy, see WikiPageNames for details.
   * Wiki formatting can be disabled completely in some places, for example when rendering commit log messages. See the [TracIni#changeset-wiki_format_messages-option "[wiki] wiki_format_messages"] option in TracIni.

  See TracIni for more information on the available options.

  == More information on !CamelCase

   * http://c2.com/cgi/wiki?WikiCase
   * http://en.wikipedia.org/wiki/CamelCase

  ----
  See also: WikiPageNames, WikiNewPage, WikiFormatting, TracWiki


name: TracFastCgi
author: trac
ipnr: 127.0.0.1
text:
  = Trac with FastCGI

  [[TracGuideToc]]
  [[PageOutline(2-5, Contents, floated)]]

  [http://www.fastcgi.com/ 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 a much wider variety of web servers.

  Note that unlike mod_python, FastCGI supports [http://httpd.apache.org/docs/suexec.html 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.

  '''Note for Windows:''' Trac's FastCGI does not run under Windows, as Windows does not implement `Socket.fromfd`, which is used by `_fcgi.py`. If you want to connect to IIS, you may want to try [trac:TracOnWindowsIisAjp AJP]/[trac:TracOnWindowsIisAjp ISAPI].

  == Apache configuration

  There are two FastCGI modules commonly available for Apache: `mod_fastcgi` and `mod_fcgid` (preferred). The latter is more up-to-date.

  The following sections focus on the FCGI specific setup, see also [wiki:TracModWSGI#ConfiguringAuthentication] for configuring the authentication in Apache.

  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`.

  === Set up with `mod_fastcgi`

  `mod_fastcgi` uses `FastCgiIpcDir` and `FastCgiConfig` directives that should be added to an appropriate Apache configuration file:
  {{{#!apache
  # Enable fastcgi for .fcgi files
  # (If you're using a distro package for mod_fcgi, something like
  # this is probably already present)
  <IfModule mod_fastcgi.c>
     AddHandler fastcgi-script .fcgi
     FastCgiIpcDir /var/lib/apache2/fastcgi 
  </IfModule>
  LoadModule fastcgi_module /usr/lib/apache2/modules/mod_fastcgi.so
  }}}

  Setting `FastCgiIpcDir` is optional if the default is suitable. Note that the `LoadModule` line must be after the `IfModule` group.

  Configure `ScriptAlias` or similar options as described in TracCgi, but calling `trac.fcgi` instead of `trac.cgi`.

  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:
  {{{#!apache
  FastCgiConfig -initial-env TRAC_ENV=/path/to/env/trac
  }}}

  Alternatively, you can serve multiple Trac projects in a directory by adding this:
  {{{#!apache
  FastCgiConfig -initial-env TRAC_ENV_PARENT_DIR=/parent/dir/of/projects
  }}}

  You can also specify the `PYTHON_EGG_CACHE` environment variable using a second `-initial-env` directive:
  {{{#!apache
  FastCgiConfig -initial-env TRAC_ENV=/var/lib/trac \ 
      -initial-env PYTHON_EGG_CACHE=/var/lib/trac/plugin-cache
  }}}

  === Set up with `mod_fcgid`

  Configure `ScriptAlias` (see TracCgi for details), but call `trac.fcgi` instead of `trac.cgi`:
  {{{#!apache
  ScriptAlias /trac /path/to/www/trac/cgi-bin/trac.fcgi/
  }}}

  Note the slash at the end.

  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 the alternative environment setup below:
  {{{#!apache
  DefaultInitEnv TRAC_ENV /path/to/env/trac/
  }}}

  === Alternative environment setup

  A better method to specify the 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 [http://www.lighttpd.net/ lighttpd] and CGI:
  {{{#!python
  import os
  os.environ['TRAC_ENV'] = "/path/to/projectenv"
  }}}

  or:
  {{{#!python
  import os
  os.environ['TRAC_ENV_PARENT_DIR'] = "/path/to/project/parent/dir"
  }}}

  With this method different projects can be supported by using different `.fcgi` scripts with different `ScriptAliases`.

  See [https://coderanger.net/~coderanger/httpd/fcgi_example.conf this fcgid example config] which uses a !ScriptAlias directive with trac.fcgi with a trailing / like this:
  {{{#!apache
  ScriptAlias / /srv/tracsite/cgi-bin/trac.fcgi/
  }}}

  == Cherokee Configuration

  Configuring [http://cherokee-project.com/ Cherokee] with Trac is straightforward, if you spawn Trac as an SCGI process. You can either start it manually, or better yet, automatically by letting Cherokee spawn the server whenever it is down.

  First set up an information source in cherokee-admin with a local interpreter:

  {{{
  Host:
  localhost:4433

  Interpreter:
  /usr/bin/tracd —single-env —daemonize —protocol=scgi —hostname=localhost —port=4433 /path/to/project/
  }}}

  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''.

  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, trac.example.net for instance, and will only need two rules. The '''default''' one will use the SCGI handler associated to the previously created information source.
  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).

  '''Note:''' If the tracd process fails to start up, and Cherokee displays a 503 error page, you might be missing the [http://trac.saddi.com/flup python-flup] package ([trac:#9903]). Python-flup is a dependency which provides Trac with SCGI capability. You can install it on Debian based systems with:
  {{{#!sh
  sudo apt-get install python-flup
  }}}

  == Lighttpd Configuration

  The FastCGI front-end was developed primarily for use with alternative webservers, such as [http://www.lighttpd.net/ Lighttpd].

  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.

  For using `trac.fcgi`(prior to 0.11) / fcgi_frontend.py (0.11) with Lighttpd add the following to your lighttpd.conf:
  {{{
  #var.fcgi_binary="/usr/bin/python /path/to/fcgi_frontend.py" # 0.11 if installed with easy_setup, it is inside the egg directory
  var.fcgi_binary="/path/to/cgi-bin/trac.fcgi" # 0.10 name of prior fcgi executable
  fastcgi.server = ("/trac" =>
     
                     ("trac" =>
                       ("socket" => "/tmp/trac-fastcgi.sock",
                        "bin-path" => fcgi_binary,
                        "check-local" => "disable",
                        "bin-environment" =>
                          ("TRAC_ENV" => "/path/to/projenv")
                       )
                     )
                   )
  }}}

  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.

  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.

  For using two projects with lighttpd add the following to your `lighttpd.conf`:
  {{{
  fastcgi.server = ("/first" =>
                     ("first" =>
                      ("socket" => "/tmp/trac-fastcgi-first.sock",
                       "bin-path" => fcgi_binary,
                       "check-local" => "disable",
                       "bin-environment" =>
                         ("TRAC_ENV" => "/path/to/projenv-first")
                      )
                    ),
                    "/second" =>
                      ("second" =>
                      ("socket" => "/tmp/trac-fastcgi-second.sock",
                       "bin-path" => fcgi_binary,
                       "check-local" => "disable",
                       "bin-environment" =>
                         ("TRAC_ENV" => "/path/to/projenv-second")
                      )
                    )
                  )
  }}}

  Note that the 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.
  Note that the above will result in different processes in any event, even if both are running from the same `trac.fcgi` script.

  {{{#!div class=important
  '''Note:''' The order in which the server.modules are loaded is very important: if mod_auth is not loaded '''before''' mod_fastcgi, then the server will fail to authenticate the user.
  }}}

  For authentication you should enable mod_auth in lighttpd.conf 'server.modules', select auth.backend and auth rules:
  {{{
  server.modules              = (
  ...
    "mod_auth",
  ...
  )

  auth.backend               = "htpasswd"

  # Separated password files for each project
  # See "Conditional Configuration" in
  # http://trac.lighttpd.net/trac/file/branches/lighttpd-merge-1.4.x/doc/configuration.txt

  $HTTP["url"] =~ "^/first/" {
    auth.backend.htpasswd.userfile = "/path/to/projenv-first/htpasswd.htaccess"
  }
  $HTTP["url"] =~ "^/second/" {
    auth.backend.htpasswd.userfile = "/path/to/projenv-second/htpasswd.htaccess"
  }

  # Enable auth on trac URLs, see
  # http://trac.lighttpd.net/trac/file/branches/lighttpd-merge-1.4.x/doc/authentication.txt

  auth.require = ("/first/login" =>
                  ("method"  => "basic",
                   "realm"   => "First project",
                   "require" => "valid-user"
                  ),
                  "/second/login" =>
                  ("method"  => "basic",
                   "realm"   => "Second project",
                   "require" => "valid-user"
                  )
                 )

  }}}

  Note that Lighttpd (v1.4.3) stops if the password file doesn't exist.

  Note that Lighttpd doesn't support 'valid-user' in versions prior to 1.3.16.

  Conditional configuration is also useful for mapping static resources, ie serving out images and CSS directly instead of through FastCGI:
  {{{
  # Aliasing functionality is needed
  server.modules += ("mod_alias")

  # Set up an alias for the static resources
  alias.url = ("/trac/chrome/common" => "/usr/share/trac/htdocs")

  # Use negative lookahead, matching all requests that ask for any resource under /trac, EXCEPT in
  # /trac/chrome/common, and use FastCGI for those
  $HTTP["url"] =~ "^/trac(?!/chrome/common)" {
  # Even if you have other fastcgi.server declarations for applications other than Trac, do NOT use += here
  fastcgi.server = ("/trac" =>
                     ("trac" =>
                       ("socket" => "/tmp/trac-fastcgi.sock",
                        "bin-path" => fcgi_binary,
                        "check-local" => "disable",
                        "bin-environment" =>
                          ("TRAC_ENV" => "/path/to/projenv")
                       )
                     )
                   )
  }
  }}}

  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.

  Also there is another way to handle multiple projects and it uses `TRAC_ENV_PARENT_DIR` instead of `TRAC_ENV` as well as global authentication:
  {{{
  #  This is for handling multiple projects
    alias.url       = ( "/trac/" => "/path/to/trac/htdocs/" )

    fastcgi.server += ("/projects"  =>
                        ("trac" =>
                          (
                            "socket" => "/tmp/trac.sock",
                            "bin-path" => fcgi_binary,
                            "check-local" => "disable",
                            "bin-environment" =>
                              ("TRAC_ENV_PARENT_DIR" => "/path/to/parent/dir/of/projects/" )
                          )
                        )
                      )
  #And here starts the global auth configuration
    auth.backend = "htpasswd"
    auth.backend.htpasswd.userfile = "/path/to/unique/htpassword/file/trac.htpasswd"
    $HTTP["url"] =~ "^/projects/.*/login$" {
      auth.require = ("/" =>
                       (
                         "method"  => "basic",
                         "realm"   => "trac",
                         "require" => "valid-user"
                       )
                     )
    }
  }}}

  Changing date/time format also supported by lighttpd over environment variable LC_TIME:
  {{{
  fastcgi.server = ("/trac" =>
                     ("trac" =>
                       ("socket" => "/tmp/trac-fastcgi.sock",
                        "bin-path" => fcgi_binary,
                        "check-local" => "disable",
                        "bin-environment" =>
                          ("TRAC_ENV" => "/path/to/projenv",
                          "LC_TIME" => "ru_RU")
                       )
                     )
                   )
  }}}

  For details about languages specification see [trac:TracFaq TracFaq] question 2.13.

  Other important information like the [wiki:TracInstall#MappingStaticResources mapping static resources advices] are useful for non-fastcgi specific installation aspects.

  Relaunch Lighttpd and browse to `http://yourhost.example.org/trac` to access Trac.

  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.

  == !LiteSpeed Configuration

  The FastCGI front-end was developed primarily for use with alternative webservers, such as [http://www.litespeedtech.com/ LiteSpeed].

  !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.

   1. Please make sure you have a working install of a Trac project. Test install with "tracd" first.
   1. 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:
  {{{
  http://yourdomain.com/trac/
  }}}
   1. Go "!TracVhost → External Apps" tab and create a new "External Application":
  {{{
  Name: MyTracFCGI	
  Address: uds://tmp/lshttpd/mytracfcgi.sock
  Max Connections: 10
  Environment: TRAC_ENV=/fullpathto/mytracproject/ <--- path to root folder of trac project
  Initial Request Timeout (secs): 30
  Retry Timeout (secs): 0
  Persistent Connection	Yes
  Connection Keepalive Timeout: 30
  Response Bufferring: No	
  Auto Start: Yes
  Command: /usr/share/trac/cgi-bin/trac.fcgi  <--- path to trac.fcgi
  Back Log: 50
  Instances: 10
  }}}
   1. Optional: If you need to use htpasswd based authentication. Go to "!TracVhost → Security" tab and create a new security Realm:
   {{{
  DB Type: Password File
  Realm Name: MyTracUserDB               <--- any name you wish and referenced later
  User DB Location: /fullpathto/htpasswd <--- path to your htpasswd file
  }}}
   If you don’t have a htpasswd file or don’t know how to create the entries within one, go to http://sherylcanter.com/encrypt.php, to generate the user:password combos.
   1. Go to "!PythonVhost → Contexts" and create a new FCGI Context:
   {{{
  URI: /trac/                              <--- URI path to bind to python fcgi app we created	
  Fast CGI App: [VHost Level] MyTractFCGI  <--- select the Trac fcgi extapp we just created
  Realm: TracUserDB                        <--- only if (4) is set. select realm created in (4)
  }}}
   1. Modify `/fullpathto/mytracproject/conf/trac.ini`:
   {{{
  #find/set base_rul, url, and link variables
  base_url = http://yourdomain.com/trac/ <--- base url to generate correct links to
  url = http://yourdomain.com/trac/      <--- link of project
  link = http://yourdomain.com/trac/     <--- link of graphic logo
  }}}
   1. Restart !LiteSpeed: `lswsctrl restart`, and access your new Trac project at {{{http://yourdomain.com/trac/}}}.

  == Nginx Configuration

  [http://nginx.org/en/ Nginx] is able to communicate with FastCGI processes, but can not spawn them. So you need to start FastCGI server for Trac separately.

   1. Nginx configuration with basic authentication handled by Nginx - confirmed to work on 0.6.32
   {{{#!nginx
      server {
          listen       10.9.8.7:443;
          server_name  trac.example;

          ssl                  on;
          ssl_certificate      /etc/ssl/trac.example.crt;
          ssl_certificate_key  /etc/ssl/trac.example.key;

          ssl_session_timeout  5m;

          ssl_protocols  SSLv2 SSLv3 TLSv1;
          ssl_ciphers  ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
          ssl_prefer_server_ciphers   on;

          # it makes sense to serve static resources through Nginx (or ``~ [/some/prefix]/chrome/(.*)``)
          location ~ /chrome/(.*) {
               alias /home/trac/instance/static/htdocs/$1;
          }

          # You can copy this whole location to ``location [/some/prefix](/login)``
          # and remove the auth entries below if you want Trac to enforce
          # authorization where appropriate instead of needing to authenticate
          # for accessing the whole site.
          # (Or ``~ location /some/prefix(/.*)``.)
          location ~ (/.*) {
              auth_basic            "trac realm";
              auth_basic_user_file /home/trac/htpasswd;

              # socket address
              fastcgi_pass   unix:/home/trac/run/instance.sock;

              # python - wsgi specific
              fastcgi_param HTTPS on;

              ## WSGI REQUIRED VARIABLES
              # WSGI application name - trac instance prefix.
  	    # (Or ``fastcgi_param  SCRIPT_NAME  /some/prefix``.)
              fastcgi_param  SCRIPT_NAME        "";
              fastcgi_param  PATH_INFO          $1;

              ## WSGI NEEDED VARIABLES - trac warns about them
              fastcgi_param  REQUEST_METHOD     $request_method;
              fastcgi_param  SERVER_NAME        $server_name;
              fastcgi_param  SERVER_PORT        $server_port;
              fastcgi_param  SERVER_PROTOCOL    $server_protocol;
              fastcgi_param  QUERY_STRING       $query_string;

              # For Nginx authentication to work - do not forget to comment these
              # lines if not using Nginx for authentication
              fastcgi_param  AUTH_USER          $remote_user;
              fastcgi_param  REMOTE_USER        $remote_user;

              # for ip to work
              fastcgi_param REMOTE_ADDR         $remote_addr;

              # For attchments to work
              fastcgi_param    CONTENT_TYPE     $content_type;
              fastcgi_param    CONTENT_LENGTH   $content_length;
          }
      }
  }}}
   1. Modified trac.fcgi:
   {{{#!python
  #!/usr/bin/env python
  import os
  sockaddr = '/home/trac/run/instance.sock'
  os.environ['TRAC_ENV'] = '/home/trac/instance'

  try:
       from trac.web.main import dispatch_request
       import trac.web._fcgi

       fcgiserv = trac.web._fcgi.WSGIServer(dispatch_request, 
            bindAddress = sockaddr, umask = 7)
       fcgiserv.run()

  except SystemExit:
      raise
  except Exception, e:
      print 'Content-Type: text/plain\r\n\r\n',
      print 'Oops...'
      print
      print 'Trac detected an internal error:'
      print
      print e
      print
      import traceback
      import StringIO
      tb = StringIO.StringIO()
      traceback.print_exc(file=tb)
      print tb.getvalue()

  }}}
   1. Reload nginx and launch trac.fcgi: 
   {{{#!sh
  trac@trac.example ~ $ ./trac-standalone-fcgi.py 
  }}}

  The above assumes that:
   * There is a user named 'trac' for running Trac instances and keeping Trac environments in its home directory
   * `/home/trac/instance` contains a Trac environment
   * `/home/trac/htpasswd` contains authentication information
   * `/home/trac/run` is owned by the same group the Nginx runs under
    * and if your system is Linux the `/home/trac/run` has setgid bit set (`chmod g+s run`)
    * and patch from [trac:#7239] is applied, or you'll have to fix the socket file permissions every time

  Unfortunately Nginx does not support variable expansion in fastcgi_pass directive. 
  Thus it is not possible to serve multiple Trac instances from one server block. 

  If you worry enough about security, run Trac instances under separate users. 

  Another way to run Trac as a FCGI external application is offered in [trac:#6224].

  ----
  See also: TracGuide, TracInstall, [wiki:TracModWSGI ModWSGI], [wiki:TracCgi CGI], [wiki:TracModPython ModPython], [trac:TracNginxRecipe TracNginxRecipe]


name: TracTickets
author: trac
ipnr: 127.0.0.1
text:
  = The Trac Ticket System
  [[TracGuideToc]]

  The Trac ticket system provides a simple but effective way to track issues and software bugs within a project.

  As the central project management element of Trac, tickets can be used for '''project tasks''', '''feature requests''', '''bug reports''', '''software support issues''' among others. 

  As with the TracWiki, this subsystem has been designed to make user contribution and participation as simple as possible.

  An issue is assigned to a person who must resolve it or reassign the ticket to someone else. All tickets can be edited, annotated, assigned, prioritized and discussed at any time.

  [=#edit-permissions]
  However, a Trac installation may place restrictions on who can change what. For example, the default installation doesn't permit to non-authenticated users ("anonymous" users) to change anything, even to comment on an issue, for obvious spam prevention reasons. Check the local contributing policy, which you can usually find on the front page of WikiStart, or contact your local Trac administrator.

  == Ticket Fields

  A ticket contains the following information:
   
   * '''Reporter''' — The author of the ticket.
   * '''Type''' — The category of the ticket. The default types are `defect`, `enhancement` and `task`. 
   * '''Component''' — The project module or subsystem that this ticket concerns.
   * '''Version''' — Version of the project that this ticket pertains to.
   * '''Keywords''' — Keywords that a ticket is tagged with. Useful for searching and report generation.
   * '''Priority''' — The importance of this issue, ranging from ''trivial'' to ''blocker''. A dropdown list when multiple priorities are defined.
   * '''Milestone''' — Due date of when this issue should be resolved. A dropdown list containing the milestones.
   * '''Assigned to/Owner''' — Principal person responsible for handling the issue.
   * '''Cc''' — A comma-separated list of other users or email addresses to notify. Note that this does not imply responsibility or any other policy.
   * '''Resolution''' — Reason for why a ticket was closed. One of {{{fixed}}}, {{{invalid}}}, {{{wontfix}}}, {{{duplicate}}}, {{{worksforme}}}.
   * '''Status''' — What is the current status? The statuses are defined in the [TracWorkflow#BasicTicketWorkflowCustomization ticket workflow]. For the default workflow the statuses are `new`, `assigned`, `accepted`, `closed` and `reopened`.
   * '''Summary''' — A description summarizing the issue. Simple text without WikiFormatting.
   * '''Description''' — The body of the ticket. A good description should be specific, descriptive and to the point. Accepts WikiFormatting.

  '''Notes:''' 
   - Versions of Trac prior to 0.9 did not have the ''type'' field, but instead provided a ''severity'' field and different default values for the ''priority'' field. This change was done to simplify the ticket model by removing the somewhat blurry distinction between ''priority'' and ''severity''. However, the old model is still available if you prefer it: just add/modify the default values of the ''priority'' and ''severity'', and optionally hide the ''type'' field by removing all the possible values through [wiki:TracAdmin trac-admin].

   - The [trac:TicketTypes type], [trac:TicketComponent component], version, priority and severity fields can be managed with [wiki:TracAdmin trac-admin] or through the !WebAdmin.

   - Description of the builtin ''priority'' values is available at [trac:TicketTypes#Whyistheseverityfieldgone TicketTypes]

  == Changing and Commenting Tickets

  With appropriate permissions, as already mentioned [#edit-permissions above], a ticket entered into Trac can at any time be modified by '''annotating'''.

  Then, annotations like changes and comments to the ticket are logged as a part of the ticket itself. When viewing a ticket, the history of changes will appear below the main ticket area.

  Comment editing (available since 0.12) is meant to be used to make small corrections to comments, like fixing formatting, forgotten WikiFormatting or spelling errors, not major edits. For longer edits, you should be adding a new comment instead. Editing a comment will not produce a new entry on [/timeline], while entering a new comment or other changes will do.

  All edits (field changes, new comments, comment edits) update the "last changed" time of the ticket.

  '''Notes:''' 
   - An important feature is being able to use TracLinks and WikiFormatting in ticket descriptions and comments. Use TracLinks to refer to other issues, changesets or files to make your ticket more specific and easier to understand.

   - See TracNotification for how to configure email notifications of ticket changes.

   - See TracWorkflow for information about the state transitions (ticket lifecycle), and how this workflow can be customized.

  == Default Values for Drop-Down Fields

  The option selected by default for the various drop-down fields can be set in [wiki:TracIni trac.ini], in the `[ticket]` section:

   * `default_component`: Name of the component selected by default.
   * `default_milestone`: Name of the default milestone.
   * `default_priority`: Default priority value.
   * `default_severity`: Default severity value.
   * `default_type`: Default ticket type.
   * `default_version`: Name of the default version.
   * `default_owner`: Name of the default owner. If set to the text `< default >` (the default value), the component owner is used.

  If any of these options are omitted, the default value will either be the first in the list, or an empty value, depending on whether the field in question is required to be set. Some of these can be chosen through the !WebAdmin in the "Ticket System" section, others can be set in the [[wiki:TracIni#ticket-section|"[ticket]"]] section in `trac.ini`.

  == Hiding Fields and Adding Custom Fields

  Many of the default ticket fields can be hidden from the ticket web interface simply by removing all the possible values through [wiki:TracAdmin trac-admin]. This of course only applies to drop-down fields, such as ''type'', ''priority'', ''severity'', ''component'', ''version'' and ''milestone''.

  Trac also lets you add your own custom ticket fields. See TracTicketsCustomFields for more information.

  == Assign-to as Drop-Down List

  If the list of possible ticket owners is finite, you can change the ''assign-to'' ticket field from a text input to a drop-down list. This is done by setting the `restrict_owner` option of the `[ticket]` section in [wiki:TracIni trac.ini] to `true`. In that case, Trac will populate the list with all users who **have an authenticated session** and possess the `TICKET_MODIFY` [TracPermissions permissions].

  An authenticated session will be created the first time a user authenticates with the project. You can manually add an authenticated session using the ["TracAdmin#?session add" trac-admin] `session add` command. The `:1` suffix on the session id (i.e. username) is the key to creating an authenticated session:
  {{{#!sh
  trac-admin /path/to/projenv session add <sid>:1 [name] [email]
  }}}

  You may find the dropdown list is //overpopulated// with users that are no longer active in the project. Revoking authentication privileges will not remove the session data that is used to populate the dropdown list. The [wiki:TracAdmin trac-admin] command can be used to list and remove sessions:

   - List all sessions:
  {{{#!sh
  trac-admin /path/to/projenv session list
  }}}
   - Remove a session:
  {{{#!sh
  trac-admin /path/to/projenv session delete SID
  }}}

  Alternatively, you can just revoke `TICKET_MODIFY` from users that you don't want to be included in the list. However, that will not be possible if you've granted `TICKET_MODIFY` to all //anonymous// or //authenticated// users.

  '''Notes:'''
   - If you need more flexibility and aren't afraid of a little plugin coding of your own, see the [https://trac-hacks.org/wiki/FlexibleAssignToPlugin FlexibleAssignTo plugin].
   
   - Activating this option may cause some performance degradation. Read more about this in the [trac:TracPerformance#Configuration Trac performance] page.

  == Preset Values for New Tickets

  To create a link to the new-ticket form filled with preset values, you need to call the `/newticket?` URL with `variable=value` separated by `&`. Possible variables are:

   * '''type''' — The type droplist.
   * '''reporter''' — Name or email of the reporter.
   * '''summary''' — Summary line for the ticket.
   * '''description''' — Long description of the ticket.
   * '''component''' — The component dropdown list.
   * '''version''' — The version dropdown list.
   * '''severity''' — The severity dropdown list.
   * '''keywords''' — The keywords or tags.
   * '''priority''' — The priority dropdown list.
   * '''milestone''' — The milestone dropdown list.
   * '''owner''' — The person responsible for the ticket.
   * '''cc''' — The list of emails for notifying about the ticket change.

  Example: `[/newticket?summary=Compile%20Error&version=1.0&component=gui]`

  == Deleting Tickets

  Ticket delete and ticket change delete functions are enabled through an optional component. To enable the functionality edit the [TracIni#components-section "[components]"] section of TracIni:
  {{{#!ini
  [components]
  tracopt.ticket.deleter.* = enabled
  }}}

  The //Delete// buttons appears next to the //Reply// buttons in the ticket description and ticket change areas. `TICKET_ADMIN` permission is required for deleting tickets and ticket changes.

  ----
  See also: TracTicketsCustomFields, TracNotification, TracReports, TracQuery


name: TracCgi
author: trac
ipnr: 127.0.0.1
text:
  = Installing Trac as CGI
  [[TracGuideToc]]
  [[PageOutline]]

  {{{#!div class=important
   ''Please note that using Trac via CGI is the slowest deployment method available. It is slower than [wiki:TracModWSGI mod_wsgi], [TracModPython mod_python], [TracFastCgi FastCGI] and even [trac:TracOnWindowsIisAjp IIS/AJP] on Windows.''
  }}}

  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.

  == Apache web-server configuration

  In [http://httpd.apache.org/ Apache] there are two ways to run Trac as CGI:

   1. Use a `ScriptAlias` directive that maps a URL to the `trac.cgi` script (recommended)
   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.

  To make Trac available at `http://yourhost.example.org/trac` add `ScriptAlias` directive to Apache configuration file, changing `trac.cgi` path to match your installation:
  {{{#!apache
  ScriptAlias /trac /path/to/www/trac/cgi-bin/trac.cgi
  }}}

   ''Note that this directive requires that the `mod_alias` module is enabled.''

  If you're using Trac with a single project you need to set its location using the `TRAC_ENV` environment variable:
  {{{#!apache
  <Location "/trac">
    SetEnv TRAC_ENV "/path/to/projectenv"
  </Location>
  }}}

  Or to use multiple projects you can specify their common parent directory using the `TRAC_ENV_PARENT_DIR` variable:
  {{{#!apache
  <Location "/trac">
    SetEnv TRAC_ENV_PARENT_DIR "/path/to/project/parent/dir"
  </Location>
  }}}

    ''Note that the `SetEnv` directive requires that the `mod_env` module is enabled.''

  An alternative to `SetEnv` is editing `TRAC_ENV` or `TRAC_ENV_PARENT_DIR` in `trac.cgi`:

  {{{#!python
      os.environ['TRAC_ENV'] = "/path/to/projectenv"
  }}}

  {{{#!python
      os.environ['TRAC_ENV_PARENT_DIR'] = "/path/to/parent/dir"
  }}}

  If you are using the [http://httpd.apache.org/docs/suexec.html Apache suEXEC] feature please see [trac:ApacheSuexec].

  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).

  === Python Egg Cache

  The [TracInstall#egg-cache egg-cache] can be configured using an `os.environ` statement in `trac.cgi`, as shown above.
  To do the same from the Apache configuration, use the `SetEnv` directive:
  {{{#!apache
  SetEnv PYTHON_EGG_CACHE /path/to/dir
  }}}

  Put this directive next to where you set the path to the [TracEnvironment Trac environment], i.e. in the same `<Location>` block.

  {{{#!apache
   <Location /trac>
     SetEnv TRAC_ENV /path/to/projenv
     SetEnv PYTHON_EGG_CACHE /path/to/dir
   </Location>
  }}}



  === Using WSGI

  You can run a [http://henry.precheur.org/python/how_to_serve_cgi WSGI handler] [http://pythonweb.org/projects/webmodules/doc/0.5.3/html_multipage/lib/example-webserver-web-wsgi-simple-cgi.html under CGI].  You can [wiki:TracModWSGI#Thetrac.wsgiscript write your own application function], or use the deployed trac.wsgi's application.

  == Mapping Static Resources

  See TracInstall#MappingStaticResources.

  == Adding Authentication

  See TracInstall#ConfiguringAuthentication.

  ----
  See also:  TracInstall, [wiki:TracModWSGI], TracFastCgi, TracModPython


name: TracAccessibility
author: trac
ipnr: 127.0.0.1
text:
  = Accessibility Support in Trac

  Not every user has a graphic environment with a mouse or other pointing device. Some users rely on a keyboard, alternative keyboard or voice input to navigate links and activate form controls. In a Trac session, users can use a device other than a pointing device by enabling keyboard shortcuts through the [/prefs/userinterface Keyboard Shortcuts] preferences panel.

  == Global Access Keys

  The global access keys differ by browser and the following work for several browsers:
   - on Linux, press any of the keys listed below in combination with the `<Alt>` key
   - on a Mac, use `<Ctrl>` + `<Opt>` + `<Key>`
   - on Windows, use `<Shift> + <Alt> + <Key>`. This works for the most common browsers, such as Firefox, Chrome, Safari and Internet Explorer

  See [wikipedia:Access_key#Access_in_different_browsers access in different browsers] for more details.

   * `1` - WikiStart
   * `2` - [TracTimeline Timeline]
   * `3` - [TracRoadmap Roadmap]
   * `4` - [TracSearch Search]
   * `6` - [TracGuide Trac Guide / Documentation]
   * `7` - [TracTickets New Ticket]
   * `9` - [/about About Trac]
   * `e` - Edit (wiki or report)
   * `r` - Preview (wiki or ticket)
   * `f` - Search

  == TracBrowser Navigation

  The browser can be navigated using the keys listed below. The key modifiers listed above are not used for navigating the browser.

  * `j` and `k` - select the next or previous entry, starting with the first
  * `o` ('''o'''pen) - toggle between expanded and collapsed state of the selected  directory or visit the selected file 
  * `v` ('''v'''iew, '''v'''isit) and `<Enter>` - same as above
  * `r` - '''r'''eload an already expanded directory
  * `a` - directly visit a file in '''a'''nnotate (blame) mode
  * `L` - view the '''L'''og for the selected entry

  If no row has been selected using `j` or `k`, the keys will operate on the entry under the mouse.


name: TracTimeline
author: trac
ipnr: 127.0.0.1
text:
  = The Trac Timeline =
  [[TracGuideToc]]

  Trac's timeline feature provides a historic view of the project.

  Trac events are listed in chronological order, comprised of a brief description of each event and, if applicable, the person responsible for the change.

  The timeline lists these kinds of events:
   * '''Wiki page events''' — Pages created and edited
   * '''Ticket events''' — Tickets open and closed, and optionally ticket updates
   * '''Source code changes ''' — Repository check-ins
   * '''Milestone events''' — Milestones completed

  Each event entry provides a hyperlink to the event, the author of the change, as well as a brief excerpt of the actual comment or text, if available. Plugins may provide additional events for the timeline.

  The displayed events can be filtered using the filters in the preferences panel:
   * ''View changes from'' — the date from which to start displaying events (current date if empty). Events that occurred after this date will not be shown, only those that occurred before the date.
   * ''and X days back'' — how many days backwards in time to get events.
   * ''done by'' — the author of an event. It accepts a space-separated list of authors for which events should be included. Alternatively, if the author names are prefixed by a `-` character, then the events having those authors will be excluded, and all the others included. Single or double quotes can be used for specifying author names containing space characters.
   * ''Changesets in all repositories'' — if you have more than one repository connected to your Trac project, you can also filter events from specific repositories.
   * ''Milestones completed'' — display or hide milestones reached.
   * ''Tickets opened and closed'' — display or hide ticket open or close events.
   * ''Ticket updates'' - display or hide ticket update events (if enabled by [TracIni#timeline-ticket_show_details-option "[timeline] ticket_show_details"]).
   * ''Wiki changes'' — display or hide Wiki change events.

  See !TracIni's [wiki:TracIni#timeline-section "[timeline] section"] for timeline configuration options. Plugins may provide additional filters for the timeline.

  == RSS Support ==

  The Timeline module supports subscription using RSS 2.0 syndication. To subscribe to project events, click the orange '''XML''' icon at the bottom of the page. See TracRss for more information on RSS support in Trac.

  ----
  See also: TracWiki, WikiFormatting, TracRss


name: TracPermissions
author: trac
ipnr: 127.0.0.1
text:
  = Trac Permissions
  [[TracGuideToc]]

  Trac uses a simple, case sensitive, permission system to control what users can and can't access.

  Permissions are managed using the [TracAdmin trac-admin] tool or the ''General / Permissions'' panel in the ''Admin'' tab of the web interface.

  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 [TracIni#trac-permission_policies-option "[trac] permission_policies"]. See TracFineGrainedPermissions for more details.

  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 privilege for will not be displayed in the navigation.
  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//.

  == Graphical Admin Tab

  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):
  {{{#!sh
  $ trac-admin /path/to/projenv permission add bob TRAC_ADMIN
  }}}

  Then, the user `bob` will be able to see the Admin tab, and can access the permissions menu. This menu will allow you to perform all the following actions, but from the browser rather than requiring root access to the server. '''Use at least one lowercase character in user names, as all-uppercase names are reserved for permissions.'''

  [[Image(htdocs:../common/guide/admin.png)]]

  [[Image(htdocs:../common/guide/admin-permissions.png)]]

  [[Image(htdocs:../common/guide/admin-permissions-TICKET_ADMIN.png)]]

  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.

  == Available Privileges

  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.

  Otherwise, individual privileges can be assigned to users for the various different functional areas of Trac ('''note that the privilege names are case-sensitive'''):

  === Repository Browser

  || `BROWSER_VIEW` || View directory listings in the [TracBrowser repository browser] ||
  || `FILE_VIEW` || View files in the [TracBrowser repository browser] ||
  || `CHANGESET_VIEW` || View [TracChangeset repository check-ins] ||
  || `LOG_VIEW` || View revision logs of files and directories in the [TracBrowser repository browser] ||

  === Ticket System

  || `TICKET_VIEW` || View existing [TracTickets tickets] and perform [TracQuery ticket queries] ||
  || `TICKET_CREATE` || Create new [TracTickets tickets] ||
  || `TICKET_APPEND` || Add comments or attachments to [TracTickets tickets] ||
  || `TICKET_CHGPROP` || Modify [TracTickets ticket] properties (priority, assignment, keywords, etc.) with the following exceptions: edit description field, add/remove other users from cc field when logged in ||
  || `TICKET_MODIFY` || Includes both `TICKET_APPEND` and `TICKET_CHGPROP`, and in addition allows resolving [TracTickets tickets] in the [TracWorkflow default workflow]. Tickets can be assigned to users through a [TracTickets#Assign-toasDrop-DownList drop-down list] when the list of possible owners has been restricted. ||
  || `TICKET_EDIT_CC` || Full modify cc field ||
  || `TICKET_EDIT_DESCRIPTION` || Modify description field ||
  || `TICKET_EDIT_COMMENT` || Modify another user's comments. Any user can modify their own comments by default. ||
  || `TICKET_BATCH_MODIFY` || [TracBatchModify Batch modify] tickets ||
  || `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. ||

  === Roadmap

  || `MILESTONE_VIEW` || View milestones and assign tickets to milestones. ||
  || `MILESTONE_CREATE` || Create new milestones ||
  || `MILESTONE_MODIFY` || Modify milestones ||
  || `MILESTONE_DELETE` || Delete milestones ||
  || `MILESTONE_ADMIN` || All `MILESTONE_*` permissions ||
  || `ROADMAP_VIEW` || View the [TracRoadmap roadmap] page, which is not yet the same as MILESTONE_VIEW, see [trac:#4292 #4292] ||
  || `ROADMAP_ADMIN` || to be removed with [trac:#3022 #3022], replaced by MILESTONE_ADMIN ||

  === Reports

  || `REPORT_VIEW` || View [TracReports reports], i.e. the //View Tickets// link. ||
  || `REPORT_SQL_VIEW` || View the SQL query of a [TracReports report] ||
  || `REPORT_CREATE` || Create new [TracReports reports] ||
  || `REPORT_MODIFY` || Modify [TracReports reports] ||
  || `REPORT_DELETE` || Delete [TracReports reports] ||
  || `REPORT_ADMIN` || All `REPORT_*` permissions ||

  === Wiki System

  || `WIKI_VIEW` || View [TracWiki wiki] pages ||
  || `WIKI_CREATE` || Create new [TracWiki wiki] pages ||
  || `WIKI_MODIFY` || Modify [TracWiki wiki] pages ||
  || `WIKI_RENAME` || Rename [TracWiki wiki] pages ||
  || `WIKI_DELETE` || Delete [TracWiki wiki] pages and attachments ||
  || `WIKI_ADMIN` || All `WIKI_*` permissions, plus the management of ''readonly'' pages. ||

  === Permissions

  || `PERMISSION_GRANT` || add/grant a permission ||
  || `PERMISSION_REVOKE` || remove/revoke a permission ||
  || `PERMISSION_ADMIN` || All `PERMISSION_*` permissions ||

  === Others

  || `TIMELINE_VIEW` || View the [TracTimeline timeline] page ||
  || `SEARCH_VIEW` || View and execute [TracSearch search] queries ||
  || `CONFIG_VIEW` || Enables additional sections on ''About Trac'' that show the current configuration and the list of installed plugins ||
  || `EMAIL_VIEW` || Shows email addresses even if [TracIni#trac-section trac show_email_addresses] configuration option is false ||

  == Granting Privileges

  You grant privileges to users using [TracAdmin trac-admin]. The current set of privileges can be listed with the following command:
  {{{#!sh
  $ trac-admin /path/to/projenv permission list
  }}}

  This command will allow the user ''bob'' to delete reports:
  {{{#!sh
  $ trac-admin /path/to/projenv permission add bob REPORT_DELETE
  }}}

  The `permission add` command also accepts multiple privilege names:
  {{{#!sh
  $ trac-admin /path/to/projenv permission add bob REPORT_DELETE WIKI_CREATE
  }}}

  Or add all privileges:
  {{{#!sh
  $ trac-admin /path/to/projenv permission add bob TRAC_ADMIN
  }}}

  == Permission Groups

  There are two built-in groups, //authenticated// and //anonymous//.
  Any user who has not logged in is automatically in the //anonymous// group.
  Any user who has logged in is also in the //authenticated// group.
  The //authenticated// group inherits permissions from the //anonymous// group.
  For example, if the //anonymous// group has permission WIKI_MODIFY, 
  it is not necessary to add the WIKI_MODIFY permission to the //authenticated// group as well.

  Custom groups may be defined that inherit permissions from the two built-in groups.

  Permissions can be grouped together to form roles such as ''developer'', ''admin'', etc.
  {{{#!sh
  $ trac-admin /path/to/projenv permission add developer WIKI_ADMIN
  $ trac-admin /path/to/projenv permission add developer REPORT_ADMIN
  $ trac-admin /path/to/projenv permission add developer TICKET_MODIFY
  $ trac-admin /path/to/projenv permission add bob developer
  $ trac-admin /path/to/projenv permission add john developer
  }}}

  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'''.

  == Adding a New Group and Permissions
  Permission groups can be created by assigning a user to a group you wish to create, then assign permissions to that group.

  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)
  {{{#!sh
  $ trac-admin /path/to/projenv permission add bob beta_testers
  $ trac-admin /path/to/projenv permission add beta_testers WIKI_ADMIN
  }}}

  == Removing Permissions

  Permissions can be removed using the 'remove' command. For example:

  This command will prevent the user ''bob'' from deleting reports:
  {{{#!sh
  $ trac-admin /path/to/projenv permission remove bob REPORT_DELETE
  }}}

  Just like `permission add`, this command accepts multiple privilege names.

  You can also remove all privileges for a specific user:
  {{{#!sh
  $ trac-admin /path/to/projenv permission remove bob '*'
  }}}

  Or one privilege for all users:
  {{{#!sh
  $ trac-admin /path/to/projenv permission remove '*' REPORT_ADMIN
  }}}

  == Creating New Privileges

  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 [TracIni#extra-permissions-section trac.ini]. For more information, please refer to the documentation  on the [TracIni#extra-permissions-section TracIni] page after enabling the component.

  == Default Permissions

  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.
  On the other hand, the //authenticated// users will have the permissions to ''create and modify tickets and wiki pages''.

  //**anonymous**//
  {{{
  BROWSER_VIEW 
  CHANGESET_VIEW 
  FILE_VIEW 
  LOG_VIEW 
  MILESTONE_VIEW 
  REPORT_SQL_VIEW 
  REPORT_VIEW 
  ROADMAP_VIEW 
  SEARCH_VIEW 
  TICKET_VIEW 
  TIMELINE_VIEW
  WIKI_VIEW
  }}}

  //**authenticated**//
  {{{
  TICKET_CREATE 
  TICKET_MODIFY 
  WIKI_CREATE 
  WIKI_MODIFY  
  }}}
  ----
  See also: TracAdmin, TracFineGrainedPermissions


name: TracPlugins
author: trac
ipnr: 127.0.0.1
text:
  [[PageOutline(2-5,Contents,pullout)]]

  = Trac plugins

  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.

  == Plugin discovery

  From the user's point of view, a plugin is either a standalone .py file or a package (egg or wheel). 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.

  == Installing a Trac plugin

  The instructions below are applicable to a plugin packaged as an egg. Plugins implemented as a single `py` file should be downloaded and copied to the [TracEnvironment project environment] `plugins` directory or the [TracIni#GlobalConfiguration global shared] plugins directory.

  === For a single project

  If you have downloaded a source distribution of a plugin, and want to build the `.egg` file:

   * Unpack the source. It should provide `setup.py`.
   * Run:
   {{{#!sh
  $ python setup.py bdist_egg
  }}}

  You should now have an *.egg file. Examine the output of running Python to find where this was created.

  Once you have the plugin archive, copy it into the `plugins` directory of the [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 [TracStandalone "tracd" standalone server], restart tracd, ie kill the process and run again.

  To uninstall a plugin installed this way, remove the egg from the `plugins` directory and restart the web server.

  '''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.

  '''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.

  === For all projects

  ==== With an .egg file

  Some plugins, such as [https://trac-hacks.org/wiki/TagsPlugin TracTags], are downloadable as an `.egg` file that can be installed with `easy_install` or `pip`:
  {{{#!sh
  $ easy_install TracTags
  }}}
  {{{#!sh
  $ pip install TracTags
  }}}

  If `easy_install` is not on your system, see the [trac:setuptools#Installsetuptools Trac setuptools documentation].

  `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 [https://pip.pypa.io/en/latest/installing.html#install-pip get_pip.py]. 

  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`:
  {{{#!sh
  $ easy_install --always-unzip TracTags
  }}}
  You should end up with a directory having the same name as the zipped egg, complete with `.egg` extension, and containing its uncompressed contents.

  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.

  ==== From source

  `easy_install` and `pip` make installing from source a snap. Just give it the URL to either a repository or a tarball/zip of the source:
  {{{#!sh
  $ easy_install https://trac-hacks.org/svn/tagsplugin/trunk
  }}}
  {{{#!sh
  $ pip install svn+https://trac-hacks.org/svn/tagsplugin/trunk
  }}}
  When installing from a repository using `pip`, be sure to use the repository type in the protocol. For example, `svn+https` for Subversion and `git+https` for Git.

  ==== Enabling the plugin

  Unlike plugins installed per environment, you'll have to explicitly enable globally installed plugins via [TracIni trac.ini]. This also applies to plugins installed in the shared plugins directory, ie the path specified in the [TracIni#inherit-plugins_dir-option "[inherit] plugins_dir"] configuration option. 

  This is done in the [TracIni#components-section "[components]"] section of the configuration file `trac.ini`. For example:
  {{{#!ini
  [components]
  tractags.* = enabled
  }}}

  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 `__init__.py`.

  After installing the plugin, you must restart your web server.

  ==== Upgrading the environment

  Some plugins may require an environment upgrade. This will typically be necessary for plugins that implement `IEnvironmentSetupParticipant`. Common reasons for requiring an environment upgrade are to add tables to the database or add configuration parameters to trac.ini. A notification will be displayed when accessing Trac for the first time after installing a plugin and restarting the web server. To upgrade the environment, run the command:

  {{{#!sh
  $ trac-admin /path/to/env upgrade
  }}}

  A database backup will be made before upgrading the environment, unless the `--no-backup` option is specified. For more information, refer to the documentation output by `trac-admin /path/to/env help upgrade`.

  ==== Redeploying static resources

  If you [TracInstall#MappingStaticResources mapped static resources] so they are served by the web server, and the plugin contains static resources (CSS, !JavaScript and image files), the resources will need to be deployed to the location on the filesystem that is served by the web server.

  Execute the `deploy` command, as was done during install and [TracUpgrade#a5.Refreshstaticresources upgrade]:

  {{{#!sh
  $ trac-admin /path/to/env deploy /deploy/path
  }}}

  After executing the command, you must restart your web server.

  {{{#!div style="border: 1pt dotted; margin: 1em"
  **Note:** Some web browsers (IE, Opera) cache CSS and Javascript files, so you should instruct your users to manually erase the contents of their browser's cache. A forced refreshed (SHIFT + <F5>) should be enough.
  {{{#!comment
  Remove above note once #9936 is fixed.
  }}}
  }}}

  ==== Upgrading a Plugin

  Normally, upgrading a plugin is simply a matter of repeating the install process. You may want to [#Uninstalling uninstall] old versions of the plugin.

  The `pip install` command has an `--upgrade (-U)` switch that will uninstall the old version and install the new version. The command can have some unintended side-effects though, because it will also upgrade the plugin dependencies. For example, if `Trac` is listed as a dependency of the plugin in `setup.py`, the latest version of Trac will be downloaded and installed. This may not be what you want if you are running an older version of Trac because not all your plugins are compatible with the latest version of Trac, or you simply haven't done the appropriate planning for upgrading Trac. Uninstalling and then installing the plugin can be a safer option:
  {{{#!sh
  $ pip uninstall <pluginname>
  $ pip install <pluginname>
  }}}

  Alternatively you can use a [https://pip.pypa.io/en/stable/user_guide/#requirements-files requirements file] and pin the versions of the packages that you don't want to implicitly upgrade. 

  ==== Uninstalling

  `pip` makes it easy to uninstall a plugin:
  {{{#!sh
  $ pip uninstall <pluginname>
  }}}

  The `pip uninstall` command can be used even if the plugin was installed using `easy_install` or `python setup.py install`.

  Neither `easy_install` nor `python setup.py` have an uninstall feature. However, it is usually trivial to remove a globally installed egg and reference:

   1. Do `easy_install -m <plugin name>` to remove references from `$PYTHONLIB/site-packages/easy-install.pth` when the plugin is installed by setuptools.
   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 `setup.py`.
   1. Delete the .egg file or folder from where it's installed, usually inside `$PYTHONLIB/site-packages/`.
   1. Restart the web server.

  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):
  {{{#!pycon
  >>> import myplugin
  >>> print myplugin.__file__
  /opt/local/python24/lib/site-packages/myplugin-0.4.2-py2.4.egg/myplugin/__init__.pyc
  }}}

  == Setting up the plugin cache

  Some plugins will need to be extracted by the Python egg's runtime. See [wiki:TracInstall#egg-cache] for information on setting up the egg cache.

  == Web-based plugin administration

  The !WebAdmin interface offers limited support for plugin configuration to users with `TRAC_ADMIN` permission:

  * enabling and disabling installed plugins
  * installing plugins by uploading them as eggs

  If you wish to disable the second function for security reasons, add the following to your `trac.ini` file:
  {{{#!ini
  [components]
  trac.admin.web_ui.PluginAdminPanel = disabled
  }}}
  This disables the whole panel, so the first function will no longer be available either.

  == Troubleshooting

  === Is setuptools properly installed?

  Try this from the command line:
  {{{#!sh
  $ python -c "import pkg_resources"
  }}}

  If you get '''no output''', setuptools '''is''' installed. Otherwise, you'll need to install it before plugins will work in Trac.

  === Did you get the correct version of the Python egg?

  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).

  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.

  === Is the plugin enabled?

  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:

   * you actually added the necessary line(s) to the `[components]` section.
   * the package/module names are correct and do not contain typos.
   * the value is "enabled", not "enable" or "Enable".
   * the section name is "components", not "component".

  === Check the permissions on the .egg file

  Trac must be able to read the .egg file. 

  === Check the log files

  Enable [TracLogging logging] and set the log level to `DEBUG`, then watch the log file for messages about loading plugins.

  === Verify you have the proper permissions

  Some plugins require you have special permissions in order to use them. !WebAdmin, for example, requires the user to have `TRAC_ADMIN` permissions for it to show up on the navigation bar.

  === Is the wrong version of the plugin loading?

  If you put your plugins inside the `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:

   * 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.
   * A globally installed plugin (typically `setup.py 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.
   * 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.
   * Having more than one version listed inside Python site-packages is fine, ie installed with `setup.py 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.

  === If all of the above failed

  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] or [trac:MailingList] and ask away!

  ----
  See also TracGuide, [trac:PluginList plugin list], [trac:TracDev/ComponentArchitecture component architecture].


name: InterWiki
author: trac
ipnr: 127.0.0.1
text:
  = Support for InterWiki links
  [[PageOutline(2-5,Contents,pullout)]]

  == Definition

  An InterWiki link can be used for referring to a Wiki page located in another Wiki system, and by extension, to any object located in any other Web application, provided a simple URL mapping can be done.

  InterWiki prefixes can even be used to introduce links to new protocols, such as `tsvn:` used by [trac:TortoiseSvn TortoiseSvn].

  == Link Syntax

  {{{
  <target_wiki>(:<identifier>)+
  }}}

  The link is composed by the targeted Wiki (or system) name, followed by a colon, eg `MeatBall:`, followed by a page specification in the target.
  Note that, as for InterTrac prefixes, '''InterWiki prefixes are case insensitive'''.

  The target Wiki URL is looked up in the [TracIni#interwiki-section "[interwiki]"] section of TracIni and in the InterMapTxt wiki page, modeled after MeatBall:InterMapTxt. If a prefix is defined in both the `[interwiki]` section and InterMapTxt, the `[interwiki]` section takes precedence.

  In addition to traditional !InterWiki links, where the target is simply ''appended'' to the URL, Trac supports parametric !InterWiki URLs:
  identifiers `$1`, `$2`, ... in the URL will be replaced by corresponding arguments.
  The argument list is formed by splitting the page identifier using the ":" separator.

  == [TracIni#interwiki-section "[interwiki]"]

  Every option in the `[interwiki]` section in TracIni defines one InterWiki prefix. The option name defines the prefix. The option value defines the URL, optionally followed by a description separated from the URL by whitespace. Parametric URLs are supported as well.

  '''Example:'''
  {{{#!ini
  [interwiki]
  MeatBall = http://www.usemod.com/cgi-bin/mb.pl?
  PEP = http://www.python.org/peps/pep-$1.html Python Enhancement Proposal $1
  tsvn = tsvn: Interact with TortoiseSvn
  }}}

  == Examples

  For the following excerpt of the InterMapTxt page:

  {{{
  = InterMapTxt =
  == This is the place for defining InterWiki prefixes ==

  Currently active prefixes: [[InterWiki]]

  This page is modelled after the MeatBall:InterMapTxt page.
  In addition, an optional comment is allowed after the mapping.
  ----
  {{{
  PEP      http://www.python.org/peps/pep-$1.html           # Python Enhancement Proposal $1 
  Trac-ML  http://thread.gmane.org/gmane.comp.version-control.subversion.trac.general/$1  # Message $1 in Trac Mailing List

  tsvn     tsvn:                                            # Interact with TortoiseSvn
  ...
  MeatBall http://www.usemod.com/cgi-bin/mb.pl?
  MetaWiki http://sunir.org/apps/meta.pl?
  MetaWikiPedia http://meta.wikipedia.org/wiki/
  MoinMoin http://moinmoin.wikiwikiweb.de/
  ...
  }}}
  }}}

  Then, 
   * `MoinMoin:InterWikiMap` will be rendered as MoinMoin:InterWikiMap and the ''title'' for that link will be "!InterWikiMap in !MoinMoin".
   * `Trac-ML:4346` will be rendered as Trac-ML:4346 and the ''title'' for that link will be "Message 4346 in Trac Mailing List".

  == List of Active Prefixes

  [[InterWiki]]

  ----
  See also: InterTrac, InterMapTxt


name: TracRevisionLog
author: trac
ipnr: 127.0.0.1
text:
  = Viewing Revision Logs
  [[TracGuideToc]]

  Each path in the //Repository Browser// contains a contextual navigation link to the //Revision Log//. The //Revision Log// displays a list of the most recent changesets in which the current path or any other path below it has been modified.

  == The Revision Log Form

  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. 

  It is also possible to specify the revision at which the log should stop, using the ''Back to'' field. By default it is empty, 
  which means the revision log will show the [TracIni#revisionlog-default_log_limit-option default log limit], which defaults to the latest 100 revisions.

  There are three modes of operation of the revision log.

  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 for that branch.

  It is also possible to indicate that one wants include what happened before a ''Copy'' or ''Rename'' change, by selecting the 
  ''Follow copies'' mode. This will continue to list all revisions across copies and renames.
  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.

  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 
  that ''Add''. This mode is labeled ''Show only adds, moves and deletes''. The operation can be quite resource intensive and therefore take some time to display.

  Finally, there's a checkbox ''Show full log messages'', which controls whether the full content of the commit log message
  should be displayed for each change, or only a shortened version of it.

  == The Revision Log Information

  For each revision log entry, the following columns are displayed:
   1. The first column contains a pair of radio buttons and should be used 
      for selecting the ''old'' and the ''new'' revisions that will be used for [#InspectingChangesBetweenRevisions viewing the actual changes].
   1. A color code (similar to the one used for the
      [TracChangeset#ChangesetHeader changesets]) indicates the kind of change.
      Clicking on this column refreshes the revision log so that it restarts
      with this change.
   1. The '''Revision''' number, displayed as `@xyz`.
      This is a link to the TracBrowser, using the displayed revision as the base line.
   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.
   1. The '''Age'''/'''Date''' at which the change was made.
      Depending on your [/prefs/localization session preference], the date is displayed in either //Relative// or //Absolute// format. 
    * //Relative// format shows the '''Age''': the time elapsed as the number of hours, days, weeks, months, or years. 
    * //Absolute// format shows the '''Date''' of the revision as a datetime.
   1. The '''Author''' of the change.
   1. The '''Log Message''', which contains either the truncated or full commit 
      log message, depending on the value of the ''Show full log messages'' 
      checkbox in the form above.

  == Inspecting Changes Between Revisions

  The ''View changes...'' buttons (placed above and below the list of changes, on the left side) will show the set of differences
  corresponding to the aggregated changes starting from the ''old'' revision (first radio-button) to the ''new'' revision (second
  radio-button), in the TracChangeset view.

  Note that the ''old'' revision doesn't need to be actually ''older'' than the ''new'' revision: it simply gives a base
  for the diff. It's therefore entirely possible to easily generate a ''reverse diff'', for reverting what has been done
  in the given range of revisions.

  Finally, if the two revisions are identical, the corresponding changeset will be shown. This has the same effect as clicking on the changeset number.

  == Alternative Formats

  === The !ChangeLog Text

  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.

  === RSS Support

  The revision log also provides an RSS feed to monitor the changes. To subscribe to an RSS feed for a file or directory, open its
  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.

  ----
  See also: TracBrowser, TracChangeset


name: TracQuery
author: trac
ipnr: 127.0.0.1
text:
  = Trac Ticket Queries
  [[TracGuideToc]]

  In addition to [wiki:TracReports reports], Trac provides support for ''custom ticket queries'', which can be used to display tickets that meet specified criteria. 

  To configure and execute a custom query, switch to the ''View Tickets'' module from the navigation bar, and select the ''Custom Query'' link.

  == Filters

  When you first go to the query page, the default filter will display tickets relevant to you:
   * If logged in then all open tickets, it will display open tickets assigned to you.
   * 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.
   * If not logged in and no name/email is defined in the preferences, then all open issues are displayed.

  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 dropdown 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 dropdown menu of options can be added multiple times to perform an ''Or'' on the criteria.

  For text fields such as Keywords and CC the `-` operator can be used to negate a match and double quotes (//since 1.2.1//) can be used to match a phrase. For example, a //contains// match for `word1 word2 -word3 "word4 word5"` matches tickets containing `word1` and `word2`, not `word3` and `word4 word5`.

  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.

  After you have edited your filters, click the ''Update'' button to refresh your results.

  Keyboard shortcuts are available for manipulating the //checkbox// filters:
  * Clicking on a filter row label toggles all checkboxes.
  * Pressing the modifier key while clicking on a filter row label inverts the state of all checkboxes.
  * Pressing the modifier key while clicking on a checkbox selects the checkbox and deselects all other checkboxes in the filter. Since 1.2.1 this also works for the //Columns// checkboxes.

  The modifier key is platform and browser dependent. On Mac the modified key is !Option/Alt or Command. On Linux the modifier key is Ctrl + Alt. Opera on Windows seems to use Ctrl + Alt, while Alt is effective for other Windows browsers.

  == Navigating Tickets

  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.  

  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. 

  The query results can be refreshed and cleared of these status indicators by clicking the ''Update'' button again.

  == Saving Queries

  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.
  You can also save references to queries in Wiki content, as described below.

  '''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.

  '''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.

  === Using TracLinks

  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.
  {{{
  [query:status=new|assigned|reopened&version=1.0 Active tickets against 1.0]
  }}}

  Which is displayed as:
    [query:status=new|assigned|reopened&version=1.0 Active tickets against 1.0]

  This uses a very simple query language to specify the criteria, see [wiki:TracQuery#QueryLanguage Query Language].

  Alternatively, you can copy the query string of a query and paste that into the Wiki link, including the leading `?` character:
  {{{
  [query:?status=new&status=assigned&status=reopened&group=owner Assigned tickets by owner]
  }}}

  Which is displayed as:
    [query:?status=new&status=assigned&status=reopened&group=owner Assigned tickets by owner]

  === Customizing the ''table'' format

  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:
  {{{
  [[TicketQuery(max=3,status=closed,order=id,desc=1,format=table,col=resolution|summary|owner|reporter)]]
  }}}

  This is displayed as:
  [[TicketQuery(max=3,status=closed,order=id,desc=1,format=table,col=resolution|summary|owner|reporter)]]

  ==== Full rows

  In ''table'' format you can also have full rows by using ''rows=<field>'':
  {{{
  [[TicketQuery(max=3,status=closed,order=id,desc=1,format=table,col=resolution|summary|owner|reporter,rows=description)]]
  }}}

  This is displayed as:
  [[TicketQuery(max=3,status=closed,order=id,desc=1,format=table,col=resolution|summary|owner|reporter,rows=description)]]

  == Query Language

  `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 (`\`).

  The available operators are:
  || '''`=`''' || the field content exactly matches one of the values ||
  || '''`~=`''' || the field content contains one or more of the values ||
  || '''`^=`''' || the field content starts with one of the values ||
  || '''`$=`''' || the field content ends with one of the values ||

  All of these operators can also be negated:
  || '''`!=`''' || the field content matches none of the values ||
  || '''`!~=`''' || the field content does not contain any of the values ||
  || '''`!^=`''' || the field content does not start with any of the values ||
  || '''`!$=`''' || the field content does not end with any of the values ||

  Filters combining matches and negated matches can be constructed for text fields such as Keywords and CC when using the //contains// (`~=`) operator. The `-` operator is used to negate a match and double quotes (//since 1.2.1//) are used for whitespace-separated words in a phrase. For example, `keywords~=word1 word2 -word3 "word4 word5"` matches tickets containing `word1` and `word2`, not `word3` and also `word4 word5`.
  || '''`status=closed,keywords~=firefox`''' || query closed tickets that contain keyword `firefox` ||
  || '''`status=closed,keywords~=opera`''' || query closed tickets that contain keyword `opera` ||
  || '''`status=closed,keywords~=firefox opera`''' || query closed tickets that contain keywords `firefox` and `opera` ||
  || '''`status=closed,keywords~=firefox|opera`''' || query closed tickets that contain keywords `firefox` or `opera` ||
  || '''`status=closed,keywords~=firefox,or,keywords~=opera`''' || query closed tickets that contain keyword `firefox`, or (closed or unclosed) tickets that contain keyword `opera` ||
  || '''`status=closed,keywords~=firefox -opera`''' || query closed tickets that contain keyword `firefox`, but not `opera` ||
  || '''`status=closed,keywords~=opera -firefox`''' || query closed tickets that contain keyword `opera`, but no `firefox` ||

  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. 
  || '''`created=2007-01-01..2008-01-01`''' || query tickets created in 2007 ||
  || '''`created=lastmonth..thismonth`''' || query tickets created during the previous month ||
  || '''`modified=1weekago..`''' || query tickets that have been modified in the last week ||
  || '''`modified=..30daysago`''' || query tickets that have been inactive for the last 30 days ||

  Note that `modified` is the //last modified time//, so `modified` with a date range shows ticket that were //last modified// in that date range. If a ticket was modified in the date range, but modified again after the end date, it will not be included in the results.

  ----
  See also: TracTickets, TracReports, TracGuide, TicketQuery


name: WikiProcessors
author: trac
ipnr: 127.0.0.1
text:
  = Wiki Processors

  Processors are WikiMacros designed to provide alternative markup formats for the [TracWiki Wiki engine]. Processors can be thought of as ''macro functions to process user-edited text''. 

  Wiki processors can be used in any Wiki text throughout Trac, such as:
   - [#CodeHighlightingSupport syntax highlighting] or for rendering text verbatim
   - rendering [#HTMLrelated Wiki markup inside a context], like inside <div> blocks or <span> or within <td> or <th> table cells
   - using an alternative markup syntax, like [WikiHtml raw HTML] and [WikiRestructuredText Restructured Text] or [http://www.textism.com/tools/textile/ textile]

  == Using Processors

  To use a processor on a block of text, first delimit the lines using a Wiki ''code block'':
  {{{
  {{{
  The lines
  that should be processed...
  }}}
  }}}

  Immediately after the `{{{` or on the line just below, add `#!` followed by the ''processor name'':

  {{{
  {{{
  #!processorname
  The lines
  that should be processed...
  }}}
  }}}

  This is the "shebang" notation, familiar to most UNIX users.

  Besides their content, some Wiki processors can also accept ''parameters'', which are then given as `key=value` pairs after the processor name and on the same line. If `value` has to contain space, as it's often the case for the style parameter, a quoted string can be used (`key="value with space"`).

  As some processors are meant to process Wiki markup, it's quite possible to ''nest'' processor blocks.
  You may want to indent the content of nested blocks for increased clarity, this extra indentation will be ignored when processing the content.

  == Examples

  ||= Wiki Markup =||= Display =||
  {{{#!td colspan=2 align=center style="border: none"

                  __Example 1__: Inserting raw HTML
  }}}
  |-----------------------------------------------------------------
  {{{#!td style="border: none"
  {{{
  {{{
  #!html
  <h1 style="color: grey">This is raw HTML</h1>
  }}}
  }}}
  }}}
  {{{#!td valign=top style="border: none; padding-left: 2em"
  {{{
  #!html
  <h1 style="color: grey">This is raw HTML</h1>
  }}}
  }}}
  |-----------------------------------------------------------------
  {{{#!td colspan=2 align=center style="border: none"

       __Example 2__: Highlighted Python code in a <div> block with custom style
  }}}
  |-----------------------------------------------------------------
  {{{#!td style="border: none"
    {{{
    {{{#!div style="background: #ffd; border: 3px ridge"

    This is an example of embedded "code" block:

      {{{
      #!python
      def hello():
          return "world"
      }}}

    }}}
    }}}
  }}}
  {{{#!td valign=top style="border: none; padding: 1em"
    {{{#!div style="background: #ffd; border: 3px ridge"

    This is an example of embedded "code" block:

      {{{
      #!python
      def hello():
          return "world"
      }}}

    }}}
  }}}
  |-----------------------------------------------------------------
  {{{#!td colspan=2 align=center style="border: none"

       __Example 3__: Searching tickets from a wiki page, by keywords.
  }}}
  |-----------------------------------------------------------------
  {{{#!td style="border: none"
    {{{
    {{{
    #!html
    <form action="/query" method="get"><div>
    <input type="text" name="keywords" value="~" size="30"/>
    <input type="submit" value="Search by Keywords"/>
    <!-- To control what fields show up use hidden fields
    <input type="hidden" name="col" value="id"/>
    <input type="hidden" name="col" value="summary"/>
    <input type="hidden" name="col" value="status"/>
    <input type="hidden" name="col" value="milestone"/>
    <input type="hidden" name="col" value="version"/>
    <input type="hidden" name="col" value="owner"/>
    <input type="hidden" name="col" value="priority"/>
    <input type="hidden" name="col" value="component"/>
    -->
    </div></form>
    }}}
    }}}
  }}}
  {{{#!td valign=top style="border: none; padding: 1em"
    {{{
    #!html
    <form action="/query" method="get"><div>
    <input type="text" name="keywords" value="~" size="30"/>
    <input type="submit" value="Search by Keywords"/>
    <!-- To control what fields show up use hidden fields
    <input type="hidden" name="col" value="id"/>
    <input type="hidden" name="col" value="summary"/>
    <input type="hidden" name="col" value="status"/>
    <input type="hidden" name="col" value="milestone"/>
    <input type="hidden" name="col" value="version"/>
    <input type="hidden" name="col" value="owner"/>
    <input type="hidden" name="col" value="priority"/>
    <input type="hidden" name="col" value="component"/>
    -->
    </div></form>
    }}}
  }}}

  == Available Processors

  The following processors are included in the Trac distribution:

  || '''`#!default`''' || Present the text verbatim in a preformatted text block. This is the same as specifying ''no'' processor name (and no `#!`). ||
  || '''`#!comment`''' || Do not process the text in this section, i.e. contents exist only in the plain text - not in the rendered page. ||
  || '''`#!rtl`''' || Introduce a Right-To-Left block with appropriate CSS direction and styling. ''(since 0.12.2)'' ||
  |||| ||
  ||||= '''[=#HTMLrelated HTML related]''' =||
  || '''`#!html`''' || Insert custom HTML in a wiki page. ||
  || '''`#!htmlcomment`''' || Insert an HTML comment in a wiki page. (''since 0.12'') ||
  || || Note that `#!html` blocks have to be ''self-contained'', i.e. you can't start an HTML element in one block and close it later in a second block. Use the following processors for achieving a similar effect.  ||
  || '''`#!div`''' || Wrap wiki content inside a <div> element. ||
  || '''`#!span`''' || Wrap wiki content inside a <span> element. ||
  || '''`#!td`''' || Wrap wiki content inside a <td> element. (''since 0.12'') ||
  || '''`#!th`''' || Wrap wiki content inside a <th> element. (''since 0.12'') ||
  || '''`#!tr`''' || Can optionally be used for wrapping `#!td` and `#!th` blocks, either for specifying row attributes or better visual grouping. (''since 0.12'') ||
  || '''`#!table`''' || Can optionally be used for wrapping `#!tr`, `#!td` and `#!th` blocks, for specifying table attributes. One current limitation however is that tables cannot be nested. (''since 0.12'') || 
  || || See WikiHtml for example usage and more details about these processors. ||
  |||| ||
  ||||= '''Other Markups''' =||
  || '''`#!rst`''' || Trac support for Restructured Text. See WikiRestructuredText. ||
  || '''`#!textile`''' || Supported if [http://cheeseshop.python.org/pypi/textile Textile] is installed. See [http://www.textism.com/tools/textile/ a Textile reference]. ||
  |||| ||
  ||||= '''[=#CodeHighlightingSupport Code Highlighting Support]''' =||
  || '''`#!c`''' [[BR]] '''`#!cpp`''' (C++) [[BR]] '''`#!python`''' [[BR]] '''`#!perl`''' [[BR]] '''`#!ruby`''' [[BR]] '''`#!php`''' [[BR]] '''`#!asp`''' [[BR]] '''`#!java`''' [[BR]] '''`#!js`''' (Javascript) [[BR]] '''`#!sql`''' [[BR]] '''`#!xml`''' (XML or HTML) [[BR]] '''`#!sh`''' (!Bourne/Bash shell) [[BR]] '''etc.''' [[BR]] || Trac includes processors to provide inline syntax highlighting for source code in various languages. [[BR]] [[BR]] Trac relies on [http://pygments.org Pygments] for syntax coloring. [[BR]] [[BR]] See TracSyntaxColoring for information about which languages are supported and how to enable support for more languages. ||
  |||| ||

  Since 1.1.2 the default, coding highlighting and MIME-type processors support the argument `lineno` for adding line numbering to the code block. When a value is specified, as in `lineno=3`, the numbering will start at the specified value. When used in combination with the `lineno` argument, the `marks` argument is also supported for highlighting lines. A single line number, set of line numbers and range of line numbers are allowed. For example, `marks=3`, `marks=3-6`, `marks=3,5,7` and `marks=3-5,7` are all allowed. The specified values are relative to the numbered lines, so if `lineno=2` is specified to start the line numbering at 2, `marks=2` will result in the first line being highlighted.

  Using the MIME type as processor, it is possible to syntax-highlight the same languages that are supported when browsing source code.

  ||||= '''MIME Type Processors''' =||
  {{{#!tr
  {{{#!td
  Some examples:
   {{{
  {{{#!text/html
  <h1>text</h1>
  }}}
   }}}
  }}}
  {{{#!td
  The result will be syntax highlighted HTML code:
   {{{#!text/html
  <h1>text</h1>
   }}}

  The same is valid for all other [TracSyntaxColoring#SyntaxColoringSupport mime types supported].
  }}}
  }}}
  {{{#!td
   {{{
  {{{#!diff
  --- Version 55
  +++ Version 56
  @@ -115,8 +115,9 @@
       name='TracHelloWorld', version='1.0',
       packages=find_packages(exclude=['*.tests*']),
  -    entry_points = """
  -        [trac.plugins]
  -        helloworld = myplugs.helloworld
  -    """,
  +    entry_points = {
  +        'trac.plugins': [
  +            'helloworld = myplugs.helloworld',
  +        ],
  +    },
   )
  }}}
   }}}
  }}}
  {{{#!td
  '''`#!diff`''' has a particularly nice renderer:
   {{{#!diff
  --- Version 55
  +++ Version 56
  @@ -115,8 +115,9 @@
       name='TracHelloWorld', version='1.0',
       packages=find_packages(exclude=['*.tests*']),
  -    entry_points = """
  -        [trac.plugins]
  -        helloworld = myplugs.helloworld
  -    """,
  +    entry_points = {
  +        'trac.plugins': [
  +            'helloworld = myplugs.helloworld',
  +        ],
  +    },
   )
   }}}
  }}}

  Line numbers can be added to code blocks and lines can be highlighted //(since 1.1.2)//.
  {{{
  {{{#!python lineno=3 marks=3,9-10,16
  def expand_markup(stream, ctxt=None):
      """A Genshi stream filter for expanding `genshi.Markup` events.

      Note: Expansion may not be possible if the fragment is badly
      formed, or partial.
      """
      for event in stream:
          if isinstance(event[1], Markup):
              try:
                  for subevent in HTML(event[1]):
                      yield subevent
              except ParseError:
                  yield event
          else:
              yield event
  }}}
  }}}
  {{{#!python lineno=3 marks=3,9-10,16
  def expand_markup(stream, ctxt=None):
      """A Genshi stream filter for expanding `genshi.Markup` events.

      Note: Expansion may not be possible if the fragment is badly
      formed, or partial.
      """
      for event in stream:
          if isinstance(event[1], Markup):
              try:
                  for subevent in HTML(event[1]):
                      yield subevent
              except ParseError:
                  yield event
          else:
              yield event
  }}}

  For more processor macros developed and/or contributed by users, visit the [https://trac-hacks.org Trac Hacks] community site.

  Developing processors is no different from Wiki macros. In fact, they work the same way, only the usage syntax differs. See WikiMacros#DevelopingCustomMacros for more information.

  ----
  See also: WikiMacros, WikiHtml, WikiRestructuredText, TracSyntaxColoring, WikiFormatting, TracGuide


name: WikiNewPage
author: trac
ipnr: 127.0.0.1
text:
  = Steps to Add a New Wiki Page =
  [[TracGuideToc]]

  You can create a new wiki page by typing the CamelCase name of the page in the quick-search field at the top of the page, or by trying to view a wiki page of that name. Note that a page is "orphaned" by default until it is linked to from another page. 

  You must be granted permission to create wiki pages. If you don't see the **Create this page** button when visiting a non-existent wiki page, you lack appropriate permission. Contact your local Trac administrator for more information.

  A new wiki page can also be created as follows:

  1. Choose a name for your new page. See WikiPageNames for naming conventions.
  1. Edit an existing page or any other resource that support WikiFormatting and add a [TracLinks link] to your new page. If your page name is CamelCase, you can simply type the page name, provided the [TracIni#wiki-section ignore_missing_pages option] is `disabled` (the default).
  1. Save your changes.
  1. Follow the link you created to take you to the new page.
  1. Click the **Create this page** button to enter edit mode and add content to your new page.
  1. Save your changes to publish your page.

  == Rename a page #renaming

  While choosing a good [WikiPageNames page name] is important for usability purposes, you can always rename the page later. You will need the WIKI_RENAME permission to rename pages.

  When renaming a page, you'll be offered the possibility to create a page at the old location that contains a link to the new page, so that links pointing to the old location are not "dangling" (i.e. pointing to a non-existent page).

  ----
  See also: TracWiki, PageTemplates, WikiFormatting, TracLinks, WikiDeletePage


name: TracBackup
author: trac
ipnr: 127.0.0.1
text:
  = Trac Backup

  [[TracGuideToc]]

  Trac backups are a copied snapshot of the entire [TracEnvironment project environment] directory, including the database. Backups can be created using the `hotcopy` command of [TracAdmin trac-admin].

  '''Note''': Trac uses the `hotcopy` nomenclature to match that of [http://subversion.tigris.org/ Subversion], to make it easier to remember when managing both Trac and Subversion servers.

  == Creating a Backup

  Create a backup of a live TracEnvironment by running:
  {{{#!sh
  $ trac-admin /path/to/projenv hotcopy /path/to/backupdir
  }}}

  The database will be locked while hotcopy is running.

  The resulting backup directory is safe to handle using standard file-based backup tools like `tar` or `dump`/`restore`.

  Please note, the `hotcopy` command will not overwrite a target directory. When the target exists the operation will end with an error: `Command failed: [Errno 17] File exists:` This is discussed in [trac:#3198 #3198].

  == Restoring a Backup

  To restore an environment from a backup, stop the process running Trac, ie the web server or [TracStandalone tracd], restore the contents of your backup to your [TracEnvironment project environment] directory and restart the process.

  If you are using a database other than SQLite, you'll need to restore the database from the dump file. The dump file is saved in the environment `db` directory.

  To restore a PostgreSQL database backup, use the command:
  {{{#!sh
  $ psql -U <user> -d <database> -f /path/to/postgresql.dump
  }}}

  The `<database>` option is the same as the [TracEnvironment#DatabaseConnectionStrings database connection string] in the [TracIni#trac-database-option "[trac] database"] option of //trac.ini//.

  Similarly, for MySQL:

  {{{#!sh
  $ mysql -u <user> -p <database> < /path/to/mysql.dump
  }}}

  ----
  See also: TracAdmin, TracEnvironment, [trac:TracMigrate TracMigrate]


name: TracModWSGI
author: trac
ipnr: 127.0.0.1
text:
  = Trac and mod_wsgi

  [https://github.com/GrahamDumpleton/mod_wsgi 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.

  [[PageOutline(2-3,Overview,inline)]]

  == The `trac.wsgi` script

  Trac can be run on top of mod_wsgi with the help of an application script, which is a Python file saved with a `.wsgi` extension. 

  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].

  If you are using Trac with multiple projects, you can specify their common parent directory using the `TRAC_ENV_PARENT_DIR` in trac.wsgi (note that this directory should contain //only// Trac environments, no other sub-directories):
  {{{#!python
  def application(environ, start_request):
      # Add this to config when you have multiple projects
      environ.setdefault('trac.env_parent_dir', '/usr/share/trac/projects')  
      ..
  }}}

  === A very basic script

  In its simplest form, the script could be:

  {{{#!python
  import os

  os.environ['TRAC_ENV'] = '/usr/local/trac/mysite'
  os.environ['PYTHON_EGG_CACHE'] = '/usr/local/trac/mysite/eggs'

  import trac.web.main
  application = trac.web.main.dispatch_request
  }}}

  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`.

  On Windows:
   - If run under the user's session, the Python Egg cache can be found in `%AppData%\Roaming`, for example:
  {{{#!python
  os.environ['PYTHON_EGG_CACHE'] = r'C:\Users\Administrator\AppData\Roaming\Python-Eggs'
  }}}
   - If run under a Window service, you should create a directory for Python Egg cache:
  {{{#!python
  os.environ['PYTHON_EGG_CACHE'] = r'C:\Trac-Python-Eggs'
  }}}

  === A more elaborate script

  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. 

  To solve this problem, use the following `.wsgi` file instead:
  {{{#!python
  import os

  os.environ['PYTHON_EGG_CACHE'] = '/usr/local/trac/mysite/eggs'

  import trac.web.main
  def application(environ, start_response):
    environ['trac.env_path'] = '/usr/local/trac/mysite' 
    return trac.web.main.dispatch_request(environ, start_response)
  }}}

  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. 

  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:

  {{{#!python
  import site
  site.addsitedir('/usr/local/trac/lib/python2.4/site-packages')
  }}}

  Change it according to the path you installed the Trac libs at.

  == Mapping requests to the script

  After preparing your .wsgi script, add the following to your Apache configuration file, typically `httpd.conf`:

  {{{#!apache
  WSGIScriptAlias /trac /usr/local/trac/mysite/apache/mysite.wsgi

  <Directory /usr/local/trac/mysite/apache>
      WSGIApplicationGroup %{GLOBAL}
      # For Apache 2.2
      <IfModule !mod_authz_core.c>
          Order deny,allow
          Allow from all
      </IfModule>
      # For Apache 2.4
      <IfModule mod_authz_core.c>
          Require all granted
      </IfModule>
  </Directory>
  }}}

  Here, the script is in a subdirectory of the Trac environment.

  If you followed the directions [TracInstall#cgi-bin Generating the Trac cgi-bin directory], your Apache configuration file should look like following:

  {{{#!apache
  WSGIScriptAlias /trac /usr/share/trac/cgi-bin/trac.wsgi

  <Directory /usr/share/trac/cgi-bin>
      WSGIApplicationGroup %{GLOBAL}
      # For Apache 2.2
      <IfModule !mod_authz_core.c>
          Order deny,allow
          Allow from all
      </IfModule>
      # For Apache 2.4
      <IfModule mod_authz_core.c>
          Require all granted
      </IfModule>
  </Directory>
  }}}

  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.

  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):

  {{{#!python
  def application(environ, start_response):
          start_response('200 OK',[('Content-type','text/html')])
          return ['<html><body>Hello World!</body></html>']
  }}}

  For more information about using the mod_wsgi specific directives, see the [https://code.google.com/archive/p/modwsgi/wikis mod_wsgi's wiki] and more specifically the [https://code.google.com/archive/p/modwsgi/wikis/IntegrationWithTrac.wiki IntegrationWithTrac] page.

  == Configuring Authentication

  The following sections describe different methods for setting up authentication. See also [http://httpd.apache.org/docs/2.4/howto/auth.html Authentication, Authorization and Access Control] in the Apache guide.

  === Using Basic Authentication

  The simplest way to enable authentication with Apache is to create a password file. Use the `htpasswd` program as follows:
  {{{#!sh
  $ htpasswd -c /somewhere/trac.htpasswd admin
  New password: <type password>
  Re-type new password: <type password again>
  Adding password for user admin
  }}}

  After the first user, you don't need the "-c" option anymore:
  {{{#!sh
  $ htpasswd /somewhere/trac.htpasswd john
  New password: <type password>
  Re-type new password: <type password again>
  Adding password for user john
  }}}

  See the man page for `htpasswd` for full documentation.

  After you've created the users, you can set their permissions using TracPermissions.

  Now, you need to enable authentication against the password file in the Apache configuration:
  {{{#!apache
  <Location "/trac/login">
    AuthType Basic
    AuthName "Trac"
    AuthUserFile /somewhere/trac.htpasswd
    Require valid-user
  </Location>
  }}}

  If you are hosting multiple projects, you can use the same password file for all of them:
  {{{#!apache
  <LocationMatch "/trac/[^/]+/login">
    AuthType Basic
    AuthName "Trac"
    AuthUserFile /somewhere/trac.htpasswd
    Require valid-user
  </LocationMatch>
  }}}

  Note that neither a file nor a directory named 'login' needs to exist. See also the [https://httpd.apache.org/docs/2.4/mod/mod_auth_basic.html mod_auth_basic] documentation.

  === Using Digest Authentication

  For better security, it is recommended that you either enable SSL or at least use the "digest" authentication scheme instead of "Basic".

  You have to create your `.htpasswd` file with the `htdigest` command instead of `htpasswd`, as follows:
  {{{#!sh
  $ htdigest -c /somewhere/trac.htpasswd trac admin
  }}}

  The "trac" parameter above is the "realm", and will have to be reused in the Apache configuration in the !AuthName directive:

  {{{#!apache
  <Location "/trac/login">
    AuthType Digest
    AuthName "trac"
    AuthDigestDomain /trac
    AuthUserFile /somewhere/trac.htpasswd
    Require valid-user
  </Location>
  }}}

  For multiple environments, you can use the same `LocationMatch` as described with the previous method.

  '''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.

  Don't forget to activate the mod_auth_digest. For example, on a Debian 4.0r1 (etch) system:
  {{{#!apache
    LoadModule auth_digest_module /usr/lib/apache2/modules/mod_auth_digest.so
  }}}

  See also the [https://httpd.apache.org/docs/2.4/mod/mod_auth_basic.html mod_auth_digest] documentation.

  === Using LDAP Authentication 

  Configuration for [https://httpd.apache.org/docs/2.4/mod/mod_ldap.html mod_ldap] authentication in Apache is more involved (httpd 2.2+ and OpenLDAP: slapd 2.3.19).

  1. You need to load the following modules in Apache httpd.conf:
  {{{#!apache
    LoadModule ldap_module modules/mod_ldap.so
    LoadModule authnz_ldap_module modules/mod_authnz_ldap.so
  }}}
  1. Your httpd.conf also needs to look something like:
  {{{#!apache
  <Location /trac/>
    # (if you're using it, mod_python specific settings go here)
    Order deny,allow
    Deny from all
    Allow from 192.168.11.0/24
    AuthType Basic
    AuthName "Trac"
    AuthBasicProvider "ldap"
    AuthLDAPURL "ldap://127.0.0.1/dc=example,dc=co,dc=ke?uid?sub?(objectClass=inetOrgPerson)"
    authzldapauthoritative Off
    Require valid-user
  </Location>
  }}}
  1. You can use the LDAP interface as a way to authenticate to a Microsoft Active Directory. Use the following as your LDAP URL:
  {{{#!apache
    AuthLDAPURL "ldap://directory.example.com:3268/DC=example,DC=com?sAMAccountName?sub?(objectClass=user)"
  }}}
   You will also need to provide an account for Apache to use when checking credentials. As this password will be listed in plain text in the configuration, you need to use an account specifically for this task:
  {{{#!apache
    AuthLDAPBindDN ldap-auth-user@example.com
    AuthLDAPBindPassword "password"
  }}}
   The whole section looks like:
  {{{#!apache
  <Location /trac/>
    # (if you're using it, mod_python specific settings go here)
    Order deny,allow
    Deny from all
    Allow from 192.168.11.0/24
    AuthType Basic
    AuthName "Trac"
    AuthBasicProvider "ldap"
    AuthLDAPURL "ldap://adserver.company.com:3268/DC=company,DC=com?sAMAccountName?sub?(objectClass=user)"
    AuthLDAPBindDN       ldap-auth-user@company.com
    AuthLDAPBindPassword "the_password"
    authzldapauthoritative Off
    # require valid-user
    Require ldap-group CN=Trac Users,CN=Users,DC=company,DC=com
  </Location>
  }}}

  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.

  Note 2: You can also require the user be a member of a certain LDAP group, instead of just having a valid login:
  {{{#!apache
    Require ldap-group CN=Trac Users,CN=Users,DC=example,DC=com
  }}}

  See also:
   - [https://httpd.apache.org/docs/2.4/mod/mod_authnz_ldap.html mod_authnz_ldap], documentation for mod_authnz_ldap.   
   - [https://httpd.apache.org/docs/2.4/mod/mod_ldap.html mod_ldap], documentation for mod_ldap, which provides connection pooling and a shared cache.
   - [https://trac-hacks.org/wiki/LdapPlugin TracHacks:LdapPlugin] for storing TracPermissions in LDAP.

  === Using SSPI Authentication

  If you are using Apache on Windows, you can use mod_auth_sspi to provide single-sign-on. Download the module from the !SourceForge [http://sourceforge.net/projects/mod-auth-sspi/ mod-auth-sspi project] and then add the following to your !VirtualHost:
  {{{#!apache
  <Location /trac/login>
    AuthType SSPI
    AuthName "Trac Login"
    SSPIAuth On
    SSPIAuthoritative On
    SSPIDomain MyLocalDomain
    SSPIOfferBasic On
    SSPIOmitDomain Off
    SSPIBasicPreferred On
    Require valid-user
  </Location>
  }}}

  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.

  Some common problems with SSPI authentication: [trac:#1055], [trac:#1168] and [trac:#3338].

  See also [trac:TracOnWindows/Advanced].

  === Using CA !SiteMinder Authentication

  Setup CA !SiteMinder to protect your Trac login URL, for example `/trac/login`. Also, make sure the policy is set to include the HTTP_REMOTE_USER variable. If your site allows it, you can set this in `LocalConfig.conf`:
  {{{#!apache
  RemoteUserVar="WHATEVER_IT_SHOULD_BE"
  SetRemoteUser="YES"
  }}}

  The specific variable is site-dependent. Ask your site administrator. If your site does not allow the use of `LocalConfig.conf` for security reasons, have your site administrator set the policy on the server to set REMOTE_USER.

  Also add a !LogOffUri parameter to the agent configuration, for example `/trac/logout`.

  Then modify the trac.wsgi script generated using `trac-admin <env> deploy <dir>` to add the following lines, which extract the `HTTP_REMOTE_USER` variable and set it to `REMOTE_USER`:

  {{{#!python
  def application(environ, start_request): 
      # Set authenticated username on CA SiteMinder to REMOTE_USER variable 
      # strip() is used to remove any spaces on the end of the string
      if 'HTTP_SM_USER' in environ: 
          environ['REMOTE_USER'] = environ['HTTP_REMOTE_USER'].strip()
      ...
  }}}

  You do not need any Apache "Location" directives.

  === Example: Apache/mod_wsgi with Basic Authentication, Trac being at the root of a virtual host

  Per the mod_wsgi documentation linked to above, here is an example Apache configuration that:
   - serves the Trac instance from a virtualhost subdomain
   - uses Apache basic authentication for Trac authentication.

  If you want your Trac to be served from eg !http://trac.my-proj.my-site.org, then from the folder eg `/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:

  Create the htpasswd file:
  {{{#!sh
  cd /home/trac-for-my-proj/the-env
  htpasswd -c htpasswd firstuser
  ### and add more users to it as needed:
  htpasswd htpasswd seconduser
  }}}

  Keep the file above your document root for security reasons.

  Create this file for example `/etc/apache2/sites-enabled/trac.my-proj.my-site.org.conf` on Ubuntu with the following content:

  {{{#!apache
  <Directory /home/trac-for-my-proj/the-deploy/cgi-bin/trac.wsgi>
    WSGIApplicationGroup %{GLOBAL}
    Order deny,allow
    Allow from all
  </Directory>

  <VirtualHost *:80>
    ServerName trac.my-proj.my-site.org
    DocumentRoot /home/trac-for-my-proj/the-env/htdocs/
    WSGIScriptAlias / /home/trac-for-my-proj/the-deploy/cgi-bin/trac.wsgi
    <Location '/'>
      AuthType Basic
      AuthName "Trac"
      AuthUserFile /home/trac-for-my-proj/the-env/htpasswd
      Require valid-user
    </Location>
  </VirtualHost>

  }}}

  For subdomains to work you would probably also need to alter `/etc/hosts` and add A-Records to your host's DNS.

  == Troubleshooting

  === Use a recent version

  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 [https://code.google.com/archive/p/modwsgi/issues/100 #100] and [https://code.google.com/archive/p/modwsgi/issues/132 #132].

  '''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 0.11.2.1). Upgrading to Python 2.6.2 (as suggested [http://www.mail-archive.com/modwsgi@googlegroups.com/msg01917.html here]) solved this for me[[BR]]-- Graham Shanks

  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.

  === Getting Trac to work nicely with SSPI and 'Require Group'

  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'.

  This WSGI script fixes that:
  {{{#!python
  import os
  import trac.web.main

  os.environ['TRAC_ENV'] = '/usr/local/trac/mysite'
  os.environ['PYTHON_EGG_CACHE'] = '/usr/local/trac/mysite/eggs'

  def application(environ, start_response):
      if "\\" in environ['REMOTE_USER']:
          environ['REMOTE_USER'] = environ['REMOTE_USER'].split("\\", 1)[1]
      return trac.web.main.dispatch_request(environ, start_response)
  }}}

  === Trac with PostgreSQL

  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.

  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.

  But it is not necessary to edit the source of Trac. The following lines in `trac.wsgi` will also work:

  {{{#!python
  import trac.db.postgres_backend
  trac.db.postgres_backend.PostgreSQLConnection.poolable = False
  }}}

  or

  {{{#!python
  import trac.db.mysql_backend
  trac.db.mysql_backend.MySQLConnection.poolable = False
  }}}

  Now Trac drops the connection after serving a page and the connection count on the database will be kept low.

  //This is not a recommended approach though. See also the notes at the bottom of the [https://code.google.com/archive/p/modwsgi/wikis/IntegrationWithTrac.wiki mod_wsgi's IntegrationWithTrac] wiki page.//

  === Missing Headers and Footers

  If python optimizations are enabled, then headers and footers will not be rendered. An error will be raised in Trac 1.0.11 and later when optimizations are enabled.

  In your WSGI configuration file, the `WSGIPythonOptimize` setting must be set to `0` (`1` or `2` will not work):

  {{{#!apache
      WSGIPythonOptimize 0
  }}}

  On Ubuntu, the WSGI mod configuration is at `/etc/apache2/mods-enabled/wsgi.conf`.

  The same issue is seen with `PythonOptimize On` in [TracModPython#Pagelayoutissues ModPython].

  === Other resources

  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 [https://code.google.com/archive/p/modwsgi/wikis/ApplicationIssues.wiki application issues] when using mod_wsgi. The wsgi page also has a [https://code.google.com/archive/p/modwsgi/wikis/IntegrationWithTrac.wiki Integration With Trac] document.

  ----
  See also: TracGuide, TracInstall, [wiki:TracFastCgi FastCGI], [wiki:TracModPython ModPython], [trac:TracNginxRecipe TracNginxRecipe]


name: TracLinks
author: trac
ipnr: 127.0.0.1
text:
  = Trac Links

  [[TracGuideToc]]
  [[PageOutline(2-5,Contents,pullout)]]

  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 where WikiFormatting is used.

  TracLinks are generally of the form '''type:id''' (where ''id'' represents the number, name or path of the item) though some frequently used kinds of items also have short-hand notations.

  == Where to use TracLinks

  You can use TracLinks in:

   * Source code (Subversion) commit messages
   * Wiki pages
   * Full descriptions for tickets, reports and milestones

  and any other text fields explicitly marked as supporting WikiFormatting.

  == Overview

  ||= Wiki Markup =||= Display =||
  {{{#!td
   Wiki pages :: `CamelCase` or `wiki:CamelCase`
   Parent page :: `[..]`
   Tickets :: `#1` or `ticket:1`
   Ticket comments :: `comment:1:ticket:2`
   Reports :: `{1}` or `report:1`
   Milestones :: `milestone:1.0`
   Attachment :: `attachment:example.tgz` (for current page attachment), `attachment:attachment.1073.diff:ticket:944` (absolute path)
   Changesets :: `r1`, `[1]`, `changeset:1` or (restricted) `[1/trunk]`, `changeset:1/trunk`, `[1/repository]`
   Revision log :: `r1:3`, `[1:3]` or `log:@1:3`, `log:trunk@1:3`, `[2:5/trunk]`
   Diffs :: `diff:@1:3`, `diff:plugins/0.12/mercurial-plugin@9128:9953`,
            `diff:tags/trac-0.9.2/wiki-default//tags/trac-0.9.3/wiki-default` 
            or `diff:trunk/trac@3538//sandbox/vc-refactoring@3539`
   Files :: `source:trunk/COPYING`, `source:/trunk/COPYING@200` (at version 200), `source:/trunk/COPYING@200#L25` (at version 200, line 25)
  }}}
  {{{#!td
   Wiki pages :: CamelCase or wiki:CamelCase
   Parent page :: [..]
   Tickets :: #1 or ticket:1
   Ticket comments :: comment:1:ticket:2 
   Reports :: {1} or report:1
   Milestones :: milestone:1.0
   Attachment :: attachment:example.tgz (for current page attachment), attachment:attachment.1073.diff:ticket:944 (absolute path)
   Changesets :: r1, [1], changeset:1 or (restricted) [1/trunk], changeset:1/trunk, [1/repository]
   Revision log :: r1:3, [1:3] or log:@1:3, log:trunk@1:3, [2:5/trunk]
   Diffs :: diff:@1:3, diff:plugins/0.12/mercurial-plugin@9128:9953,
            diff:tags/trac-0.9.2/wiki-default//tags/trac-0.9.3/wiki-default 
            or diff:trunk/trac@3538//sandbox/vc-refactoring@3539
   Files :: source:trunk/COPYING, source:/trunk/COPYING@200 (at version 200), source:/trunk/COPYING@200#L25 (at version 200, line 25)
  }}}

  '''Note:''' The wiki:CamelCase form is rarely used, but it can be convenient to refer to pages whose names do not follow WikiPageNames rules, ie single words, non-alphabetic characters, etc. See WikiPageNames for more about features specific to links to Wiki page names.


  {{{#!table class=""
  |||| Trac links using the full (non-shorthand) notation can also be given a custom link title like this: ||
  {{{#!td
  {{{
  [ticket:1 This is a link to ticket number one] or
  [[ticket:1|This is another link to ticket number one]].
  }}}
  }}}
  {{{#!td
  [ticket:1 This is a link to ticket number one] or
  [[ticket:1|This is another link to ticket number one]].
  }}}
  |--------------------------------------------------------------------------------------
  |||| If the title is omitted, only the id (the part after the colon) is displayed:  ||
  {{{#!td
  {{{
  [ticket:1] or [[ticket:2]]
  }}}
  }}}
  {{{#!td
  [ticket:1] or [[ticket:2]]
  }}}
  |--------------------------------------------------------------------------------------
  |||| `wiki` is the default if the namespace part of a full link is omitted:  || 
  {{{#!td
  {{{
  [SandBox the sandbox] or
  [[SandBox|the sandbox]]
  }}}
  }}}
  {{{#!td
  [SandBox the sandbox] or
  [[SandBox|the sandbox]]
  }}}
  |--------------------------------------------------------------------------------------
  |||| The short form ''realm:target'' can also be wrapped within a <...> pair, [[br]] which allow for arbitrary characters (i.e. anything but >)  ||
  {{{#!td
  {{{
  <wiki:Strange(page@!)>
  }}}
  }}}
  {{{#!td
  <wiki:Strange(page@!)>
  }}}
  |--------------------------------------------------------------------------------------
  |||| Quoting can be used with the full notation to allow brackets in the label. ||
  {{{#!td
  {{{
  [TracIni#logging-log_type-option "[logging] log_type"]
  }}}
  }}}
  {{{#!td
  [TracIni#logging-log_type-option "[logging] log_type"]
  }}}
  }}}

  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.

  == Advanced use of TracLinks

  === Relative links

  To create a link to a [trac:SubWiki SubWiki]-page just use a '/':
  {{{
   WikiPage/SubWikiPage or ./SubWikiPage
  }}}

  To link from a [trac:SubWiki SubWiki] page to a parent, simply use a '..':
  {{{
    [..] or [[..]]
  }}}
    [..] or [[..]]

  To link from a [trac:SubWiki SubWiki] page to a [=#sibling sibling] page, use a '../':
  {{{
    [../Sibling see next sibling] or [[../Sibling|see next sibling]]
  }}}
    [../Sibling see next sibling] or [[../Sibling|see next sibling]]

  But in practice you often won't need to add the `../` prefix to link to a sibling page.
  For resolving the location of a wiki link, it's the target page closest in the hierarchy to the page where the link is written which will be selected. So for example, within a sub-hierarchy, a sibling page will be targeted in preference to a toplevel page.
  This makes it easy to copy or move pages to a sub-hierarchy by [[WikiNewPage#renaming|renaming]] without having to adapt the links.

  To link explicitly to a [=#toplevel toplevel] Wiki page, 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.

  === Link anchors

  To create a link to a specific anchor in a page, use '#':
  {{{
   [#Linkanchors Link anchors] or [[#Linkanchors|Link anchors]]
  }}}
    [#Linkanchors Link anchors] or [[#Linkanchors|Link anchors]]

  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.

  To create a link to the first or last occurrence of a term on a page, use a ''pseudo anchor'' starting with '#/' or '#?':
  {{{
   [#/Milestone first occurrence of Milestone] or
   [#?Milestone last occurrence of Milestone]
  }}}
   [#/Milestone first occurrence of Milestone] or
   [#?Milestone last occurrence of Milestone]
  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':
  {{{
   [#/Milestone/i first occurrence of Milestone or milestone] or
   [#?Milestone/i last occurrence of Milestone or milestone]
  }}}
   [#/Milestone/i first occurrence of Milestone or milestone] or
   [#?Milestone/i last occurrence of Milestone or milestone]

  ''(since Trac 1.0)''

  Such anchors can be very useful for linking to specific lines in a file in the source browser:
  {{{
   [trac:source:tags/trac-0.12/trac/wiki/api.py#L127 Line 127] or
   [trac:source:tags/trac-0.12/trac/ticket/roadmap.py#L47 Line 47]
  }}}
   [trac:source:tags/trac-0.12/trac/wiki/api.py#L127 Line 127] or
   [trac:source:tags/trac-0.12/trac/ticket/roadmap.py#L47 Line 47]
  (Hint: The line numbers displayed in the source browser are links to anchors on the respective lines.)

  Since such links become outdated when the file changes, it can be useful to link using a '#/' pseudo anchor instead:
  {{{
   [trac:source:trunk/trac/wiki/api.py#/IWikiSyntaxProvider IWikiSyntaxProvider] or
   [trac:source:trunk/trac/env.py#/ISystemInfoProvider ISystemInfoProvider]
  }}}
   [trac:source:trunk/trac/wiki/api.py#/IWikiSyntaxProvider IWikiSyntaxProvider] or
   [trac:source:trunk/trac/env.py#/ISystemInfoProvider ISystemInfoProvider]

  === InterWiki links

  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 is a more specialized way to register other Trac environments which offers greater flexibility.

  === InterTrac links

  This can be seen as a kind of InterWiki link specialized for targeting other Trac projects.

  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. 

  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].
  See InterTrac for the complete details. 

  === Server-relative links

  It is often useful to be able to link to objects in your project that have no built-in Trac linking mechanism, such as static resources, `newticket`, a shared `/register` page on the server, etc.

  To link to resources inside the project, use either an absolute path from the project root, or a relative link from the URL of the current page (''Changed in 0.11''):

  {{{
  [/newticket Create a new ticket] or [[//newticket|Create a new ticket]]
  [/ home] or [[/|home]]
  }}}

  Display: [/newticket Create a new ticket] or [[//newticket|Create a new ticket]]
  [/ home] or [[/|home]]

  To link to another location on the server (possibly outside the project but on the same host), use the `//` prefix (''Changed in 0.11''):

  {{{
  [//register Register Here] or [[//register|Register Here]]
  }}}

  Display: [//register Register Here] or [[//register|Register Here]]

  === Quoting space in TracLinks

  Immediately after a TracLinks prefix, targets containing space characters should be enclosed in a pair of quotes or double quotes.
  Examples:
   * !wiki:"The whitespace convention"
   * !attachment:'the file.txt' or
   * !attachment:"the file.txt" 
   * !attachment:"the file.txt:ticket:123" 

  Note that by using [trac:WikiCreole] style links, it's quite natural to write links containing spaces:
   * ![[The whitespace convention]]
   * ![[attachment:the file.txt]]

  === Escaping Links

  To prevent parsing of a !TracLink, you can escape it by preceding it with a '!' (exclamation mark).
  {{{
   !NoLinkHere.
   ![42] is not a link either.
  }}}

  Display:
   !NoLinkHere.
   ![42] is not a link either.

  === Parameterized Trac links

  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.

  Trac links can support an arbitrary set of parameters, written in the same way as they would be for the corresponding URL. Some examples:
   - `wiki:WikiStart?format=txt`
   - `ticket:1?version=1`
   - `[/newticket?component=module1 create a ticket for module1]`
   - `[/newticket?summary=Add+short+description+here create a ticket with URL with spaces]`

  == TracLinks Reference

  The following sections describe the individual link types in detail, as well as notes on advanced usage of links.

  === attachment: links

  The link syntax for attachments is as follows:
   * !attachment:the_file.txt creates a link to the attachment the_file.txt of the current object
   * !attachment:the_file.txt:wiki:MyPage creates a link to the attachment the_file.txt of the !MyPage wiki page
   * !attachment:the_file.txt:ticket:753 creates a link to the attachment the_file.txt of the ticket 753

  Note that the older way, putting the filename at the end, is still supported: !attachment:ticket:753:the_file.txt, but is not recommended.

  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:`.

  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.

  See also [#export:links].

  === comment: links

  When you're inside a given ticket, you can simply write e.g. !comment:3 to link to the third change comment.
  It is possible to link to a comment of a specific ticket from anywhere using one of the following syntax:
   - `comment:3:ticket:123` 
   - `ticket:123#comment:3` (note that you can't write `#123#!comment:3`!)
  It is also possible to link to the ticket's description using one of the following syntax:
   - `comment:description` (within the ticket)
   - `comment:description:ticket:123`
   - `ticket:123#comment:description`

  === htdocs: links

  Use `htdocs:path/to/file` to reference files in the `htdocs` directory of the Trac environment, the [TracEnvironment#DirectoryStructure web resource directory].

  === query: links

  See TracQuery#UsingTracLinks and [#ticket:links].

  === search: links

  See TracSearch#SearchLinks 

  === ticket: links

   ''aliases:'' `bug:`, `issue:`

  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.

  Example: 
   - `ticket:5000-6000`
   - `ticket:1,150`

  === timeline: links

  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.

  Examples:
   - `timeline:2008-01-29`
   - `timeline:2008-01-29T15:48`
   - `timeline:2008-01-29T15:48Z`
   - `timeline:2008-01-29T16:48+01`
   - `timeline:2008-01-29T16:48+0100`
   - `timeline:2008-01-29T16:48+01:00`

  === wiki: links

  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.

  === Version Control related links

  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.

  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'`.

  ==== source: links

   ''aliases:'' `browser:`, `repos:`

  The default behavior for a `source:/some/path link` is to open the browser in that directory directory if the path points to a directory or to show the latest content of the file.

  It's also possible to link directly to a specific revision of a file like this:
   - `source:/some/file@123` - link to the file's revision 123
   - `source:/some/file@head` - link explicitly to the latest revision of the file
   - `source:/some/file@named-branch` - link to latest revision of the specified file in `named-branch` (DVCS such as Git or Mercurial)

  If the revision is specified, one can even link to a specific line number:
   - `source:/some/file@123#L10`
   - `source:/tag/0.10@head#L10`
   - `source:/some/file@named-branch#L10`

  Finally, one can also highlight an arbitrary set of lines:
   - `source:/some/file@123:10-20,100,103#L99` - highlight lines 10 to 20, and lines 100 and 103, and target line 99
   - 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.

  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)''

  ==== export: links

  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:
   * `export:/some/file` - get the HEAD revision of the specified file
   * `export:123:/some/file` - get revision 123 of the specified file
   * `export:/some/file@123` - get revision 123 of the specified file
   * `export:/some/file@named-branch` - get latest revision of the specified file in `named-branch` (DVCS such as Git or Mercurial).

  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. 

  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`).

  ==== log: links

  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.
   - `log:/` - the latest revisions starting at the root of the repository
   - `log:/trunk/tools` - the latest revisions in `trunk/tools`
   - `log:/trunk/tools@10000` - the revisions in `trunk/tools` starting from  revision 10000
   - `log:@20788,20791:20795` - list revision 20788 and the revisions from 20791 to 20795 
   - `log:/trunk/tools@20788,20791:20795` - list revision 20788 and the revisions from 20791 to 20795 which affect the given path
   - `log:/tools@named-branch` - the revisions in `tools` starting from the latest revision in `named-branch` (DVCS such as Git or Mercurial)

  There are short forms for revision ranges as well:
   - `[20788,20791:20795]`
   - `[20788,20791:20795/trunk/tools]`
   - `r20791:20795` (but not `r20788,20791:20795` nor `r20791:20795/trunk`)

  Finally, note that in all of the above, a revision range can be written either as `x:y` or `x-y`.

  ==== Multi-repository links

  In the presence of multiple repositories, the name of the repository should be specified as the first part of the path:
  - `log:repos/branch`
  - `[20-40/repos]`
  - `r20/repos`

  ----
  See also: WikiFormatting, TracWiki, WikiPageNames, InterTrac, InterWiki


name: InterTrac
author: trac
ipnr: 127.0.0.1
text:
  = InterTrac Links

  Trac supports a convenient way to refer to resources of other Trac servers using Wiki markup. An !InterTrac link can be seen as a scoped [TracLinks TracLink]. It is used for referring to a Trac resource located in another Trac environment.

  == Link Syntax

  Simply use the name of the other Trac environment as a prefix, followed by a colon, ending with the resource located in the other environment:

  {{{
  <target_environment>:<TracLinks>
  }}}

  The other resource is specified using a regular !TracLink, of any flavor.

  That target environment name is either the real name of the environment or an alias. 
  The aliases are defined in the `trac.ini` file, see below.
  The prefix is case insensitive.

  If the InterTrac link is enclosed in square brackets, like `[th:WikiExtrasPlugin]`, the InterTrac prefix is removed in the displayed link like a normal link resolver would be. For example, the above would be displayed as `WikiExtrasPlugin`.

  For convenience, there is also an alternate short-hand form, where an alias can be used as an immediate prefix for the identifier of a ticket, changeset or report, eg `#T234`, `[T1508]`, `[trac 1508]`.

  == Examples

  The only prefix defined by default is `trac`, which points to trac.edgewall.org. Additional prefixes can be specified in the [TracIni#intertrac-section intertrac] section of TracIni. For example:

  {{{#!ini
  [intertrac]
  # -- Example of setting up an alias:
  t = trac

  # -- Link to an external Trac:
  genshi.title = Edgewall's Trac for Genshi
  genshi.url = http://genshi.edgewall.org
  }}}

  The `.url` is mandatory and is used for locating the other Trac.
  It can be a relative URL when the Trac environment is located on the same server.

  The `.title` information is used in a tooltip, ie when hovering the cursor over an InterTrac link.

  Now, given the above configuration, one could create the following links:
   * to this InterTrac page:
     * `trac:wiki:InterTrac` trac:wiki:InterTrac
     * `t:wiki:InterTrac` t:wiki:InterTrac
     * `genshi:InterTrac` genshi:InterTrac
     * Keys are case insensitive: `T:wiki:InterTrac` T:wiki:InterTrac
   * to the ticket #234:
     * `trac:ticket:234` trac:ticket:234
     * `trac:#234` trac:#234 
     * `genshi:#234` genshi:#234
     * `#T234` #T234
   * to the changeset [1912]:
     * `trac:changeset:1912` trac:changeset:1912
     * `[T1912]` [T1912]
   * to the log range [3300:3330]:
     * `trac:log:@3300:3330` trac:log:@3300:3330  
     * `[trac 3300:3330]` [trac 3300:3330]
     * finally, to link to the start page of a remote trac, simply use its prefix followed by ':', inside an explicit link. Example: `[th: Trac Hacks]` (note that the ''remote'' Trac has to run Trac >= 0.11 for this to work'')

  The generic form `intertrac_prefix:module:id` is translated to the corresponding URL `<remote>/module/id`. Shorthand links are specific to some modules (e.g. !#T234 is processed by the ticket module). For the rest (`intertrac_prefix:something`), we rely on the [TracSearch#quickjump quick jump] facility of the remote Trac.

  == List of Active InterTrac Prefixes

  The following InterTrac prefixes are available on this site:

  [[InterTrac]]

  ----
  See also: TracLinks, InterWiki


name: WikiRestructuredText
author: trac
ipnr: 127.0.0.1
text:
  = reStructuredText Support in Trac

  == Introduction


  Trac supports [http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html reStructuredText (RST)] as an alternative to wiki markup where WikiFormatting is used.

  From the reStucturedText webpage:
   "reStructuredText is an easy-to-read, what-you-see-is-what-you-get plaintext markup syntax and parser system. It is useful for in-line program documentation (such as Python docstrings), for quickly creating simple web pages, and for standalone documents. reStructuredText is designed for extensibility for specific application domains."

  If you want a file from your Subversion repository to be displayed as reStructuredText in the Trac source browser, set `text/x-rst` as the value for the Subversion property `svn:mime-type`, or add the extension `rst` to the filename. See [trac:source:/trunk/INSTALL.rst this example].

  The examples will only be rendered as reStructuredText if docutils is installed. If Pygments is installed but docutils is not installed, the examples will be syntax-highlighted rather than rendered as reStructuredText.

  === Requirements

  To activate RST support in Trac, install the python docutils package with the command `easy_install docutils`, or through your operating system package manager. If not already available on your operating system, you can download it from [https://pypi.python.org/pypi/docutils PyPI].

  === More information on RST

   * [http://docutils.sourceforge.net/rst.html reStructuredText Website]
   * [http://docutils.sourceforge.net/docs/rst/quickref.html RST Quick Reference]

  == Using RST in Trac

  To specify that a block of text should be parsed using RST, use the ''rst'' processor. 

  === TracLinks in reStructuredText

   * Trac provides a custom RST directive `trac::` to allow TracLinks from within RST text.
     ||= Wiki Markup ||= Display ||
     {{{#!td
       {{{
       {{{#!rst
       This is a reference to |a ticket|

       .. |a ticket| trac:: #42
       }}}
       }}}
     }}}
     {{{#!td
       {{{#!rst
       This is a reference to |a ticket|

       .. |a ticket| trac:: #42
       }}}
     }}}

   * You can also use the custom `:trac:` role to create TracLinks in RST.
     ||= Wiki Markup ||= Display ||
     {{{#!td
       {{{
       {{{#!rst
       This is a reference to ticket `#12`:trac:

       To learn how to use Trac, see `TracGuide`:trac:
       }}}
       }}}
     }}}
     {{{#!td
       {{{#!rst
       This is a reference to ticket `#12`:trac:

       To learn how to use Trac, see `TracGuide`:trac:
       }}}
     }}}

   For a complete example of all uses of the `:trac:` role, see WikiRestructuredTextLinks. 

  === Syntax highlighting in reStructuredText

  There is a directive for doing TracSyntaxColoring in RST as well. The directive is called code-block:

  ||= Wiki Markup ||= Display ||
  {{{#!td
    {{{
    {{{#!rst

    .. code-block:: python

       class Test:

           def TestFunction(self):
               pass
    
    }}}
    }}}
  }}}
  {{{#!td
    {{{#!rst

    .. code-block:: python

       class Test:

           def TestFunction(self):
               pass

    }}}
  }}}
  Note the need to indent the code at least one character after the `.. code-block` directive.

  === Wiki Macros in reStructuredText

  To enable [WikiMacros Wiki Macros] in RST, you use the same `code-block` directive as for syntax highlighting:

  ||= Wiki Markup ||= Display ||
  {{{#!td
    {{{
    {{{#!rst

    .. code-block:: RecentChanges

       Trac,3

    }}}
    }}}
  }}}
  {{{#!td
    {{{#!rst

    .. code-block:: RecentChanges

       Trac,3

    }}}
  }}}

  Or use the `:code-block:` role for a more concise Wiki Macro-like syntax:

  ||= Wiki Markup ||= Display ||
  {{{#!td
    {{{
    {{{
    #!rst

    :code-block:`RecentChanges:Trac,3`
    }}}
    }}}
  }}}
  {{{#!td
    {{{#!rst

    :code-block:`RecentChanges:Trac,3`
    }}}
  }}}

  === Bigger RST Example

  The example below should be self-explanatory:

  ||= Wiki Markup ||= Display ||
  {{{#!td
  {{{#!html
  <pre class="wiki">{{{#!rst
  FooBar Header
  =============
  reStructuredText is **nice**. It has its own webpage_.

  A table:

  =====  =====  ======
     Inputs     Output
  ------------  ------
    A      B    A or B
  =====  =====  ======
  False  False  False
  True   False  True
  False  True   True
  True   True   True
  =====  =====  ======

  RST TracLinks
  -------------

  See also ticket `#42`:trac:.

  .. _webpage: http://docutils.sourceforge.net/rst.html
  }}}</pre>
  }}}
  }}}
  {{{#!td
  {{{#!rst
  FooBar Header
  =============
  reStructuredText is **nice**. It has its own webpage_.

  A table:

  =====  =====  ======
     Inputs     Output
  ------------  ------
    A      B    A or B
  =====  =====  ======
  False  False  False
  True   False  True
  False  True   True
  True   True   True
  =====  =====  ======

  RST TracLinks
  -------------

  See also ticket `#42`:trac:.

  .. _webpage: http://docutils.sourceforge.net/rst.html
  }}}
  }}}

  ----
  See also: WikiRestructuredTextLinks, WikiProcessors, WikiFormatting


name: TracFineGrainedPermissions
author: trac
ipnr: 127.0.0.1
text:
  = Fine grained permissions
  [[PageOutline(2-5, Contents, floated)]]
  [[TracGuideToc]]

  There is a general mechanism in place that allows custom **permission policies** to grant or deny any action on any Trac resource, or even specific versions of a resource.

  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.

  == Permission Policies

  A great diversity of permission policies can be implemented and Trac comes with a few examples. 

  The active policies are determined by a [TracIni#trac-permission_policies-option configuration setting]:

  {{{#!ini
  [trac]
  permission_policies = ReadonlyWikiPolicy, DefaultPermissionPolicy, LegacyAttachmentPolicy
  }}}

  * [#ReadonlyWikiPolicy] controls readonly access to wiki pages.
  * !DefaultPermissionPolicy checks for the traditional coarse-grained permissions described in TracPermissions.
  * !LegacyAttachmentPolicy uses the coarse-grained permissions to check permissions on attachments.

  Among the optional choices, there is [#AuthzPolicy], a very generic permission policy, based on an Authz-style system. See
  [trac:source:branches/1.2-stable/tracopt/perm/authz_policy.py authz_policy.py] for details. 

  Another permission policy [#AuthzSourcePolicy], uses the [http://svnbook.red-bean.com/nightly/en/svn.serverconfig.pathbasedauthz.html path-based authorization] defined by Subversion to enforce permissions on the version control system.

  See also [trac:source:branches/1.2-stable/sample-plugins/permissions sample-plugins/permissions] for more examples.

  === !AuthzPolicy
  ==== Configuration
  * Put a [http://swapoff.org/files/authzpolicy.conf conf] file in a secure location on the server, not readable by users other than the webuser. If the  file contains non-ASCII characters, the UTF-8 encoding should be used.
  * Update your `trac.ini`:
    1. modify the [TracIni#trac-section permission_policies] entry in the `[trac]` section:
  {{{#!ini
  [trac]
  permission_policies = AuthzPolicy, ReadonlyWikiPolicy, DefaultPermissionPolicy, LegacyAttachmentPolicy
  }}}
    1. add a new `[authz_policy]` section and point the `authz_file` option to the conf file:
  {{{#!ini
  [authz_policy]
  authz_file = /some/trac/env/conf/authzpolicy.conf
  }}}
    1. enable the plugin through [/admin/general/plugin WebAdmin] or by editing the `[components]` section:
  {{{#!ini
  [components]
  tracopt.perm.authz_policy.* = enabled
  }}}

  ==== Usage Notes

  Note the order in which permission policies are specified: policies are implemented in the sequence provided and therefore may override earlier policy specifications.

  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.

  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.

  The `authzpolicy.conf` file is a `.ini` style configuration file:
  {{{#!ini
  [wiki:PrivatePage@*]
  john = WIKI_VIEW, !WIKI_MODIFY
  jack = WIKI_VIEW
  * =
  }}}
  * Each section of the config is a glob pattern used to match against a Trac resource descriptor. These descriptors are in the form:
  {{{
  <realm>:<id>@<version>[/<realm>:<id>@<version> ...]
  }}}

  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:
  {{{#!ini
  [wiki:*]
  [wiki:WikiStart*]
  [wiki:WikiStart@*]
  [wiki:WikiStart]
  }}}

  Example: Match the attachment `wiki:WikiStart@117/attachment:FOO.JPG@*` on WikiStart:
  {{{#!ini
  [wiki:*]
  [wiki:WikiStart*]
  [wiki:WikiStart@*]
  [wiki:WikiStart@*/attachment:*]
  [wiki:WikiStart@117/attachment:FOO.JPG]
  }}}

  * Sections are checked against the current Trac resource descriptor '''IN ORDER''' of appearance in the configuration file. '''ORDER IS CRITICAL'''.

  * Once a section matches, the current username is matched against the keys (usernames) of the section, '''IN ORDER'''. 
    * If a key (username) is prefixed with a `@`, it is treated as a group. 
    * If a value (permission) is prefixed with a `!`, the permission is denied rather than granted.

  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. ||

  For example, if the `authz_file` contains:
  {{{#!ini
  [wiki:WikiStart@*]
  * = WIKI_VIEW

  [wiki:PrivatePage@*]
  john = WIKI_VIEW
  * = !WIKI_VIEW
  }}}
  and the default permissions are set like this:
  {{{
  john           WIKI_VIEW
  jack           WIKI_VIEW
  # anonymous has no WIKI_VIEW
  }}}

  Then: 
    * All versions of WikiStart will be viewable by everybody, including anonymous
    * !PrivatePage will be viewable only by john
    * other pages will be viewable only by john and jack

  Groups:
  {{{#!ini
  [groups]
  admins = john, jack
  devs = alice, bob

  [wiki:Dev@*]
  @admins = TRAC_ADMIN
  @devs = WIKI_VIEW
  * =

  [*]
  @admins = TRAC_ADMIN
  * =
  }}}

  Then:
  - everything is blocked (whitelist approach), but
  - admins get all TRAC_ADMIN everywhere and
  - devs can view wiki pages.

  Some repository examples (Browse Source specific):
  {{{#!ini
  # A single repository:
  [repository:test_repo@*]
  john = BROWSER_VIEW, FILE_VIEW
  # John has BROWSER_VIEW and FILE_VIEW for the entire test_repo

  # The default repository (requires Trac 1.0.2 or later):
  [repository:@*]
  john = BROWSER_VIEW, FILE_VIEW
  # John has BROWSER_VIEW and FILE_VIEW for the entire default repository

  # All repositories:
  [repository:*@*]
  jack = BROWSER_VIEW, FILE_VIEW
  # Jack has BROWSER_VIEW and FILE_VIEW for all repositories
  }}}

  Very granular repository access:
  {{{#!ini
  # John has BROWSER_VIEW and FILE_VIEW access to trunk/src/some/location/ only
  [repository:test_repo@*/source:trunk/src/some/location/*@*]
  john = BROWSER_VIEW, FILE_VIEW

  # John has BROWSER_VIEW and FILE_VIEW access to only revision 1 of all files at trunk/src/some/location only
  [repository:test_repo@*/source:trunk/src/some/location/*@1]
  john = BROWSER_VIEW, FILE_VIEW

  # John has BROWSER_VIEW and FILE_VIEW access to all revisions of 'somefile' at trunk/src/some/location only 
  [repository:test_repo@*/source:trunk/src/some/location/somefile@*]
  john = BROWSER_VIEW, FILE_VIEW

  # John has BROWSER_VIEW and FILE_VIEW access to only revision 1 of 'somefile' at trunk/src/some/location only
  [repository:test_repo@*/source:trunk/src/some/location/somefile@1]
  john = BROWSER_VIEW, FILE_VIEW
  }}}

  Note: In order for Timeline to work/visible for John, we must add CHANGESET_VIEW to the above permission list.

  ==== Missing Features
  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].

  You cannot do the following:
  {{{#!ini
  [groups]
  team1 = a, b, c
  team2 = d, e, f
  team3 = g, h, i
  departmentA = team1, team2
  }}}

  Permission groups are not supported either, so you cannot do the following:
  {{{#!ini
  [groups]
  permission_level_1 = WIKI_VIEW, TICKET_VIEW
  permission_level_2  = permission_level_1, WIKI_MODIFY, TICKET_MODIFY
  [*]
  @team1 = permission_level_1
  @team2 = permission_level_2
  @team3 = permission_level_2, TICKET_CREATE
  }}}

  === !AuthzSourcePolicy  (mod_authz_svn-like permission policy) #AuthzSourcePolicy

  `AuthzSourcePolicy` can be used for restricting access to the repository. Granular permission control needs a definition file, which is the one used by Subversion's mod_authz_svn. 
  More information about this file format and about its usage in Subversion is available in the [http://svnbook.red-bean.com/en/1.7/svn.serverconfig.pathbasedauthz.html Path-Based Authorization] section in the Server Configuration chapter of the svn book.

  Example:
  {{{#!ini
  [/]
  * = r

  [/branches/calc/bug-142]
  harry = rw
  sally = r

  [/branches/calc/bug-142/secret]
  harry =
  }}}

   * '''/''' = ''Everyone has read access by default''
   * '''/branches/calc/bug-142''' = ''harry has read/write access, sally read only''
   * '''/branches/calc/bug-142/secret''' = ''harry has no access, sally has read access (inherited as a sub folder permission)''

  ==== Trac Configuration

  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.

  {{{#!ini
  [svn]
  authz_file = /path/to/svnaccessfile
  }}}

  If you want to support the use of the `[`''modulename''`:/`''some''`/`''path''`]` syntax within the `authz_file`, add:

  {{{#!ini
  authz_module_name = modulename
  }}}

  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:

  {{{ #!ini
  [svn]
  authz_file = /path/to/svnaccessfile
  authz_module_name = somemodule
  ...
  [repositories]
  somemodule.dir = /srv/active/svn/somemodule 
  }}}

  where the svn access file, {{{/path/to/svnaccessfile}}}, contains entries such as {{{[somemodule:/some/path]}}}.

  '''Note:''' Usernames inside the Authz file __must__ be the same as those used inside trac. 

  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.

  {{{#!ini
  [trac]
  permission_policies = AuthzSourcePolicy, ReadonlyWikiPolicy, DefaultPermissionPolicy, LegacyAttachmentPolicy
  }}}

  ==== Subversion Configuration

  The same access file is typically applied to the corresponding Subversion repository using an Apache directive like this:
  {{{#!apache
  <Location /repos>
    DAV svn
    SVNParentPath /usr/local/svn

    # our access control policy
    AuthzSVNAccessFile /path/to/svnaccessfile
  </Location>
  }}}

  For information about how to restrict access to entire projects in a multiple project environment see [trac:wiki:TracMultipleProjectsSVNAccess].

  === ReadonlyWikiPolicy

  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:
  {{{
  [trac]
  permission_policies = ReadonlyWikiPolicy,
   DefaultPermissionPolicy,
   LegacyAttachmentPolicy
  }}}

  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.

  **!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.

  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.

  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.
  {{{
  [trac]
  permission_policies = AuthzPolicy,
   ReadonlyWikiPolicy,
   DefaultPermissionPolicy,
   LegacyAttachmentPolicy
  }}}

  The placement of [#AuthzSourcePolicy] relative to `ReadonlyWikiPolicy` does not matter since they don't perform checks on the same realms.

  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.

  == Debugging permissions
  In trac.ini set:
  {{{#!ini
  [logging]
  log_file = trac.log
  log_level = DEBUG
  log_type = file
  }}}

  Display the trac.log to understand what checks are being performed:
  {{{#!sh
  tail -n 0 -f log/trac.log | egrep '\[perm\]|\[authz_policy\]'
  }}}

  See the sourced documentation of the plugin for more info.

  ----
  See also: TracPermissions,
  [http://trac-hacks.org/wiki/FineGrainedPageAuthzEditorPlugin TracHacks:FineGrainedPageAuthzEditorPlugin] for a simple editor plugin.


name: TracIni
author: trac
ipnr: 127.0.0.1
text:
  = The Trac Configuration File

  [[TracGuideToc]]
  [[PageOutline(2-5,Contents,pullout)]]

  Trac is configured through 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.

  Trac monitors the timestamp of the file to trigger an environment reload 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.

  == Global Configuration

  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:
  {{{#!ini
  [inherit]
  file = /path/to/global/trac.ini
  }}}
  Multiple files can be specified using a comma-separated list.

  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 specify `--inherit` 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 in the global file.

  There are two more options in the [[#inherit-section| [inherit] ]] section, [#inherit-templates_dir-option templates_dir] for sharing global templates and [TracIni#inherit-plugins_dir-option plugins_dir], for sharing plugins. Those options can be specified in the shared configuration file, and in fact, configuration files can even be chained if you specify another `[inherit] file` there.

  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 to write a custom plugin doing an appropriate `ITemplateStreamFilter` transformation.

  == Reference for settings

  This is a reference of available configuration options, and their default settings.

  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.

  [[TracIni]]

  ----
  See also: TracAdmin, TracEnvironment


name: TracWorkflow
author: trac
ipnr: 127.0.0.1
text:
  = The Trac Ticket Workflow System

  [[PageOutline(2-5,Contents,pullout)]]
  [[TracGuideToc]]
  The Trac ticket system provides a configurable workflow.

  == The Default Ticket Workflow

  When a new environment is created, a default workflow is configured in your trac.ini. This workflow is the basic workflow, as specified in [trac:source:/trunk/trac/ticket/workflows/basic-workflow.ini basic-workflow.ini]:

  {{{#!Workflow width=700 height=300
  leave = * -> *
  leave.operations = leave_status
  leave.default = 1

  create = <none> -> new
  create.default = 1

  create_and_assign = <none> -> assigned
  create_and_assign.label = assign
  create_and_assign.permissions = TICKET_MODIFY
  create_and_assign.operations = may_set_owner

  accept = new,assigned,accepted,reopened -> accepted
  accept.permissions = TICKET_MODIFY
  accept.operations = set_owner_to_self

  resolve = new,assigned,accepted,reopened -> closed
  resolve.permissions = TICKET_MODIFY
  resolve.operations = set_resolution

  reassign = new,assigned,accepted,reopened -> assigned
  reassign.permissions = TICKET_MODIFY
  reassign.operations = set_owner

  reopen = closed -> reopened
  reopen.permissions = TICKET_CREATE
  reopen.operations = del_resolution
  }}}

  == Additional Ticket Workflows

  There are example workflows provided in the Trac source tree, see [trac:source:trunk/contrib/workflow contrib/workflow] for `.ini` config sections. One of those may be a good match for what you want. They can be pasted into the `[ticket-workflow]` section of your `trac.ini` file. However, if you have existing tickets then there may be issues if those tickets have states that are not in the new workflow. 

  Here are some [trac:WorkFlow/Examples diagrams] of the above examples.

  == Basic Ticket Workflow Customization

  '''Note''': Ticket "statuses" or "states" are not separately defined. The states a ticket can be in are automatically generated by the transitions defined in a workflow. Therefore, creating a new ticket state simply requires defining a state transition in the workflow that starts or ends with that state.

  In the `[ticket-workflow]` section of `trac.ini`, each entry is an action that may be taken on a ticket. 
  For example, consider the `accept` action from `simple-workflow.ini`:

  {{{#!ini
  accept = new,accepted -> accepted
  accept.permissions = TICKET_MODIFY
  accept.operations = set_owner_to_self
  }}}

  The first line in this example defines the `accept` action, along with the states the action is valid in (`new` and `accepted`), and the new state of the ticket when the action is taken (`accepted`).

  The `accept.permissions` line specifies the permissions the user must have to use this action. [trac:ExtraPermissionsProvider] can define new permissions to be used here.

  The `accept.operations` line specifies changes that will be made to the ticket in addition to the status change when the action is taken.  In this case, when a user clicks on `accept`, the ticket owner field is updated to the logged in user.  Multiple operations may be specified in a comma separated list.

  The available operations are:
  - **del_owner** -- Clears the owner field.
  - **set_owner** -- Sets the owner to the selected or entered owner. Defaults to the current user. When `[ticket] restrict_owner = true`, the select will be populated with users that have `TICKET_MODIFY` permission and an authenticated session.
   - ''actionname''`.set_owner` may optionally specify a comma delimited list of users that will be used to populate the select, or a single user. Groups and permissions may also be included in the list //(Since 1.1.3)//. When groups or permissions are specified the select is populated with all members of the group or all users that possess the permission.
  - **set_owner_to_self** -- Sets the owner to the logged in user.
  - **may_set_owner** -- Sets the owner to the selected or entered owner. Defaults to the existing owner. //(Since 1.1.2)//. 
  - **del_resolution** -- Clears the resolution field.
  - **set_resolution** -- Sets the resolution to the selected value.
   - ''actionname''`.set_resolution` may optionally be set to a comma delimited list or a single value. Example:
   {{{#!ini
  resolve_new = new -> closed
  resolve_new.label = resolve
  resolve_new.operations = set_resolution
  resolve_new.permissions = TICKET_MODIFY
  resolve_new.set_resolution = invalid,wontfix
  }}}
  - **leave_status** -- Displays "leave as <current status>" and makes no change to the ticket.
  - **reset_workflow** -- Resets the status of tickets that are in states no longer defined.
  '''Note:''' Specifying conflicting operations, such as `set_owner` and `del_owner`, has unspecified results.

  The example that follows demonstrates the `.label` attribute. The action here is `resolve_accepted`, but it will be presented to the user as `resolve`.

  {{{#!ini
  resolve_accepted = accepted -> closed
  resolve_accepted.label = resolve
  resolve_accepted.permissions = TICKET_MODIFY
  resolve_accepted.operations = set_resolution
  }}}

  The `.label` attribute is new in Trac 1.1.3 and is functionally the same as the `.name` attribute, which is now deprecated. If neither `.label` or `.name` is specified, the action will be presented to the user as //resolve accepted//, the underscores having been replaced by whitespace (//Since 1.1.3//).

  For actions that should be available in all states, `*` may be used in place of the state. The obvious example is the `leave` action:
  {{{#!ini
  leave = * -> *
  leave.operations = leave_status
  leave.default = 1
  }}}

  This also shows the use of the `.default` attribute. This value is expected to be an integer, and the order in which the actions are displayed is determined by this value. The action with the highest `.default` value is listed first, and is selected by default. The rest of the actions are listed in order of decreasing `.default` values.
  If not specified for an action, `.default` is 0. The value may be negative.

  There is one hard-coded constraint to the workflow: tickets are expected to have a `closed` state. The default reports/queries treat any state other than `closed` as an open state.

  === Ticket Create Action

  The ticket create actions are specified by a transition from the special `<none>` state. At least one create action must be available to the user in order for tickets to be created. The create actions defined in the default workflow are:
  {{{#!ini
  create = <none> -> new
  create.default = 1

  create_and_assign = <none> -> assigned
  create_and_assign.label = assign
  create_and_assign.permissions = TICKET_MODIFY
  create_and_assign.operations = may_set_owner
  }}}

  === Ticket Reset Action

  The special `_reset` action is added by default for tickets that are in states that are no longer defined. This allows tickets to be individually "repaired" after the workflow is changed, although it's recommended that the administrator perform the action by batch modifying the affected tickets. By default the `_reset` action is available to users with the `TICKET_ADMIN` permission and reset tickets are put in the //new// state. The default `_reset` action is equivalent to the following `[ticket-workflow]` action definition:

  {{{#!ini
  _reset = -> new
  _reset.label = reset
  _reset.operations = reset_workflow
  _reset.permissions = TICKET_ADMIN
  _reset.default = 0
  }}}

  Since [trac:milestone:1.0.3] the `_reset` action can be customized by redefining the implicit action. For example, to allow anyone with `TICKET_MODIFY` to perform the `_reset` action, the workflow action would need to be defined:

  {{{#!ini
  _reset = -> new
  _reset.label = reset
  _reset.operations = reset_workflow
  _reset.permissions = TICKET_MODIFY
  _reset.default = 0
  }}}

  == Workflow Visualization

  Workflows can be visualized by rendering them on the wiki using the [WikiMacros#Workflow-macro Workflow macro].

  Workflows can also be visualized using the `contrib/workflow/workflow_parser.py` script. The script outputs `.dot` files that [http://www.graphviz.org GraphViz] understands. The script can be used as follows (your install path may be different):

  {{{#!sh
  $ cd /var/local/trac_devel/contrib/workflow/
  $ ./showworkflow /srv/trac/PlannerSuite/conf/trac.ini
  }}}
  The script outputs `trac.pdf` in the same directory as the `trac.ini` file.

  == Example: Adding optional Testing with Workflow

  The following adds a `testing` action. When the ticket has status `new`, `accepted` or `needs_work`, you can choose to submit it for testing.  When it's in the testing status the user gets the option to reject it and send it back to `needs_work`, or pass the testing and send it along to `closed`. If they accept it, then it is automatically marked as `closed` and the resolution is set to `fixed`. Since all the old work flow remains, a ticket can skip this entire section.

  {{{#!ini
  testing = new,accepted,needs_work,assigned,reopened -> testing
  testing.label = Submit to reporter for testing
  testing.permissions = TICKET_MODIFY

  reject = testing -> needs_work
  reject.label = Failed testing, return to developer

  pass = testing -> closed
  pass.label = Passes Testing
  pass.operations = set_resolution
  pass.set_resolution = fixed
  }}}

  == Example: Add simple optional generic review state

  Sometimes Trac is used in situations where "testing" can mean different things to different people so you may want to create an optional workflow state that is between the default workflow's `assigned` and `closed` states, but does not impose implementation-specific details. The only new state you need to add for this is a `reviewing` state. A ticket may then be "submitted for review" from any state that it can be reassigned. If a review passes, you can re-use the `resolve` action to close the ticket, and if it fails you can re-use the `reassign` action to push it back into the normal workflow.

  The new `reviewing` state along with its associated `review` action looks like this:

  {{{#!ini
  review = new,assigned,reopened -> reviewing
  review.operations = set_owner
  review.permissions = TICKET_MODIFY
  }}}

  To integrate this with the default workflow, you also need to add the `reviewing` state to the `accept` and `resolve` actions:

  {{{#!ini
  accept = new,reviewing -> assigned
  […]
  resolve = new,assigned,reopened,reviewing -> closed
  }}}

  Optionally, you can also add a new action that allows you to change the ticket's owner without moving the ticket out of the `reviewing` state. This enables you to reassign review work without pushing the ticket back to the `new` status:

  {{{#!ini
  reassign_reviewing = reviewing -> *
  reassign_reviewing.label = reassign review
  reassign_reviewing.operations = set_owner
  reassign_reviewing.permissions = TICKET_MODIFY
  }}}

  The full `[ticket-workflow]` configuration will be:

  {{{#!ini
  [ticket-workflow]
  create = <none> -> new
  create.default = 1
  create_and_assign = <none> -> assigned
  create_and_assign.label = assign
  create_and_assign.permissions = TICKET_MODIFY
  create_and_assign.operations = may_set_owner
  accept = new,reviewing -> assigned
  accept.operations = set_owner_to_self
  accept.permissions = TICKET_MODIFY
  leave = * -> *
  leave.default = 1
  leave.operations = leave_status
  reassign = new,assigned,accepted,reopened -> assigned
  reassign.operations = set_owner
  reassign.permissions = TICKET_MODIFY
  reopen = closed -> reopened
  reopen.operations = del_resolution
  reopen.permissions = TICKET_CREATE
  resolve = new,assigned,reopened,reviewing -> closed
  resolve.operations = set_resolution
  resolve.permissions = TICKET_MODIFY
  review = new,assigned,reopened -> reviewing
  review.operations = set_owner
  review.permissions = TICKET_MODIFY
  reassign_reviewing = reviewing -> *
  reassign_reviewing.operations = set_owner
  reassign_reviewing.label = reassign review
  reassign_reviewing.permissions = TICKET_MODIFY
  }}}

  == Advanced Ticket Workflow Customization

  If the customizations above do not meet your needs, you can extend the workflow with plugins. Plugins can provide additional operations for the workflow, like code_review, or implement side-effects for an action, such as triggering a build, that may not be merely simple state changes. Look at [trac:source:trunk/sample-plugins/workflow sample-plugins/workflow] for a few examples to get started.

  But if even that is not enough, you can disable the !ConfigurableTicketWorkflow component and create a plugin that completely replaces it. See also the [https://trac-hacks.org/wiki/AdvancedTicketWorkflowPlugin AdvancedTicketWorkflowPlugin], which provides additional operations.

  == Adding Workflow States to Milestone Progress Bars

  If you add additional states to your workflow, you may want to customize your milestone progress bars as well. See the [TracIni#milestone-groups-section "[milestone-groups]"] section.

  == Ideas for next steps

  Enhancement ideas for the workflow system should be filed as enhancement tickets against the [trac:query:?status=assigned&status=new&status=reopened&keywords=~workflow&component=ticket+system ticket system] component.  You can also document ideas on the [trac:TracIdeas/TracWorkflow TracIdeas/TracWorkflow] page. 


name: TracRss
author: trac
ipnr: 127.0.0.1
text:
  = Using RSS with Trac
  [[TracGuideToc]]

  Several of the Trac modules support content syndication using the RSS ([http://en.wikipedia.org/wiki/RSS Really Simple Syndication]) XML format. RSS pushes out Trac updates 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.

  Trac supports RSS feeds in:

   * TracTimeline — Use the RSS feed to '''subscribe to project events'''. Monitor overall project progress in your favorite RSS reader.
   * TracTickets, TracReports, and TracQuery — Allows syndication of report and ticket query results. Be notified about important and relevant tickets.
   * TracBrowser and TracRevisionLog — Syndication of file changes. Stay up to date with changes to a specific file or directory.

  == How to access RSS data

  Where RSS is available in Trac you should find a small orange '''RSS''' icon, typically at the bottom of the page:
  {{{#!html
  <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>
  }}}
  Clicking the icon will access the RSS feed for that specific resource.

  '''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''.

  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//.

  == Links
   * ''Specifications:''
     * http://blogs.law.harvard.edu/tech/rss — RSS 2.0 Specification.

   * ''Multi-platform RSS readers:''
     * http://www.rssowl.org/ — Open source, Eclipse-based, RSS reader for Linux, Mac and Windows systems that supports https and authenticated feeds.

   * ''Linux/BSD/*n*x systems:''
     * http://liferea.sourceforge.net/ — Open source GTK2 RSS Reader for Linux.
     * [http://akregator.sourceforge.net/ Akregator] — Open source KDE RSS Reader, part of KDE-PIM.

   * ''Mac OS X systems:''
     * http://ranchero.com/netnewswire/ — An excellent RSS reader for Mac OS X, has both free and paid versions.
     * http://www.utsire.com/shrook/ — An RSS reader for Max OS X that supports https, even with self signed certificates, and authenticated feeds.
     * http://vienna-rss.sourceforge.net/ — Open source Feed Reader for Mac OS X with smart folders support.

   * ''Windows systems:''
     * http://www.rssreader.com/ — Free and powerful RSS Reader for MS Windows.
     * http://www.sharpreader.net/ — A free RSS Reader written in .NET for MS Windows.

   * ''Firefox:''
     * http://www.mozilla.org/products/firefox/ — Mozilla Firefox features plenty [https://addons.mozilla.org/en-US/firefox/search/?q=rss&appver=&platform= add-ons] for supporting RSS.

  ----
  See also: TracTimeline, TracQuery, TracReports, TracTickets, TracBrowser, TracRevisionLog


name: TracLogging
author: trac
ipnr: 127.0.0.1
text:
  = Trac Logging
  [[TracGuideToc]]

  Trac supports logging of system messages using Python's [http://docs.python.org/library/logging.html logging module].

  Logging is configured in the [TracIni#logging-section "[logging]"] section of TracIni.

  == Supported Logging Methods

  The log method is set using the [TracIni#logging-log_type-option "[logging] log_type"] option, which accepts the following values:

   '''none'':: Suppress all log messages.
   '''file''':: Log messages to a file, specified with the [TracIni#logging-log_file-option "[logging] log_file"] option. Relative paths for `log_file` are resolved relative to the environment `log` directory.
   '''stderr''':: Output log entries to console ([TracStandalone tracd] only).
   '''syslog''':: (UNIX) Send log messages to the local syslogd via named pipe `/dev/log`. By default, syslog will write them to the `/var/log/messages` file.
   '''eventlog''':: (Windows) Use the system's NT Event Log.

  == Log Levels

  The verbosity level of logged messages can be set using the [TracIni#logging-log_level-option "[logging] log_level"] option. The log level defines the minimum level of urgency required for a message to be logged, and those levels are:

   '''CRITICAL''':: Log only the most critical (typically fatal) errors.
   '''ERROR''':: Log failures, bugs and errors. 
   '''WARN''':: Log warnings, non-interrupting events.
   '''INFO''':: Diagnostic information, log information about all processing.
   '''DEBUG''':: Trace messages, profiling, etc.

  Additionally, you can  enable logging of SQL statements at debug level. This is turned off by default, as it's very verbose. Set [TracIni#trac-debug_sql-option "[trac] debug_sql  = yes"] to activate.

  == Log Format

  The output format for log entries can be specified in the [TracIni#logging-log_format-option "[logging] log_format"] option. The format is a string which can contain any of the [https://docs.python.org/2/library/logging.html#logrecord-attributes Python logging Formatter variables]. Additionally, the following Trac-specific variables can be used:
   '''$(basename)s''':: The environment directory name.
   '''$(path)s''':: The absolute path of the environment directory.
   '''$(project)s''':: The originating project's name.

  Note that variables are identified using a dollar sign (`$(...)s`) instead of percent sign (`%(...)s`).

  The default format is:
  {{{#!ini
  log_format = Trac[$(module)s] $(levelname)s: $(message)s
  }}}

  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:
  {{{#!ini
  log_format = Trac[$(basename)s:$(module)s] $(levelname)s: $(message)s
  }}}

  ----
  See also: TracIni, TracEnvironment


name: TracSupport
author: trac
ipnr: 127.0.0.1
text:
  = Trac Support =

  Like most [http://www.opensource.org/ open source projects], Trac support is available primarily through the [trac:MailingList mailing list] and the [trac: project wiki]. Both are maintained by the Trac community. The [trac: project wiki] is the authoritative source for the TracGuide, consisting of the administrator and user guides for Trac.

  There is an [trac:IrcChannel IRC channel] where online users can help out. Much of the 'live' development discussions also happen there.

  You can search questions tagged with `trac` on [http://stackoverflow.com/questions/tagged/trac Stack Overflow].

  Before you start a new support query, make sure you have done the appropriate searching:
   * in the project's [trac:TracFaq FAQ]
   * in past messages to the [http://groups.google.com/group/trac-users Trac Users Mailing List]
   * in the Trac ticket system, using either a [trac:search:?q=&ticket=on&wiki=on full search] or a [trac:query: ticket query].

  Please '''don't''' create a ticket in trac.edgewall.org to ask a Trac support question. Only create a ticket when you face a ''real'' and ''new'' bug in Trac, and do so only after having read the [trac:NewTicketGuidelines NewTicketGuidelines]. The more a bug report or enhancement request complies with those guidelines, the higher the chances are that it will be fixed or implemented promptly!

  ----
  See also: [trac:MailingList], [trac:TracTroubleshooting], [trac:TracFaq], [trac:CommercialServices]


name: TracSyntaxColoring
author: trac
ipnr: 127.0.0.1
text:
  = Syntax Coloring of Source Code
  Trac supports language-specific syntax highlighting of source code within wiki formatted text in [WikiProcessors#CodeHighlightingSupport wiki processors] blocks and in the [TracBrowser repository browser]. Syntax coloring is provided using [http://pygments.org/ Pygments], which covers a wide range of programming languages and other structured texts, and is actively supported. If Pygments is not available, Trac will display the content as plain text. 

  == About Pygments

  [http://pygments.org/ Pygments] is a highlighting library implemented in pure python, very fast, easy to extend and [http://pygments.org/docs/ well documented].

  The Pygments default style can specified in the [TracIni#mimeviewer-section mime-viewer] section of trac.ini. The default style can be overridden by setting a //Style// preference on the [/prefs/pygments preferences page]. 

  [http://pygments.org/docs/lexers/ Pygments lexer] options can be specified as [WikiProcessors WikiProcessor] arguments and defaults can be set in the [TracIni#pygments-lexer-section environment configuration].

  == Syntax Coloring Support

  === Supported languages

  The list of currently supported languages can be found on the [http://pygments.org/languages/ supported languages] page. The list represents the languages supported in the most recent version of Pygments, so the languages actually supported in your installation could differ if you have an older version installed. The listing of [http://pygments.org/docs/lexers/ supported lexers] provides additional information about the default mime type to keyword mappings.

  Explicit control of the mime type associated with a [WikiProcessors WikiProcessor] and file extension is available through the `mime_map` setting. For example, by default `.m` files are considered Objective-C files. In order to treat `.m` files as MATLAB files, add `text/matlab:m` to the [wiki:TracIni#mimeviewer-mime_map-option "[mimeviewer] mime_map"] option.

  If a mimetype property such as `svn:mime-type` is set to `text/plain`, there is no coloring even if file is known type like `java`.

  === Direct Rendering

  Rich content may be directly //rendered// instead of syntax highlighted. This usually depends on which auxiliary packages are installed and which components are activated in your setup. For example, a `text/x-rst` document will be rendered via `docutils` if it is installed and the `trac.mimeview.rst.ReStructuredTextRenderer` is not disabled. It will be syntax highlighted otherwise.

  Similarly, a document with the mimetype `text/x-trac-wiki` is rendered using the Trac wiki formatter, unless the `trac.mimeview.api.WikiTextRenderer` component is disabled. If you want to ensure that an HTML document gets syntax highlighted and not rendered, use the `text/xml` mimetype.

  HTML documents are directly rendered only if the `render_unsafe_html` settings are enabled in your TracIni file. See [TracIni#attachment-render_unsafe_content-option "[attachment] render_unsafe_content"], [TracIni#browser-render_unsafe_content-option "[browser] render_unsafe_content"] and [TracIni#wiki-render_unsafe_content-option "[wiki] render_unsafe_content"]. The setting is present in multiple sections because there are different security concerns depending on where the document comes from.

  === Known MIME types

  [[KnownMimeTypes]]

  ----
  See also: WikiProcessors, WikiFormatting, TracWiki, TracBrowser


name: TracImport
author: trac
ipnr: 127.0.0.1
text:
  = Importing ticket data

  [[PageOutline(2-5,Contents,pullout)]]

  To migrate issue tickets from other issue-tracking systems into Trac or perform housekeeping actions on tickets or simply synchronize different databases, there are some tools, plugins and scripts available. 

  == !TicketImportPlugin

  [https://trac-hacks.org/wiki/TicketImportPlugin TicketImportPlugin]: a plugin that lets you import or update into Trac a series of tickets from a '''CSV file''' or (if the [https://pypi.python.org/pypi/xlrd xlrd library] is installed) from an '''Excel spreadsheet'''. 

  == !ExportImportXlsPlugin

  [https://trac-hacks.org/wiki/ExportImportXlsPlugin ExportImportXlsPlugin]: a plugin that adds an admin panel for exporting and importing tickets via '''XLS file'''. Requires the python packages xlwt/rxld.

  == Bugzilla

  [https://trac-hacks.org/wiki/BugzillaIssueTrackingPlugin BugzillaIssueTrackingPlugin]: a plugin that integrates Bugzilla issue data into Trac keeping TracLinks. Ticket data can be imported from Bugzilla using the [trac:browser:trunk/contrib/bugzilla2trac.py bugzilla2trac.py] script, available in the `contrib/` directory of the Trac distribution.

  {{{#!python
  $ bugzilla2trac.py
  bugzilla2trac - Imports a bug database from Bugzilla into Trac.

  Usage: bugzilla2trac.py [options]

  Available Options:
    --db <MySQL dbname>              - Bugzilla's database
    --tracenv /path/to/trac/env      - full path to Trac db environment
    -h | --host <MySQL hostname>     - Bugzilla's DNS host name
    -u | --user <MySQL username>     - effective Bugzilla's database user
    -p | --passwd <MySQL password>   - Bugzilla's user password
    -c | --clean                     - remove current Trac tickets before importing
    --help | help                    - this help info

  Additional configuration options can be defined directly in the script.
  }}}

  Currently, the following data is imported from Bugzilla:
   * bugs
   * bug activity (field changes)
   * bug attachments
   * user names and passwords (put into an htpasswd file)

  The script provides a number of features to ease the conversion, such as:
   * PRODUCT_KEYWORDS: Trac has no concept of products, so the script provides the ability to attach a ticket keyword instead.
   * IGNORE_COMMENTS: Don't import Bugzilla comments that match a certain regexp.
   * 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.

  For more details on the available options, see the configuration section at the top of the script.

  == Jira

  [https://trac-hacks.org/wiki/JiraToTracIntegration JiraToTracIntegration]: a plugin that provides tools to import Atlassian Jira backup files into Trac. The plugin consists of a Python 3.1 commandline tool that:
   - Parses the Jira backup XML file.
   - Sends the imported Jira data and attachments to Trac using the [https://trac-hacks.org/wiki/XmlRpcPlugin XmlRpcPlugin].
   - Generates a htpasswd file containing the imported Jira users and their SHA-512 base64 encoded passwords.

  == Mantis

  [https://trac-hacks.org/wiki/MantisImportScript MantisImportScript]: a script to import the following type of data from Mantis into Trac:
   * bugs
   * bug comments
   * bug activity (field changes)
   * attachments (as long as the files live in the mantis database, not on the filesystem).

  == !PlanetForge

  [https://trac-hacks.org/wiki/PlanetForgeImportExportPlugin PlanetForgeImportExportPlugin]: this plugin exports Trac data (wiki, tickets, compoments, permissions, repositories, etc.) using the open format designed by the [https://gforge.inria.fr/projects/coclico/ COCLICO] project. It extends the webadmin panel and the 'trac admin ...' command. Has no 'import' feature. 

  == Scarab

  [https://trac-hacks.org/wiki/ScarabToTracScript ScarabToTracScript]: a script that migrates Scarab issues to Trac tickets. Requires [https://trac-hacks.org/wiki/XmlRpcPlugin XmlRpcPlugin].

  == Sourceforge

  [https://trac-hacks.org/wiki/SfnToTracScript SfnToTracScript]: importer of !SourceForge's new backup file (originated from #Trac3521).
  Also, ticket data can be imported from Sourceforge using the [trac:browser:trunk/contrib/sourceforge2trac.py sourceforge2trac.py] script, available in the contrib/ directory of the Trac distribution.

  == Other

  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 [http://www.sqlite.org/sqlite.html sqlite] command line to look at the tables and import them from your application.

  === Comma delimited file - CSV

  See [trac:attachment:csv2trac.2.py:wiki:TracSynchronize csv2trac.2.py] 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.

  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. 

  ----
  See also: 
   * to import/export wiki pages: TracAdmin, 
   * to export tickets: TracTickets, TracQuery


name: WikiRestructuredTextLinks
author: trac
ipnr: 127.0.0.1
text:
  = TracLinks in reStructuredText =

  This document illustrates how to use the `:trac:` role in [http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html reStructuredText]. The page is written like:

  {{{
  {{{#!rst
  Examples:

   * Tickets: :trac:`#1` or :trac:`ticket:1`
   * Ticket comments: :trac:`comment:ticket:1:2`
   * Reports: :trac:`{1}` or :trac:`report:1`
   * Changesets: :trac:`r1`, :trac:`[1]` or :trac:`changeset:1`
   * Revision log: :trac:`r1:3`, :trac:`[1:3]` or :trac:`log:@1:3`, :trac:`log:trunk@1:3`
   * Diffs: :trac:`diff:@20:30`, :trac:`diff:tags/trac-0.9.2/wiki-default//tags/trac-0.9.3/wiki-default` or :trac:`diff:trunk/trac@3538//sandbox/vc-refactoring/trac@3539`
   * Wiki pages: :trac:`CamelCase` or :trac:`wiki:CamelCase`
   * Milestones: :trac:`milestone:1.0`
   * Attachment: :trac:`attachment:ticket:944:attachment.1073.diff`
   * Files: :trac:`source:trunk/COPYING`
   * A specific file revision: :trac:`source:/trunk/COPYING@200`
   * A particular line of a specific file revision: :trac:`source:/trunk/COPYING@200#L25`

  An explicit label can be specified, separated from the link by a space:

   * See :trac:`#1 ticket 1` and the :trac:`source:trunk/COPYING license`.
  }}}
  }}}

  Provided you have [http://docutils.sourceforge.net/ docutils] installed, the above block will render as:
  ----
  {{{#!rst
  Examples:

   * Tickets: :trac:`#1` or :trac:`ticket:1`
   * Ticket comments: :trac:`comment:ticket:1:2`
   * Reports: :trac:`{1}` or :trac:`report:1`
   * Changesets: :trac:`r1`, :trac:`[1]` or :trac:`changeset:1`
   * Revision log: :trac:`r1:3`, :trac:`[1:3]` or :trac:`log:@1:3`, :trac:`log:trunk@1:3`
   * Diffs: :trac:`diff:@20:30`, :trac:`diff:tags/trac-0.9.2/wiki-default//tags/trac-0.9.3/wiki-default` or :trac:`diff:trunk/trac@3538//sandbox/vc-refactoring/trac@3539`
   * Wiki pages: :trac:`CamelCase` or :trac:`wiki:CamelCase`
   * Milestones: :trac:`milestone:1.0`
   * Attachment: :trac:`attachment:ticket:944:attachment.1073.diff`
   * Files: :trac:`source:trunk/COPYING`
   * A specific file revision: :trac:`source:/trunk/COPYING@200`
   * A particular line of a specific file revision: :trac:`source:/trunk/COPYING@200#L25`

  An explicit label can be specified, separated from the link by a space:

   * See :trac:`#1 ticket 1` and the :trac:`source:trunk/COPYING license`.
  }}}
  ----

  Note that the above could have been written using substitution references and the `trac::` directive:
  {{{
  {{{#!rst
  See |ticket123|.

   .. |ticket123| trac:: ticket:123 this ticket
  }}}
  }}}

  This renders as:
  ----

  {{{#!rst
  See |ticket123|.

   .. |ticket123| trac:: ticket:123 this ticket
  }}}

  ----
  See also: WikiRestructuredText, TracLinks


name: TracBatchModify
author: trac
ipnr: 127.0.0.1
text:
  = Trac Ticket Batch Modification =
  [[TracGuideToc]]

  Trac supports modifying a batch of tickets in one request from [TracQuery custom query] results. The Batch Modify functionality only appears on Query pages (/query), not Report pages (/report).

  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. 

  == List fields

  The `Keywords` and `Cc` fields are treated as lists, where list items can be added and/or removed, as well as replacing the entire list value. All list field controls accept multiple items, such as multiple keywords or cc addresses.

  == Excluded fields

  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 batch modification of textareas in conjunction with more suitable actions like 'prepend', 'append' or 'search & replace' ([trac:#11197]).


name: WikiHtml
author: trac
ipnr: 127.0.0.1
text:
  = Using HTML in Wiki Text

  Trac supports the display of HTML in any wiki context, by using the `#!html` [wiki:WikiProcessors WikiProcessor]. 

  However, this HTML has to be [http://en.wikipedia.org/wiki/Well-formed_element well-formed].
  In particular, you can't insert a start tag in an `#!html` block, resume normal wiki text and insert the corresponding end tag in a second `#!html` block. 

  For creating styled `<div>`s, `<span>`s  or even complex tables containing arbitrary Wiki text, there is a powerful alternative: `#!div`, `#!span` and `#!table`, `#!tr`, `#!td` and `#!th` blocks. Those Wiki processors are built-in and do not require additional packages to be installed.

  == How to use `#!html` #HowtoUseHTML
  To inform the wiki engine that a block of text should be treated as HTML, use the ''html'' processor:

  ||= Wiki Markup =||= Display =||
  {{{#!td
    {{{
    {{{#!html
    <h1 style="text-align: right; color: blue">HTML Test</h1>
    }}}
    }}}
  }}}
  {{{#!td style="padding-left: 2em"
    {{{#!html
    <h1 style="text-align: right; color: blue">HTML Test</h1>
    }}}
  }}}

  Note that Trac sanitizes your HTML code before displaying it. That means that potentially dangerous constructs, such as Javascript event handlers, will be removed from the output. 

  The filtering is done by [http://genshi.edgewall.org/ Genshi] and the output will be a well-formed fragment of HTML. This means that you cannot use two HTML blocks, one for opening a <div> and another for closing it, in order to wrap arbitrary wiki text.

  == How to use `#!div` and `#!span` == #HowtoUseDivSpan

  ||= Wiki Markup =||= Display =||
  {{{#!td
    {{{
    {{{#!div class="important" 
    **important** is a predefined class.
    }}}
    }}}
    {{{
    {{{#!div style="border: 1pt dotted; margin: 1em"
    **wikipage** is another predefined class that will 
    be used when no class is specified.
    }}}
    }}}
    {{{
    {{{#!div class="compact" style="border: 1pt dotted; margin: 1em"
    **compact** is another predefined class reducing
    the padding within the `<div>` to a minimum.
    }}}
    }}}
    {{{
    {{{#!div class="wikipage compact" style="border: 1pt dotted"
    Classes can be combined (here **wikipage** and **compact**)
    which results in this case in reduced //vertical// 
    padding but there's still some horizontal space for coping
    with headings.
    }}}
    }}}
    {{{
    {{{#!div class="" style="border: 1pt dotted; margin: 1em"
    Explicitly specifying no classes is //not// the same
    as specifying no class attribute, as this will remove
    the //wikipage// default class.
    }}}
    }}}
  }}}
  {{{#!td style="padding-left: 2em"

    {{{#!div class="important" 
    **important** is a predefined class.
    }}}

    {{{#!div style="border: 1pt dotted; margin: 1em"
    **wikipage** is another predefined class that will 
    be used when no class is specified.
    }}}

    {{{#!div class="compact" style="border: 1pt dotted; margin: 1em"
    **compact** is another predefined class reducing
    the padding within the `<div>` to a minimum.
    }}}

    {{{#!div class="wikipage compact" style="border: 1pt dotted"
    Classes can be combined (here **wikipage** and **compact**)
    which results in this case in reduced //vertical// 
    padding but there's still some horizontal space for coping
    with headings.
    }}}

    {{{#!div class="" style="border: 1pt dotted; margin: 1em"
    Explicitly specifying no classes is //not// the same
    as specifying no class attribute, as this will remove
    the //wikipage// default class.
    }}}

  }}}

  Note that the contents of a `#!div` block are contained in one or more paragraphs, which have a non-zero top and bottom margin. This leads to the top and bottom padding in the example above. To remove the top and bottom margin of the content, add the `compact` class to the `#!div`. Another predefined class besides `wikipage` and `compact` is `important`, which can be used to make a paragraph stand out. Extra CSS classes can be defined via [TracInterfaceCustomization#SiteAppearance site/style.css].

  For spans, you should use the Macro call syntax:
  ||= Wiki Markup =||
  {{{#!td
    {{{
    Hello 
    [[span(''WORLD'' (click [#anchor here]), style=color: green; font-size: 120%, id=anchor)]]!
    }}}
  }}}
  |---------------------------------------------------------------------------------
  ||= Display =||
  {{{#!td style="padding-left: 2em"
    Hello
    [[span(''WORLD'' (click [#anchor here]), style=color: green; font-size: 120%, id=anchor)]]!
  }}}

  == How to use `#!td` and other table related processors #Tables

  The `#!td` or `#!th` processors should be used to create table data and table header cells, respectively. The other processors `#!table` and `#!tr` are not required for introducing a table structure, as `#!td` and `#!th` will do this automatically. The `|-` row separator can be used to start a new row when needed, but some may prefer to use a `#!tr` block for that, as this introduces a more formal grouping and offers the possibility to use an extra level of indentation. The main purpose of the `#!table` and `#!tr` is to give the possibility to specify HTML attributes, like ''style'' or ''valign'' to these elements.

  ||= Wiki Markup =||= Display =||
  {{{#!td
   {{{
   Simple 2x2 table with rich content:
   {{{#!th align=left
    - Left
    - Header
   }}}
   {{{#!th align=left
    - Right
    - Header
   }}}
   |----------------------------------
   {{{#!td style="background: #ffd"
    - Left
    - Content
   }}}
   {{{#!td style="vertical-align: top"
   !RightContent
   }}}
   |----------------------------------
   || ... and this can be mixed||\
   ||with pipe-based cells ||
   {{{#!td colspan=2
   Pick the style the more appropriate
   to your content
   
   See WikiFormatting#Tables for details
   on the pipe-based table syntax.
   }}}
   
   If one needs to add some 
   attributes to the table itself...
   
   {{{#!table style="border:none;text-align:center;margin:auto"
     {{{#!tr ====================================
       {{{#!th style="border: none"
       Left header
       }}}
       {{{#!th style="border: none"
       Right header
       }}}
     }}}
     {{{#!tr ==== style="border: 1px dotted grey"
       {{{#!td style="border: none"
       1.1
       }}}
       {{{#!td style="border: none"
       1.2
       }}}
     }}}
     {{{#!tr ====================================
       {{{#!td style="border: none"
       2.1
       }}}
       {{{#!td
       2.2
       }}}
     }}}
   }}}


   }}}
  }}}
  {{{#!td valign=top
  Simple 2x2 table with rich content:
  {{{#!th align=left
   - Left
   - Header
  }}}
  {{{#!th align=left
   - Right
   - Header
  }}}
  |----------------------------------
  {{{#!td style="background: #ffd"
   - Left
   - Content
  }}}
  {{{#!td style="vertical-align: top"
  !RightContent
  }}}
  |----------------------------------
  || ... and this can be mixed||\
  ||with pipe-based cells ||
  {{{#!td colspan=2
  Pick the style the more appropriate
  to your content

  See WikiFormatting#Tables for details
  on the pipe-based table syntax.
  }}}

  If one needs to add some 
  attributes to the table itself...

  {{{#!table style="border:none;text-align:center;margin:auto"
    {{{#!tr ====================================
      {{{#!th style="border: none"
      Left header
      }}}
      {{{#!th style="border: none"
      Right header
      }}}
    }}}
    {{{#!tr ==== style="border: 1px dotted grey"
      {{{#!td style="border: none"
      1.1
      }}}
      {{{#!td style="border: none"
      1.2
      }}}
    }}}
    {{{#!tr ====================================
      {{{#!td style="border: none"
      2.1
      }}}
      {{{#!td
      2.2
      }}}
    }}}
  }}}
  }}}

  Note that by default tables are assigned the "wiki" CSS class, which gives a distinctive look to the header cells and a default border to the table and cells, as can be seen for the tables on this page. By removing this class (`#!table class=""`), one regains complete control on the table presentation. In particular, neither the table nor the rows nor the cells will have a border, so this is a more effective way to get such an effect rather than having to specify a `style="border: no"` parameter everywhere. 

  {{{#!table class=""
  ||= Wiki Markup =||= Display =||
   {{{#!td
    {{{
    {{{#!table class=""
    ||  0||  1||  2||
    || 10|| 20|| 30||
    || 11|| 22|| 33||
    ||||||=  numbers  =||
    }}}
    }}}
   }}}
   {{{#!td
    {{{#!table class=""
    ||  0||  1||  2||
    || 10|| 20|| 30||
    || 11|| 22|| 33||
    ||||||=  numbers  =||
    }}}
   }}}
  }}}

  Other classes can be specified as alternatives (remember that you can define your own in [TracInterfaceCustomization#SiteAppearance site/style.css]).

  ||= Wiki Markup =||= Display =||
  {{{#!td
    {{{
    {{{#!table class="listing"
    ||  0||  1||  2||
    || 10|| 20|| 30||
    || 11|| 22|| 33||
    ||||||=  numbers  =||
    }}}
    }}}
  }}}
  {{{#!td
    {{{#!table class="listing"
    ||  0||  1||  2||
    || 10|| 20|| 30||
    || 11|| 22|| 33||
    ||||||=  numbers  =||
    }}}
  }}}

  == HTML comments
  HTML comments are stripped from the output of the `html` processor. To add an HTML comment to a wiki page, use the `htmlcomment` processor, available since Trac 0.12:
  ||= Wiki Markup =||
  {{{#!td
    {{{
    {{{#!htmlcomment
    This block is translated to an HTML comment.
    It can contain <tags> and &entities; that will not be escaped in the output.
    }}}
    }}}
  }}}
  |---------------------------------------------------------------------------------
  ||= Display =||
  {{{#!td
    {{{
    <!--
    This block is translated to an HTML comment.
    It can contain <tags> and &entities; that will not be escaped in the output.
    -->
    }}}
  }}}

  The character sequence `--` is not allowed in HTML comments, and will generate a rendering error.


  == More Information

   * http://www.w3.org/ -- World Wide Web Consortium
   * http://www.w3.org/MarkUp/ -- HTML Markup Home Page

  ----
  See also:  WikiFormatting, WikiProcessors, WikiRestructuredText


name: TracInstall
author: trac
ipnr: 127.0.0.1
text:
  = Trac Installation Guide for 1.2
  [[TracGuideToc]]

  Trac is written in the Python programming language and needs a database, [http://sqlite.org/ SQLite], [http://www.postgresql.org/ PostgreSQL], or [http://mysql.com/ MySQL]. For HTML rendering, Trac uses the [http://genshi.edgewall.org Genshi] templating system.

  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.

  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].

  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.

  [[PageOutline(2-3,Installation Steps,inline)]]

  == Dependencies
  === Mandatory Dependencies
  To install Trac, the following software packages must be installed:

   * [http://www.python.org/ Python], version >= 2.6 and < 3.0
     (note that we dropped the support for Python 2.5 in this release)
   * [http://pypi.python.org/pypi/setuptools setuptools], version >= 0.6
   * [http://genshi.edgewall.org/wiki/Download Genshi], version >= 0.6

  You also need a database system and the corresponding python bindings. The database can be either SQLite, PostgreSQL or MySQL.

  ==== For the SQLite database #ForSQLite

  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).

  Optionally, you may install a newer version of [http://pypi.python.org/pypi/pysqlite pysqlite] than the one provided by the Python distribution. See [trac:PySqlite#ThePysqlite2bindings PySqlite] for details.

  ==== For the PostgreSQL database #ForPostgreSQL

  You need to install the database and its Python bindings:
   * [http://www.postgresql.org/ PostgreSQL], version 8.0 or later
   * [http://pypi.python.org/pypi/psycopg2 psycopg2], version 2.0 or later

  See [trac:DatabaseBackend#Postgresql DatabaseBackend] for details.

  ==== For the MySQL database #ForMySQL

  Trac works well with MySQL, provided you follow the guidelines:

   * [http://mysql.com/ MySQL], version 5.0 or later
   * [http://sf.net/projects/mysql-python MySQLdb], version 1.2.2 or later

  Given the caveats and known issues surrounding MySQL, read carefully the [trac:MySqlDb] page before creating the database.

  === Optional Dependencies

  ==== Subversion

  [http://subversion.apache.org/ Subversion], 1.6.x or later and the '''''corresponding''''' Python bindings.

  There are [http://subversion.apache.org/packages.html 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 [http://alagazam.net Alagazam], which works for me under Python 2.6.)

  For troubleshooting information, see the [trac:TracSubversion#Troubleshooting TracSubversion] page.

  {{{#!div style="border: 1pt dotted; margin: 1em"
  **Note:**
  * Trac '''doesn't''' use [http://pysvn.tigris.org/ PySVN], nor does it work yet with the newer `ctype`-style bindings.
  * If using Subversion, Trac must be installed on the '''same machine'''. Remote repositories are currently [trac:ticket:493 not supported].
  }}}

  ==== Git

  [http://git-scm.com/ Git] 1.5.6 or later is supported. More information is available on the [trac:TracGit] page.

  ==== Other Version Control Systems

  Support for other version control systems is provided via third-party plugins. See [trac:PluginList#VersionControlSystems] and [trac:VersionControlSystem].

  ==== Web Server
  A web server is optional because Trac is shipped with a server included, see the [#RunningtheStandaloneServer Running the Standalone Server] section below.

  Alternatively you can configure Trac to run in any of the following environments:
   * [http://httpd.apache.org/ Apache] with 
    * [https://github.com/GrahamDumpleton/mod_wsgi mod_wsgi], see [wiki:TracModWSGI] and [http://code.google.com/p/modwsgi/wiki/IntegrationWithTrac ModWSGI IntegrationWithTrac].
    * [http://modpython.org/ mod_python 3.5.0], see TracModPython
   * a [http://www.fastcgi.com/ FastCGI]-capable web server (see TracFastCgi)
   * an [http://tomcat.apache.org/connectors-doc/ajp/ajpv13a.html AJP]-capable web
     server (see [trac:TracOnWindowsIisAjp TracOnWindowsIisAjp])
   * Microsoft IIS with FastCGI and a FastCGI-to-WSGI gateway (see [trac:CookBook/Installation/TracOnWindowsIisWfastcgi IIS with FastCGI])
   * a CGI-capable web server (see TracCgi), '''but usage of Trac as a cgi script 
     is highly discouraged''', better use one of the previous options. 
     

  ==== Other Python Packages

   * [http://babel.edgewall.org Babel], version 0.9.6 or >= 1.3, 
     needed for localization support
   * [http://docutils.sourceforge.net/ docutils], version >= 0.3.9 
     for WikiRestructuredText.
   * [http://pygments.org Pygments] for 
     [TracSyntaxColoring syntax highlighting].
   * [http://pytz.sf.net pytz] to get a complete list of time zones,
     otherwise Trac will fall back on a shorter list from 
     an internal time zone implementation.

  {{{#!div style="border: 1pt dotted; margin: 1em"
  **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].
  }}}

  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''.

  == Installing Trac

  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.

  It is assumed throughout this guide that you have elevated permissions as the `root` user or by prefixing commands with `sudo`. The umask `0002` should be used for a typical installation on a Unix-based platform.

  === Using `easy_install`
  Trac can be installed from PyPI or the Subversion repository using [http://pypi.python.org/pypi/setuptools setuptools].

  A few examples:

   - Install the latest stable version of Trac:
   {{{#!sh
  $ easy_install Trac
  }}}
   - Install latest development version:
   {{{#!sh
  $ easy_install http://download.edgewall.org/trac/Trac-latest-dev.tar.gz
  }}}
     Note that in this case you won't have the possibility to run a localized version of Trac;
     either use a released version or install from source 

  More information can be found on the [trac:wiki:setuptools setuptools] page.

  {{{#!div style="border: 1pt dotted; margin: 1em"
  **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 [#DeployingTrac Deploying Trac].
  }}}

  === Using `pip`
  'pip' is an easy_install replacement that is very useful to quickly install python packages.
  To get a Trac installation up and running in less than 5 minutes:

  Assuming you want to have your entire pip installation in `/opt/user/trac`

   {{{#!sh
  $ pip install trac psycopg2 
  }}}
  or
   {{{#!sh
  $ pip install trac mysql-python 
  }}}

  Make sure your OS specific headers are available for pip to automatically build PostgreSQL (`libpq-dev`) or MySQL (`libmysqlclient-dev`) bindings.

  pip will automatically resolve all dependencies (like Genshi, pygments, etc.), download the latest packages from pypi.python.org and create a self contained installation in `/opt/user/trac`.

  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)

  Additionally, you can install several Trac plugins (listed [https://pypi.python.org/pypi?:action=browse&show=all&c=516 here]) through pip.

  === From source
  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.

  {{{#!sh
  $ python ./setup.py install
  }}}

  ''You will need root permissions or equivalent for this step.''

  This will byte-compile the Python source code and install it as an .egg file or folder in the `site-packages` directory
  of your Python installation. The .egg will also contain all other resources needed by standard Trac, such as `htdocs` and `templates`.

  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):
  {{{#!sh
  $ python ./setup.py install
  }}}
  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`).

  === Using installer

  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.

  === Using package manager

  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.

  === Advanced `easy_install` Options

  To install Trac to a custom location, or find out about other advanced installation options, run:
  {{{#!sh
  $ easy_install --help
  }}}

  Also see [http://docs.python.org/2/install/index.html Installing Python Modules] for detailed information.

  Specifically, you might be interested in:
  {{{#!sh
  $ easy_install --prefix=/path/to/installdir
  }}}
  or, if installing Trac on a Mac OS X system:
  {{{#!sh
  $ easy_install --prefix=/usr/local --install-dir=/Library/Python/2.6/site-packages
  }}}

  {{{#!div style="border: 1pt dotted; margin: 1em"
  **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.

  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.
  }}}

  == Creating a Project Environment

  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.

  A new environment is created using [TracAdmin trac-admin]:
  {{{#!sh
  $ trac-admin /path/to/myproject initenv
  }}}

  You will be prompted for the information needed 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. 

  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.

  Also note that the values you specify here can be changed later using TracAdmin or directly editing the [TracIni conf/trac.ini] configuration file.

  {{{#!div style="border: 1pt dotted; margin: 1em"
  **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.
  }}}

  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:
  {{{#!sh
  $ chown -R apache:apache /path/to/myproject
  }}}

  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).

  {{{#!div class=important
  '''Warning:''' Please only use ASCII-characters for account name and project path, unicode characters are not supported there.
  }}}

  == Deploying Trac

  {{{#!div style="border: 1pt dotted; margin: 1em"
  **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.

  If running `tracd`, 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.

  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`.
  {{{#!sh
  export PKG_RESOURCES_CACHE_ZIP_MANIFESTS=1
  }}}

  Alternatively, the variable can be set in the shell before executing `tracd`:
  {{{#!sh
  $ PKG_RESOURCES_CACHE_ZIP_MANIFESTS=1 tracd --port 8000 /path/to/myproject
  }}}

  If running the Apache web server, !Ubuntu/Debian users should add the `export` statement to `/etc/apache2/envvars`. !RedHat/CentOS/Fedora should can add the `export` statement to `/etc/sysconfig/httpd`.
  }}}

  === Running the Standalone Server

  After having created a Trac environment, you can easily try the web interface by running the standalone server [TracStandalone tracd]:
  {{{#!sh
  $ tracd --port 8000 /path/to/myproject
  }}}

  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:
  {{{#!sh
  $ tracd -s --port 8000 /path/to/myproject
  }}}

  === Running Trac on a Web Server

  Trac provides various options for connecting to a "real" web server: 
   - [TracFastCgi FastCGI]
   - [wiki:TracModWSGI Apache with mod_wsgi] 
   - [TracModPython Apache with mod_python]
   - [TracCgi CGI] //(should not be used, as the performance is far from optimal)//

  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], [http://projects.unbit.it/uwsgi/wiki/Example#Traconapacheinasub-uri uwsgi], [trac:TracOnWindowsIisIsapi Isapi-wsgi] etc.

  ==== Generating the Trac cgi-bin directory #cgi-bin

  Application scripts for CGI, FastCGI and mod-wsgi can be generated using the [TracAdmin trac-admin] `deploy` command:
  [[TracAdminHelp(deploy)]]

  Grant the web server execution right on scripts in the `cgi-bin` directory.

  For example, the following yields a typical directory structure:
  {{{#!sh
  $ mkdir -p /var/trac
  $ trac-admin /var/trac/<project> initenv
  $ trac-admin /var/trac/<project> deploy /var/www
  $ ls /var/www
  cgi-bin	htdocs
  $ chmod ugo+x /var/www/cgi-bin/*
  }}}

  ==== Mapping Static Resources

  Without additional configuration, Trac will handle requests for static resources such as stylesheets and images. For anything other than a TracStandalone deployment, this is not optimal as the web server can be set up to directly serve the static resources. For CGI setup, this is '''highly undesirable''' as it causes abysmal performance.

  Web servers such as [http://httpd.apache.org/ Apache] allow you to create //Aliases// to resources, giving them a virtual URL that doesn't necessarily reflect their location on the file system. We can map requests for static resources directly to directories on the file system, to avoid Trac processing the requests.

  There are two primary URL paths for static resources: `/chrome/common` and `/chrome/site`. Plugins can add their own resources, usually accessible at the `/chrome/<plugin>` path.

  A single `/chrome` alias can used if the static resources are extracted for all plugins. This means that the `deploy` command (discussed in the previous section) must be executed after installing or updating a plugin that provides static resources, or after modifying resources in the `$env/htdocs` directory. This is probably appropriate for most installations but may not be what you want if, for example, you wish to upload plugins through the //Plugins// administration page.

  The `deploy` command creates an `htdocs` directory with:
   - `common/` - the static resources of Trac
   - `site/` - a copy of the environment's `htdocs/` directory
   - `shared` - the static resources shared by multiple Trac environments, with a location defined by the `[inherit]` `htdocs_dir` option
   - `<plugin>/` - one directory for each resource directory provided by the plugins enabled for this environment

  The example that follows will create a single `/chrome` alias. If that isn't the correct approach for your installation you simply need to create more specific aliases:
  {{{#!apache
  Alias /trac/chrome/common /path/to/trac/htdocs/common
  Alias /trac/chrome/site /path/to/trac/htdocs/site
  Alias /trac/chrome/shared /path/to/trac/htdocs/shared
  Alias /trac/chrome/<plugin> /path/to/trac/htdocs/<plugin>
  }}}

  ===== Example: Apache and `ScriptAlias` #ScriptAlias-example

  Assuming the deployment has been done this way:
  {{{#!sh
  $ trac-admin /var/trac/<project> deploy /var/www
  }}}

  Add the following snippet to Apache configuration, changing paths to match your deployment. The snippet must be placed ''before'' the `ScriptAlias` or `WSGIScriptAlias` directive, because those directives map all requests to the Trac application:
  {{{#!apache
  Alias /trac/chrome /path/to/trac/htdocs

  <Directory "/path/to/www/trac/htdocs">
    # For Apache 2.2
    <IfModule !mod_authz_core.c>
      Order allow,deny
      Allow from all
    </IfModule>
    # For Apache 2.4
    <IfModule mod_authz_core.c>
      Require all granted
    </IfModule>
  </Directory>
  }}}

  If using mod_python, add this too, otherwise the alias will be ignored:
  {{{#!apache
  <Location "/trac/chrome/common">
    SetHandler None
  </Location>
  }}}

  Alternatively, if you wish to serve static resources directly from your project's `htdocs` directory rather than the location to which the files are extracted with the `deploy` command, 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:
  {{{#!apache
  Alias /trac/chrome/site /path/to/projectenv/htdocs

  <Directory "/path/to/projectenv/htdocs">
    # For Apache 2.2
    <IfModule !mod_authz_core.c>
      Order allow,deny
      Allow from all
    </IfModule>
    # For Apache 2.4
    <IfModule mod_authz_core.c>
      Require all granted
    </IfModule>
  </Directory>
  }}}

  Another alternative to aliasing `/trac/chrome/common` is having Trac generate direct links for those static resources (and only those), using the [TracIni#trac-section htdocs_location] configuration setting:
  {{{#!ini
  [trac]
  htdocs_location = http://static.example.org/trac-common/
  }}}

  Note that this makes it easy to have a dedicated domain serve those static resources, preferentially cookie-less.

  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:
  {{{#!sh
  $ ln -s /path/to/trac/htdocs/common /var/www/static.example.org/trac-common
  }}}

  ==== Setting up the Plugin Cache #egg-cache

  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.

  If you setup hook scripts that call Trac, such as the Subversion post-commit hook script provided in the `/contrib` directory, make sure you define the `PYTHON_EGG_CACHE` environment variable within these scripts as well.

  == Configuring Authentication

  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.

  The process of adding, removing, and configuring user accounts for authentication depends on the specific way you run Trac. 

  Please refer to one of the following sections:
   * TracStandalone#UsingAuthentication if you use the standalone server, `tracd`.
   * [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`.
   * TracFastCgi if you're using another web server with FCGI support (Cherokee, Lighttpd, !LiteSpeed, nginx)

  [trac:TracAuthenticationIntroduction] also contains some useful information for beginners.

  == Granting admin rights to the admin user
  Grant admin rights to user admin:
  {{{#!sh
  $ trac-admin /path/to/myproject permission add admin TRAC_ADMIN
  }}}

  This user will have an //Admin// navigation item that directs to pages for administering your Trac project.

  == Configuring Trac

  TracRepositoryAdmin provides information on configuring version control repositories for your project.

  == Using Trac

  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.

  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.

  '' Enjoy! ''

  [trac:TracTeam The Trac Team]

  ----
  See also: [trac:TracInstallPlatforms TracInstallPlatforms], TracGuide, TracUpgrade, TracPermissions


name: TracReports
author: trac
ipnr: 127.0.0.1
text:
  = Trac Reports

  [[TracGuideToc]]

  The Trac reports module provides a simple, yet powerful reporting facility to present information about tickets in the Trac database.

  Rather than have its own report definition format, TracReports relies on standard SQL `SELECT` statements for custom report definition. 

    '''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.

    You can already completely replace the reports module by the query module simply by disabling the former in [wiki:TracIni trac.ini]:
    {{{#!ini
    [components]
    trac.ticket.report.* = disabled
    }}}
    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.

  A report consists of these basic parts:
   * '''ID''' — Unique (sequential) identifier 
   * '''Title''' — Descriptive title
   * '''Description''' — A brief description of the report, in WikiFormatting text.
   * '''Report Body''' — List of results from report query, formatted according to the methods described below.
   * '''Footer''' — Links to alternative download formats for this report.

  == Changing Sort Order

  Simple reports - ungrouped reports to be specific - can be sorted by clicking the column header. 

  If a column header is a hyperlink (red), click the column to sort by it. Clicking the same header again reverses the sort order.

  == Navigating Tickets

  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'' contextual navigation links, or click the ''Back to Report'' link to return to the report page.

  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, in contrast to the query results (see TracQuery#NavigatingTickets).

  == Alternate Download Formats

  In addition to the HTML view, reports can also be exported in a number of alternate formats.
  At the bottom of the report page, you will find a list of available data formats. Click the desired link to 
  download the alternate format.

  === Comma-delimited - CSV (Comma Separated Values)

  Export the report as plain text, each row on its own line, columns separated by a single comma (',').
  '''Note:''' The output is fully escaped so carriage returns, line feeds, and commas will be preserved in the output.

  === Tab-delimited

  Like above, but uses tabs (\t) instead of comma.

  === RSS - XML Content Syndication

  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.

  == Creating Custom Reports

  Creating a custom report requires a comfortable knowledge of SQL.

  Note that you need grant [TracPermissions#Reports permissions] in order to see the buttons for adding or editing reports.

  A report is basically a single named SQL query, executed and presented by Trac. Reports can be viewed and created from a custom SQL expression directly in the web interface.

  Typically, a report consists of a SELECT-expression from the 'ticket' table, using the available columns and sorting the way you want it.

  == Ticket columns

  The ''ticket'' table has the following columns:
   * id
   * type
   * time
   * changetime
   * component
   * severity  
   * priority 
   * owner
   * reporter
   * cc
   * version
   * milestone
   * status
   * resolution
   * summary
   * description
   * keywords

  See TracTickets for a detailed description of the column fields.

  Example: '''All active tickets, sorted by priority and time'''
  {{{#!sql
  SELECT id AS ticket, status, severity, priority, owner, time AS created, summary 
  FROM ticket 
  WHERE status IN ('new', 'assigned', 'reopened')
  ORDER BY priority, time
  }}}

  == Advanced Reports: Dynamic Variables

  For more flexible reports, Trac supports the use of ''dynamic variables'' in report SQL statements. 
  In short, dynamic variables are ''special'' strings that are replaced by custom data before query execution. Dynamic variables can also be used in the report title and description //(since 1.1.1)//.

  === Using Variables in a Query

  The syntax for dynamic variables is simple, any upper case word beginning with '$' is considered a variable.

  Example:
  {{{#!sql
  SELECT id AS ticket,summary FROM ticket WHERE priority=$PRIORITY
  }}}

  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 '$':
  {{{
   http://trac.edgewall.org/reports/14?PRIORITY=high
  }}}

  To use multiple variables, separate them with an '&':
  {{{
   http://trac.edgewall.org/reports/14?PRIORITY=high&SEVERITY=critical
  }}}

  === !Special/Constant Variables

  There is one dynamic variable whose value is set automatically (the URL does not have to be changed) to allow practical reports. 

   * $USER — Username of logged in user.

  Example: List all tickets assigned to me:
  {{{#!sql
  SELECT id AS ticket,summary FROM ticket WHERE owner=$USER
  }}}

  == Advanced Reports: Custom Formatting

  Trac is also capable of more advanced reports, including custom layouts, result grouping and user-defined CSS styles. To create such reports, we will use specialized SQL statements to control the output of the Trac report engine.

  === Special Columns

  To format reports, TracReports look for 'magic' column names in the query result. These 'magic' names are processed and affect the layout and style of the final report.

  === Automatically formatted columns

   * '''ticket''' — Ticket ID number. Becomes a hyperlink to that ticket. 
   * '''id''' — same as '''ticket''' above when '''realm''' is not set
   * '''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)
     - for some resources, it may be necessary to specify their ''parent'' resources (e.g. for ''changeset'', the ''repos'') and this can be achieved using the '''parent_realm''' and '''parent_id''' columns
   * '''created, modified, date, time''' — Format cell as a date and/or time.
   * '''description''' — Ticket description field, parsed through the wiki engine.

  '''Example:'''
  {{{#!sql
  SELECT id AS ticket, created, status, summary FROM ticket 
  }}}

  Those columns can also be defined but marked as hidden, see [#column-syntax below].

  See [trac:CookBook/Configuration/Reports] for examples of creating reports for realms other than ''ticket''.

  === Custom formatting columns

  Columns whose names begin and end with 2 underscores (e.g. '''`__color__`''') are
  assumed to be ''formatting hints'', affecting the appearance of the row.
   
   * '''`__group__`''' — Group results based on values in this column. Each group will have its own header and table.
   * '''`__grouplink__`''' — Make the header of each group a link to the specified URL. The URL is taken from the first row of each group.
   * '''`__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.
   {{{#!html
  <div style="margin-left:3em">Defaults: 
  <span style="border: none; color: #333; background: transparent;  font-size: 85%; background: #fdc; border-color: #e88; color: #a22">Color 1</span>
  <span style="border: none; color: #333; background: transparent;  font-size: 85%; background: #ffb; border-color: #eea; color: #880">Color 2</span>
  <span style="border: none; color: #333; background: transparent;  font-size: 85%; background: #fbfbfb; border-color: #ddd; color: #444">Color 3</span>
  <span style="border: none; color: #333; background: transparent; font-size: 85%; background: #e7ffff; border-color: #cee; color: #099">Color 4</span>
  <span style="border: none; color: #333; background: transparent;  font-size: 85%; background: #e7eeff; border-color: #cde; color: #469">Color 5</span>
  </div>
  }}}
   * '''`__style__`''' — A custom CSS style expression to use on the `<tr>` element of the current row.
   * '''`__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.

  '''Example:''' List active tickets, grouped by milestone, group header linked to milestone page, colored by priority:
  {{{#!sql
  SELECT p.value AS __color__,
       t.milestone AS __group__,
       '../milestone/' || t.milestone AS __grouplink__,
       (CASE owner WHEN 'daniel' THEN 'font-weight: bold; background: red;' ELSE '' END) AS __style__,
       t.id AS ticket, summary
  FROM ticket t,enum p
  WHERE t.status IN ('new', 'assigned', 'reopened') 
    AND p.name = t.priority AND p.type = 'priority'
  ORDER BY t.milestone, p.value, t.severity, t.time
  }}}

  Note that table join is used to match ''ticket'' priorities with their numeric representation from the ''enum'' table.

  === Changing layout of report rows === #column-syntax

  By default, all columns on each row are display on a single row in the HTML report, possibly formatted according to the descriptions above. However, it is also possible to create multi-line report entries.

   * '''`column_`''' — ''Break row after this''. By appending an underscore ('_') to the column name, the remaining columns will be continued on a second line.

   * '''`_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.

   * '''`_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).
     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.

  '''Example:''' List active tickets, grouped by milestone, colored by priority, with  description and multi-line layout:

  {{{#!sql
  SELECT p.value AS __color__,
         t.milestone AS __group__,
         (CASE owner 
            WHEN 'daniel' THEN 'font-weight: bold; background: red;' 
            ELSE '' END) AS __style__,
         t.id AS ticket, summary AS summary_,             -- ## Break line here
         component,version, severity, milestone, status, owner,
         time AS created, changetime AS modified,         -- ## Dates are formatted
         description AS _description_,                    -- ## Uses a full row
         changetime AS _changetime, reporter AS _reporter -- ## Hidden from HTML output
  FROM ticket t,enum p
  WHERE t.status IN ('new', 'assigned', 'reopened') 
    AND p.name = t.priority AND p.type = 'priority'
  ORDER BY t.milestone, p.value, t.severity, t.time
  }}}

  === Reporting on custom fields

  If you have added [TracTicketsCustomFields custom fields] to your tickets, you can write a SQL query to include them in a report. You'll need to make a join on the `ticket_custom` table.

  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.

  === A note about SQL rewriting #rewriting

  Beyond the relatively trivial replacement of dynamic variables, the SQL query is also altered in order to support two features of the reports:
   1. [#sort-order sorting]
   1. pagination: limiting the number of results displayed on each page
  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.
  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:
   - `@SORT_COLUMN@`, the place where the name of the selected sort column will be inserted,
   - `@LIMIT_OFFSET@`, the place where the pagination support clause will be added
  Note that if you write them after an SQL comment, `--`, you'll effectively disable rewriting if this is what you want!

  Let's take an example, consider the following SQL query:
  {{{#!sql
  -- ## 4: Assigned, Active Tickets by Owner ## --

  -- 
  -- List assigned tickets, group by ticket owner, sorted by priority.
  -- 

  SELECT p.value AS __color__,
     owner AS __group__,
     id AS ticket, summary, component, milestone, t.type AS type, severity, time AS created,
     changetime AS _changetime, description AS _description,
     reporter AS _reporter
  FROM ticket t,enum p
  WHERE status = 'assigned'
    AND p.name = t.priority AND p.type = 'priority'
  ORDER BY __group__, p.value, severity, time
  }}}

  The automatic rewrite will be the following (4 rows per page, page 2, sorted by `component`):
  {{{#!sql
  SELECT p.value AS __color__,
     owner AS __group__,
     id AS ticket, summary, component, milestone, t.type AS type, severity, time AS created,
     changetime AS _changetime, description AS _description,
     reporter AS _reporter
  FROM ticket t,enum p
  WHERE status = 'assigned'
    AND p.name = t.priority AND p.type = 'priority'
  ORDER BY __group__ ASC, `component` ASC,  __group__, p.value, severity, time
  LIMIT 4 OFFSET 4
  }}}

  The equivalent SQL query with the rewrite tokens would have been:
  {{{#!sql
  SELECT p.value AS __color__,
     owner AS __group__,
     id AS ticket, summary, component, milestone, t.type AS type, severity, time AS created,
     changetime AS _changetime, description AS _description,
     reporter AS _reporter
  FROM ticket t,enum p
  WHERE status = 'assigned'
    AND p.name = t.priority AND p.type = 'priority'
  ORDER BY __group__, @SORT_COLUMN@, p.value, severity, time
  @LIMIT_OFFSET@
  }}}

  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:
  {{{#!sql
  ORDER BY __group__, p.value, @SORT_COLUMN@, severity, time
  }}}

  == Changing Report Numbering

  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:
   * id integer PRIMARY KEY
   * author text
   * title text
   * query text
   * description text
  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:
  {{{#!sql
  UPDATE report SET id = 5 WHERE id = 3;
  }}}
  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 for your database.

  You may also need to update or remove the report number stored in the report or query.

  ----
  See also: TracTickets, TracQuery, [http://www.sqlite.org/lang_expr.html Query Language Understood by SQLite]


name: WikiDeletePage
author: trac
ipnr: 127.0.0.1
text:
  = Deleting a Wiki Page =

  Wiki pages can be completely deleted using the //Delete page// or the //Delete this version// button at the bottom of the wiki page. These buttons are only visible for users that have the `WIKI_DELETE` permission.

  '''Note:''' Deleting a wiki page is an irreversible operation.

  Deleting specific versions or even complete pages can make sense to remove spam or other abusive submissions.

  However, if you want to delete a page because you re-created a new page with the same content but a different name, it is recommended to keep the page and use it as a redirection page instead of completely deleting it. This will avoid frustrating the visitor with broken links, particularly when coming to the site from a search engine. 

  In this situation, chances are that you actually wanted to [[WikiNewPage#renaming|rename]] the page instead of doing a copy and delete. 
  The //Rename// operation offers you the possibility to create a redirection page.
  A redirection page is a short page that  contains a link such as  “See !SomeOtherPage”. 

  ----
  See also: TracWiki, TracPermissions


name: TracWiki
author: trac
ipnr: 127.0.0.1
text:
  = The Trac Wiki System =
  [[TracGuideToc]]

  Trac has a built-in wiki system which you can use for organizing knowledge and information in a very flexible way by [WikiNewPage creating pages] containing an intuitive and easy to learn textual markup. The wiki markup is used throughout Trac, so not only in [wiki:TitleIndex wiki pages], but also in [TracTickets ticket] description and comments, [TracChangeset version control] log messages, [TracRoadmap milestone] descriptions, [TracReports report] descriptions  and even in third-party extensions.
  It allows for formatted text and hyperlinks in and between all Trac modules.

  Editing wiki text is easy, as compared to complex markup languages like HTML, using any web browser and simple [WikiFormatting formatting]. The motivation for wiki markup is that HTML, with its large collection of nestable tags, is too complicated to allow fast-paced editing, and distracts from the actual content of the pages. Note that Trac also supports [WikiHtml HTML], [WikiRestructuredText reStructuredText] and [https://txstyle.org Textile] as alternative markup formats, which can be used in parts of a page, so called wiki blocks.

  The main goal of the wiki is to make editing text easy in order to ''encourage'' people to contribute to a project. Trac also provides a simple toolbar to make formatting text even easier, and supports the [http://universaleditbutton.org/Universal_Edit_Button universal edit button] of your browser.

  The wiki itself does not enforce any structure, but rather resembles a stack of empty sheets of paper, where you can organize information and documentation as you see fit, and later reorganize if necessary. 
  As contributing to a wiki is essentially building hypertext, general advice regarding HTML authoring apply here as well.
  For example, the ''[https://www.w3.org/Provider/Style Style Guide for online hypertext]'' explains how to think about the [https://www.w3.org/Provider/Style/Structure.html overall structure of a work] and how to organize information [https://www.w3.org/Provider/Style/WithinDocument.html within each document]. One of the most important tips is to "make your HTML page such that you can read it, even if you don't follow any links".

  Learn more about:
   * WikiFormatting rules, including advanced topics like WikiMacros and WikiProcessors.
   * How to use WikiPageNames and other forms of TracLinks which are used to refer to any resource within Trac.

  If you want to practice editing, please use the SandBox. Note that not all Trac wiki pages are editable by anyone, this depends on the local policy; check with your Trac administrators.

  Before saving your changes, you can ''Preview'' the page or ''Review Changes'' you have made.
  You can get an automatic preview of the formatting as you type when you activate the ''Edit Side-by-side'' mode. There is a [wiki:TracIni#/auto_preview_timeout configurable delay] between when you make your edit and when the automatic preview will update.

  Some more information about wikis on the web:
   * A definition of [https://wikipedia.org/wiki/Wiki Wiki] according to Wikipedia.
   * The [http://c2.com/cgi/wiki?WikiHistory history] behind the original wiki.
   * A wiki page explaining [http://www.usemod.com/cgi-bin/mb.pl?WhyWikiWorks why wiki works].

  ----
  See also: TracGuide


name: TracInterfaceCustomization
author: trac
ipnr: 127.0.0.1
text:
  = Customizing the Trac Interface
  [[TracGuideToc]]
  [[PageOutline(2-5,Contents,pullout)]]

  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.

  == Project Logo and Icon
  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 [TracIni#project-section trac.ini].

  The logo or icon image should be put your environment's `htdocs` directory. 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.

  Next, configure the appropriate section of your trac.ini:

  === Logo
  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. 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`.

  {{{#!ini
  [header_logo]
  src = site/my_logo.gif
  alt = My Project
  width = 300
  height = 100
  }}}

  === Icon
  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:

  {{{#!ini
  [project]
  icon = site/my_icon.ico
  }}}

  == Custom Navigation Entries
  The `[mainnav]` and `[metanav]` sections of trac.ini be used to customize the navigation items' text and link, or even disable them, but not for adding new ones.

  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:
  {{{#!ini
  [mainnav]
  wiki.label = Home
  tickets.href = /report/24

  [metanav]
  help = disabled
  }}}

  See also TracNavigation for a more detailed explanation of the mainnav and metanav navigation.

  == Site Appearance #SiteAppearance

  Trac is using [http://genshi.edgewall.org 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`:

  {{{#!xml
  <html xmlns="http://www.w3.org/1999/xhtml"
        xmlns:py="http://genshi.edgewall.org/"
        py:strip="">

    <!--! Add site-specific style sheet -->
    <head py:match="head" py:attrs="select('@*')">
      ${select('*|comment()|text()')}
      <link rel="stylesheet" href="${href.chrome('site/style.css')}" />
    </head>

    <body py:match="body" py:attrs="select('@*')">
      <!--! Add site-specific header -->
      <div id="siteheader">
        <!--! Place your header content here... -->
      </div>

      ${select('*|text()')}

      <!--! Add site-specific footer -->
      <div id="sitefooter">
        <!--! Place your footer content here... -->
      </div>
    </body>
  </html>
  }}}

  Notice that XSLT bears some similarities with Genshi templates. However, there are some Trac specific features, for example the `${href.chrome('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-htdocs_location-option "[trac] htdocs_location"] setting.

  `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 into specific sections. See [http://groups.google.com/group/trac-users/browse_thread/thread/70487fb2c406c937/ this thread] for a detailed explanation of the above example `site.html`.
  A `site.html` can contain any number of `py:match` sections. This is all Genshi, so the [http://genshi.edgewall.org/wiki/Documentation/xml-templates.html docs on the exact syntax] can be found there.

  Example snippet of adding introduction text to the new ticket form (but not shown during preview):

  {{{#!xml
  <form py:match="div[@id='content' and @class='ticket']/form" py:attrs="select('@*')">
    <py:if test="req.path_info == '/newticket' and (not 'preview' in req.args)">
      <p>Please make sure to search for existing tickets before reporting a new one!</p>
    </py:if>
    ${select('*')} 
  </form>
  }}}

  This example illustrates a technique of using `req.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.path_info == '/timeline'` as the condition in a `<py:if>` test.

  More examples snippets for `site.html` can be found at [trac:wiki:CookBook/SiteHtml CookBook/SiteHtml].

  Example snippets for `style.css` can be found at [trac:wiki:CookBook/SiteStyleCss CookBook/SiteStyleCss].

  Note that the `site.html`, despite its name, can be put in a shared templates directory, see the [[TracIni#inherit-templates_dir-option|[inherit] templates_dir]] option. This could provide easier maintainence as one new global `site.html` file can be made to include any existing header, footer and newticket snippets.

  == Project List #ProjectList

  You can use a custom Genshi template to display the list of projects if you are using Trac with multiple projects.

  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:

  {{{#!text/html
  <!DOCTYPE html
      PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  <html xmlns="http://www.w3.org/1999/xhtml"
        xmlns:py="http://genshi.edgewall.org/"
        xmlns:xi="http://www.w3.org/2001/XInclude">
    <head>
      <title>Available Projects</title>
    </head>
    <body>
      <h1>Available Projects</h1>
      <ul>
        <li py:for="project in projects" py:choose="">
          <a py:when="project.href" href="$project.href"
             title="$project.description">$project.name</a>
          <py:otherwise>
            <small>$project.name: <em>Error</em> <br /> ($project.description)</small>
          </py:otherwise>
        </li>
      </ul>
    </body>
  </html>
  }}}

  Once you've created your custom template you will need to configure the webserver to tell Trac where the template is located:

  For [wiki:TracModWSGI mod_wsgi]:
  {{{#!python
  os.environ['TRAC_ENV_INDEX_TEMPLATE'] = '/path/to/template.html'
  }}}

  For [TracFastCgi FastCGI]:
  {{{#!apache
  FastCgiConfig -initial-env TRAC_ENV_PARENT_DIR=/parent/dir/of/projects \
                -initial-env TRAC_ENV_INDEX_TEMPLATE=/path/to/template
  }}}

  For [TracModPython mod_python]:
  {{{#!apache
  PythonOption TracEnvParentDir /parent/dir/of/projects
  PythonOption TracEnvIndexTemplate /path/to/template
  }}}

  For [TracCgi CGI]:
  {{{#!apache
  SetEnv TRAC_ENV_INDEX_TEMPLATE /path/to/template
  }}}

  For TracStandalone, you'll need to set up the `TRAC_ENV_INDEX_TEMPLATE` environment variable in the shell used to launch tracd:
   - Unix:
     {{{#!sh
  $ export TRAC_ENV_INDEX_TEMPLATE=/path/to/template
     }}}
   - Windows:
     {{{#!sh
  $ set TRAC_ENV_INDEX_TEMPLATE=/path/to/template
     }}}

  == Project Templates

  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 whenever possible, see [#SiteAppearance]. 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.

  With that word of caution, any Trac template may be copied and customized. The default Trac templates are located in the Trac egg or wheel, such as `/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 or wheel's `trac/htdocs` directory.

  However, do not edit templates or site resources inside the Trac egg/wheel. Reinstalling Trac overwrites your modifications. Instead use one of these alternatives:
   * For a modification to one project only, copy the template to project `templates` directory.
   * For a modification shared by several projects, copy the template to a shared location and have each project point to this location using the [[TracIni#inherit-templates_dir-option|[inherit] templates_dir]] option.

  Trac resolves requests for a template by first looking inside the project, then in any inherited templates location, and finally inside the Trac egg or wheel.

  Trac caches templates in memory by default to improve performance. To apply a template you need to restart the web server.

  ----
  See also TracIni, TracNavigation


name: WikiFormatting
author: trac
ipnr: 127.0.0.1
text:
  = WikiFormatting

  [[TracGuideToc]]

  Wiki markup is a core feature in Trac, tightly integrating all the other parts of Trac into a flexible and powerful whole.

  Trac has a built-in small and powerful wiki rendering engine. This wiki engine implements a growing subset of the commands from other popular Wikis, especially [http://moinmo.in/ MoinMoin] and [trac:WikiCreole].

  This page will give you an in-depth explanation of the wiki markup available anywhere WikiFormatting is allowed.

  The sections below provide an overview for the most common syntax, each link in the ''Category'' column will lead you to the more detailed explanation later in this page.

  A few other wiki pages present the advanced features of the Trac wiki markup in more depth: 
   - TracLinks covers all the possible ways to refer precisely to any Trac resource or parts thereof.
   - WikiPageNames covers the various names a wiki page can take, whether in CamelCase or not.
   - WikiMacros lists the macros available for generating dynamic content.
   - WikiProcessors and WikiHtml details how parts of the wiki text can be processed in special ways.
   - [trac:wiki:TracDev/Proposals/AdvancedWikiOperations AdvancedWikiOperations] provides some operations in uncommon or administrative scenarios.

  == Common wiki markup

  ||= '''Category''' =||= '''Wiki Markup''' =||= '''Display''' =||
  |-----------------------------------------------------------
  {{{#!th rowspan=3
  [#FontStyles Font Styles]
  }}}
  || `'''bold'''`, `''italic''`, `'''''Wikipedia style'''''` || \
  || '''bold''', ''italic'', '''''Wikipedia style''''' ||
  || {{{`monospaced (''other markup ignored'')`}}} || \
  || `monospaced (''other markup ignored'')` ||
  || `**bold**`, `//italic//`, `**//!WikiCreole style//**` || \
  || **bold**, //italic//, **//!WikiCreole style//** ||
  |-----------------------------------------------------------
  ||= [#Headings Headings] =||\
  {{{#!td 
   {{{
   == Level 2
   === Level 3 ^([#hn note])^
   }}}
  }}}
  {{{#!td style="padding-left: 2em"
  == Level 2
  === Level 3 ^([#hn note])^
  }}}
  |-----------------------------------------------------------
  ||= [#Paragraphs Paragraphs]  =||\
  {{{#!td
   {{{
   First paragraph
   on multiple lines.

   Second paragraph.
   }}}
  }}}
  {{{#!td
  First paragraph
  on multiple lines.

  Second paragraph.
  }}}
  |-----------------------------------------------------------
  ||= [#Lists Lists] =||\
  {{{#!td
   {{{
   * bullet list
     on multiple lines
     1. nested list
       a. different numbering 
          styles
   }}}
  }}}
  {{{#!td
  * bullet list
    on multiple lines
    1. nested list
      a. different numbering
         styles
  }}}
  |-----------------------------------------------------------
  {{{#!th
  [#DefinitionLists Definition Lists]
  }}}
  {{{#!td
   {{{
    term:: definition on
           multiple lines
   }}}
  }}}
  {{{#!td
   term:: definition on
          multiple lines
  }}}
  |-----------------------------------------------------------
  ||= [#PreformattedText Preformatted Text] =||\
  {{{#!td
   {{{
   {{{
   multiple lines, ''no wiki''
         white space respected
   }}}
   }}}
  }}}
  {{{#!td
   {{{
   multiple lines, ''no wiki''
         white space respected
   }}}
  }}}
  |-----------------------------------------------------------
  ||= [#Blockquotes Blockquotes] =||\
  {{{#!td
   {{{
     if there's some leading
     space the text is quoted
   }}}
  }}}
  {{{#!td
   if there's some leading
   space the text is quoted
  }}}
  |-----------------------------------------------------------
  ||= [#DiscussionCitations Discussion Citations] =||\
  {{{#!td
   {{{
   >> ... (I said)
   > (he replied)
   }}}
  }}}
  {{{#!td
  >>... (I said)
  > (he replied)
  }}}
  |-----------------------------------------------------------
  ||= [#Tables Tables] =||\
  {{{#!td
   {{{
   ||= Table Header =|| Cell ||
   ||||  (details below)  ||
   }}}
  }}}
  {{{#!td
  ||= Table Header =|| Cell ||
  ||||  (details below)  ||
  }}}
  |-----------------------------------------------------------
  {{{#!th rowspan=2
  [#Links Links]
  }}}
  || `http://trac.edgewall.org` ||\
  || http://trac.edgewall.org ||
  || `WikiFormatting (CamelCase)` ||\
  || WikiFormatting (CamelCase) ||
  |-----------------------------------------------------------
  {{{#!th rowspan=5
  [#TracLinks TracLinks]
  }}}
  || `wiki:WikiFormatting`, `wiki:"WikiFormatting"` ||\
  || wiki:WikiFormatting, wiki:"WikiFormatting" ||
  || `#1 (ticket)`, `[1] (changeset)`, `{1} (report)` ||\
  || #1 (ticket), [1] (changeset), {1} (report) ||
  || `ticket:1, ticket:1#comment:1, comment:1:ticket:1` ||\
  || ticket:1, ticket:1#comment:1, comment:1:ticket:1 ||
  || `Ticket [ticket:1]`, `[ticket:1 ticket one]` ||\
  || Ticket [ticket:1], [ticket:1 ticket one] ||
  || `Ticket [[ticket:1]]`, `[[ticket:1|ticket one]]` ||\
  || Ticket [[ticket:1]], [[ticket:1|ticket one]] ||
  |-----------------------------------------------------------
  {{{#!th rowspan=2 
  [#SettingAnchors Setting Anchors]
  }}}
  || `[=#point1 (1)] First...` ||\
  || [=#point1 (1)] First... ||
  || `see [#point1 (1)]` ||\
  || see [#point1 (1)] ||
  |-----------------------------------------------------------
  {{{#!th rowspan=3
  [#Escaping Escaping Markup]
  }}}
  || `!'' doubled quotes` ||\
  || !'' doubled quotes ||
  || `!wiki:WikiFormatting`, `!WikiFormatting` ||\
  || !wiki:WikiFormatting, !WikiFormatting ||
  || [[html(<code>`{{{-}}}` triple curly brackets</code>)]] ||\
  || `{{{-}}}` triple curly brackets ||
  |-----------------------------------------------------------
  ||= [#Images Images] =|| `[[Image(`''link''`)]]` || [[Image(htdocs:../common/trac_logo_mini.png)]] ||
  |-----------------------------------------------------------
  {{{#!th rowspan=2
  [#Macros Macros]
  }}}
  || `[[MacroList(*)]]` ||  ''(short list of all available macros)''  ||
  || `[[Image?]]` ||  ''(help for the Image macro)''  ||
  |-----------------------------------------------------------
  ||= [#Processors Processors] =||\
  {{{#!td
   {{{
   {{{
   #!div style="font-size: 80%"
   Code highlighting:
     {{{#!python
     hello = lambda: "world"
     }}}
   }}}
   }}}
  }}}
  {{{#!td style="padding-left: 2em"
   {{{
   #!div style="font-size: 80%"
   Code highlighting:
     {{{#!python 
     hello = lambda: "world"
     }}}
   }}}
  }}}
  |-----------------------------------------------------------
  ||= [#Comments Comments] =||\
  {{{#!td
   {{{
   {{{#!comment
   Note to Editors: ...
   }}}
   }}}
  }}}
  {{{#!td style="padding-left: 2em"
   {{{#!comment
   Note to Editors: ...
   }}}
  }}}
  |-----------------------------------------------------------
  ||= [#Miscellaneous Miscellaneous] =||\
  {{{#!td
   {{{
   Line [[br]] break 
   Line \\ break
   ----
   }}}
  }}}
  {{{#!td style="padding-left: 2em"
  Line [[br]] break
  Line \\ break
  ----
  }}}

  == Font Styles

  The Trac wiki supports the following font styles:
  ||= Wiki Markup =||= Display =||
  {{{#!td
    {{{
     * '''bold''', 
       ''' triple quotes !''' 
       can be bold too if prefixed by ! ''', 
     * ''italic''
     * '''''bold italic''''' or ''italic and
       ''' italic bold ''' ''
     * __underline__
     * {{{monospace}}} or `monospace`
       (hence `{{{` or {{{`}}} quoting)
     * ~~strike-through~~
     * ^superscript^ 
     * ,,subscript,,
     * **also bold**, //italic as well//, 
       and **'' bold italic **'' //(since 0.12)//
     * [[span(style=color: #FF0000, a red text )]]
    }}}
  }}}
  {{{#!td
   * '''bold''', 
     ''' triple quotes !''' 
     can be bold too if prefixed by ! ''', 
   * ''italic''
   * '''''bold italic''''' or ''italic and
     ''' italic bold ''' ''
   * __underline__
   * {{{monospace}}} or `monospace`
     (hence `{{{` or {{{`}}} quoting)
   * ~~strike-through~~
   * ^superscript^ 
   * ,,subscript,,
   * **also bold**, //italic as well//, 
     and **'' bold italic **'' //(since 0.12)//
   * [[span(style=color: #FF0000, a red text )]]
  }}}

  Notes:
   * `{{{...}}}` and {{{`...`}}} commands not only select a monospace font, but also treat their content as verbatim text, meaning that no further wiki processing is done on this text.
   * {{{ ! }}} tells wiki parser to not take the following characters as wiki format, so pay attention to put a space after !, e.g. when ending bold.
   * all the font styles marks have to be used in opening/closing pairs, 
     and they must nest properly; in particular, an `''` italic can't be paired 
     with a `//` one, and `'''` can't be paired with `**`.

  == Headings

  You can create heading by starting a line with one up to six ''equal'' characters ("=") followed by a single space and the headline text. 

  [=#hn]
  The headline text can be followed by the same number of "=" characters, but this is not mandatory. That is, `=== Section3 ===` is identical to `=== Section3`.

  Finally, the heading might optionally be followed by an explicit id. If not, an implicit but nevertheless readable id will be generated.

  ||= Wiki Markup =||= Display =||
  {{{#!td
    {{{
    = Heading =
    == Subheading
    === About ''this'' ===
    === Explicit id === #using-explicit-id-in-heading
    == Subheading #sub2
  }}}
  }}}
  {{{#!td style="padding: 1em;"
    {{{
    #!div
    = Heading =
    == Subheading
    === About ''this'' ===
    === Explicit id === #using-explicit-id-in-heading
    == Subheading #sub2
    }}}
  }}}

  == Paragraphs

  A new text paragraph is created whenever two blocks of text are separated by one or more empty lines.

  A forced line break can also be inserted, using:
  ||= Wiki Markup =||= Display =||
  {{{#!td
    {{{
    Line 1[[BR]]Line 2
    }}}
    {{{
    Paragraph
    one

    Paragraph 
    two
    }}}
  }}}
  {{{#!td
    Line 1[[BR]]Line 2

    Paragraph 
    one

    Paragraph 
    two
  }}}

  == Lists

  The wiki supports both ordered/numbered and unordered lists.

  Example:
  ||= Wiki Markup =||= Display =||
  {{{#!td
    {{{
     * Item 1
       * Item 1.1
          * Item 1.1.1   
          * Item 1.1.2
          * Item 1.1.3
       * Item 1.2
     * Item 2
    - items can start at the beginning of a line
      and they can span multiple lines
      - be careful though to continue the line 
      with the appropriate indentation, otherwise
    that will start a new paragraph...
    
     1. Item 1
       a. Item 1.a
       a. Item 1.b
          i. Item 1.b.i
          i. Item 1.b.ii
     1. Item 2
    And numbered lists can also be restarted
    with an explicit number:
     3. Item 3
    }}}
  }}}
  {{{#!td
   * Item 1
     * Item 1.1
        * Item 1.1.1   
        * Item 1.1.2
        * Item 1.1.3
     * Item 1.2
   * Item 2
  - items can start at the beginning of a line
    and they can span multiple lines
    - be careful though to continue the line 
    with the appropriate indentation, otherwise
  that will start a new paragraph...

   1. Item 1
     a. Item 1.a
     a. Item 1.b
        i. Item 1.b.i
        i. Item 1.b.ii
   1. Item 2
  And numbered lists can also be restarted with an explicit number:
   3. Item 3
  }}}

  == Definition Lists

  The wiki also supports definition lists.

  ||= Wiki Markup =||= Display =||
  {{{#!td
    {{{
     llama::
       some kind of mammal, with hair
     ppython::
       some kind of reptile, without hair
       (can you spot the typo?)
    }}}
  }}}
  {{{#!td
   llama::
     some kind of mammal, with hair
   ppython::
     some kind of reptile, without hair
     (can you spot the typo?)
  }}}

  Note that you need a space in front of the defined term.

  == Preformatted Text

  Block containing preformatted text are suitable for source code snippets, notes and examples. Use three ''curly braces'' wrapped around the text to define a block quote. The curly braces need to be on a separate line.
    
  ||= Wiki Markup =||= Display =||
  {{{#!td
    {{{
    {{{
    def HelloWorld():
        print '''Hello World'''
    }}}
    }}}
  }}}
  {{{#!td
    {{{
    def HelloWorld():
        print '''Hello World'''
    }}}
  }}}

  Note that this kind of block is also used for selecting lines that should be processed through WikiProcessors.

  == Blockquotes

  In order to mark a paragraph as blockquote, indent that paragraph with two spaces.

  ||= Wiki Markup =||= Display =||
  {{{#!td
  {{{
  Paragraph
    This text is a quote from someone else.
  }}}
  }}}
  {{{#!td
  Paragraph
    This text is a quote from someone else.
  }}}

  == Discussion Citations

  To delineate a citation in an ongoing discussion thread, such as the ticket comment area, email-like citation marks (">", ">>", etc.) may be used.  

  ||= Wiki Markup =||= Display =||
  {{{#!td
    {{{
    >> Someone's original text
    > Someone else's reply text
    >  - which can be any kind of Wiki markup
    My reply text
    }}}
  }}}
  {{{#!td
  >> Someone's original text
  > Someone else's reply text
  >  - which can be any kind of Wiki markup
  My reply text
  }}}

  == Tables
  === Simple Tables

  Simple tables can be created like this:
  ||= Wiki Markup =||= Display =||
  {{{#!td
    {{{
    ||Cell 1||Cell 2||Cell 3||
    ||Cell 4||Cell 5||Cell 6||
    }}}
  }}}
  {{{#!td style="padding: 2em;"
  ||Cell 1||Cell 2||Cell 3||
  ||Cell 4||Cell 5||Cell 6||
  }}}

  Cell headings can be specified by wrapping the content in a pair of '=' characters.
  Note that the '=' characters have to stick to the cell separators, like this:
  ||= Wiki Markup =||= Display =||
  {{{#!td
    {{{
    ||        ||= stable =||= latest =||
    ||= 0.10 =||  0.10.5  || 0.10.6dev||
    ||= 0.11 =||  0.11.6  || 0.11.7dev||
    }}}
  }}}
  {{{#!td style="padding: 2em;"
  ||        ||= stable =||= latest =||
  ||= 0.10 =||  0.10.5  || 0.10.6dev||
  ||= 0.11 =||  0.11.6  || 0.11.7dev||
  }}}

  Finally, specifying an empty cell means that the next non empty cell will span the empty cells. For example:
  ||= Wiki Markup =||= Display =||
  {{{#!td
    {{{
    || 1 || 2 || 3 ||
    |||| 1-2 || 3 ||
    || 1 |||| 2-3 ||
    |||||| 1-2-3 ||
    }}}
  }}}
  {{{#!td style="padding: 2em;"
  || 1 || 2 || 3 ||
  |||| 1-2 || 3 ||
  || 1 |||| 2-3 ||
  |||||| 1-2-3 ||
  }}}

  Note that if the content of a cell "sticks" to one side of the cell and only one, then the text will be aligned on that side. Example:
  ||= Wiki Markup =||= Display =||
  {{{#!td
    {{{
    ||=Text =||= Numbers =||
    ||left align    ||        1.0||
    ||  center      ||        4.5||
    ||      right align||     4.5||
    || default alignment ||   2.5||
    ||default||         2.5||
    ||  default ||      2.5||
    || default ||       2.5||
    }}}
  }}}
  {{{#!td style="padding: 2em;"
  ||=Text =||= Numbers =||
  ||left align    ||        1.0||
  ||  center      ||        4.5||
  ||      right align||     4.5||
  || default alignment ||   2.5||
  ||default||         2.5||
  ||  default ||      2.5||
  || default ||       2.5||
  }}}

  If contrary to the example above, the cells in your table contain more text, it might be convenient to spread a table row over multiple lines of markup. The `\` character placed at the end of a line after a cell separator tells Trac to not start a new row for the cells on the next line.

  ||= Wiki Markup =||
  {{{#!td
    {{{
    || this is column 1 [http://trac.edgewall.org/newticket new ticket] || \
    || this is column 2 [http://trac.edgewall.org/roadmap the road ahead] || \
    || that's column 3 and last one ||
    }}}
  }}}
  |-------------
  ||= Display =||
  {{{#!td style="padding: 2em;"
  || this is column 1 [http://trac.edgewall.org/newticket new ticket] || \
  || this is column 2 [http://trac.edgewall.org/roadmap the road ahead] || \
  || that's column 3 and last one ||
  }}}

  === Complex Tables

  If the possibilities offered by the simple pipe-based markup ('||') for tables described above are not enough for your needs, you can create more elaborate tables by using [#Processors-example-tables WikiProcessor based tables].

  == Links

  Hyperlinks are automatically created for WikiPageNames and URLs. !WikiPageLinks can be disabled by prepending an exclamation mark ('!'), such as {{{!WikiPageLink}}}.

  ||= Wiki Markup =||= Display =||
  {{{#!td
    {{{
    TitleIndex, http://www.edgewall.com/, !NotAlink
    }}}
  }}}
  {{{#!td
  TitleIndex, http://www.edgewall.com/, !NotAlink
  }}}

  Links can be given a more descriptive title by writing the link followed by a space and a title and all this inside square brackets. 
  If the descriptive title is omitted, then the explicit prefix is discarded, unless the link is an external link. This can be useful for wiki pages not adhering to the WikiPageNames convention.

  ||= Wiki Markup =||= Display =||
  {{{#!td
    {{{
     * [http://www.edgewall.com Edgewall Software]
     * [wiki:TitleIndex Title Index] 
     * [wiki:TitleIndex] 
     * [wiki:ISO9000]
    }}}
  }}}
  {{{#!td
     * [http://www.edgewall.com Edgewall Software]
     * [wiki:TitleIndex Title Index] 
     * [wiki:TitleIndex] 
     * [wiki:ISO9000]
  }}}

  Following the [trac:WikiCreole] trend, the descriptive title can also be specified by writing the link followed by a pipe ('|') and a title and all this inside //double// square brackets. 

  {{{#!td
    {{{
     * [[http://www.edgewall.com|Edgewall Software]]
     * [[wiki:TitleIndex|Title Index]]
       or even [[TitleIndex|Title Index]]
     * [[wiki:TitleIndex]]
       ''' but not ![[TitleIndex]]! '''
     * [[ISO9000]]
    }}}
  }}}
  {{{#!td
     * [[http://www.edgewall.com|Edgewall Software]]
     * [[wiki:TitleIndex|Title Index]]
       or even [[TitleIndex|Title Index]]
     * [[wiki:TitleIndex]]
       ''' but not ![[TitleIndex]]! '''
     * [[ISO9000]]
  }}}

  '''Note''': the [trac:WikiCreole] style for links is quick to type and certainly looks familiar as it is the one used on Wikipedia and in many other wikis. Unfortunately it conflicts with the syntax for [#Macros macros].
  So in the rare case when you need to refer to a page which is named after a macro (typical examples being TitleIndex, InterTrac and InterWiki), by writing `[[TitleIndex]]` you will actually call the macro instead of linking to the page.

  == Trac Links

  Wiki pages can link directly to other parts of the Trac system. Pages can refer to tickets, reports, changesets, milestones, source files and other Wiki pages using the following notations:

  ||= Wiki Markup =||= Display =||
  {{{#!td
    {{{
     * Tickets: #1 or ticket:1
     * Reports: {1} or report:1
     * Changesets: r1, [1] or changeset:1
     * ...
     * targeting other Trac instances, 
       so called InterTrac links:
       - Tickets: #Trac1 or Trac:ticket:1
       - Changesets: [Trac1] or Trac:changeset:1
    }}}
  }}}
  {{{#!td
   * Tickets: #1 or ticket:1
   * Reports: {1} or report:1
   * Changesets: r1, [1] or changeset:1
   * ... 
   * targeting other Trac instances, 
     so called InterTrac links:
     - Tickets: #Trac1 or Trac:ticket:1
     - Changesets: [Trac1] or Trac:changeset:1
  }}}

  There are many more flavors of Trac links, see TracLinks for more in-depth information and a reference for all the default link resolvers.

  == Setting Anchors

  An anchor, or more correctly speaking, an [http://www.w3.org/TR/REC-html40/struct/links.html#h-12.2.1 anchor name] can be added explicitly at any place in the Wiki page, in order to uniquely identify a position in the document:

  {{{
  [=#point1]
  }}}

  This syntax was chosen to match the format for explicitly naming the header id [#Headings documented above]. For example:
  {{{
  == Long title == #title
  }}}

  It is also very close to the syntax for the corresponding link to that anchor:
  {{{
  [#point1]
  }}}

  Optionally, a label can be given to the anchor:
  {{{
  [=#point1 '''Point 1''']
  }}}

  ||= Wiki Markup =||= Display =||
  |----------------------------------
  {{{#!td
    {{{
    [#point2 jump to the second point]

    ...

    Point2:  [=#point2] Jump here
    }}}
  }}}
  {{{#!td
    [#point2 jump to the second point]

    ...

    Point2:  [=#point2] Jump here
  }}}

  For more complex anchors (eg when a custom title is wanted), you can use the Span macro: `[[span(id=point2, class=wikianchor, title=Point 2, ^(2)^)]]`.

  == Escaping Links, WikiPageNames and other Markup == #Escaping

  You may avoid making hyperlinks out of TracLinks by preceding an expression with a single exclamation mark ('!').

  ||= Wiki Markup =||= Display =||
  {{{#!td
    {{{
     !NoHyperLink
     !#42 is not a link
    }}}
    {{{
  Various forms of escaping for list markup:
   ^^- escaped minus sign \\
   ^^1. escaped number  \\
   ^^* escaped asterisk sign
    }}}
  }}}
  {{{#!td
   !NoHyperLink
   !#42 is not a link

  Various forms of escaping for list markup:
   ^^- escaped minus sign \\
   ^^1. escaped number  \\
   ^^* escaped asterisk sign
  }}}

  == Images

  Urls ending with `.png`, `.gif` or `.jpg` are no longer automatically interpreted as image links, and converted to `<img>` tags.

  You now have to use the ![[Image]] macro. The simplest way to include an image is to upload it as attachment to the current page, and put the filename in a macro call like `[[Image(picture.gif)]]`.

  In addition to the current page, it is possible to refer to other resources:
   * `[[Image(wiki:WikiFormatting:picture.gif)]]` (referring to attachment on another page)
   * `[[Image(ticket:1:picture.gif)]]` (file attached to a ticket)
   * `[[Image(htdocs:picture.gif)]]` (referring to a file inside the [TracEnvironment environment] `htdocs` directory)
   * `[[Image(source:/trunk/trac/htdocs/trac_logo_mini.png)]]` (a file in repository)

  ||= Wiki Markup =||= Display =||
  {{{#!td
    {{{
    [[Image(htdocs:../common/trac_logo_mini.png)]]
    }}}
  }}}
  {{{#!td
  [[Image(htdocs:../common/trac_logo_mini.png)]]
  }}}

  See WikiMacros for further documentation on the `[[Image()]]` macro, which has several useful options (`title=`, `link=`, etc.)

  == Macros

  Macros are ''custom functions'' to insert dynamic content in a page.

  ||= Wiki Markup =||= Display =||
  {{{#!td
    {{{
    [[RecentChanges(Trac,3)]]
    }}}
  }}}
  {{{#!td style="padding-left: 2em"
  [[RecentChanges(Trac,3)]]
  }}}

  See WikiMacros for more information, and a list of installed macros.

  The detailed help for a specific macro can also be obtained more directly by appending a "?" to the macro name.

  ||= Wiki Markup =||= Display =||
  {{{#!td
    {{{
    [[MacroList?]]
    }}}
  }}}
  {{{#!td style="padding-left: 2em"
  [[MacroList?]]
  }}}

  == Processors

  Trac supports alternative markup formats using WikiProcessors. For example, processors are used to write pages in 
  [wiki:WikiRestructuredText reStructuredText] or [wiki:WikiHtml HTML]. 

  ||= Wiki Markup =||= Display =||
  |--------------------------------------------------------
  {{{#!td align="center" colspan=2 style="border: 0px; font-size: 90%"

     [=#Processors-example-html Example 1:] HTML

  }}}
  |--------------------------------------------------------
  {{{#!td style="border: 0px"
    {{{
    {{{
    #!html
    <h1 style="text-align: right; color: blue">
     HTML Test
    </h1>
    }}}
    }}}
  }}}
  {{{#!td valign="top"  style="border: 0px"

  {{{
  #!html
  <h1 style="text-align: right; color: blue">HTML Test</h1>
  }}}

  }}}
  |--------------------------------------------------------
  {{{#!td align="center" colspan=2 style="border: 0px; font-size: 90%"

     [=#Processors-example-highlight Example 2:] Code Highlighting

  }}}
  |--------------------------------------------------------
  {{{#!td style="border: 0px"
    {{{
    {{{
    #!python
    class Test:
    
        def __init__(self):
            print "Hello World"
    if __name__ == '__main__':
       Test()
    }}}
    }}}
  }}}
  {{{
  #!td valign="top"  style="border: 0px"

  {{{
  #!python
  class Test:
      def __init__(self):
          print "Hello World"
  if __name__ == '__main__':
     Test()
  }}}

  }}}
  |--------------------------------------------------------
  {{{#!td align="center" colspan=2 style="border: 0px; font-size: 90%"

         [=#Processors-example-tables Example 3:] Complex Tables

  }}}
  |--------------------------------------------------------
  {{{#!td style="border: 0px"
    {{{
    {{{#!th rowspan=4 align=justify
    With the `#td` and `#th` processors,
    table cells can contain any content:
    }}}
    |----------------
    {{{#!td
      - lists
      - embedded tables
      - simple multiline content
    }}}
    |----------------
    {{{#!td
    As processors can be easily nested, 
    so can be tables:
      {{{#!th
      Example:
      }}}
      {{{#!td style="background: #eef"
      || must be at the third level now... ||
      }}}
    }}}
    |----------------
    {{{#!td
    Even when you don't have complex markup,
    this form of table cells can be convenient
    to write content on multiple lines.
    }}}
    }}}
  }}}
  {{{
  #!td  valign="top"  style="border: 0px"

    {{{#!th rowspan=4 align=justify
    With the `#td` and `#th` processors,
    table cells can contain any content:
    }}}
    |----------------
    {{{#!td
      - lists
      - embedded tables
      - simple multiline content
    }}}
    |----------------
    {{{#!td
    As processors can be easily nested, 
    so can be tables:
      {{{#!th
      Example:
      }}}
      {{{#!td style="background: #eef"
      || must be at the third level now... ||
      }}}
    }}}
    |----------------
    {{{#!td
    Even when you don't have complex markup,
    this form of table cells can be convenient
    to write content on multiple lines.
    }}}

  }}}

  See WikiProcessors for more information.

  == Comments

  Comments can be added to the plain text. These will not be rendered and will not display in any other format than plain text.

  ||= Wiki Markup =||= Display =||
  {{{#!td
    {{{
    Nothing to
    {{{
    #!comment
    Your comment for editors here
    }}}
    see.
    }}}
  }}}
  {{{#!td
    Nothing to
    {{{
    #!comment
    Your comment for editors here
    }}}
    see.
  }}}

  == Miscellaneous

  ||= Wiki Markup =||= Display =||
  {{{#!td
    Horizontal line:
    {{{
    Four or more dashes will be replaced 
    by a horizontal line (<HR>)
    ----
    See?
    }}}
  }}}
  {{{#!td
  Four or more dashes will be replaced
  by a horizontal line (<HR>)
  ----
  See?
  }}}
  |----------------------------------
  {{{#!td
    Two examples of line breaks:
    {{{
    "macro" style [[BR]] line break
    }}}
    or:
    {{{
    !WikiCreole style \\ line\\break
    }}}
  }}}
  {{{#!td
  "macro" style [[BR]] line break

  !WikiCreole style \\ line\\break
  }}}
  |----------------------------------


name: TracSearch
author: trac
ipnr: 127.0.0.1
text:
  = Using Search

  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.

  In addition to the [search: Search module], you will also find a small search field above the navigation bar. It provides convenient access to the search module from all pages.

  The search results show the most recent modifications ranked first.

  == Quick searches

  For quick access to project resources, the quick-search field at the top of every page can be used to enter a [TracLinks TracLink], which will take you directly to the resource identified by that link:

   * ![42] -- Opens change set 42
   * !#42 -- Opens ticket number 42
   * !{1} -- Opens report 1
   * /trunk -- Opens the browser for the `trunk` directory in the default repository
   * /repos1/trunk -- Opens the browser for the `trunk` directory in the `repos1` repository

  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.

  == Search TracLinks

  From the Wiki, it is possible to link to a specific search using `search:` links:
   * `search:?q=crash` will search for the string "crash" 
   * `search:?q=trac+link&wiki=on` will search for "trac" and "link" in wiki pages only

  == Search Filters

  On the search page, pressing the modifier key while selecting a search filter will unselect all other search filters.

  ----
  See also: TracLinks, TracQuery


name: PageTemplates
author: trac
ipnr: 127.0.0.1
text:
  = Wiki Page Templates

  The default content for a new wiki page can be chosen from a list of page templates. 

  The list is generated from all the wiki pages having a name starting with ''!PageTemplates/''.
  The initial content of a new page will simply be the content of the chosen template page, or a blank page if the special ''(blank page)'' entry is selected. When there are no wiki pages with the ''!PageTemplates/'' prefix, the initial content will always be the blank page and the template list selector will not be shown.

  To create a new template, simply create a new page having a name starting with ''!PageTemplates/''.

  Hint: one could even create a ''!PageTemplates/Template'' for facilitating the creation of new templates!

  After the first template has been created, a drop-down selection box will automatically appear on any new wiki page that is created. By default it is located on the right side of the ''Create this page'' button. The default selection will be ''blank page'', or ''!DefaultPage'' if ''!PageTemplates/DefaultPage'' exists.

  The following templates are available on this site:
  [[TitleIndex(PageTemplates/)]]

  ----
  See also: TracWiki


name: TracBrowser
author: trac
ipnr: 127.0.0.1
text:
  = The Trac Repository Browser

  [[TracGuideToc]]

  The Trac repository browser can be used to browse specific revisions of directories and files stored in the repositories associated with the Trac environment.

  At the top-level of the repository browser is the '''Repository Index''', listing all the configured repositories. 
  Each repository has a name which is used as a path prefix in a "virtual" file hierarchy encompassing all the available repositories.
  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.

  Directory entries are displayed in a list with sortable columns. The list entries can be sorted by ''Name'', ''Size'', ''Age''/''Date'' or ''Author'' by clicking on the column headers. The third sortable column is labeled //Age// when the //Time format// [/prefs/localization preference] is //Relative// and //Date// when the //Time format// is //Absolute//. The sort order can be reversed by clicking on a given column header again.

  The browser can be used to navigate through the directory structure by clicking on the directory names. 
  Clicking on a file name will show the contents of the file. 
  Clicking on the revision number of a file or directory will take you to the TracRevisionLog for that file.
  Note that there's also a ''Revision Log'' navigation link that will do the same for the path currently being examined.
  Clicking on the ''diff'' icon after revision number will display the changes made to the files modified in that revision.
  Clicking on the ''Age''/''Date'' of the file - will take you to that changeset in the timeline.

  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.

  The color bar next to the ''Age''/''Date'' 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-color_scale-option configured].

  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. 
  This is sometimes referred to as the ''browser quickjump'' facility.
  The precise meaning and content of this menu depends on your repository backend.
  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 configured for more advanced cases through the `[svn]` [TracIni#svn-branches-option "branches"] and [TracIni#svn-tags-option "tags"] options.

  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 [TracAccessibility#TracBrowserAccessKeys keyboard shortcuts] can be used.

  For the Subversion backend, some advanced additional features are available:
   - The `svn:needs-lock` property is shown.
   - The `svn:mergeinfo` property shows eligible and merged revisions.
   - The `svn:externals` property can be [TracIni#svn:externals-section configured] to display a link to an external repository.
   - 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 [TracIni#trac-default_charset-option "[trac] default_charset"] option.
  {{{#!comment
  MMM: I found this section a bit hard to understand. I changed the first item as I understood that well.
  but I think the other items could be changed also
   cboos: in the meantime, I've added the ''advanced'' word as a hint this can be a bit complex...
  }}}

  ----
  See also: TracChangeset, TracRevisionLog


name: TracGuide
author: trac
ipnr: 127.0.0.1
text:
  = The Trac User and Administration Guide

  [[TracGuideToc]]
  {{{#!span style="font-size:90%"
  //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: Trac Project] itself.//
  }}}

  == Introduction

  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 helps 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.

  It provides an interface to Subversion as well as other version control systems, an integrated Wiki and convenient reporting facilities.

  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.

  == User Guide

     * Using the Wiki subsystem:
       * TracWiki — How to use the built-in Wiki.
       * WikiFormatting — Reference to the wiki syntax.
     * Using the Version Control subsystem:
       * TracBrowser — Browsing source code with Trac.
       * TracChangeset — Viewing changes to source code.
       * TracRevisionLog — Viewing change history.
     * Using the Ticket subsystem:
       * TracTickets — Using the issue tracker.
       * TracRoadmap — Tracking project progress.
       * TracReports — Writing and using reports.
       * TracQuery — Executing custom ticket queries.
       * TracBatchModify - Modifying several tickets in one request.
     * Other modules and general topics:
       * TracSearch — Full text search in all content.
       * TracTimeline — Historic perspective on a project.
       * TracRss — RSS content syndication.
       * TracAccessibility — Accessibility keys.

  == Administrator Guide

     * Installation and upgrade:
       * TracInstall — How to install and run Trac.
       * TracUpgrade — How to upgrade existing installations.
       * TracImport — Importing tickets from other bug databases.
       * TracPlugins — Installing and managing Trac extensions.
     * Configuration and customization:
       * TracIni — Trac configuration file reference. 
       * TracPermissions — Access control and permissions.
       * TracNavigation — Customize main navigation menus.
       * TracInterfaceCustomization — Customizing the Trac interface.
       * TracLogging — The Trac logging facility.
     * Administering the Version Control subsystem:
       * TracRepositoryAdmin — Management of Source Code Repositories.
     * Administering the Ticket subsystem:
       * TracTicketsCustomFields — Expanding tickets with customized fields.
       * TracNotification — Email notification.
       * TracWorkflow — Configurable Ticket Workflow.
     * Reference:
       * TracEnvironment — All you need to know about Trac environments.
       * TracAdmin — Administering a Trac project via the command-line.

  == Support and Other Sources of Information

   * [trac:TracFaq Trac FAQ] — A collection of Frequently Asked Questions on the project website.
   * [trac:TracDev] and [trac:TracDev/ApiDocs API docs] — Trac Developer documentation.
   * TracSupport — How to get more information.

  If you are looking for a good place to ask a question about Trac, see the [trac:MailingList MailingList]. It provides a friendly environment to discuss openly among Trac users and developers.


name: TracNavigation
author: trac
ipnr: 127.0.0.1
text:
  = Trac Navigation

  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.

  === `[mainnav]` #mainnav-bar
  `[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.


  ** [=#Example Example] ** 

  In the following example we rename the link to WikiStart //Home//, and make the //View Tickets// entry link to a specific report.
  {{{#!ini
  [mainnav]
  wiki.label = Home
  tickets.href = /report/24
  }}}

  === `[metanav]` #metanav-bar
  `[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.

  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.
  [[comment(see also #Trac3808)]]

  ** Example ** 

  {{{#!ini
  [metanav]
  help = disabled
  logout.redirect = wiki/Logout
  }}}


  === URL Formats
  Possible URL formats for `.href` or `.redirect`:
  || '''config''' || '''redirect to''' ||
  || `wiki/Logout` || `/projects/env/wiki/Logout` ||
  || `http://hostname/` || `http://hostname/` ||
  || `/projects` || `/projects` ||


  === Ordering #nav-order
  The `order` attribute specifies the order in which the navigation items are displayed. This can be particularly useful for plugins that add navigation items.

  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.

  The default values are:
  {{{#!ini
  [mainnav]
  browser.order = 4
  newticket.order = 6
  roadmap.order = 3
  search.order = 7
  tickets.order = 5
  timeline.order = 2
  wiki.order = 1

  [metanav]
  about.order = 5
  help.order = 4
  login.order = 1
  logout.order = 2
  prefs.order = 3
  }}}

  === Context Navigation #ctxtnav-bar

  Note that it is still not possible to customize the '''contextual navigation bar''', ie the one usually placed below the main navigation bar.

  ----
  See also: TracInterfaceCustomization, and the [http://trac-hacks.org/wiki/NavAddPlugin TracHacks:NavAddPlugin] or [http://trac-hacks.org/wiki/MenusPlugin TracHacks:MenusPlugin] (still needed for adding entries)


name: TracUnicode
author: trac
ipnr: 127.0.0.1
text:
  = Unicode Support in Trac

  [[TracGuideToc]]

  Trac encodes all text using [wikipedia:UTF-8], including text in tickets and wiki pages. Internal processing of text uses true [wikipedia:Unicode] representations. As such, it supports the most commonly used character encodings.

  If the default encoding of your source code repository is not UTF-8, you can specify it in [TracIni#trac-default_charset-option "[trac] default_charset"]:
  {{{#!ini
  default_charset = gbk
  }}}

  Ensure that your [trac:DatabaseBackend database] stores its data in UTF-8, otherwise results may be unpredictable.

  To convert your database to UTF-8, the easiest way is to create a dump of the database, convert it into UTF-8, for example using [http://www.gnu.org/software/libiconv/documentation/libiconv/iconv.1.html iconv], and then re-import it.

  == Examples

  === Arabic

  تراك يقوم بحفظ كل الكلمات باستخدام صيغة UTF-8، بما في ذلك الكلمات المستخدمة في صفحات  التيكت والويكي.

  === Bulgarian

  Българският език работи ли?

  === Česky

  Čeština v kódování UTF-8, žádný problém.

  === Chinese

  Traditional: 繁體中文, 漢字測試

  Simplified: 简体中文，汉字测试

  === Croatian

  Ako podržava srpski i slovenski mora podržavati i Hrvatski - čćžšđ ČĆŽŠĐ.

  === English

  Yes indeed, Trac supports English. Fully.

  === Français

  Il est possible d'écrire en Français : à, ç, û.

  === German

  Trac-Wiki muß auch deutsche Umlaute richtig anzeigen: ö, ä, ü, Ä, Ö, Ü; und das scharfe ß.

  === Greek

  Τα Ελληνικά υποστηρίζονται επαρκώς επίσης.

  === Hebrew

  אני יכול לאכול זכוכית וזה לא מזיק לי

  === Hindi

  अब हिन्दी में।

  === Hungarian

  Árvíztűrő tükörfúrógép.

  === Icelandic

  Ævar sagði við ömmu sína: Sjáðu hvað ég er stór!

  === Japanese

  漢字 ひらがな カタカナ ﾊﾝｶｸｶﾅ 日本語試験

  === Korean

  이번에는 한글로 써보겠습니다. 잘 보이나요? 한글.

  === Latvian

  Latviešu valoda arī strādā!

  === Lithuanian

  Sudalyvaukime ir mes. Ar veikia lietuviškos raidės? ąčęėįšųūž ĄČĘĖĮŠŲŪŽ Žinoma, kad veikia. Kas tie mes?

  === Persian (Farsi)

  این یک متن فارسی است ولی امکان نوشتن مستقیم فارسی نیست چون حالت متن از راست به چپ و جود ندارد برای فارسی نوشتن باید از HTML استفاده کنید.
  {{{
  #!html
  <div dir="rtl">
  }}}
  این نمونه یک متن از راست به چپ فارسی است که در HTML نوشته شده تا اعداد 12345 و حروف لاتین ABCDEF در محل خودشان نمایش داده شوند.
  {{{
  #!html
  </div>
  }}}

  === Polish

  Pchnąć w tę łódź jeża lub osiem skrzyń fig. Nocna gżegżółka zawsze dzienną przekuka.

  === Portuguese

  É possível guardar caracteres especias da língua portuguesa, incluindo o símbolo da moeda européia '€', trema 'ü', crase 'à', agudos 'áéíóú', circunflexos 'âêô', til 'ãõ', cedilha 'ç', ordinais 'ªº', grau '°¹²³'.

  === Russian

  Проверка русского языка: кажется работает. И буква "ё" есть.

  === Serbian

  Podržan, uprkos činjenici da se za njegovo pisanje koriste чак два алфабета.

  === Slovenian

  Ta suhi škafec pušča vodo že od nekdaj!

  === Spanish

  Esto es un pequeño texto en Español, donde el veloz murciélago hindú comía cardillo y kiwi.

  === Swedish

  Räven raskar över isen med luva på.

  === Thai

  Trac แสดงภาษาไทยได้อย่างถูกต้อง!

  === Ukrainian

  Перевірка української мови.

  === Urdu

  ٹریک اردو بھی سپورٹ کرتا ہے۔

  === Vietnamese

  Viết tiếng Việt cũng được.


name: TracTicketsCustomFields
author: trac
ipnr: 127.0.0.1
text:
  = Custom Ticket Fields
  Trac supports adding custom, user-defined fields to the ticket module. With custom fields you can add typed, site-specific properties to tickets.

  == Configuration

  Configuring custom ticket fields is done in the [wiki:TracIni trac.ini] file. All field definitions should be under a section named `[ticket-custom]`.

  The syntax of each field definition is:
  {{{
   FIELD_NAME = TYPE
   (FIELD_NAME.OPTION = VALUE)
   ...
  }}}

  The example below should help to explain the syntax.

  === Available Field Types and Options

   * '''text''': A simple (one line) text field.
     * label: Descriptive label.
     * value: Default value.
     * order: Sort order placement; this determines relative placement in forms with respect to other custom fields.
     * format: One of: 
       * `plain` for plain text 
       * `wiki` to interpret the content as WikiFormatting
       * `reference` to treat the content as a queryable value (''since 1.0'') 
       * `list` to interpret the content as a list of queryable values, separated by whitespace (''since 1.0'')
   * '''checkbox''': A boolean value check box.
     * label: Descriptive label.
     * value: Default value, 0 or 1.
     * order: Sort order placement.
   * '''select''': Drop-down select box. Uses a list of values.
     * label: Descriptive label.
     * options: List of values, separated by '''|''' (vertical pipe).
     * value: Default value (one of the values from options).
     * order: Sort order placement.
   * '''radio''': Radio buttons. Essentially the same as '''select'''.
     * label: Descriptive label.
     * options: List of values, separated by '''|''' (vertical pipe).
     * value: Default value, one of the values from options.
     * order: Sort order placement.
   * '''textarea''': Multi-line text area.
     * label: Descriptive label.
     * value: Default text.
     * cols: Width in columns. //(Removed in 1.1.2)//
     * rows: Height in lines.
     * order: Sort order placement.
     * format: Either `plain` for plain text or `wiki` to interpret the content as WikiFormatting.
   * '''time''': Date and time picker. (''Since 1.1.1.'')
     * label: Descriptive label.
     * value: Default date.
     * order: Sort order placement.
     * format: One of:
       * `relative` for relative dates.
       * `date` for absolute dates.
       * `datetime` for absolute date and time values.

  If the `label` is not specified, it will be created by capitalizing the custom field name and replacing underscores with whitespaces.

  Macros will be expanded when rendering `textarea` fields with format `wiki`, but not when rendering `text` fields with format `wiki`.

  === Sample Configuration

  {{{#!ini
  [ticket-custom]

  test_one = text
  test_one.label = Just a text box

  test_two = text
  test_two.label = Another text-box
  test_two.value = Default [mailto:joe@nospam.com owner]
  test_two.format = wiki

  test_three = checkbox
  test_three.label = Some checkbox
  test_three.value = 1

  test_four = select
  test_four.label = My selectbox
  test_four.options = one|two|third option|four
  test_four.value = two

  test_five = radio
  test_five.label = Radio buttons are fun
  test_five.options = uno|dos|tres|cuatro|cinco
  test_five.value = dos

  test_six = textarea
  test_six.label = This is a large textarea
  test_six.value = Default text
  test_six.cols = 60
  test_six.rows = 30

  test_seven = time
  test_seven.label = A relative date
  test_seven.format = relative
  test_seven.value = now

  test_eight = time
  test_eight.label = An absolute date
  test_eight.format = date
  test_eight.value = yesterday

  test_nine = time
  test_nine.label = A date and time
  test_nine.format = datetime
  test_nine.value = in 2 hours
  }}}

  '''Note''': To make a `select` type field optional, specify a leading `|` in the `fieldname.options` option.

  === Reports Involving Custom Fields

  Custom ticket fields are stored in the `ticket_custom` table, not in the `ticket` table. So to display the values from custom fields in a report, you will need a join on the 2 tables. Let's use an example with a custom ticket field called `progress`.

  {{{#!sql
  SELECT p.value AS __color__,
     id AS ticket, summary, owner, c.value AS progress
    FROM ticket t, enum p, ticket_custom c
    WHERE status IN ('assigned') AND t.id = c.ticket AND c.name = 'progress'
  AND p.name = t.priority AND p.type = 'priority'
    ORDER BY p.value
  }}}
  '''Note''': This will only show tickets that have progress set in them. This is '''not the same as showing all tickets'''. If you created this custom ticket field ''after'' you have already created some tickets, they will not have that field defined, and thus they will never show up on this ticket query. If you go back and modify those tickets, the field will be defined, and they will appear in the query.

  However, if you want to show all ticket entries (with progress defined and without), you need to use a `JOIN` for every custom field that is in the query:
  {{{#!sql
  SELECT p.value AS __color__,
     id AS ticket, summary, component, version, milestone, severity,
     (CASE status WHEN 'assigned' THEN owner||' *' ELSE owner END) AS owner,
     time AS created,
     changetime AS _changetime, description AS _description,
     reporter AS _reporter,
     (CASE WHEN c.value = '0' THEN 'None' ELSE c.value END) AS progress
    FROM ticket t
       LEFT OUTER JOIN ticket_custom c ON (t.id = c.ticket AND c.name = 'progress')
       JOIN enum p ON p.name = t.priority AND p.type='priority'
    WHERE status IN ('new', 'assigned', 'reopened')
    ORDER BY p.value, milestone, severity, time
  }}}

  Note in particular the `LEFT OUTER JOIN` statement here.

  Note that if your config file uses an '''uppercase''' name:
  {{{#!ini
  [ticket-custom]

  Progress_Type = text
  }}}
  you would use '''lowercase''' in the SQL: `AND c.name = 'progress_type'`.

  ----
  See also: TracTickets, TracIni


name: TracEnvironment
author: trac
ipnr: 127.0.0.1
text:
  = The Trac Environment

  [[TracGuideToc]]
  [[PageOutline(2-5,Contents,pullout)]]

  Trac uses a directory structure and a database for storing project data. The directory is referred to as the '''environment'''.

  Trac supports [http://sqlite.org/ SQLite], [http://www.postgresql.org/ PostgreSQL] and [http://mysql.com/ MySQL] databases. With PostgreSQL and MySQL you have to create the database before running `trac-admin initenv`.

  == Creating an Environment

  A new Trac environment is created using the [TracAdmin#initenv initenv] command:
  {{{#!sh
  $ trac-admin /path/to/myproject initenv
  }}}

  `trac-admin` will ask you for the name of the project and the [#DatabaseConnectionStrings database connection string].

  === Useful Tips

   - 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.

   - 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. 
   
   - `initenv` does not create a version control repository for the specified path. If you wish to specify a default repository using the optional arguments to `initenv` you must create the repository first, otherwise you will see a message when initializing the environment: //Warning: couldn't index the default repository//.

   - Non-ascii environment paths are not supported.

   - TracPlugins located in a [TracIni#inherit-plugins_dir-option shared plugins directory] that is defined in an [TracIni#GlobalConfiguration inherited configuration] are not enabled by default, in contrast to plugins in the environment `plugins` directory. Hence, if they need to create extra tables, for example, the tables will not be created during environment creation and you'll need to [TracUpgrade#UpgradetheTracEnvironment upgrade the environment]. Alternatively you can avoid the need to upgrade the environment by explicitly enabling the plugin in the inherited configuration, or in a configuration file using the `--config` option. See TracAdmin#FullCommandReference for more information.

  {{{#!div style="border: 1pt dotted; margin: 1em;"
  **Caveat:** don't confuse the //Trac environment directory// with the //source code repository directory//.

  This is a common beginners' mistake.
  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.
  }}}

  == Database Connection Strings

  You will need to specify a database connection string at the time the environment is created. The default is SQLite, which is sufficient for most projects. The SQLite database file is stored in the environment directory, and can easily be [wiki:TracBackup backed up] together with the rest of the environment.

  Note that if the username or password of the connection string (if applicable) contains the `:`, `/` or `@` characters, they need to be [http://meyerweb.com/eric/tools/dencoder/ URL encoded].
  {{{#!sh
  $ python -c "import urllib; print urllib.quote('password@:/123', '')"
  password%40%3A%2F123
  }}}

  === SQLite Connection String

  The connection string for an SQLite database is:
  {{{
  sqlite:db/trac.db
  }}}
  where `db/trac.db` is the path to the database file within the Trac environment.

  === PostgreSQL Connection String

  The connection string for PostgreSQL is a bit more complex. For example, to connect to a PostgreSQL database named `trac` on `localhost` for user `johndoe` and password `letmein`, use:
  {{{
  postgres://johndoe:letmein@localhost/trac
  }}}

  If PostgreSQL is running on a non-standard port, for example 9342, use:
  {{{
  postgres://johndoe:letmein@localhost:9342/trac
  }}}

  On UNIX, you might want to select a UNIX socket for the transport, either the default socket as defined by the PGHOST environment variable:
  {{{
  postgres://user:password@/database
  }}}

  or a specific one:
  {{{
  postgres://user:password@/database?host=/path/to/socket/dir
  }}}

  See the [http://www.postgresql.org/docs/ PostgreSQL documentation] for detailed instructions on how to administer [http://postgresql.org PostgreSQL].
  Generally, the following is sufficient to create a database user named `tracuser` and a database named `trac`:
  {{{#!sh
  $ createuser -U postgres -E -P tracuser
  $ createdb -U postgres -O tracuser -E UTF8 trac
  }}}

  When running `createuser` you will be prompted for the password for the `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.

  Under some default configurations (Debian), run the `createuser` and `createdb` scripts as the `postgres` user:
  {{{#!sh
  $ sudo su - postgres -c 'createuser -U postgres -S -D -R -E -P tracuser'
  $ sudo su - postgres -c 'createdb -U postgres -O tracuser -E UTF8 trac'
  }}}

  Trac uses the `public` schema by default, but you can specify a different schema in the connection string:
  {{{
  postgres://user:pass@server/database?schema=yourschemaname
  }}}

  === MySQL Connection String

  The format of the MySQL connection string is similar to PostgreSQL, with the `postgres` scheme being replaced by `mysql`. For example, to connect to a MySQL database on `localhost` named `trac` for user `johndoe` with password `letmein`:
  {{{
  mysql://johndoe:letmein@localhost:3306/trac
  }}}

  == Source Code Repository

  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'' navigation item will not be displayed.

  There are several 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.

  == Directory Structure

  An environment consists of the following files and directories:

   * `README` - Brief description of the environment.
   * `VERSION` - Environment version identifier.
   * `files`
    * `attachments` - Attachments to wiki pages and tickets.
   * `conf`
    * `trac.ini` - Main [TracIni configuration file].
   * `db`
    * `trac.db` - The SQLite database, if you are using SQLite.
   * `htdocs` - Directory containing web resources, which can be referenced in templates using the path `/chrome/site/...`.
   * `log` - Default directory for log files when `file` logging is enabled and a relative path is given.
   * `plugins` - Environment-specific [wiki:TracPlugins plugins].
   * `templates` - Custom Genshi environment-specific templates.
    * `site.html` - Method to [TracInterfaceCustomization#SiteAppearance customize] the site header, footer, and style.

  ----
  See also: TracAdmin, TracBackup, TracIni


name: TracChangeset
author: trac
ipnr: 127.0.0.1
text:
  = Trac Changeset Module

  [[TracGuideToc]]
  [[PageOutline(2-5,Contents,pullout)]]

  Trac has a built-in functionality for visualizing "diffs", or changes to files.

  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.

  The changeset view consists of two parts, the ''header'' and the ''diff views''.

  == Changeset Header

  The header shows an overview of the whole changeset.
  Here you will find metadata:

   * Timestamp — When the changeset was commited
   * Author — Who commited the changeset
   * Message — A brief description from the author (the commit log message)
   * Location — Parent directory of all files affected by this changeset
   * Files — A list of files affected by this changeset

  If more than one revision is involved in the set of changes being displayed, the ''Timestamp'', ''Author'' and ''Message'' fields will not be shown.

  A colored rectangle indicates how the file is affected by the changeset:
   
   [[span(style=background:#bfb;border:1px solid #999;font-size:80%;margin-right:.5em,''  '')]] Green: Added \\
   [[span(style=background:#f88;border:1px solid #999;font-size:80%;margin-right:.5em,''  '')]] Red: Removed \\
   [[span(style=background:#fd8;border:1px solid #999;font-size:80%;margin-right:.5em,''  '')]] Yellow: Modified \\
   [[span(style=background:#88f;border:1px solid #999;font-size:80%;margin-right:.5em,''  '')]] Blue: Copied \\
   [[span(style=background:#ccc;border:1px solid #999;font-size:80%;margin-right:.5em,''  '')]] Gray: Moved \\

  The color legend is located below the header.

  == Diff Views

  Below the header is the main part of the changeset, the diff view. Each file is shown in a separate section. There are two different diff styles: ''inline'' and ''side-by-side''. You can switch between the styles using the preferences form:

   * 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.
   * 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.

  In addition, various advanced options are available in the preferences form for adjusting the display of the diffs:
   * You can set how many lines are displayed before and after every change, or display the changes in the context of the full file.
   * You can toggle whether blank lines, case changes and white space changes are ignored. This can be useful in more easily locating the functional changes.
   * You can toggle between contextual and unified diff views using the //Tabular// and //Unified// links at the top of each section.

  == The Different Ways to Get a Diff

  === Examining a Changeset

  When viewing a repository check-in, such as when following a changeset [TracLinks link] or a changeset event in the [TracTimeline timeline], Trac will display the exact changes made by the check-in.

  There will also be navigation links to the ''Previous Changeset'' and the ''Next Changeset''.

  === Downloading a Changeset

  From the changeset view, the changeset can be downloaded in unified diff format using the links at the bottom of the page. The full content of each file in the changeset can also be downloaded as a zip archive.

  === Examining Differences Between Revisions

  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.

  === Examining Differences Between Branches

  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.

  Following the '''View changes ...''' button in the TracBrowser leads to the diff page, where you can 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.

  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.

  === Checking the Last Change

  Another way to examine changes is to use the ''Last Change'' link provided by the TracBrowser.

  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.

  ----
  See also: TracGuide, TracBrowser


name: WikiPageNames
author: trac
ipnr: 127.0.0.1
text:
  = Wiki Page Names
  [[TracGuideToc]]

  Wiki page names commonly use the CamelCase convention. Within wiki text, any word in CamelCase automatically becomes a hyperlink to the wiki page with that name.

  CamelCase page names follow these rules:

   1. The name must consist of '''alphabetic characters only'''; no digits, spaces, punctuation or underscores are allowed.
   1. A name must have at least two capital letters.
   1. The first character must be capitalized.
   1. Every capital letter must be followed by one or more lower-case letters. 
   1. The use of slash ( / ) is permitted in page names, where it typically represents a hierarchy.

  If you want to create a wiki page that does not follow CamelCase rules. you can use the following syntax:
  {{{
   * [wiki:Wiki_page], [wiki:ISO9000],
     and with a label: [wiki:ISO9000 ISO 9000 standard]
   * [wiki:"Space Matters"]
     and with a label: [wiki:"Space Matters" all about white space]
   * or simply: ["WikiPageName"]s
   * even better, the [[WikiCreole link style]]
     and with a label: [[WikiCreole link style|WikiCreole style links]]
  }}}

  This will be rendered as:
   * [wiki:Wiki_page], [wiki:ISO9000],
     and with a label: [wiki:ISO9000 ISO 9000 standard]
   * [wiki:"Space Matters"] ''(that page name embeds space characters)''
     and with a label: [wiki:"Space Matters" all about white space]
   * or simply: ["WikiPageName"]s
   * even better, the [[WikiCreole link style]]
     and with a label: [[WikiCreole link style|WikiCreole style links]]

  It is possible to link to a specific ''version'' of a Wiki page as you would do for a specific version of a file, for example: WikiStart@1.

  You can prevent a !CamelCase name from being interpreted as a [TracLinks link] by quoting it with an exclamation mark: `!CamelCase`. See TracLinks#EscapingLinks.

  As in the example above, you can append an anchor to a Wiki page name to link to a specific section within that page. The anchor can be seen by hovering the mouse over a section heading, then clicking on the [[html(&para;)]] sign that appears at its end. The anchor is usually generated automatically, but it is also possible to specify it explicitly: see WikiFormatting#using-explicit-id-in-heading.

  There are a few options that govern the rendering of WikiPageNames:
  * CamelCase linking to missing pages can be disabled with the `ignore_missing_pages` [https://trac.edgewall.org/wiki/TracIni#wiki-section option]. Linking to missing pages is enabled by default.
  * The `split_page_names` option, when enabled, will split CamelCase words when rendering a link. For example, WikiStart will be rendered as [WikiStart Wiki Start].

  ----
  See also: WikiNewPage, WikiFormatting, TracWiki, TracLinks


name: TracRepositoryAdmin
author: trac
ipnr: 127.0.0.1
text:
  = Repository Administration
  [[PageOutline(2-3)]]

  == Quick start #QuickStart

   * Enable the repository connector(s) for the version control system(s) that you will use.
   * Add repositories through the //Repositories// admin panel, with `trac-admin` or in the `[repositories]` section of [wiki:TracIni#repositories-section trac.ini].
   * 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.
   * 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.

  == Enabling the components

  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.

  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.

  {{{#!ini
  tracopt.versioncontrol.svn.* = enabled
  }}}

  {{{#!ini
  tracopt.versioncontrol.git.* = enabled
  }}}

  == Specifying repositories #Repositories
  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.

  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.

  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:

  ||='''Attribute''' =||='''Description''' =||
  ||`alias` ||\
  ||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. ||
  ||`description` ||\
  ||The text specified in the `description` attribute is displayed below the top-level entry for the repository in the source browser. It supports WikiFormatting. ||
  ||`dir` ||\
  ||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. ||
  ||`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. ||
  ||`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`.||
  ||`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. ||
  ||`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. ||

  A repository `name` and one of `alias` or `dir` attributes are mandatory. All others are optional.

  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.

  After adding a repository, the cache for that repository must be re-synchronized once with the `trac-admin $ENV repository resync` command.

   `repository resync <repos>`::
     Re-synchronize Trac with a repository.


  === In `trac.ini` #ReposTracIni
  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.

  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.

  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.
  {{{#!ini
  [repositories]
  project.dir = /var/repos/project
  project.description = This is the ''main'' project repository.
  project.type = svn
  project.url = http://example.com/svn/project
  project.hidden = true

  lib.dir = /var/repos/lib
  lib.description = This is the secondary library code.
  lib.type = svn
  lib.url = http://example.com/svn/lib

  .alias = project
  }}}
  Note that `name.alias = target` makes `name` an alias for the `target` repo, not the other way around.

  === In the database #ReposDatabase
  Repositories can also be specified in the database, using either the "Repositories" admin panel under "Version Control", or the `trac-admin $ENV repository` commands.

  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.

  The following [wiki:TracAdmin trac-admin] commands can be used to perform repository operations from the command line.

   `repository add <repos> <dir> [type]`::
     Add a repository `<repos>` located at `<dir>`, and optionally specify its type.

   `repository alias <name> <target>`::
     Create an alias `<name>` for the repository `<target>`.

   `repository remove <repos>`::
     Remove the repository `<repos>`.

   `repository set <repos> <key> <value>`::
     Set the attribute `<key>` to `<value>` for the repository `<repos>`. 

  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.

  == Repository caching

  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.

  Subversion repositories are cached unless the type is `direct-svnfs`. Git repositories are cached when `[git]` [wiki:TracIni#git-section cached_repository] is `true`.

  == Repository synchronization #Synchronization
  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. 

  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.

  === Mercurial Repositories
  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. 

  === Explicit synchronization #ExplicitSync
  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.

   `changeset added <repos> <rev> [...]`::
     Notify Trac that one or more changesets have been added to a repository.

   `changeset modified <repos> <rev> [...]`::
     Notify Trac that metadata on one or more changesets in a repository has been modified.

  The `<repos>` argument can be either a repository name (use "`(default)`" for the default repository) or the path to the repository.

  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.

  ==== Subversion

  ===== Using `trac-svn-hook`

  In a Unix environment, the simplest way to configure explicit synchronization is by using the [trac:source:trunk/contrib/trac-svn-hook contrib/trac-svn-hook] script. `trac-svn-hook` starts `trac-admin` asynchronously to avoid slowing the commit and log editing operations. The script comes with a number of safety checks and usage advice. Output is written to a log file with prefix `svn-hooks-` in the environment `log` directory, which can make configuration issues easier to debug.

  There's no equivalent `trac-svn-hook.bat` for Windows yet, but the script can be run by Cygwin's bash.

  Follow the help in the documentation header of the script to configure `trac-svn-hook`. Configuring the hook environment variables is made easier in Subversion 1.8 by using the [http://svnbook.red-bean.com/en/1.8/svn.reposadmin.create.html#svn.reposadmin.hooks.configuration hook script environment] configuration. Rather than directly editing `trac-svn-hook` to set the environment variables, they can be configured through the repository `conf/hooks-env` file. Replace the [trac:source:trunk/contrib/trac-svn-hook@:65-67#L61 configuration section] with:
  {{{#!bash
  export PATH=$PYTHON_BIN:$PATH
  export LD_LIBRARY_PATH=$PYTHON_LIB:$LD_LIBRARY_PATH
  }}}
  and set the variables `TRAC_ENV`, `PYTHON_BIN` and `PYTHON_LIB` in the `hooks-env` file. Here is an example, using a Python virtual environment at `/usr/local/venv`:
  {{{#!ini
  [default]
  TRAC_ENV=/var/trac/project-1
  PYTHON_BIN=/usr/local/venv/bin
  PYTHON_LIB=/usr/local/venv/lib
  }}}

  ===== Writing Your Own Hook Script

  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`):
  {{{#!sh
  #!/bin/sh
  export PYTHON_EGG_CACHE="/path/to/dir"
  /usr/bin/trac-admin /path/to/env changeset added "$1" "$2"
  }}}
  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.
  On Windows (`post-commit.cmd`):
  {{{#!bat
  @C:\Python26\Scripts\trac-admin.exe C:\path\to\env changeset added "%1" "%2"
  }}}

  The post-revprop-change hook for Subversion is very similar. On Unix (`post-revprop-change`):
  {{{#!sh
  #!/bin/sh
  export PYTHON_EGG_CACHE="/path/to/dir"
  /usr/bin/trac-admin /path/to/env changeset modified "$1" "$2"
  }}}
  On Windows (`post-revprop-change.cmd`):
  {{{#!bat
  @C:\Python26\Scripts\trac-admin.exe C:\path\to\env changeset modified "%1" "%2"
  }}}

  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`.

  See the [http://svnbook.red-bean.com/en/1.7/svn.reposadmin.create.html#svn.reposadmin.create.hooks section about hooks] in the Subversion book for more information. Other repository types will require different hook setups.

  ==== Git

  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):
  {{{#!sh
  #!/bin/sh 
  REV=$(git rev-parse HEAD) 
  trac-admin /path/to/env changeset added <repos> $REV 
  }}}

  Alternately, if your repository is one that only gets pushed to, add the following to the `hooks/post-receive` file in the repo:
  {{{#!sh
  #!/bin/sh
  tracenv=/path/to/env     # change with your Trac environment's path
  repos=                   # change with your repository's name
  while read oldrev newrev refname; do
      if [ "$oldrev" = 0000000000000000000000000000000000000000 ]; then
          git rev-list --reverse "$newrev" --
      else
          git rev-list --reverse "$newrev" "^$oldrev" --
      fi | xargs trac-admin "$tracenv" changeset added "$repos"
  done
  }}}

  The `<repos>` argument can be either a repository name (use "`(default)`" for the default repository) or the path to the repository.

  ==== Mercurial

  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/hooks.py hooks.py] and place it somewhere accessible):
  {{{#!ini
  [hooks]
  ; If mercurial-plugin is installed globally
  commit = python:tracext.hg.hooks.add_changesets
  changegroup = python:tracext.hg.hooks.add_changesets

  ; If mercurial-plugin is installed in a Trac plugins directory
  commit = python:/path/to/hooks.py:add_changesets
  changegroup = python:/path/to/hooks.py:add_changesets

  [trac]
  env = /path/to/env
  trac-admin = /path/to/trac-admin
  }}}

  === Per-request synchronization #PerRequestSync
  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`.

  Note that in this case, the changeset listener extension point is not called, and therefore plugins using it will not work correctly.

  == Automatic changeset references in tickets

  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:
   * '''`Refs #123`''' - to reference this changeset in `#123` ticket
   * '''`Fixes #123`''' - to reference this changeset and close `#123` ticket with the default status ''fixed''

  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.
  {{{#!ini
  tracopt.ticket.commit_updater.* = enabled
  }}}
  For more information, see the documentation of the `CommitTicketUpdater` component in the //Plugins// admin panel and the [trac:CommitTicketUpdater] page.

  == Troubleshooting

  === My trac-post-commit-hook doesn't work anymore #trac-post-commit-hook

  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.

  See [trac:CommitTicketUpdater#Troubleshooting] for more troubleshooting tips.


name: WikiMacros
author: trac
ipnr: 127.0.0.1
text:
  = Trac Macros

  [[PageOutline(2-5,Contents,pullout)]]

  '''Trac macros''' extend the Trac engine with custom functionality. Macros are a special type of plugin and are written in Python. A macro inserts dynamic HTML data in any context supporting WikiFormatting.

  The macro syntax is `[[macro-name(optional-arguments)]]`.

  '''WikiProcessors''' are another kind of macros. They are typically used for source code highlighting, such as `!#python` or `!#apache` and when the source code spans multiple lines, such as:

  {{{
  {{{#!wiki-processor-name
  ... 
  }}}
  }}}

  == Using Macros

  Macro calls are enclosed in double-square brackets `[[..]]`. Like Python functions, macros can have arguments, which is then a comma separated list within parentheses `[[..(,)]]`.

  === Getting Detailed Help

  The list of available macros and the full help can be obtained using the !MacroList macro, as seen [#AvailableMacros below].

  A brief list can be obtained via `[[MacroList(*)]]` or `[[?]]`.

  Detailed help on a specific macro can be obtained by passing it as an argument to !MacroList, e.g. `[[MacroList(MacroList)]]`, or, more conveniently, by appending a question mark (`?`) to the macro's name, like in `[[MacroList?]]`.

  === Example

  A list of the 3 most recently changed wiki pages starting with 'Trac':

  ||= Wiki Markup =||= Display =||
  {{{#!td
    {{{
    [[RecentChanges(Trac,3)]]
    }}}
  }}}
  {{{#!td style="padding-left: 2em;"
  [[RecentChanges(Trac,3)]]
  }}}
  |-----------------------------------
  {{{#!td
    {{{
    [[RecentChanges?(Trac,3)]]
    }}}
  }}}
  {{{#!td style="padding-left: 2em;"
  [[RecentChanges?(Trac,3)]]
  }}}
  |-----------------------------------
  {{{#!td
    {{{
    [[?]]
    }}}
  }}}
  {{{#!td style="padding-left: 2em"
  {{{#!html 
  <div class="trac-macrolist">
  <h3><code>[[Image]]</code></h3>Embed an image in wiki-formatted text.

  The first argument is the file, as in <code>[[Image(filename.png)]]</code>
  <h3><code>[[InterTrac]]</code></h3>Provide a list of known <a class="wiki" href="/wiki/InterTrac">InterTrac</a> prefixes.
  <h3><code>[[InterWiki]]</code></h3>Provide a description list for the known <a class="wiki" href="/wiki/InterWiki">InterWiki</a> prefixes.
  <h3><code>[[KnownMimeTypes]]</code></h3>List all known mime-types which can be used as <a class="wiki" href="/wiki/WikiProcessors">WikiProcessors</a>.
  </div>
  }}}
  etc.
  }}}

  == Available Macros

  ''Note that the following list will only contain the macro documentation if you've not enabled `-OO` optimizations, or not set the `PythonOptimize` option for [wiki:TracModPython mod_python].''

  [[MacroList]]

  == Macros from around the world

  The [http://trac-hacks.org/ Trac Hacks] site provides a wide collection of macros and other Trac [TracPlugins plugins] contributed by the Trac community. If you are looking for new macros, or have written one that you would like to share, please visit that site.

  == Developing Custom Macros

  Macros, like Trac itself, are written in the [http://python.org/ Python programming language] and are developed as part of TracPlugins.

  For more information about developing macros, see the [trac:TracDev development resources] on the main project site.

  Here are 2 simple examples showing how to create a Macro. Also, have a look at [trac:source:tags/trac-1.0.2/sample-plugins/Timestamp.py Timestamp.py] for an example that shows the difference between old style and new style macros and at the [trac:source:tags/trac-0.11/wiki-macros/README macros/README] which provides more insight about the transition.

  === Macro without arguments

  To test the following code, save it in a `timestamp_sample.py` file located in the TracEnvironment's `plugins/` directory.

  {{{#!python
  from datetime import datetime
  # Note: since Trac 0.11, datetime objects are used internally

  from trac.util.datefmt import format_datetime, utc
  from trac.util.html import tag
  from trac.wiki.macros import WikiMacroBase

  class TimeStampMacro(WikiMacroBase):
      """Inserts the current time (in seconds) into the wiki page."""

      revision = "$Rev$"
      url = "$URL$"

      def expand_macro(self, formatter, name, text):
          t = datetime.now(utc)
          return tag.strong(format_datetime(t, '%c'))
  }}}

  === Macro with arguments

  To test the following code, save it in a `helloworld_sample.py` file located in the TracEnvironment's `plugins/` directory.

  {{{#!python
  from trac.util.html import Markup
  from trac.wiki.macros import WikiMacroBase

  class HelloWorldMacro(WikiMacroBase):
      """Simple HelloWorld macro.

      Note that the name of the class is meaningful:
       - it must end with "Macro"
       - what comes before "Macro" ends up being the macro name

      The documentation of the class (i.e. what you're reading)
      will become the documentation of the macro, as shown by
      the !MacroList macro (usually used in the WikiMacros page).
      """

      revision = "$Rev$"
      url = "$URL$"

      def expand_macro(self, formatter, name, text, args):
          """Return some output that will be displayed in the Wiki content.

          `name` is the actual name of the macro (no surprise, here it'll be
          `'HelloWorld'`),
          `text` is the text enclosed in parenthesis at the call of the macro.
            Note that if there are ''no'' parenthesis (like in, e.g.
            [[HelloWorld]]), then `text` is `None`.
          `args` are the arguments passed when HelloWorld is called using a
          `#!HelloWorld` code block.
          """
          return 'Hello World, text = %s, args = %s' % \
              (Markup.escape(text), Markup.escape(repr(args)))

  }}}

  Note that `expand_macro` optionally takes a 4^th^ parameter ''`args`''. When the macro is called as a [WikiProcessors WikiProcessor], it is also possible to pass `key=value` [WikiProcessors#UsingProcessors processor parameters]. If given, those are stored in a dictionary and passed in this extra `args` parameter. In the other case, when called as a macro, `args` is `None`. (''since 0.12'').

  For example, when writing:
  {{{
  {{{#!HelloWorld style="polite" -silent verbose
  <Hello World!>
  }}}

  {{{#!HelloWorld
  <Hello World!>
  }}}

  [[HelloWorld(<Hello World!>)]]
  }}}

  One should get:
  {{{
  Hello World, text = <Hello World!>, args = {'style': u'polite', 'silent': False, 'verbose': True}
  Hello World, text = <Hello World!>, args = {}
  Hello World, text = <Hello World!>, args = None
  }}}

  Note that the return value of `expand_macro` is '''not''' HTML escaped. Depending on the expected result, you should escape it yourself (using `return Markup.escape(result)`) or, if this is indeed HTML, wrap it in a Markup object: `return Markup(result)` (`from trac.util.html import Markup`).

  You can also recursively use a wiki Formatter (`from trac.wiki import Formatter`) to process the `text` as wiki markup:

  {{{#!python
  from trac.util.html import Markup
  from trac.wiki.macros import WikiMacroBase
  from trac.wiki import Formatter
  import StringIO

  class HelloWorldMacro(WikiMacroBase):
      def expand_macro(self, formatter, name, text, args):
          text = "whatever '''wiki''' markup you want, even containing other macros"
          # Convert Wiki markup to HTML, new style
          out = StringIO.StringIO()
          Formatter(self.env, formatter.context).format(text, out)
          return Markup(out.getvalue())
  }}}


name: TracModPython
author: trac
ipnr: 127.0.0.1
text:
  [[TracGuideToc]]

  = Trac and mod_python

  Mod_python is an [https://httpd.apache.org/ 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.
  Trac supports [http://www.modpython.org/ 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.

  [[PageOutline(2-3,Overview,inline)]]

  == Simple configuration: single project #Simpleconfiguration

  If you just installed mod_python, you may have to add a line to load the module in the Apache configuration:
  {{{#!apache
  LoadModule python_module modules/mod_python.so
  }}}

  '''Note''': The exact path to the module depends on how the HTTPD installation is laid out.

  On Debian using apt-get:
  {{{#!sh
  apt-get install libapache2-mod-python libapache2-mod-python-doc
  }}}

  Still on Debian, after you have installed mod_python, you must enable the modules in apache2, equivalent to the above Load Module directive:
  {{{#!sh
  a2enmod python
  }}}

  On Fedora use, using yum:
  {{{#!sh
  yum install mod_python
  }}}

  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+.
  {{{#!apache
  <Location /mpinfo>
    SetHandler mod_python
    PythonInterpreter main_interpreter
    PythonHandler mod_python.testhandler
    # For Apache 2.2
    <IfModule !mod_authz_core.c>
      Order allow,deny
      Allow from all
    </IfModule>
    # For Apache 2.4
    <IfModule mod_authz_core.c>
      Require all granted
    </IfModule>
  </Location>
  }}}

  A simple setup of Trac on mod_python looks like this:
  {{{#!apache
  <Location /projects/myproject>
    SetHandler mod_python
    PythonInterpreter main_interpreter
    PythonHandler trac.web.modpython_frontend 
    PythonOption TracEnv /var/trac/myproject
    PythonOption TracUriRoot /projects/myproject
    # For Apache 2.2
    <IfModule !mod_authz_core.c>
      Order allow,deny
      Allow from all
    </IfModule>
    # For Apache 2.4
    <IfModule mod_authz_core.c>
      Require all granted
    </IfModule>
  </Location>
  }}}

  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.

  The options available are:
  {{{#!apache
  # For a single project
  PythonOption TracEnv /var/trac/myproject

  # For multiple projects
  PythonOption TracEnvParentDir /var/trac/myprojects

  # For the index of multiple projects
  PythonOption TracEnvIndexTemplate /srv/www/htdocs/trac/project_list_template.html

  # A space delimitted list, with a "," between key and value pairs.
  PythonOption TracTemplateVars key1,val1 key2,val2

  # Useful to get the date in the wanted order
  PythonOption TracLocale en_GB.UTF8

  # See description above        
  PythonOption TracUriRoot /projects/myproject
  }}}

  === Python Egg Cache

  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:
  {{{#!apache
  PythonOption PYTHON_EGG_CACHE /var/trac/myprojects/egg-cache
  }}}

  Or you can uncompress the Genshi egg to resolve problems extracting from it.

  === Configuring Authentication

  See corresponding section in the [wiki:TracModWSGI#ConfiguringAuthentication] page.

  == Advanced Configuration

  === Setting the Python Egg Cache

  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. 

  {{{#!apache
  <Location /projects/myproject>
    ...
    PythonOption PYTHON_EGG_CACHE /tmp 
    ...
  </Location>
  }}}

  === Setting the !PythonPath

  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:
  {{{#!apache
  <Location /projects/myproject>
    ...
    PythonPath "sys.path + ['/path/to/trac']"
    ...
  </Location>
  }}}

  Be careful about using the !PythonPath directive, and ''not'' `SetEnv PYTHONPATH`, as the latter won't work.

  === Setting up multiple projects

  The Trac mod_python handler supports a configuration option similar to Subversion's `SvnParentPath`, called `TracEnvParentDir`:
  {{{#!apache
  <Location /projects>
    SetHandler mod_python
    PythonInterpreter main_interpreter
    PythonHandler trac.web.modpython_frontend 
    PythonOption TracEnvParentDir /var/trac
    PythonOption TracUriRoot /projects
  </Location>
  }}}

  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.

  If you don't want to have the subdirectory listing as your projects home page you can use a
  {{{#!apache
  <LocationMatch "/.+/">
  }}}

  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.

  You can also use the same authentication realm for all of the projects using a `<LocationMatch>` directive:
  {{{#!apache
  <LocationMatch "/projects/[^/]+/login">
    AuthType Basic
    AuthName "Trac"
    AuthUserFile /var/trac/.htpasswd
    Require valid-user
  </LocationMatch>
  }}}

  === Virtual Host Configuration

  Below is the sample configuration required to set up your Trac as a virtual server, ie when you access it at the URLs like
  `http://trac.mycompany.com`:

  {{{#!apache
  <VirtualHost *>
      DocumentRoot /var/www/myproject
      ServerName trac.mycompany.com
      <Location />
          SetHandler mod_python
          PythonInterpreter main_interpreter
          PythonHandler trac.web.modpython_frontend
          PythonOption TracEnv /var/trac/myproject
          PythonOption TracUriRoot /
      </Location>
      <Location /login>
          AuthType Basic
          AuthName "MyCompany Trac Server"
          AuthUserFile /var/trac/myproject/.htpasswd
          Require valid-user
      </Location>
  </VirtualHost>
  }}}

  This does not seem to work in all cases. What you can do if it does not:
   * Try using `<LocationMatch>` instead of `<Location>`.
   * `<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.
   * Depending on apache's `NameVirtualHost` configuration, you may need to use `<VirtualHost *:80>` instead of `<VirtualHost *>`.

  For a virtual host that supports multiple projects replace `TracEnv /var/trac/myproject` with `TracEnvParentDir /var/trac`.

  '''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".

  == Troubleshooting

  If you get server error pages, you can either check the Apache error log, or enable the `PythonDebug` option:
  {{{#!apache
  <Location /projects/myproject>
    ...
    PythonDebug on
  </Location>
  }}}

  For multiple projects, try restarting the server as well.

  === Login Not Working

  If you've used `<Location />` directive, it will override any other directives, as well as `<Location /login>`.
  The workaround is to use negation expression as follows (for multi project setups):
  {{{#!apache
  #this one for other pages
  <Location ~ "/*(?!login)">
     SetHandler mod_python
     PythonHandler trac.web.modpython_frontend
     PythonOption TracEnvParentDir /projects
     PythonOption TracUriRoot /
  </Location>

  #this one for login page
  <Location ~ "/[^/]+/login">
     SetHandler mod_python
     PythonHandler trac.web.modpython_frontend
     PythonOption TracEnvParentDir /projects
     PythonOption TracUriRoot /

     #remove these if you don't want to force SSL
     RewriteEngine On 
     RewriteCond %{HTTPS} off
     RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

     AuthType Basic
     AuthName "Trac"
     AuthUserFile /projects/.htpasswd
     Require valid-user
  </Location>
  }}}

  === Expat-related segmentation faults === #expat

  This problem will most certainly hit you on Unix when using Python 2.4.
  In Python 2.4, some version of [http://expat.sourceforge.net/ Expat] (an XML parser library written in C) is used and if Apache is using another version, this results in segmentation faults.
  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.

  === Form submission problems

  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.

  === Problem with virtual host configuration

  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.

  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.

  === Problem with zipped egg

  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:

  {{{#!sh
  easy_install --always-unzip Trac-0.12b1.zip
  }}}

  === Using .htaccess

  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.

  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.

  This also works out-of-box, with following trivial config:
  {{{#!apache
  SetHandler mod_python
  PythonInterpreter main_interpreter
  PythonHandler trac.web.modpython_frontend 
  PythonOption TracEnv /system/path/to/this/directory
  PythonOption TracUriRoot /path/on/apache

  AuthType Basic
  AuthName "ProjectName"
  AuthUserFile /path/to/.htpasswd
  Require valid-user
  }}}

  The `TracUriRoot` is obviously the path you need to enter to the browser to get to Trac, eg `domain.tld/projects/trac`.

  === Additional .htaccess help

  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:

  {{{#!apache
  <IfModule mod_rewrite.c>
    RewriteEngine Off
  </IfModule>
  }}}

  === Platform specific issues
  ==== Win32 Issues

  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.

  ==== OS X issues

  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.

  ==== SELinux issues

  If Trac reports something like: `Cannot get shared lock on db.lock`, then the security context on the repository may need to be set:

  {{{#!sh
  chcon -R -h -t httpd_sys_content_t PATH_TO_REPOSITORY
  }}}

  See also [http://subversion.apache.org/faq.html#reposperms How do I set repository permissions correctly?]

  ==== FreeBSD issues

  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:
   * pysqlite requires threaded support in Python
   * mod_python requires a threadless install.

  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.
  The best option [http://modpython.org/pipermail/mod_python/2006-September/021983.html seems to be] adding to /usr/local/apache2/bin/ennvars the line:

  {{{#!sh
  export LD_PRELOAD=/usr/lib/libc_r.so
  }}}

  ==== Fedora 7 Issues

  Make sure you install the 'python-sqlite2' package as it seems to be required for TracModPython, but not for tracd.

  === Subversion issues

  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.

  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`).

  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:
  {{{#!apache
  PythonInterpreter main_interpreter
  }}}

  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.

  === Page layout issues

  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:
  {{{#!apache
  Alias /myproject/css "/usr/share/trac/htdocs/css"
  <Location /myproject/css>
      SetHandler None
  </Location>
  }}}

  '''Note''': For the above configuration to have any effect it must be put after the configuration of your project root location, ie {{{<Location /myproject />}}}.

  **Note:** Do not enable python optimizations using the directive `PythonOptimize On`. When optimizations are enabled the page header/footer and documentation for macros and plugins will be hidden. An error will be raised in Trac 1.0.11 and later when optimizations are enabled.

  === HTTPS issues

  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:
  {{{#!apache
  <VirtualHost *>
      DocumentRoot /var/www/myproject
      ServerName trac.mycompany.com
      SetEnv HTTPS 1
      ....
  </VirtualHost>
  }}}

  === Segmentation fault with php5-mhash or other php5 modules

  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 [http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=411487 Debian bug report].

  Some people also have troubles when using PHP5 compiled with its own third party libraries instead of system libraries. Check [http://www.djangoproject.com/documentation/modpython/#if-you-get-a-segmentation-fault Django segmentation fault].

  ----
  See also: TracGuide, TracInstall, [wiki:TracModWSGI ModWSGI], [wiki:TracFastCgi FastCGI], [trac:TracNginxRecipe]


