# wiki

name: TracWiki
author: trac
ipnr: 127.0.0.1
text:
  = The Trac Wiki Engine =
  [[TracGuideToc]]

  Trac has a built-in wiki engine, used for text and documentation throughout the system. WikiFormatting is used in [wiki:TitleIndex wiki pages], [wiki:TracTickets tickets], [wiki:TracChangeset check-in log messages], [wiki:TracRoadmap milestone] and [wiki:TracReports report] descriptions.  It allows for formatted text and hyperlinks in and between all Trac modules.

  Editing wiki text is easy, using any web browser and a simple [WikiFormatting formatting system], rather than more complex markup languages like HTML.  The reasoning behind its design 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 though that Trac also supports [WikiHtml HTML], [WikiRestructuredText reStructuredText] and [http://www.textism.com/tools/textile/ Textile] as alternative markup formats.

  The main goal of the wiki is to make editing text easier and ''encourage'' people to contribute and annotate text content for 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 an hypertext, 
  general advice regarding HTML authoring apply here as well.
  For example, the ''[http://www.w3.org/Provider/Style Style Guide for online hypertext]'' explains how to think about the
  [http://www.w3.org/Provider/Style/Structure.html overall structure of a work] 
  and how to organize information [http://www.w3.org/Provider/Style/WithinDocument.html within each document]. One of the most important tip is “make your HTML page such that you can read it even if you don't follow any links.”

  Learn more about:
   * WikiNewPage creation, which can be configured to start from a [PageTemplates page template]
   * WikiFormatting rules, including advanced topics like WikiMacros and WikiProcessors
   * How to use WikiPageNames and other forms of TracLinks which are used to refer in a precise way to any resource within Trac

  If you want to practice editing, please use the SandBox.

  Before saving your changes, you can ''Preview'' the page or ''Review the Changes'' you've 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#trac-section 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 [http://wikipedia.org/wiki/Wiki Wiki], in a famous  wiki encyclopedia
   * The [http://c2.com/cgi/wiki?WikiHistory History] of the original wiki
   * A wiki page explaining [http://www.usemod.com/cgi-bin/mb.pl?WhyWikiWorks why wiki works]

  ----
  See also: TracGuide


name: TracGuide
author: trac
ipnr: 127.0.0.1
text:
  = The Trac User and Administration Guide =
  [[TracGuideToc]]

  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 [http://trac.edgewall.org Trac Project] itself.

  == Table of Contents ==

  Currently available documentation:
   * '''User Guide'''
     * TracWiki — How to use the built-in Wiki.
     * TracTimeline — The timeline provides a historic perspective on a project.
     * TracRss — RSS content syndication in Trac.
     * ''The Version Control Subsystem''
       * TracBrowser — Browsing source code with Trac.
       * TracChangeset — Viewing changes to source code.
       * TracRevisionLog — Viewing change history.
     * ''The Ticket Subsystem''
       * TracTickets — Using the issue tracker.
       * TracReports — Writing and using reports.
       * TracQuery — Executing custom ticket queries.
       * TracRoadmap — The roadmap helps tracking project progress.
   * '''Administrator Guide'''
     * TracInstall — How to install and run Trac.
     * TracUpgrade — How to upgrade existing installations.
     * TracAdmin — Administering a Trac project.
     * TracImport — Importing tickets from other bug databases.
     * TracIni — Trac configuration file reference. 
     * TracPermissions — Access control and permissions.
     * TracInterfaceCustomization — Customizing the Trac interface.
     * TracPlugins — Installing and managing Trac extensions.
     * TracLogging — The Trac logging facility.
     * TracNotification — Email notification.
     * TracWorkflow — Configurable Ticket Workflow.
     * TracRepositoryAdmin — Management of Source Code Repositories.
   * [trac:TracFaq Trac FAQ] — A collection of Frequently Asked Questions (on the project website).
   * [trac:TracDev Trac Developer Documentation] — Developer documentation

  == Support and Other Sources of Information ==
  If you are looking for a good place to ask a question about Trac, look no further than the [http://trac.edgewall.org/wiki/MailingList MailingList]. It provides a friendly environment to discuss openly among Trac users and developers.

  See also the TracSupport page for more information resources.


name: WikiRestructuredTextLinks
author: trac
ipnr: 127.0.0.1
text:
  = TracLinks in reStructuredText =

  This document illustrates how to use the `:trac:` role in 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 (since version 0.10): :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 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 (since version 0.10): :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 also that any of 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: WikiStart
author: trac
ipnr: 127.0.0.1
text:
  = Welcome to Trac 0.12.2 =

  Trac is a '''minimalistic''' approach to '''web-based''' management of
  '''software projects'''. Its goal is to simplify effective tracking and handling of software issues, enhancements and overall progress.

  All aspects of Trac have been designed with the single goal to 
  '''help developers write great software''' while '''staying out of the way'''
  and imposing as little as possible on a team's established process and
  culture.

  As all Wiki pages, this page is editable, this means that you can
  modify the contents of this page simply by using your
  web-browser. Simply click on the "Edit this page" link at the bottom
  of the page. WikiFormatting will give you a detailed description of
  available Wiki formatting commands.

  "[wiki:TracAdmin trac-admin] ''yourenvdir'' initenv" created
  a new Trac environment, containing a default set of wiki pages and some sample
  data. This newly created environment also contains 
  [wiki:TracGuide documentation] to help you get started with your project.

  You can use [wiki:TracAdmin trac-admin] to configure
  [http://trac.edgewall.org/ Trac] to better fit your project, especially in
  regard to ''components'', ''versions'' and ''milestones''. 


  TracGuide is a good place to start.

  Enjoy! [[BR]]
  ''The Trac Team''

  == Starting Points ==

   * TracGuide --  Built-in Documentation
   * [http://trac.edgewall.org/ The Trac project] -- Trac Open Source Project
   * [http://trac.edgewall.org/wiki/TracFaq Trac FAQ] -- Frequently Asked Questions
   * TracSupport --  Trac Support

  For a complete list of local wiki pages, see TitleIndex.


name: WikiMacros
author: trac
ipnr: 127.0.0.1
text:
  = Trac Macros =

  [[PageOutline]]

  Trac macros are plugins to extend the Trac engine with custom 'functions' written in Python. A macro inserts dynamic HTML data in any context supporting WikiFormatting.

  Another kind of macros are WikiProcessors. They typically deal with alternate markup formats and representation of larger blocks of information (like source code highlighting).

  == Using Macros ==

  Macro calls are enclosed in two ''square brackets''. Like Python functions, macros can also have arguments, 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 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 style="font-size: 80%" class="trac-macrolist">
  <h3><code>[[Image]]</code></h3>Embed an image in wiki-formatted text.

  The first argument is the file …
  <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>.
  Can be …</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're looking for new macros, or have written one that you'd like to share with the world, please don't hesitate to 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 with Trac 0.11. 

  Also, have a look at [trac:source:tags/trac-0.11/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 a little more insight about the transition.

  === Macro without arguments ===
  To test the following code, you should saved 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 genshi.builder import tag

  from trac.util.datefmt import format_datetime, utc
  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.b(format_datetime(t, '%c'))
  }}}

  === Macro with arguments ===
  To test the following code, you should saved it in a `helloworld_sample.py` file located in the TracEnvironment's `plugins/` directory.
  {{{
  #!python
  from genshi.core 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's 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. On the contrary, when called as a macro, `args` is  `None`. (''since 0.12'').

  For example, when writing:
  {{{
  {{{#!HelloWorld style="polite"
  <Hello World!>
  }}}

  {{{#!HelloWorld
  <Hello World!>
  }}}

  [[HelloWorld(<Hello World!>)]]
  }}}
  One should get:
  {{{
  Hello World, text = <Hello World!> , args = {'style': u'polite'}
  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 by yourself (using `return Markup.escape(result)`) or, if this is indeed HTML, wrap it in a Markup object (`return Markup(result)`) with `Markup` coming from Genshi, (`from genshi.core import Markup`).  

  You can also recursively use a wiki Formatter (`from trac.wiki import Formatter`) to process the `text` as wiki markup, for example by doing:

  {{{
  #!python
  from genshi.core 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: TracAdmin
author: trac
ipnr: 127.0.0.1
text:
  = TracAdmin =
  [[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 those operations can also be performed via the ''Admin'' web interface, an updated version of the [trac:WebAdmin] plugin now integrated within Trac (since version 0.11).

  == Usage ==

  For nearly every `trac-admin` command, you'll need to specify the path to the TracEnvironment that you want to administer as the first argument, for example:
  {{{
  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'll only get a very succinct list of commands (`help` and `initenv`), the same list you'd get when invoking `trac-admin` alone.
  Also, `trac-admin --version` will tell you about the Trac version (e.g. 0.12) corresponding to the program.

  If you want to get a comprehensive list of the available commands and sub-commands, you need to specify an existing environment:
  {{{
  trac-admin /path/to/projenv help
  }}}

  Some commands have a more detailed help, which you can access by specifying the command's name as a subcommand for `help`:

  {{{
  trac-admin /path/to/projenv help <command>
  }}}

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

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

  [[TracAdminHelp(initenv)]]

  It supports an extra `--inherit` option, which can be used to specify a global configuration file which can be used share settings between several environments. You can also inherit from a shared configuration afterwards, by setting the `[inherit] file` option in the `conf/trac.ini` file in your newly created environment, but the advantage of specifying the inherited configuration file at environment creation time is that only the options ''not'' already specified in the global configuration file will be written in the created environment's `conf/trac.ini` file.
  See TracIni#GlobalConfiguration.

  Note that in version 0.11 of Trac, `initenv` lost an extra last argument `<templatepath>`, which was used in previous versions to point to the `templates` folder. If you are using the one-liner '`trac-admin /path/to/trac/ initenv <projectname> <db> <repostype> <repospath>`' in the above and getting an error that reads ''''`Wrong number of arguments to initenv: 4`'''', then this is because you're using a `trac-admin` script from an '''older''' version of Trac.

  == Interactive Mode ==

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

  Once you're 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:
  {{{
  > help resync
  }}}

  To get help on all the Wiki-related commands, run:
  {{{
  > help wiki
  }}}

  == Full Command Reference ==

  You'll find below the detailed help for all the commands available by default in `trac-admin`. Note that this may not match the list given by `trac-admin <yourenv> help`, as the commands  pertaining to components disabled in that environment won't be available and conversely some plugins activated in the environment can add their own commands.

  [[TracAdminHelp()]]

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


name: WikiHtml
author: trac
ipnr: 127.0.0.1
text:
  = Using HTML in Wiki Text =

  Trac supports inserting HTML into any wiki context, accomplished using the `#!html` [wiki:WikiProcessors WikiProcessor]. 

  However a constraint is that this HTML has to be 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. 

  Fortunately, for creating styled <div>s, <span>s  or even complex tables
  containing arbitrary Wiki text, there's a powerful alternative: use of
  dedicated `#!div`, `#!span` and `#!table`, `#!tr`, `#!td` and `#!th` blocks.

  Those Wiki processors are built-in, and does not require installing any additional packages.

  == 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 if you try to use potentially dangerous constructs such as Javascript event handlers, those will be removed from the output. 

  Since 0.11, the filtering is done by Genshi, and as such, the produced output will be a well-formed fragment of HTML. As noted above in the introduction, this mean that you can no longer use two HTML blocks, one for opening a <div>, the second for closing it, in order to wrap arbitrary wiki text.
  The new way to wrap any wiki content inside a <div> is to use the `#!div` Wiki  processor.

  == How to use `#!div` and `#!span` == #HowtoUseDivSpan

  ||= Wiki Markup =||= Display =||
  {{{#!td
    {{{
    {{{
    #!div class="important" style="border: 2pt solid; text-align: center"
    This is the ''only'' way to go in Trac 0.11
    }}}

    {{{
    #!div class="wikipage" style="border: 1pt dotted"
    Only `wikipage` (same as specifying no class attribute)
    }}}

    {{{
    #!div class="wikipage compact " style="border: 1pt solid"
    Use combined classes (`compact` and `wikipage`)
    }}}

    {{{
    #!div class="compact" style="border: 1pt dotted"
    Only `compact`
    }}}

    {{{
    #!div class="" style="border: 1pt solid"
    No classes (//not// the same as specifying no class attribute...)
    }}}
    }}}
  }}}
  {{{#!td style="padding-left: 2em"
    {{{
    #!div class="important" style="border: 2pt solid; text-align: center"
    This is the ''only'' way to go in Trac 0.11
    }}}

    {{{
    #!div class="wikipage" style="border: 1pt dotted"
    Only `wikipage` (same as specifying no class attribute)
    }}}

    {{{
    #!div class="wikipage compact " style="border: 1pt solid"
    Use combined classes (`compact` and `wikipage`)
    }}}

    {{{
    #!div class="compact" style="border: 1pt dotted"
    Only compact
    }}}

    {{{
    #!div class="" style="border: 1pt solid"
    No classes (//not// the same as specifying no class attribute...)
    }}}
  }}}

  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 contents, 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 the `site/style.css` file for example, see TracInterfaceCustomization#SiteAppearance.

  For spans, you should rather 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

  `#!td` or `#!th` processors are actually the main ones, for creating table data and 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, the rows nor the cells will have a border, so this is a more effective way to get such an effect 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 0.12). For example, the following code block:
  ||= 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.
    -->
    }}}
  }}}

  Please note that 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:  WikiProcessors, WikiFormatting, WikiRestructuredText


name: TracLinks
author: trac
ipnr: 127.0.0.1
text:
  = Trac Links =
  [[TracGuideToc]]

  TracLinks are a fundamental feature of Trac, because they allow easy hyperlinking between the various entities in the system—such as tickets, reports, changesets, Wiki pages, milestones, and source files—from anywhere WikiFormatting is used.

  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`
   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
   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, i.e., 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@!)>
  }}}
  }}}

  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 specific anchor in a page, use '#':
  {{{
   [#Relativelinks relative links] or [[#Relativelinks|relative links]]
  }}}
  Displays:
    [#Relativelinks relative links] or [[#Relativelinks|relative links]]

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

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

  ''(Changed in 0.11)'' Note that in Trac 0.10, using e.g. `[../newticket]`  may have worked for linking to the `/newticket` top-level URL, but since 0.11, such a link will stay in the wiki namespace and therefore link to a sibling page. 
  See [#Server-relativelinks] for the new syntax.

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

  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`

  === query: links ===

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

  === search: links ===

  See TracSearch#SearchLinks 

  === ticket: links ===
   ''alias:'' `bug:`

  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`

  ''(since Trac 0.11)''

  === 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 alternatively you can specify your local time, followed by your timezone if you don't want to compute the UTC time.

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

  ''(since Trac 0.11)''

  === wiki: links ===

  See WikiPageNames and [#QuotingspaceinTracLinks quoting space in TracLinks] above.

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

  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`

  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.
     ''(since 0.11)''

  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

  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

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

  In the presence of multiple repositories, the name of the repository should be specified as the first part of the path, e.g. `log:repos/branches` or `[20-40/repos]`.

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


name: TracUpgrade
author: trac
ipnr: 127.0.0.1
text:
  = Upgrade Instructions =
  [[TracGuideToc]]

  == Instructions ==

  Typically, there are seven steps involved in upgrading to a newer version of Trac:

  === 1. Update the Trac Code === #UpdatetheTracCode

  Get the new version as described in TracInstall, or your operating system specific procedure.

  If you already have a 0.11 version of Trac installed via `easy_install`, it might be easiest to also use `easy_install` to upgrade your Trac installation:

  {{{
  # easy_install --upgrade Trac==0.12
  }}}

  If you do a manual (not operating system-specific) upgrade, you should also stop any running Trac servers before the installation. Doing "hot" upgrades is not advised, especially on Windows ([trac:#7265]).

  You may also want to remove the pre-existing Trac code by deleting the `trac` directory from the Python `lib/site-packages` directory, or remove Trac `.egg` files from former versions.
  The location of the site-packages directory depends on the operating system and the location in which Python was installed. However, the following locations are typical:
   * on Linux: `/usr/lib/python2.X/site-packages`
   * on Windows: `C:\Python2.X\lib\site-packages`
   * on MacOSX: `/Library/Python/2.X/site-packages`

  You may also want to remove the Trac `cgi-bin`, `htdocs`, `templates` and `wiki-default` directories that are commonly found in a directory called `share/trac`. (The exact location depends on your platform.)

  This cleanup is not mandatory, but makes it easier to troubleshoot issues later on, as you won't waste your time looking at code or templates from a previous release that are not being used anymore... As usual, make a backup before actually deleting things.

  === 2. Upgrade the Trac Environment === #UpgradetheTracEnvironment

  Environment upgrades are not necessary for minor version releases unless otherwise noted. 

  After restarting, Trac should show the instances which need a manual upgrade via the automated upgrade scripts to ease the pain. These scripts are run via [TracAdmin trac-admin]:
  {{{
  trac-admin /path/to/projenv upgrade
  }}}

  This command will do nothing if the environment is already up-to-date.

  Note that a backup of your database will be performed automatically prior to the upgrade. 
  This feature is relatively new for the PostgreSQL or MySQL database backends, so if it fails, you will have to backup the database manually. Then, to perform the actual upgrade, run:
  {{{
  trac-admin /path/to/projenv upgrade --no-backup
  }}}

  === 3. Update the Trac Documentation === #UpdatetheTracDocumentation

  Every [TracEnvironment Trac environment] includes a copy of the Trac documentation for the installed version. As you probably want to keep the included documentation in sync with the installed version of Trac, [TracAdmin trac-admin] provides a command to upgrade the documentation:
  {{{
  trac-admin /path/to/projenv wiki upgrade
  }}}

  Note that this procedure will leave your `WikiStart` page intact.

  === 4. Resynchronize the Trac Environment Against the Source Code Repository ===

  Each [TracEnvironment Trac environment] must be resynchronized against the source code repository in order to avoid errors such as "[http://trac.edgewall.org/ticket/6120 No changeset ??? in the repository]" while browsing the source through the Trac interface:

  {{{
  trac-admin /path/to/projenv repository resync '*'
  }}}

  === 5. Refresh static resources ===

  If you have set up a web server to give out static resources directly (accessed using the `/chrome/` URL) then you will need to refresh them using the same command:
  {{{
  trac-admin /path/to/env deploy /deploy/path
  }}}
  this will extract static resources and CGI scripts (`trac.wsgi`, etc) from new Trac version and its plugins into `/deploy/path`.

  Some web browsers cache CSS and Javascript files persistently, so you may need to instruct your users to manually erase the contents of their browser's cache.

  === 6. Steps specific to a given Trac version  ===
  ==== Upgrading from Trac 0.11 to Trac 0.12 ====
  ===== Python 2.3 no longer supported =====
  The minimum supported version of python is now 2.4

  ===== SQLite v3.x required =====
  SQLite v2.x is no longer supported. If you still use a Trac database of this format, you'll need to convert it to SQLite v3.x first. See [trac:PySqlite#UpgradingSQLitefrom2.xto3.x] for details.

  ===== PySqlite 2 required =====
  PySqlite 1.1.x is no longer supported. Please install 2.5.5 or later if possible (see [#Tracdatabaseupgrade Trac database upgrade] below).

  ===== Multiple Repository Support =====
  The latest version includes support for multiple repositories. If you plan to add more repositories to your Trac instance, please refer to TracRepositoryAdmin#Migration.

  This may be of interest to users with only one repository, since there's now a way to avoid the potentially costly resync check at every request.

  ===== Improved repository synchronization =====
  In addition to supporting multiple repositories, there is now a more efficient method for synchronizing Trac and your repositories.

  While you can keep the same synchronization as in 0.11 adding the post-commit hook as outlined in TracRepositoryAdmin#Synchronization and TracRepositoryAdmin#ExplicitSync will allow more efficient synchronization and is more or less required for multiple repositories.

  Note that if you were using the `trac-post-commit-hook`, ''you're strongly advised to upgrade it'' to the new hook documented in the above references, as the old hook will not work with anything else than the default repository and even for this case, it won't trigger the appropriate notifications.

  ===== Authz permission checking =====
  The authz permission checking has been migrated to a fine-grained permission policy. If you use authz permissions (aka `[trac] authz_file` and `authz_module_name`), you must add `AuthzSourcePolicy` in front of your permission policies in `[trac] permission_policies`. You must also remove `BROWSER_VIEW`, `CHANGESET_VIEW`, `FILE_VIEW` and `LOG_VIEW` from your global permissions (with `trac-admin $ENV permission remove` or the "Permissions" admin panel).

  ===== Microsecond timestamps =====
  All timestamps in database tables (except the `session` table) have been changed from "seconds since epoch" to "microseconds since epoch" values. This change should be transparent to most users, except for custom reports. If any of your reports use date/time columns in calculations (e.g. to pass them to `datetime()`), you must divide the values retrieved from the database by 1'000'000. Similarly, if a report provides a calculated value to be displayed as a date/time (i.e. with a column named "time", "datetime", "changetime", "date", "created" or "modified"), you must provide a microsecond timestamp, that is, multiply your previous calculation with 1'000'000.

  ==== Upgrading from Trac 0.10 to Trac 0.11 ====
  ===== Site Templates and Styles =====
  The templating engine has changed in 0.11 to Genshi, please look at TracInterfaceCustomization for more information.

  If you are using custom CSS styles or modified templates in the `templates` directory of the TracEnvironment, you will need to convert them to the Genshi way of doing things. To continue to use your style sheet, follow the instructions at TracInterfaceCustomization#SiteAppearance.

  ===== Trac Macros, Plugins =====
  The Trac macros will need to be adapted, as the old-style wiki-macros are not supported anymore (due to the drop of [trac:ClearSilver] and the HDF); they need to be converted to the new-style macros, see WikiMacros. When they are converted to the new style, they need to be placed into the plugins directory instead and not wiki-macros, which is no longer scanned for macros or plugins.

  ===== For FCGI/WSGI/CGI users =====
  For those who run Trac under the CGI environment, run this command in order to obtain the trac.*gi file:
  {{{
  trac-admin /path/to/env deploy /deploy/directory/path
  }}}

  This will create a deploy directory with the following two subdirectories: `cgi-bin` and `htdocs`. Then update your Apache configuration file `httpd.conf` with this new `trac.cgi` location and `htdocs` location.

  ===== Web Admin plugin integrated =====
  If you had the webadmin plugin installed, you can uninstall it as it is part of the Trac code base since 0.11.

  === 7. Restart the Web Server === #RestarttheWebServer

  If you are not running [wiki:TracCgi CGI], reload the new Trac code by restarting your web server.

  == Known Issues ==

  === parent dir ===
  If you use a trac parent env configuration and one of the plugins in one child does not work, none of the children work.

  === Wiki Upgrade ===
  `trac-admin` will not delete or remove default wiki pages that were present in a previous version but are no longer in the new version.

  === Trac database upgrade ===

  A known issue in some versions of PySqlite (2.5.2-2.5.4) prevents the trac-admin upgrade script from successfully upgrading the database format. It is advised to use either a newer or older version of the sqlite python bindings to avoid this error. For more details see ticket [trac:#9434].

  == Upgrading Python ==

  Upgrading Python to a newer version will require reinstallation of Python packages: Trac of course; also [http://pypi.python.org/pypi/setuptools easy_install], if you've been using that.  Assuming you're using Subversion, you'll also need to upgrade the Python bindings for svn.

  === Windows and Python 2.6 ===

  If you've been using !CollabNet's Subversion package, you may need to uninstall that in favor of [http://alagazam.net/ Algazam], which has the Python bindings readily available (see TracSubversion).  The good news is, that works with no tweaking.

  == Changing Database Backend ==
  === SQLite to PostgreSQL ===

  The [http://trac-hacks.org/wiki/SqliteToPgScript sqlite2pg] script on [http://trac-hacks.org trac-hacks.org] has been written to assist in migrating a SQLite database to a PostgreSQL database

  == Older Versions ==

  For upgrades from versions older than Trac 0.10, refer first to [trac:wiki:0.10/TracUpgrade#SpecificVersions].

  -----
  See also: TracGuide, TracInstall


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'', used to display lists of tickets meeting a specified set of 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 and no name/email 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 pulldown lists at the bottom corners of the filters box ('And' conditions on the left, 'Or' conditions on the right).  Filters with either a text box or a pulldown menu of options can be added multiple times to perform an ''or'' of the criteria.

  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.

  Once you've edited your filters click the ''Update'' button to refresh your results.

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

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

  === Using the `[[TicketQuery]]` Macro ===

  The [trac:TicketQuery TicketQuery] macro lets you display lists of tickets matching certain criteria anywhere you can use WikiFormatting.

  Example:
  {{{
  [[TicketQuery(version=0.6|0.7&resolution=duplicate)]]
  }}}

  This is displayed as:
    [[TicketQuery(version=0.6|0.7&resolution=duplicate)]]

  Just like the [wiki:TracQuery#UsingTracLinks query: wiki links], the parameter of this macro expects a query string formatted according to the rules of the simple [wiki:TracQuery#QueryLanguage ticket query language].

  A more compact representation without the ticket summaries is also available:
  {{{
  [[TicketQuery(version=0.6|0.7&resolution=duplicate, compact)]]
  }}}

  This is displayed as:
    [[TicketQuery(version=0.6|0.7&resolution=duplicate, compact)]]

  Finally, if you wish to receive only the number of defects that match the query, use the ``count`` parameter.

  {{{
  [[TicketQuery(version=0.6|0.7&resolution=duplicate, count)]]
  }}}

  This is displayed as:
    [[TicketQuery(version=0.6|0.7&resolution=duplicate, count)]]

  === 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 by placing pipes (`|`) between the columns like below:

  {{{
  [[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>'' like below:

  {{{
  [[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. Basically, the filters are separated by ampersands (`&`). Each filter then 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 ||

  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 left out 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 ||

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


name: TracFineGrainedPermissions
author: trac
ipnr: 127.0.0.1
text:
  = Fine grained permissions =

  Before Trac 0.11, it was only possible to define fine-grained permissions checks on the repository browser sub-system.

  Since 0.11, there's a general mechanism in place that allows custom **permission policy plugins** to grant or deny any action on any kind of Trac resources, even at the level of specific versions of such resources.

  Note that for Trac 0.12, `authz_policy` has been integrated as an optional module (in `tracopt.perm.authz_policy.*`), so it's installed by default and can simply 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. 

  Which policies are currently active is determined by a configuration setting in TracIni:
  e.g.
  {{{
  [trac]
  permission_policies = AuthzSourcePolicy, DefaultPermissionPolicy, LegacyAttachmentPolicy
  }}}
  This lists the [#AuthzSourcePolicy] described below as the first policy, followed by the !DefaultPermissionPolicy which checks for the traditional coarse grained style permissions described in TracPermissions, and the !LegacyAttachmentPolicy which knows how to use the coarse grained permissions for checking the permissions available on attachments.

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

  Another popular permission policy [#AuthzSourcePolicy], re-implements the pre-0.12 support for checking fine-grained permissions limited to Subversion repositories in terms of the new system.

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


  === !AuthzPolicy === 

   - Install [http://www.voidspace.org.uk/python/configobj.html ConfigObj] (required).
   - Copy authz_policy.py into your plugins directory.
   - Put a [http://swapoff.org/files/authzpolicy.conf authzpolicy.conf] file somewhere, preferably on a secured location on the server, not readable for others than the webuser. If the  file contains non-ASCII characters, the UTF-8 encoding should be used.
   - Update your `trac.ini`:
     1. modify the [TracIni#trac-section permission_policies] entry in the `[trac]` section
  {{{
  [trac]
  ...
  permission_policies = AuthzPolicy, DefaultPermissionPolicy, LegacyAttachmentPolicy
  }}}
     2. add a new `[authz_policy]` section
  {{{
  [authz_policy]
  authz_file = /some/trac/env/conf/authzpolicy.conf
  }}}
     3. enable the single file plugin
  {{{
  [components]
  ...
  # Trac 0.12
  tracopt.perm.authz_policy.* = enabled
  # for Trac 0.11 use this
  #authz_policy.* = enabled 
  }}}

  Note that the order in which permission policies are specified is quite critical, 
  as policies will be examined in the sequence provided.

  A policy will return either `True`, `False` or `None` for a given permission check.
  Only if the return value is `None` will the ''next'' permission policy be consulted.
  If no policy explicitly grants the permission, the final result will be `False` 
  (i.e. no permission).

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

  [wiki:PrivatePage@*]
  john = 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


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

  At the time of this writing, the old fine grained permissions system from Trac 0.11 and before used for restricting access to the repository has  been converted to a permission policy component, but from the user point of view, this makes little if no difference.

  That kind of fine-grained 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.5/svn.serverconfig.pathbasedauthz.html Path-Based Authorization] section in the Server Configuration chapter of the svn book.

  Example:
  {{{
  [/]
  * = 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 fine grained permissions you __must__ specify the {{{authz_file}}} option in the {{{[trac]}}} section of trac.ini. If this option is set to null or not specified the permissions will not be used.

  {{{
  [trac]
  authz_file = /path/to/svnaccessfile
  }}}

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

  {{{
  authz_module_name = modulename
  }}}

  where ''modulename'' refers to the same repository indicated by the `repository_dir` entry in the `[trac]` section. As an example, if the `repository_dir` entry in the `[trac]` section is {{{/srv/active/svn/blahblah}}}, that would yield the following:

  {{{ 
  [trac]
  authz_file = /path/to/svnaccessfile
  authz_module_name = blahblah
  ...
  repository_dir = /srv/active/svn/blahblah 
  }}}

  where the svn access file, {{{/path/to/svnaccessfile}}}, contains entries such as {{{[blahblah:/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.

  {{{ 
  [trac]
  permission_policies = AuthzSourcePolicy, DefaultPermissionPolicy, LegacyAttachmentPolicy
  }}}

  ==== Subversion Configuration ====

  The same access file is typically applied to the corresponding Subversion repository using an Apache directive like this:
  {{{
  <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]

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

  And watch:
  {{{
  tail -n 0 -f log/trac.log | egrep '\[perm\]|\[authz_policy\]'
  }}}

  to understand what checks are being performed. 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: TracModWSGI
author: trac
ipnr: 127.0.0.1
text:
  = Trac and mod_wsgi =

  '''Important note:''' ''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. See mod_wsgi tickets [http://code.google.com/p/modwsgi/issues/detail?id=100 #100] and [http://code.google.com/p/modwsgi/issues/detail?id=132 #132].''

  [http://code.google.com/p/modwsgi/ mod_wsgi] is an Apache module for running WSGI-compatible Python applications directly on top of Apache. The mod_wsgi adapter is written completely in C and provides significantly better performance than using existing WSGI adapters for mod_python or CGI.

  Trac can be run on top of mod_wsgi with the help of the following application script, which is just a Python file, though usually saved with a .wsgi extension). This file can be created using '''trac-admin <env> deploy <dir>''' command which automatically substitutes required paths.

  {{{
  #!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 (if you have several Trac environments in a directory, you can also use `TRAC_ENV_PARENT_DIR` instead), while the `PYTHON_EGG_CACHE` should be a directory where Python can temporarily extract Python eggs.

  '''Important note:''' If you're 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. (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 it's own directory, since you will open up its directory to Apache. You can create a .wsgi files which handles all this for you by running the TracAdmin command `deploy`.

  If you have installed trac and eggs in a path different from the standard one you should add that path by adding the following code on 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.

  After you've done preparing your wsgi-script, add the following to your httpd.conf.

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

  <Directory /usr/local/trac/mysite/apache>
      WSGIApplicationGroup %{GLOBAL}
      Order deny,allow
      Allow from all
  </Directory>
  }}}

  Here, the script is in a subdirectory of the Trac environment. 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 subinterpreters and may cause requests to hang or cause Apache to crash as a result. 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):

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

  See also the mod_wsgi [http://code.google.com/p/modwsgi/wiki/IntegrationWithTrac installation instructions] for Trac.

  For troubleshooting tips, see the [TracModPython#Troubleshooting mod_python troubleshooting] section, as most Apache-related issues are quite similar, plus discussion of potential [http://code.google.com/p/modwsgi/wiki/ApplicationIssues application issues] when using mod_wsgi.

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

  == Apache Basic Authentication for Trac thru mod_wsgi ==

  Per the mod_wsgi documentation linked to above, here is an example Apache configuration that a) serves the trac from a virtualhost subdomain and b) uses Apache basic authentication for Trac authentication.


  If you want your trac to be served from e.g. !http://trac.my-proj.my-site.org, then from the folder e.g. {{{/home/trac-for-my-proj}}}, if you used the command {{{trac-admin the-env initenv}}} to create a folder {{{the-env}}}, and you used {{{trac-admin the-env deploy the-deploy}}} to create a folder {{{the-deploy}}}, then:

  create the htpasswd file:
  {{{
  cd /home/trac-for-my-proj/the-env
  htpasswd -c htpasswd firstuser
  ### and add more users to it as needed:
  htpasswd htpasswd seconduser
  }}}
  (for security keep the file above your document root)

  create this file e.g. (ubuntu) {{{/etc/apache2/sites-enabled/trac.my-proj.my-site.org.conf}}} with these contents:

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

  == Trac with PostgreSQL ==

  When using the mod_wsgi adapter with multiple Trac instances and PostgreSQL (or MySQL?) as a database back-end the server can get a lot of open database connections. (and thus PostgreSQL processes)

  A workable solution is to disabled connection pooling in Trac. This is done by setting poolable = False in trac.db.postgres_backend on the PostgreSQLConnection class.

  But it's not necessary to edit the source of trac, the following lines in trac.wsgi will also work:

  {{{
  import trac.db.postgres_backend
  trac.db.postgres_backend.PostgreSQLConnection.poolable = False
  }}}

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

  == Getting Trac to work nicely with SSPI and 'Require Group' ==
  If like me you've 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 its not working your usernames in trac are probably looking like 'DOMAIN\user' rather than 'user'.

  This WSGI script 'fixes' things, hope it helps:
  {{{
  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)
  }}}
  ----
  See also:  TracGuide, TracInstall, [wiki:TracFastCgi FastCGI], [wiki:TracModPython ModPython], [trac:TracNginxRecipe TracNginxRecipe]


name: CamelCase
author: trac
ipnr: 127.0.0.1
text:
  = !CamelCase =
  New words created by smashing together capitalized words.

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

  == Customizing the Wiki behavior ==

  Some people dislike linking by CamelCase.  While Trac remains faithful to the original Wiki style, it provides a number of ways to accomodate users with different preferences:
   * There's an option (`ignore_missing_pages` in the [wiki:TracIni#wiki-section "[wiki]"] section of TracIni) to simply ignore links to missing pages when the link is written using the CamelCase style, instead of that word being replaced by a gray link followed by a question mark.[[BR]]
     That can be useful when CamelCase style is used to name code artifacts like class names and there's no corresponding page for them.
   * There's an option (`split_page_names` in the  [wiki:TracIni#wiki-section "[wiki]"] section of TracIni) to automatically insert space characters between the words of a CamelCase link when rendering the link.
   * Creation of explicit Wiki links is also easy, see WikiPageNames for details.
   * In addition, Wiki formatting can be disabled completely in some places (e.g. when rendering commit log messages). See `wiki_format_messages` in the [wiki:TracIni#changeset-section "[changeset]"] section of 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: TracIni
author: trac
ipnr: 127.0.0.1
text:
  = The Trac Configuration File =

  [[TracGuideToc]]

  Trac configuration is done by editing the '''`trac.ini`''' config file, located in `<projectenv>/conf/trac.ini`.  Changes to the configuration are usually 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 global configuration file when none was previously present.

  The `trac.ini` configuration file should be writable by the web server, as Trac currently relies on the possibility to trigger a complete environment reload to flush its caches.

  == Global Configuration ==

  In versions prior to 0.11, the global configuration was by default located in `$prefix/share/trac/conf/trac.ini` or /etc/trac/trac.ini, depending on the distribution. If you're upgrading, you may want to specify that file to inherit from.  Literally, when you're upgrading to 0.11, you have to add an `[inherit]` section to your project's `trac.ini` file. Additionally, you have to move your customized templates and common images from `$prefix/share/trac/...` to the new location.

  Global options will be merged with the environment-specific options, where local options override global options. The options file is specified as follows:
  {{{
  [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 do not do this but nevertheless intend to use a global option file with your new environment, you will have to go through the newly generated `conf/trac.ini` file and delete the entries that will otherwise override those set in the global file.

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

  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 be sure to refresh your modifications when you upgrade to a new version of Trac (the preferred way to perform TracInterfaceCustomization being still to write a custom plugin doing an appropriate `ITemplateStreamFilter` transformation).

  == Reference for settings

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

  [[TracIni]]

  == Reference for special sections
  [[PageOutline(3,,inline)]]

  === [components] === #components-section
  This section is used to enable or disable components provided by plugins, as well as by Trac itself. The component to enable/disable is specified via the name of the option. Whether its enabled is determined by the option value; setting the value to `enabled` or `on` will enable the component, any other value (typically `disabled` or `off`) will disable the component.

  The option name is either the fully qualified name of the components or the module/package prefix of the component. The former enables/disables a specific component, while the latter enables/disables any component in the specified package/module.

  Consider the following configuration snippet:
  {{{
  [components]
  trac.ticket.report.ReportModule = disabled
  webadmin.* = enabled
  }}}

  The first option tells Trac to disable the [wiki:TracReports report module]. The second option instructs Trac to enable all components in the `webadmin` package. Note that the trailing wildcard is required for module/package matching.

  See the ''Plugins'' page on ''About Trac'' to get the list of active components (requires `CONFIG_VIEW` [wiki:TracPermissions permissions].)

  See also: TracPlugins

  === [milestone-groups] === #milestone-groups-section
  ''(since 0.11)''

  As the workflow for tickets is now configurable, there can be many ticket states,
  and simply displaying closed tickets vs. all the others is maybe not appropriate 
  in all cases. This section enables one to easily create ''groups'' of states 
  that will be shown in different colors in the milestone progress bar.

  Example configuration (the default only has closed and active):
  {{{
  closed = closed
  # sequence number in the progress bar
  closed.order = 0
  # optional extra param for the query (two additional columns: created and modified and sort on created)
  closed.query_args = group=resolution,order=time,col=id,col=summary,col=owner,col=type,col=priority,col=component,col=severity,col=time,col=changetime
  # indicates groups that count for overall completion percentage
  closed.overall_completion = true

  new = new
  new.order = 1
  new.css_class = new
  new.label = new

  # one catch-all group is allowed
  active = *
  active.order = 2
  # CSS class for this interval
  active.css_class = open
  # Displayed label for this group
  active.label = in progress
  }}}

  The definition consists in a comma-separated list of accepted status.
  Also, '*' means any status and could be used to associate all remaining
  states to one catch-all group.

  The CSS class can be one of: new (yellow), open (no color) or
  closed (green). New styles can easily be added using the following
  selector:  `table.progress td.<class>`

  === [repositories] === #repositories-section

  (''since 0.12'' multirepos)

  One of the alternatives for registering new repositories is to populate the `[repositories]` section of the trac.ini.

  This is especially suited for setting up convenience aliases, short-lived repositories, or during the initial phases of an installation.

  See [TracRepositoryAdmin#Intrac.ini TracRepositoryAdmin] for details about the format adopted for this section and the rest of that page for the other alternatives.

  === [svn:externals] === #svn:externals-section
  ''(since 0.11)''

  The TracBrowser for Subversion can interpret the `svn:externals` property of folders.
  By default, it only turns the URLs into links as Trac can't browse remote repositories.

  However, if you have another Trac instance (or an other repository browser like [http://www.viewvc.org/ ViewVC]) configured to browse the target repository, then you can instruct Trac which other repository browser to use for which external URL.

  This mapping is done in the `[svn:externals]` section of the TracIni

  Example:
  {{{
  [svn:externals]
  1 = svn://server/repos1                       http://trac/proj1/browser/$path?rev=$rev
  2 = svn://server/repos2                       http://trac/proj2/browser/$path?rev=$rev
  3 = http://theirserver.org/svn/eng-soft       http://ourserver/viewvc/svn/$path/?pathrev=25914
  4 = svn://anotherserver.com/tools_repository  http://ourserver/tracs/tools/browser/$path?rev=$rev
  }}}
  With the above, the `svn://anotherserver.com/tools_repository/tags/1.1/tools` external will be mapped to `http://ourserver/tracs/tools/browser/tags/1.1/tools?rev=` (and `rev` will be set to the appropriate revision number if the external additionally specifies a revision, see the [http://svnbook.red-bean.com/en/1.4/svn.advanced.externals.html SVN Book on externals] for more details).

  Note that the number used as a key in the above section is purely used as a place holder, as the URLs themselves can't be used as a key due to various limitations in the configuration file parser.

  Finally, the relative URLs introduced in [http://subversion.tigris.org/svn_1.5_releasenotes.html#externals Subversion 1.5] are not yet supported.

  === [ticket-custom] === #ticket-custom-section

  In this section, you can define additional fields for tickets. See TracTicketsCustomFields for more details.

  === [ticket-workflow] === #ticket-workflow-section
  ''(since 0.11)''

  The workflow for tickets is controlled by plugins. 
  By default, there's only a `ConfigurableTicketWorkflow` component in charge. 
  That component allows the workflow to be configured via this section in the trac.ini file.
  See TracWorkflow for more details.

  ----
  See also: TracGuide, TracAdmin, TracEnvironment


name: TracBackup
author: trac
ipnr: 127.0.0.1
text:
  = Trac Backup =
  [[TracGuideToc]]

  Since Trac uses a database backend, some extra care is required to safely create a backup of a [wiki:TracEnvironment project environment]. Luckily, [wiki:TracAdmin trac-admin] has a command to make backups easier: `hotcopy`.

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

  To create a backup of a live TracEnvironment, simply run:
  {{{

    $ trac-admin /path/to/projenv hotcopy /path/to/backupdir

  }}}

  [wiki:TracAdmin trac-admin] will lock the database while copying.''

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

  Please, note, that hotcopy command does not overwrite target directory and when such exists, hotcopy ends with error: `Command failed: [Errno 17] File exists:` This is discussed in [trac:ticket:3198 #3198].

  === Restoring a Backup ===

  Backups are simply a copied snapshot of the entire [wiki:TracEnvironment project environment] directory, including the SQLite database. 

  To restore an environment from a backup, stop the process running Trac (i.e. the Web server or [wiki:TracStandalone tracd]), restore the contents of your backup (path/to/backupdir) to your [wiki:TracEnvironment project environment] directory and restart the service.

    ''Note: Automatic backup of environments that don't use SQLite as database backend is not supported at this time. As a workaround, we recommend that you stop the server, copy the environment directory, and make a backup of the database using whatever mechanism is provided by the database system.''

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


name: TracUnicode
author: trac
ipnr: 127.0.0.1
text:
  = Unicode Support in Trac =
  [[TracGuideToc]]

  Trac stores all text using UTF-8 encoding, including text in tickets and wiki pages. Internal processing of text uses true Unicode representations.

  As such, it supports most (all?) commonly used character encodings.

  If your encoding is not UTF-8, you can use [wiki:TracModPython mod_python] to handle it.  For example, if your local encoding is gbk, you can set 
     default_charset = gbk
  in trac.ini.

  You also must make sure that your [trac:DatabaseBackend database backend] stores its data in UTF-8; otherwise strange things will happen.

  To convert your database to UTF-8, the easiest way is to dump the database, convert the dump into UTF-8 and then import the converted dump back into the database.[[BR]]
  You can use [http://www.gnu.org/software/libiconv/documentation/libiconv/iconv.1.html iconv] to convert the dump.


  == 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 cardlllo 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: TracNavigation
author: trac
ipnr: 127.0.0.1
text:
  = Trac Navigation =

  Starting with Trac 0.11, it is now possible to customize the main and meta navigation entries in some basic ways.

  The new `[mainnav]` and `[metanav]` configuration sections can now be used to customize the text and link used for the navigation items, or even to 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 and accessible for the current user.


  ** [=#Example Example] ** 

  In the following example, we rename the link to the Wiki start "Home", and hide the "!Help/Guide" link. 
  We also make the "View Tickets" entry link to a specific report.

  Relevant excerpt from the TracIni:
  {{{
  [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 ''Log in'', ''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. 
  [[comment(see also #Trac3808)]]

  ** Example ** 

  {{{
  [metanav]
  help = disabled
  logout.redirect = wiki/Logout
  }}}


  === Notes
  Possible URL formats (for `.href` or `.redirect`):
  || '''config''' || '''redirect to''' ||
  || `wiki/Logout` || `/projects/env/wiki/Logout` ||
  || `http://hostname/` || `http://hostname/` ||
  || `/projects` || `/projects` ||


  Note that it is still not possible to customize the '''contextual navigation bar''', i.e. 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: TracEnvironment
author: trac
ipnr: 127.0.0.1
text:
  = The Trac Environment =

  Trac uses a directory structure and a database for storing project data. The directory is referred to as the “environment”.

  == Creating an Environment ==

  A new Trac environment is created using  [TracAdmin#initenv trac-admin's initenv]:
  {{{
  $ trac-admin /path/to/myproject initenv
  }}}

  `trac-admin` will ask you for the name of the project and the
  database connection string (explained below).

  === Some Useful Tips
   - 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`, when using an svn repository, does not imply that trac-admin will perform `svnadmin create` for the specified repository path. You need to perform the `svnadmin create` prior to `trac-admin initenv` if you're creating a new svn repository altogether with a new trac environment, otherwise you will see a message "Warning: couldn't index the repository" when initializing the environment.

   - Non-ascii environment paths are not supported
   
   - Also, it seems that project names with spaces can be problematic for authentication (see [trac:#7163]).

   - TracPlugins located in a [TracIni#inherit-section shared plugins folder] that is defined in an [TracIni#GlobalConfiguration inherited configuration] are currently not loaded during creation, and hence, if they need to create extra tables for example, you'll need to [TracUpgrade#UpgradetheTracEnvironment upgrade the environment] before being able to use it.

  == Database Connection Strings ==

  Since version 0.9, Trac supports both [http://sqlite.org/ SQLite] and
  [http://www.postgresql.org/ PostgreSQL] database backends.  Preliminary
  support for [http://mysql.com/ MySQL] was added in 0.10.  The default is
  to use SQLite, which is probably sufficient for most projects. The database
  file is then stored in the environment directory, and can easily be 
  [wiki:TracBackup backed up] together with the rest of the environment.

  === 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 ===
  If you want to use PostgreSQL or MySQL instead, you'll have to use a
  different connection string. For example, to connect to a PostgreSQL
  database on the same machine called `trac`, that allows access to the
  user `johndoe` with the password `letmein`, use:
  {{{
  postgres://johndoe:letmein@localhost/trac
  }}}
  ''Note that due to the way the above string is parsed, the "/" and "@" characters cannot be part of the password.''

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

  Note that with PostgreSQL you will have to create the database before running
  `trac-admin initenv`.

  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`.
  {{{
  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 user 'tracuser'. This new user will not be a superuser, will not be allowed to create other databases and will not be allowed to create other roles. These privileges are not needed to run a trac instance. If no password is desired for the user, simply remove the `-P` and `-E` options from the `createuser` command.  Also note that the database should be created as UTF8. LATIN1 encoding causes errors trac's use of unicode in trac.  SQL_ASCII also seems to work.

  Under some default configurations (debian) one will have run the `createuser` and `createdb` scripts as the `postgres` user.  For example:
  {{{
  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 ===

  If you want to use MySQL instead, you'll have to use a
  different connection string. For example, to connect to a MySQL
  database on the same machine called `trac`, that allows access to the
  user `johndoe` with the password `letmein`, the mysql connection string is:
  {{{
  mysql://johndoe:letmein@localhost:3306/trac
  }}}

  == Source Code Repository ==

  Since version 0.12, a single Trac environment can be connected to more than one repository. There are many different ways to connect repositories to an environment, see TracRepositoryAdmin. This page also details the various attributes that can be set for a repository (like `type`, `url`, `description`).

  In Trac 0.12 `trac-admin` no longer asks questions related to repositories. Therefore, by default Trac is not connected to any source code repository, and the ''Browse Source'' toolbar item will not be displayed.
  You can also explicitly disable the `trac.versioncontrol.*` components (which are otherwise still loaded)
  {{{
  [components]
  trac.versioncontrol.* = disabled
  }}}

  For some version control systems, it is possible to specify not only the path to the repository,
  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.

  Example of a configuration for a Subversion repository used as the default repository:
  {{{
  [trac]
  repository_type = svn
  repository_dir = /path/to/your/repository
  }}}

  The configuration for a scoped Subversion repository would be:
  {{{
  [trac]
  repository_type = svn
  repository_dir = /path/to/your/repository/scope/within/repos
  }}}

  == Directory Structure ==

  An environment directory will usually consist of the following files and directories:

   * `README` - Brief description of the environment.
   * `VERSION` - Contains the environment version identifier.
   * `attachments` - Attachments to wiki pages and tickets are stored here.
   * `conf`
     * `trac.ini` - Main configuration file. See TracIni.
   * `db`
     * `trac.db` - The SQLite database (if you're using SQLite).
   * `htdocs` - directory containing web resources, which can be referenced in Genshi templates using `/htdocs/site/...` URLs. ''(since 0.11)''
   * `log` - default directory for log files, if logging is turned on and a relative path is given.
   * `plugins` - Environment-specific [wiki:TracPlugins plugins] (Python eggs or single file plugins, since [trac:milestone:0.10 0.10])
   * `templates` - Custom Genshi environment-specific templates. ''(since 0.11)''
     * `site.html` - method to customize header, footer, and style, described in TracInterfaceCustomization#SiteAppearance

  '''Caveat:''' ''don't confuse a 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 modelled 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.

  ----
  See also: TracAdmin, TracBackup, TracIni, TracGuide


name: TracStandalone
author: trac
ipnr: 127.0.0.1
text:
  = Tracd =

  Tracd is a lightweight standalone Trac web server.
  It can be used in a variety of situations, from a test or development server to a multiprocess setup behind another web server used as a load balancer.

  == Pros ==

   * Fewer dependencies: You don't need to install apache or any other web-server.
   * Fast: Should be almost as fast as the [wiki:TracModPython mod_python] version (and much faster than the [wiki:TracCgi CGI]), even more so since version 0.12 where the HTTP/1.1 version of the protocol is enabled by default
   * Automatic reloading: For development, Tracd can be used in ''auto_reload'' mode, which will automatically restart the server whenever you make a change to the code (in Trac itself or in a plugin).

  == Cons ==

   * Fewer features: Tracd implements a very simple web-server and is not as configurable or as scalable as Apache httpd.
   * No native HTTPS support: [http://www.rickk.com/sslwrap/ sslwrap] can be used instead,
     or [http://trac.edgewall.org/wiki/STunnelTracd stunnel -- a tutorial on how to use stunnel with tracd] or Apache with mod_proxy.

  == Usage examples ==

  A single project on port 8080. (http://localhost:8080/)
  {{{
   $ tracd -p 8080 /path/to/project
  }}}
  Stricly speaking this will make your Trac accessible to everybody from your network rather than ''localhost only''. To truly limit it use ''--hostname'' option.
  {{{
   $ tracd --hostname=localhost -p 8080 /path/to/project
  }}}
  With more than one project. (http://localhost:8080/project1/ and http://localhost:8080/project2/)
  {{{
   $ tracd -p 8080 /path/to/project1 /path/to/project2
  }}}

  You can't have the last portion of the path identical between the projects since Trac uses that name to keep the URLs of the
  different projects unique. So if you use `/project1/path/to` and `/project2/path/to`, you will only see the second project.

  An alternative way to serve multiple projects is to specify a parent directory in which each subdirectory is a Trac project, using the `-e` option. The example above could be rewritten:
  {{{
   $ tracd -p 8080 -e /path/to
  }}}

  To exit the server on Windows, be sure to use {{{CTRL-BREAK}}} -- using {{{CTRL-C}}} will leave a Python process running in the background.

  == Installing as a Windows Service ==

  === Option 1 ===
  To install as a Windows service, get the [http://www.google.com/search?q=srvany.exe SRVANY] utility and run:
  {{{
   C:\path\to\instsrv.exe tracd C:\path\to\srvany.exe
   reg add HKLM\SYSTEM\CurrentControlSet\Services\tracd\Parameters /v Application /d "\"C:\path\to\python.exe\" \"C:\path\to\python\scripts\tracd-script.py\" <your tracd parameters>"
   net start tracd
  }}}

  '''DO NOT''' use {{{tracd.exe}}}.  Instead register {{{python.exe}}} directly with {{{tracd-script.py}}} as a parameter.  If you use {{{tracd.exe}}}, it will spawn the python process without SRVANY's knowledge.  This python process will survive a {{{net stop tracd}}}.

  If you want tracd to start automatically when you boot Windows, do:
  {{{
   sc config tracd start= auto
  }}}

  The spacing here is important.

  {{{#!div
  Once the service is installed, it might be simpler to run the Registry Editor rather than use the `reg add` command documented above.  Navigate to:[[BR]]
  `HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\tracd\Parameters`

  Three (string) parameters are provided:
  ||!AppDirectory ||C:\Python26\ ||
  ||Application ||python.exe ||
  ||!AppParameters ||scripts\tracd-script.py -p 8080 ... ||

  Note that, if the !AppDirectory is set as above, the paths of the executable ''and'' of the script name and parameter values are relative to the directory.  This makes updating Python a little simpler because the change can be limited, here, to a single point.
  (This is true for the path to the .htpasswd file, as well, despite the documentation calling out the /full/path/to/htpasswd; however, you may not wish to store that file under the Python directory.)
  }}}

  For Windows 7 User, srvany.exe may not be an option, so you can use [http://www.google.com/search?q=winserv.exe WINSERV] utility and run:
  {{{
  "C:\path\to\winserv.exe" install tracd -displayname "tracd" -start auto "C:\path\to\python.exe" c:\path\to\python\scripts\tracd-script.py <your tracd parameters>"

  net start tracd
  }}}

  === Option 2 ===

  Use [http://trac-hacks.org/wiki/WindowsServiceScript WindowsServiceScript], available at [http://trac-hacks.org/ Trac Hacks]. Installs, removes, starts, stops, etc. your Trac service.

  == Using Authentication ==

  Tracd provides support for both Basic and Digest authentication. Digest is considered more secure. The examples below use Digest; to use Basic authentication, replace `--auth` with `--basic-auth` in the command line.

  The general format for using authentication is:
  {{{
   $ tracd -p port --auth="base_project_dir,password_file_path,realm" project_path
  }}}
  where:
   * '''base_project_dir''': the base directory of the project specified as follows:
     * when serving multiple projects: ''relative'' to the `project_path`
     * when serving only a single project (`-s`): the name of the project directory
   Don't use an absolute path here as this won't work. ''Note:'' This parameter is case-sensitive even for environments on Windows.
   * '''password_file_path''': path to the password file
   * '''realm''': the realm name (can be anything)
   * '''project_path''': path of the project

   * **`--auth`** in the above means use Digest authentication, replace `--auth` with `--basic-auth` if you want to use Basic auth.  Although Basic authentication does not require a "realm", the command parser does, so the second comma is required, followed directly by the closing quote for an empty realm name.

  Examples:

  {{{
   $ tracd -p 8080 \
     --auth="project1,/path/to/passwordfile,mycompany.com" /path/to/project1
  }}}

  Of course, the password file can be be shared so that it is used for more than one project:
  {{{
   $ tracd -p 8080 \
     --auth="project1,/path/to/passwordfile,mycompany.com" \
     --auth="project2,/path/to/passwordfile,mycompany.com" \
     /path/to/project1 /path/to/project2
  }}}

  Another way to share the password file is to specify "*" for the project name:
  {{{
   $ tracd -p 8080 \
     --auth="*,/path/to/users.htdigest,mycompany.com" \
     /path/to/project1 /path/to/project2
  }}}

  === Basic Authorization: Using a htpasswd password file ===
  This section describes how to use `tracd` with Apache .htpasswd files.

  To create a .htpasswd file use Apache's `htpasswd` command (see [#GeneratingPasswordsWithoutApache below] for a method to create these files without using Apache):
  {{{
   $ sudo htpasswd -c /path/to/env/.htpasswd username
  }}}
  then for additional users:
  {{{
   $ sudo htpasswd /path/to/env/.htpasswd username2
  }}}

  Then to start `tracd` run something like this:
  {{{
   $ tracd -p 8080 --basic-auth="projectdirname,/fullpath/environmentname/.htpasswd,realmname" /fullpath/environmentname
  }}}

  For example:
  {{{
   $ tracd -p 8080 --basic-auth="testenv,/srv/tracenv/testenv/.htpasswd,My Test Env" /srv/tracenv/testenv
  }}}
  ''Note:'' You might need to pass "-m" as a parameter to htpasswd on some platforms (OpenBSD).

  === Digest authentication: Using a htdigest password file ===

  If you have Apache available, you can use the htdigest command to generate the password file. Type 'htdigest' to get some usage instructions, or read [http://httpd.apache.org/docs/2.0/programs/htdigest.html this page] from the Apache manual to get precise instructions.  You'll be prompted for a password to enter for each user that you create.  For the name of the password file, you can use whatever you like, but if you use something like `users.htdigest` it will remind you what the file contains. As a suggestion, put it in your <projectname>/conf folder along with the [TracIni trac.ini] file.

  Note that you can start tracd without the --auth argument, but if you click on the ''Login'' link you will get an error.

  === Generating Passwords Without Apache ===

  Basic Authorization can be accomplished via this [http://www.4webhelp.net/us/password.php online HTTP Password generator].  Copy the generated password-hash line to the .htpasswd file on your system.

  You can use this simple Python script to generate a '''digest''' password file:

  {{{
  #!python
  from optparse import OptionParser
  # The md5 module is deprecated in Python 2.5
  try:
      from hashlib import md5
  except ImportError:
      from md5 import md5
  realm = 'trac'

  # build the options
  usage = "usage: %prog [options]"
  parser = OptionParser(usage=usage)
  parser.add_option("-u", "--username",action="store", dest="username", type = "string",
                    help="the username for whom to generate a password")
  parser.add_option("-p", "--password",action="store", dest="password", type = "string",
                    help="the password to use")
  parser.add_option("-r", "--realm",action="store", dest="realm", type = "string",
                    help="the realm in which to create the digest")
  (options, args) = parser.parse_args()

  # check options
  if (options.username is None) or (options.password is None):
     parser.error("You must supply both the username and password")
  if (options.realm is not None):
     realm = options.realm
     
  # Generate the string to enter into the htdigest file
  kd = lambda x: md5(':'.join(x)).hexdigest()
  print ':'.join((options.username, realm, kd([options.username, realm, options.password])))
  }}}

  Note: If you use the above script you must set the realm in the `--auth` argument to '''`trac`'''. Example usage (assuming you saved the script as trac-digest.py):

  {{{
   $ python trac-digest.py -u username -p password >> c:\digest.txt
   $ tracd --port 8000 --auth=proj_name,c:\digest.txt,trac c:\path\to\proj_name
  }}}

  ==== Using `md5sum`
  It is possible to use `md5sum` utility to generate digest-password file:
  {{{
   $ printf "${user}:trac:${password}" | md5sum - >>user.htdigest
  }}}
  and manually delete " -" from the end and add "${user}:trac:" to the start of line from 'to-file'.

  == Reference ==

  Here's the online help, as a reminder (`tracd --help`):
  {{{
  Usage: tracd [options] [projenv] ...

  Options:
    --version             show program's version number and exit
    -h, --help            show this help message and exit
    -a DIGESTAUTH, --auth=DIGESTAUTH
                          [projectdir],[htdigest_file],[realm]
    --basic-auth=BASICAUTH
                          [projectdir],[htpasswd_file],[realm]
    -p PORT, --port=PORT  the port number to bind to
    -b HOSTNAME, --hostname=HOSTNAME
                          the host name or IP address to bind to
    --protocol=PROTOCOL   http|scgi|ajp
    -q, --unquote         unquote PATH_INFO (may be needed when using ajp)
    --http10              use HTTP/1.0 protocol version (default)
    --http11              use HTTP/1.1 protocol version instead of HTTP/1.0
    -e PARENTDIR, --env-parent-dir=PARENTDIR
                          parent directory of the project environments
    --base-path=BASE_PATH
                          the initial portion of the request URL's "path"
    -r, --auto-reload     restart automatically when sources are modified
    -s, --single-env      only serve a single project without the project list
  }}}

  == Tips ==

  === Serving static content ===

  If `tracd` is the only web server used for the project, 
  it can also be used to distribute static content 
  (tarballs, Doxygen documentation, etc.)

  This static content should be put in the `$TRAC_ENV/htdocs` folder,
  and is accessed by URLs like `<project_URL>/chrome/site/...`.

  Example: given a `$TRAC_ENV/htdocs/software-0.1.tar.gz` file,
  the corresponding relative URL would be `/<project_name>/chrome/site/software-0.1.tar.gz`, 
  which in turn can be written as `htdocs:software-0.1.tar.gz` (TracLinks syntax) or `[/<project_name>/chrome/site/software-0.1.tar.gz]` (relative link syntax). 

   ''Support for `htdocs:` TracLinks syntax was added in version 0.10''

  === Using tracd behind a proxy

  In some situations when you choose to use tracd behind Apache or another web server.

  In this situation, you might experience issues with redirects, like being redirected to URLs with the wrong host or protocol. In this case (and only in this case), setting the `[trac] use_base_url_for_redirect` to `true` can help, as this will force Trac to use the value of `[trac] base_url` for doing the redirects.

  If you're using the AJP protocol to connect with `tracd` (which is possible if you have flup installed), then you might experience problems with double quoting. Consider adding the `--unquote` parameter.

  See also [trac:TracOnWindowsIisAjp], [trac:TracNginxRecipe].

  === Serving a different base path than / ===
  Tracd supports serving projects with different base urls than /<project>. The parameter name to change this is
  {{{
   $ tracd --base-path=/some/path
  }}}

  ----
  See also: TracInstall, TracCgi, TracModPython, TracGuide, [trac:TracOnWindowsStandalone#RunningTracdasservice Running tracd.exe as a Windows service]


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, from within the Wiki markup, since version 0.10.

  == Definitions ==

  An InterTrac link can be seen as a scoped TracLinks.
  It is used for referring to a Trac resource 
  (Wiki page, changeset, ticket, ...) located in another
  Trac environment.

  == List of Active InterTrac Prefixes ==

  [[InterTrac]]

  == 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 TracLinks, of any flavor.

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

  If the InterTrac link is enclosed in square brackets (like `[th:WikiGoodiesPlugin]`), the InterTrac prefix is removed in the displayed link, like a normal link resolver would be (i.e. the above would be displayed as `WikiGoodiesPlugin`).

  For convenience, there's also some alternative short-hand form, 
  where one can use an alias as an immediate prefix 
  for the identifier of a ticket, changeset or report:
  (e.g. `#T234`, `[T1508]`, `[trac 1508]`, ...)

  == Examples ==

  It is necessary to setup a configuration for the InterTrac facility.
  This configuration has to be done in the TracIni file, `[intertrac]` section.

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

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

  The `.url` is mandatory and is used for locating the other Trac.
  This can be a relative URL in case that Trac environment is located 
  on the same server.

  The `.title` information will be used for providing an useful tooltip
  when moving the cursor over an InterTrac links.

  Finally, the `.compat` option can be used to activate or disable
  a ''compatibility'' mode:
   * If the targeted Trac is running a version below [trac:milestone:0.10 0.10] 
     ([trac:r3526 r3526] to be precise), then it doesn't know how to dispatch an InterTrac 
     link, and it's up to the local Trac to prepare the correct link. 
     Not all links will work that way, but the most common do. 
     This is called the compatibility mode, and is `true` by default. 
   * If you know that the remote Trac knows how to dispatch InterTrac links, 
     you can explicitly disable this compatibility mode and then ''any'' 
     TracLinks can become 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
     * Keys are case insensitive: `T:wiki:InterTrac` T:wiki:InterTrac
   * to the ticket #234:
     * `trac:ticket:234` trac:ticket:234
     * `trac:#234` trac:#234 
     * `#T234` #T234
   * to the changeset [1912]:
     * `trac:changeset:1912` trac:changeset:1912
     * `[T1912]` [T1912]
   * to the log range [3300:3330]: '''(Note: the following ones need `trac.compat=false`)'''
     * `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]` (''since 0.11; note that the ''remote'' Trac has to run 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) and for the rest (`intertrac_prefix:something`),
  we rely on the TracSearch#quickjump facility of the remote Trac.

  ----
  See also: TracLinks, InterWiki


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

  The Trac ticket database provides simple but effective tracking of issues and bugs within a project.

  As the central project management element of Trac, tickets are used for '''project tasks''', '''feature requests''', '''bug reports''' and '''software support issues'''. 

  As with the TracWiki, this subsystem has been designed with the goal of making user contribution and participation as simple as possible. It should be as easy as possible to report bugs, ask questions and suggest improvements.

  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.

  == Ticket Fields ==

  A  ticket contains the following information attributes:
   
   * '''Reporter''' — The author of the ticket.
   * '''Type''' — The nature of the ticket (for example, defect or enhancement request)

   * '''Component''' — The project module or subsystem this ticket concerns.
   * '''Version''' — Version of the project that this ticket pertains to.
   * '''Keywords''' — Keywords that a ticket is marked with.  Useful for searching and report generation.

   * '''Priority''' — The importance of this issue, ranging from ''trivial'' to ''blocker''.
   * '''Milestone''' — When this issue should be resolved at the latest.
   * '''Assigned to/Owner''' — Principal person responsible for handling the issue.
   * '''Cc''' — A comma-separated list of other users or E-Mail addresses to notify. ''Note that this does not imply responsiblity 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? One of {{{new}}}, {{{assigned}}}, {{{closed}}}, {{{reopened}}}.
   * '''Summary''' — A brief description summarizing the problem or issue.
   * '''Description''' — The body of the ticket. A good description should be specific, descriptive and to the point.

  '''Note:''' 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].

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

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

  == Changing and Commenting Tickets ==

  Once a ticket has been entered into Trac, you can at any time change the
  information by '''annotating''' the bug. This means 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.

  ''In the Trac project, we use ticket comments to discuss issues and tasks. This makes
  understanding the motivation behind a design- or implementation choice easier,
  when returning to it later.''

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

  '''Note:''' See TracNotification for how to configure email notifications of ticket changes.

  '''Note:''' 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 no owner for the component has been set''

  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 [trac:WebAdmin WebAdmin] plugin in the "Ticket System" section (others in the "trac.ini" section).  The default owner for a ticket will be the component owner, if that is set, or `default_owner`, if not.


  == 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 use the list of all users who have accessed the project to populate the drop-down field.

  To appear in the dropdown list, a user needs be registered with the project, ''i.e.'' a user session should exist in the database. Such an entry is automatically created in the database the first time the user submits a change in the project, for example when editing the user's details in the ''Settings'' page, or simply by authenticating if the user has a login. Also, the user must have `TICKET_MODIFY` [TracPermissions permissions].

  '''Note:''' See [http://pacopablo.com/wiki/pacopablo/blog/set-assign-to-drop-down Populating Assign To Drop Down] on how to add user entries at database level

  '''Note 2:''' If you need serious flexibility and aren't afraid of a little plugin coding of your own, see [http://trac-hacks.org/wiki/FlexibleAssignToPlugin FlexibleAssignTo] (disclosure: I'm the author)

  '''Note 3:''' 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 droplist
   * '''version''' — The version droplist
   * '''severity''' — The severity droplist
   * '''keywords''' — The keywords 
   * '''priority''' — The priority droplist
   * '''milestone''' — The milestone droplist
   * '''owner''' — The person responsible for the ticket
   * '''cc''' — The list of emails for notifying about the ticket change

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

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


name: TracRoadmap
author: trac
ipnr: 127.0.0.1
text:
  = The Trac Roadmap =
  [[TracGuideToc]]

  The roadmap provides a view on the [wiki:TracTickets ticket system] that helps planning and managing the future development of a project.

  == The Roadmap View ==

  Basically, the roadmap is just a list of future milestones. You can add a description to milestones (using WikiFormatting) describing main objectives, for example. In addition, tickets targeted for a milestone are aggregated, and the ratio between active and resolved tickets is displayed as a milestone progress bar.  It is possible to further [trac:TracRoadmapCustomGroups customise the ticket grouping] and have multiple ticket statuses shown on the progress bar.

  The roadmap can be filtered to show or hide ''completed milestones'' and ''milestones with no due date''. In the case that both ''show completed milestones'' and ''hide milestones with no due date'' are selected, ''completed'' milestones with no due date __will__ be shown.

  == The Milestone View ==

  You can add a description for each milestone (using WikiFormatting) describing main objectives, for example. In addition, tickets targeted for a milestone are aggregated, and the ratio between active and resolved tickets is displayed as a milestone progress bar.  It is possible to further [trac:TracRoadmapCustomGroups customise the ticket grouping] and have multiple ticket statuses shown on the progress bar.

  It is possible to drill down into this simple statistic by viewing the individual milestone pages. By default, the active/resolved ratio will be grouped and displayed by component. You can also regroup the status by other criteria, such as ticket owner or severity. Ticket numbers are linked to [wiki:TracQuery custom queries] listing corresponding tickets.

  == Roadmap Administration ==

  With appropriate permissions it is possible to add, modify and remove milestones using either the web interface (roadmap and milestone pages), web administration interface or by using `trac-admin`. 

  '''Note:''' Milestone descriptions can not currently be edited using 'trac-admin'.

  == iCalendar Support ==

  The Roadmap supports the [http://www.ietf.org/rfc/rfc2445.txt iCalendar] format to keep track of planned milestones and related tickets from your favorite calendar software. Many calendar applications support the iCalendar specification including
   * [http://www.apple.com/ical/ Apple iCal] for Mac OS X
   * the cross-platform [http://www.mozilla.org/projects/calendar/ Mozilla Calendar]
   * [http://chandlerproject.org Chandler]
   * [http://kontact.kde.org/korganizer/ Korganizer] (the calendar application of the [http://www.kde.org/ KDE] project)
   * [http://www.novell.com/de-de/products/desktop/features/evolution.html Evolution] also support iCalendar
   * [http://office.microsoft.com/en-us/outlook/ Microsoft Outlook] can also read iCalendar files (it appears as a new static calendar in Outlook)

  To subscribe to the roadmap, copy the iCalendar link from the roadmap (found at the bottom of the page) and choose the "Subscribe to remote calendar" action (or similar) of your calendar application, and insert the URL just copied.

  '''Note:''' For tickets to be included in the calendar as tasks, you need to be logged in when copying the link. You will only see tickets assigned to yourself, and associated with a milestone.

  More information about iCalendar can be found at [http://en.wikipedia.org/wiki/ICalendar Wikipedia].
  ----
  See also: TracTickets, TracReports, TracQuery, [trac:TracRoadmapCustomGroups TracRoadmapCustomGroups]


name: TracTicketsCustomFields
author: trac
ipnr: 127.0.0.1
text:
  = Custom Ticket Fields =
  Trac supports adding custom, user-defined fields to the ticket module. Using 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. (Determines relative placement in forms with respect to other custom fields.)
     * format: Either `plain` for plain text or `wiki` to interpret the content as WikiFormatting. (''since 0.11.3'')
   * '''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.
     * rows: Height in lines.
     * order: Sort order placement.
     * format: Either `plain` for plain text or `wiki` to interpret the content as WikiFormatting. (''since 0.11.3'')

  === Sample Config ===
  {{{
  [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
  }}}

  ''Note: To make entering an option for 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''' that this will only show tickets that have progress set in them, which 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. If that's all you want, you're set.

  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.

  === Updating the database ===

  As noted above, any tickets created before a custom field has been defined will not have a value for that field. Here's a bit of SQL (tested with SQLite) that you can run directly on the Trac database to set an initial value for custom ticket fields. Inserts the default value of 'None' into a custom field called 'request_source' for all tickets that have no existing value:

  {{{
  #!sql
  INSERT INTO ticket_custom
     (ticket, name, value)
     SELECT 
        id AS ticket,
        'request_source' AS name,
        'None' AS value
     FROM ticket 
     WHERE id NOT IN (
        SELECT ticket FROM ticket_custom
     );
  }}}

  If you added multiple custom fields at different points in time, you should be more specific in the subquery on table {{{ticket}}} by adding the exact custom field name to the query:

  {{{
  #!sql
  INSERT INTO ticket_custom
     (ticket, name, value)
     SELECT 
        id AS ticket,
        'request_source' AS name,
        'None' AS value
     FROM ticket 
     WHERE id NOT IN (
        SELECT ticket FROM ticket_custom WHERE name = 'request_source'
     );
  }}}

  ----
  See also: TracTickets, TracIni


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.

  Permission privileges are managed using the [TracAdmin trac-admin] tool or (new in version 0.11) 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 the `[trac] permission_policies` configuration entry in the TracIni. 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 the privileges 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 ==
  ''This feature is new in version 0.11.''

  To access this tab, a user must have `TRAC_ADMIN privileges`. This can be performed as follows (more on the trac-admin script below):
  {{{
    $ trac-admin /path/to/projenv permission add bob TRAC_ADMIN
  }}}

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

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

  An easy way to quickly secure a new Trac install is to run the above command on the anonymous user, install the [http://trac-hacks.org/wiki/AccountManagerPlugin AccountManagerPlugin], create a new admin account graphically and then remove the TRAC_ADMIN permission from the anonymous user.

  == 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 [wiki:TracBrowser repository browser] ||
  || `LOG_VIEW` || View revision logs of files and directories in the [wiki:TracBrowser repository browser] ||
  || `FILE_VIEW` || View files in the [wiki:TracBrowser repository browser] ||
  || `CHANGESET_VIEW` || View [wiki:TracChangeset repository check-ins] ||

  === Ticket System ===

  || `TICKET_VIEW` || View existing [wiki:TracTickets tickets] and perform [wiki:TracQuery ticket queries] ||
  || `TICKET_CREATE` || Create new [wiki:TracTickets tickets] ||
  || `TICKET_APPEND` || Add comments or attachments to [wiki:TracTickets tickets] ||
  || `TICKET_CHGPROP` || Modify [wiki:TracTickets ticket] properties (priority, assignment, keywords, etc.) with the following exceptions: edit description field, add/remove other users from cc field when logged in, and set email to pref ||
  || `TICKET_MODIFY` || Includes both `TICKET_APPEND` and `TICKET_CHGPROP`, and in addition allows resolving [wiki:TracTickets tickets]. Tickets can be assigned to users through a [TracTickets#Assign-toasDrop-DownList drop-down list] when the list of possible owners has been restricted. ||
  || `TICKET_EDIT_CC` || Full modify cc field ||
  || `TICKET_EDIT_DESCRIPTION` || Modify description field ||
  || `TICKET_EDIT_COMMENT` || Modify comments ||
  || `TICKET_ADMIN` || All `TICKET_*` permissions, plus the deletion of ticket attachments and modification of the reporter and description fields. It also allows managing ticket properties in the WebAdmin panel. ||

  Attention: the "view tickets" button appears with the `REPORT_VIEW` permission.

  === Roadmap ===

  || `MILESTONE_VIEW` || View milestones and assign tickets to milestones. ||
  || `MILESTONE_CREATE` || Create a new milestone ||
  || `MILESTONE_MODIFY` || Modify existing milestones ||
  || `MILESTONE_DELETE` || Delete milestones ||
  || `MILESTONE_ADMIN` || All `MILESTONE_*` permissions ||
  || `ROADMAP_VIEW` || View the [wiki:TracRoadmap roadmap] page, 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 [wiki:TracReports reports], i.e. the "view tickets" link. ||
  || `REPORT_SQL_VIEW` || View the underlying SQL query of a [wiki:TracReports report] ||
  || `REPORT_CREATE` || Create new [wiki:TracReports reports] ||
  || `REPORT_MODIFY` || Modify existing [wiki:TracReports reports] ||
  || `REPORT_DELETE` || Delete [wiki:TracReports reports] ||
  || `REPORT_ADMIN` || All `REPORT_*` permissions ||

  === Wiki System ===

  || `WIKI_VIEW` || View existing [wiki:TracWiki wiki] pages ||
  || `WIKI_CREATE` || Create new [wiki:TracWiki wiki] pages ||
  || `WIKI_MODIFY` || Change [wiki:TracWiki wiki] pages ||
  || `WIKI_RENAME` || Rename [wiki:TracWiki wiki] pages ||
  || `WIKI_DELETE` || Delete [wiki: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 [wiki:TracTimeline timeline] page ||
  || `SEARCH_VIEW` || View and execute [wiki:TracSearch search] queries ||
  || `CONFIG_VIEW` || Enables additional pages on ''About Trac'' that show the current configuration or the list of installed plugins ||
  || `EMAIL_VIEW` || Shows email addresses even if [trac:wiki:0.11/TracIni trac show_email_addresses configuration option is false] ||

  == Creating New Privileges ==

  To create custom permissions, for example to be used in a custom workflow, enable the optional `tracopt.perm.config_perm_provider.ExtraPermissionsProvider` component in the "Plugins" admin panel, and add the desired permissions to the `[extra-permissions]` section in your [wiki:TracIni#extra-permissions-section trac.ini]. For more information, please refer to the documentation of the component in the admin panel.

  == Granting Privileges ==

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

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

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

  Or add all privileges:
  {{{
    $ 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.
  {{{
    $ 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)
  {{{ 
     $ 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:
  {{{
    $ 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:
  {{{
    $ trac-admin /path/to/projenv permission remove bob '*'
  }}}

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

  == 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, TracGuide and TracFineGrainedPermissions


name: SandBox
author: trac
ipnr: 127.0.0.1
text:
  = The Sandbox =

  This is just a page to practice and learn WikiFormatting. 

  Go ahead, edit it freely.


name: TracCgi
author: trac
ipnr: 127.0.0.1
text:
  = Installing Trac as CGI =

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

  CGI script is the entrypoint that web-server calls when a web-request to an application is made. To generate the `trac.cgi` script run:
  {{{
  trac-admin /path/to/env deploy /path/to/www/trac
  }}}
  `trac.cgi` will be in the `cgi-bin` folder inside the given path. Make sure it is executable by your web server. This command also copies `static resource` files to a `htdocs` directory of a given destination.

  == 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 an URL to the `trac.cgi` script (recommended)
   2. 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:
  {{{
  ScriptAlias /trac /path/to/www/trac/cgi-bin/trac.cgi
  }}}

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

  If you're using Trac with a single project you need to set its location using the `TRAC_ENV` environment variable:
  {{{
  <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:
  {{{
  <Location "/trac">
    SetEnv TRAC_ENV_PARENT_DIR "/path/to/project/parent/dir"
  </Location>
  }}}

   ''Note that the `SetEnv` directive requires enabled `mod_env` module. It is also possible to set TRAC_ENV in trac.cgi. Just add the following code between "try:" and "from trac.web ...":''

  {{{
      import os
      os.environ['TRAC_ENV'] = "/path/to/projectenv"
  }}}

   '' Or for TRAC_ENV_PARENT_DIR: ''

  {{{
      import os
      os.environ['TRAC_ENV_PARENT_DIR'] = "/path/to/project/parent/dir"
  }}}

  If you are using the [http://httpd.apache.org/docs/suexec.html Apache suEXEC] feature please see [http://trac.edgewall.org/wiki/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).

  == Mapping Static Resources ==

  Out of the box, Trac will pass static resources such as style sheets or images through itself. For a CGI setup this is '''highly undesirable''', because this way CGI script is invoked for documents that could be much more efficiently served directly by web server.

  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 the layout of the servers file system. We already used this capability by defining a `ScriptAlias` for the CGI script. We also can map requests for static resources directly to the directory on the file system, avoiding processing these requests by CGI script.

  There are two primary URL paths for static resources - `/chrome/common` and `/chrome/site`. Plugins can add their own resources usually accessible by `/chrome/plugin` path, so its important to override only known paths and not try to make universal `/chrome` alias for everything.

  Add the following snippet to Apache configuration '''before''' the `ScriptAlias` for the CGI script, changing paths to match your deployment:
  {{{
  Alias /trac/chrome/common /path/to/trac/htdocs/common
  Alias /trac/chrome/site /path/to/trac/htdocs/site
  <Directory "/path/to/www/trac/htdocs">
    Order allow,deny
    Allow from all
  </Directory>
  }}}

  If using mod_python, you might want to add this too (otherwise, the alias will be ignored):
  {{{
  <Location "/trac/chrome/common/">
    SetHandler None
  </Location>
  }}}

  Note that we mapped `/trac` part of the URL to the `trac.cgi` script, and the path `/chrome/common` is the path you have to append to that location to intercept requests to the static resources. 

  For example, if Trac is mapped to `/cgi-bin/trac.cgi` on your server, the URL of the Alias should be `/cgi-bin/trac.cgi/chrome/common`.

  Similarly, if you have static resources in a project's htdocs directory (which is referenced by /chrome/site URL in themes), you can configure Apache to serve those resources (again, put this '''before''' the `ScriptAlias` for the CGI script, and adjust names and locations to match your installation):

  {{{
  Alias /trac/chrome/site /path/to/projectenv/htdocs
  <Directory "/path/to/projectenv/htdocs">
    Order allow,deny
    Allow from all
  </Directory>
  }}}

  Alternatively to hacking `/trac/chrome/site`, you can directly specify path to static resources using `htdocs_location` configuration option in [wiki:TracIni trac.ini]:
  {{{
  [trac]
  htdocs_location = http://yourhost.example.org/trac-htdocs
  }}}

  Trac will then use this URL when embedding static resources into HTML pages. Of course, you still need to make the Trac `htdocs` 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:
  {{{
  $ ln -s /path/to/www/trac/htdocs /var/www/yourhost.example.org/trac-htdocs
  }}}

  Note that in order to get this `htdocs` directory, you need first to extract the relevant Trac resources using the `deploy` command of TracAdmin:
  [[TracAdminHelp(deploy)]]


  == Adding Authentication ==

  The simplest way to enable authentication with Apache is to create a password file. Use the `htpasswd` program to create the password file:
  {{{
  $ 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 dont need the "-c" option anymore:
  {{{
  $ 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'll need to enable authentication against the password file in the Apache configuration:
  {{{
  <Location "/trac/login">
    AuthType Basic
    AuthName "Trac"
    AuthUserFile /somewhere/trac.htpasswd
    Require valid-user
  </Location>
  }}}

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

  For better security, it is recommended that you either enable SSL or at least use the “digest” authentication scheme instead of “Basic”. Please read the [http://httpd.apache.org/docs/2.0/ Apache HTTPD documentation] to find out more. For example, on a Debian 4.0r1 (etch) system the relevant section  in apache configuration can look like this:
  {{{
  <Location "/trac/login">
      LoadModule auth_digest_module /usr/lib/apache2/modules/mod_auth_digest.so
      AuthType Digest
      AuthName "trac"
      AuthDigestDomain /trac
      AuthUserFile /somewhere/trac.htpasswd
      Require valid-user
  </Location>
  }}}
  and you'll have to create your .htpasswd file with htdigest instead of htpasswd as follows:
  {{{
  # htdigest /somewhere/trac.htpasswd trac admin
  }}}
  where the "trac" parameter above is the same as !AuthName above  ("Realm" in apache-docs). 

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


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 (Really Simple Syndication) XML format.
  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'''.[[br]]Monitor overall project progress in your favorite RSS reader.
   * TracTickets, TracReports, and TracQuery — Allows syndication of report and ticket query results.[[br]]Be notified about important and relevant issue tickets.
   * TracBrowser and TracRevisionLog — Syndication of file changes.[[br]]Stay up to date with changes to a specific file or directory.

  == How to access RSS data ==
  Anywhere in Trac where RSS is available, you should find a small orange '''XML''' icon, typically placed at the bottom of the page. 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''.

  == 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://pim.kde.org/users.php — [http://kde.org KDE] RSS Reader for Linux/BSD/*n*x systems
     * http://liferea.sourceforge.net/ — Open source GTK2 RSS Reader for Linux
     * http://akregator.sourceforge.net/ — 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 pay 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
     * http://www.mesadynamics.com/Tickershock.html — Non-intrusive "news ticker" style RSS reader for Mac OS X

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

   * ''Firefox:''
     * http://www.mozilla.org/products/firefox/ — Mozilla Firefox supports [http://www.mozilla.org/products/firefox/live-bookmarks.html live bookmarks] using RSS
     * http://sage.mozdev.org — Sage RSS and Atom feed aggregator for Mozilla Firefox
     * http://www.wizzrss.com/Welcome.php — WizzRSS Feed Reader for Firefox

  ----
  See also: TracGuide, TracTimeline, TracReports, TracBrowser


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]:''
    {{{
    [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 changed to be sorted by any column simply by clicking the column header. 

  If a column header is a hyperlink (red), click the column you would like to sort by. Clicking the same header again reverses the order.

  == 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 ''(since 0.10)'':
   * 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:
  {{{
  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, since that's managed by SQLite someplace).

  You may also need to update or remove the report number stored in the report or query.

  == 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'' links just below the main menu bar, 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, as would happen if you were navigating a list of tickets obtained from a query (see TracQuery#NavigatingTickets). ''(since 0.11)''

  == Alternative Download Formats ==
  Aside from the default HTML view, reports can also be exported in a number of alternative formats.
  At the bottom of the report page, you will find a list of available data formats. Click the desired link to 
  download the alternative report 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.''

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

  === Using Variables in a Query ===
  The syntax for dynamic variables is simple, any upper case word beginning with '$' is considered a variable.

  Example:
  {{{
  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 '$'.

  Example:
  {{{
   http://trac.edgewall.org/reports/14?PRIORITY=high
  }}}

  To use multiple variables, separate them with an '&'.

  Example:
  {{{
   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''):
  {{{
  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'll use
  specialized SQL statements to control the output of the Trac report engine.

  == Special Columns ==
  To format reports, TracReports looks 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)
   * '''created, modified, date, time''' — Format cell as a date and/or time.
   * '''description''' — Ticket description field, parsed through the wiki engine.

  '''Example:'''
  {{{
  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:wiki/CookBook/Configuration/Reports for some example of creating reports for realms other than ''ticket''.

  === Custom formatting columns ===
  Columns whose names begin and end with 2 underscores (Example: '''`__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:7.5em">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 for the current row. 

  '''Example:''' ''List active tickets, grouped by milestone, group header linked to milestone page, colored by priority''
  {{{
  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:''' A 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's
  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''

  {{{
  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 custom fields to your tickets (a feature since v0.8, see TracTicketsCustomFields), you can write a SQL query to cover them. You'll need to make a join on the ticket_custom table, but this isn't especially easy.

  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.

  '''Note that you need to set up permissions in order to see the buttons for adding or editing reports.'''

  ----
  See also: TracTickets, TracQuery, TracGuide, [http://www.sqlite.org/lang_expr.html Query Language Understood by SQLite]


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

  The timeline provides a historic view of the project in a single report.

  It lists all Trac events that have occurred in chronological order, 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''' — Creation and changes
   * '''Ticket events''' — Creation and resolution/closing (and optionally other changes)
   * '''Source code changes ''' — Repository check-ins
   * '''Milestone ''' — Milestone completed

  Each event entry provides a hyperlink to the specific event in question, who authored the change as well as
  a brief excerpt of the actual comment or text, if available.

  It is possible to filter the displayed events with the various filters in the option 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 that 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. ''(since 0.12)''
   * ''Changesets in all repositories'' — if you have more than one repository connected to your Trac project, then you can filter the output so events from specific repositories are not shown. ''(since 0.12)''
   * ''Milestones reached'' — display or hide milestones reached.
   * ''Opened and closed tickets'' — display or hide ticket open or close events.
   * ''Wiki changes'' — display or hide Wiki change events.

  See !TracIni's [wiki:TracIni#timeline-section "[timeline] section"] for timeline configuration options.

  == 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: TracGuide, TracIni, TracWiki, WikiFormatting, TracRss, TracNotification


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

  The Trac issue database provides a configurable workflow.

  == The Default Ticket Workflow ==
  === Environments upgraded from 0.10 ===
  When you run `trac-admin <env> upgrade`, your `trac.ini` will be modified to include a `[ticket-workflow]` section.
  The workflow configured in this case is the original workflow, so that ticket actions will behave like they did in 0.10.

  Graphically, that looks like this:

  [[Image(htdocs:../common/guide/original-workflow.png)]]

  There are some significant "warts" in this; such as accepting a ticket sets it to 'assigned' state, and assigning a ticket sets it to 'new' state.  Perfectly obvious, right?
  So you will probably want to migrate to "basic" workflow; [trac:source:trunk/contrib/workflow/migrate_original_to_basic.py contrib/workflow/migrate_original_to_basic.py] may be helpful.

  === Environments created with 0.11 ===
  When a new environment is created, a default workflow is configured in your trac.ini.  This workflow is the basic workflow (described in `basic-workflow.ini`), which is somewhat different from the workflow of the 0.10 releases.

  Graphically, it looks like this:

  [[Image(htdocs:../common/guide/basic-workflow.png)]]

  == Additional Ticket Workflows ==

  There are several example workflows provided in the Trac source tree; look in [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 [http://trac.edgewall.org/wiki/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.

  Create a `[ticket-workflow]` section in `trac.ini`.
  Within this section, each entry is an action that may be taken on a ticket. 
  For example, consider the `accept` action from `simple-workflow.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 what permissions the user must have to use this action.
  The `accept.operations` line specifies changes that will be made to the ticket in addition to the status change when this 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 -- Clear the owner field.
   - set_owner -- Sets the owner to the selected or entered owner.
     - ''actionname''`.set_owner` may optionally be set to a comma delimited list or a single value.
   - set_owner_to_self -- Sets the owner to the logged in user.
   - 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:

  resolve_new = new -> closed
  resolve_new.name = 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.
  '''Note:''' Specifying conflicting operations (such as `set_owner` and `del_owner`) has unspecified results.

  {{{
  resolve_accepted = accepted -> closed
  resolve_accepted.name = resolve
  resolve_accepted.permissions = TICKET_MODIFY
  resolve_accepted.operations = set_resolution
  }}}

  In this example, we see the `.name` attribute used.  The action here is `resolve_accepted`, but it will be presented to the user as `resolve`.

  For actions that should be available in all states, `*` may be used in place of the state.  The obvious example is the `leave` action:
  {{{
  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 are a couple of hard-coded constraints to the workflow.  In particular, tickets are created with status `new`, and tickets are expected to have a `closed` state.  Further, the default reports/queries treat any state other than `closed` as an open state.

  While creating or modifying a ticket workfow, `contrib/workflow/workflow_parser.py` may be useful.  It can create `.dot` files that [http://www.graphviz.org GraphViz] understands to provide a visual description of the workflow.

  This can be done as follows (your install path may be different).
  {{{
  cd /var/local/trac_devel/contrib/workflow/
  sudo ./showworkflow /srv/trac/PlannerSuite/conf/trac.ini
  }}}
  And then open up the resulting `trac.pdf` file created by the script (it will be in the same directory as the `trac.ini` file).

  An online copy of the workflow parser is available at http://foss.wush.net/cgi-bin/visual-workflow.pl

  After you have changed a workflow, you need to restart apache for the changes to take effect. This is important, because the changes will still show up when you run your script, but all the old workflow steps will still be there until the server is restarted.

  == Example: Adding optional Testing with Workflow ==

  By adding the following to your [ticket-workflow] section of trac.ini you get optional testing.  When the ticket is in new, accepted or needs_work status 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 gets 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.

  {{{
  testing = new,accepted,needs_work,assigned,reopened -> testing
  testing.name = Submit to reporter for testing
  testing.permissions = TICKET_MODIFY

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

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

  === How to combine the `tracopt.ticket.commit_updater` with the testing workflow ===

  The [[source:trunk/tracopt/ticket/commit_updater.py|tracopt.ticket.commit_updater]] is the optional component that [[TracRepositoryAdmin#trac-post-commit-hook|replaces the old trac-post-commit-hook]], in Trac 0.12.

  By default it reacts on some keywords found in changeset message logs like ''close'', ''fix'' etc. and performs the corresponding workflow action.

  If you have a more complex workflow, like the testing stage described above and you want the ''closes'' keyword to move the ticket to the ''testing'' status instead of the ''closed'' status, you need to adapt the code a bit. 

  Have a look at the [[0.11/TracWorkflow#How-ToCombineSVNtrac-post-commit-hookWithTestWorkflow|Trac 0.11 recipe]] for the `trac-post-commit-hook`, this will give you some ideas about how to modify the component.

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

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

  Then, to integrate this with the default Trac 0.11 workflow, you also need to add the `reviewing` state to the `accept` and `resolve` actions, like so:

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

  {{{
  reassign_reviewing = reviewing -> *
  reassign_reviewing.name = reassign review
  reassign_reviewing.operations = set_owner
  reassign_reviewing.permissions = TICKET_MODIFY
  }}}

  The full `[ticket-workflow]` configuration will thus look like this:

  {{{
  [ticket-workflow]
  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,reopened -> new
  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.name = reassign review
  reassign_reviewing.permissions = TICKET_MODIFY
  }}}

  == Example: Limit the resolution options for a new ticket ==

  The above resolve_new operation allows you to set the possible resolutions for a new ticket.  By modifying the existing resolve action and removing the new status from before the `->` we then get two resolve actions.  One with limited resolutions for new tickets, and then the regular one once a ticket is accepted.

  {{{
  resolve_new = new -> closed
  resolve_new.name = resolve
  resolve_new.operations = set_resolution
  resolve_new.permissions = TICKET_MODIFY
  resolve_new.set_resolution = invalid,wontfix,duplicate

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

  == Advanced Ticket Workflow Customization ==

  If the customization above is not extensive enough for your needs, you can extend the workflow using plugins.  These 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 simple 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.

  == 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 [TracIni#milestone-groups-section TracIni].

  == some ideas for next steps ==

  New enhancement ideas for the workflow system should be filed as enhancement tickets against the `ticket system` component.  If desired, add a single-line link to that ticket here.  Also look at the [th:wiki:AdvancedTicketWorkflowPlugin] as it provides experimental operations.

  If you have a response to the comments below, create an enhancement ticket, and replace the description below with a link to the ticket.

   * the "operation" could be on the nodes, possible operations are:
     * '''preops''': automatic, before entering the state/activity
     * '''postops''': automatic, when leaving the state/activity
     * '''actions''': can be chosen by the owner in the list at the bottom, and/or drop-down/pop-up together with the default actions of leaving the node on one of the arrows.
  ''This appears to add complexity without adding functionality; please provide a detailed example where these additions allow something currently impossible to implement.''

   * operations could be anything: sum up the time used for the activity, or just write some statistical fields like 
  ''A workflow plugin can add an arbitrary workflow operation, so this is already possible.''

   * set_actor should be an operation allowing to set the owner, e.g. as a "preop":
     * either to a role, a person
     * entered fix at define time, or at run time, e.g. out of a field, or select.
  ''This is either duplicating the existing `set_owner` operation, or needs to be clarified.''

   * Actions should be selectable based on the ticket type (different Workflows for different tickets)
  ''Look into the [th:wiki:AdvancedTicketWorkflowPlugin]'s `triage` operation.''


name: TracInterfaceCustomization
author: trac
ipnr: 127.0.0.1
text:
  = Customizing the Trac Interface =
  [[TracGuideToc]]

  == Introduction ==
  This page is meant to give users suggestions on how they can customize the look of Trac.  Topics on this page cover editing the HTML templates and CSS files, but not the program code itself.  The topics are intended to 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 [wiki:TracIni trac.ini].

  The logo or icon image should be put in a folder named "htdocs" in your project's environment folder.  (''Note: in projects created with a Trac version prior to 0.9 you will need to create this folder'')

   ''Note: you can actually put the logo and icon anywhere on your server (as long as it's accessible through the web server), and use their absolute or server-relative URLs in the configuration.''

  Now configure the appropriate section of your [wiki:TracIni 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 ones). Note that 'site/' is not a placeholder for your project name, it is the actual prefix that should be used (literally). 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'.

  {{{
  [header_logo]
  src = site/my_logo.gif
  alt = My Project
  width = 300
  height = 100
  }}}

  === Icon ===
  Icons should be a 16x16 image in `.gif` or `.ico` format.  Change the `icon` setting to `site/` followed by the name of your icon file.  Icons will typically be displayed by your web browser next to the site's URL and in the `Bookmarks` menu.

  {{{
  [project]
  icon = site/my_icon.ico
  }}}

  Note though that this icon is ignored by Internet Explorer, which only accepts a file named ``favicon.ico`` at the root of the host. To make the project icon work in both IE and other browsers, you can store the icon in the document root of the host, and reference it from ``trac.ini`` as follows:

  {{{
  [project]
  icon = /favicon.ico
  }}}

  Should your browser have issues with your favicon showing up in the address bar, you may put a "?" (less the quotation marks) after your favicon file extension. 

  {{{
  [project]
  icon = /favicon.ico?
  }}}

  == Custom Navigation Entries ==
  The new [mainnav] and [metanav] can now be used to customize the text and link used for the navigation items, or even to disable them (but not for adding new ones).

  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 .
  {{{
  [mainnav]
  wiki.label = Home
  tickets.href = /report/24

  [metanav]
  help = disabled
  }}}

  See also TracNavigation for a more detailed explanation of the mainnav and metanav terms.

  == Site Appearance == #SiteAppearance

  Trac is using [http://genshi.edgewall.org Genshi] as the templating engine. Documentation is yet to be written, in the meantime the following tip should work.

  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), e.g. {{{/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" type="text/css"
            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>
  }}}

  Those who are familiar with XSLT may notice that Genshi templates bear some similarities. However, there are some Trac specific features - for example '''${href.chrome('site/style.css')}''' attribute references template placed into environment's ''htdocs/''  In a similar fashion '''${chrome.htdocs_location}''' is used to specify common ''htdocs/'' directory from Trac installation.

  `site.html` is one file to contain all your modifications. It usually works by the py:match (element or attribute), and it allows you to modify the page as it renders - the matches hook onto specific sections depending on what it tries to find
  and modify them.
  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 such py:match sections for whatever you need to modify. This is all [http://genshi.edgewall.org/ Genshi], so the docs on the exact syntax can be found there.


  Example snippet of adding introduction text to the new ticket form (hide when preview):

  {{{
  #!xml
  <form py:match="div[@id='content' and @class='ticket']/form" py:attrs="select('@*')">
    <py:if test="req.environ['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.environ['PATH_INFO']`''' to limit scope of changes to one view only. For instance, to make changes in site.html only for timeline and avoid modifying other sections - use  ''`req.environ['PATH_INFO'] == '/timeline'`'' condition in <py:if> test.

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

  If the environment is upgraded from 0.10 and a `site_newticket.cs` file already exists, it can actually be loaded by using a workaround - providing it contains no ClearSilver processing. In addition, as only one element can be imported, the content needs some sort of wrapper such as a `<div>` block or other similar parent container. The XInclude namespace must be specified to allow includes, but that can be moved to document root along with the others:
  {{{
  #!xml
  <form py:match="div[@id='content' and @class='ticket']/form" py:attrs="select('@*')"
          xmlns:xi="http://www.w3.org/2001/XInclude">
    <py:if test="req.environ['PATH_INFO'] == '/newticket' and (not 'preview' in req.args)"> 
      <xi:include href="site_newticket.cs"><xi:fallback /></xi:include>
    </py:if>
    ${select('*')} 
  </form>
  }}}

  Also note that the `site.html` (despite its name) can be put in a common templates directory - see the `[inherit] templates_dir` option. This could provide easier maintainence (and a migration path from 0.10 for larger installations) as one new global `site.html` file can be made to include any existing header, footer and newticket snippets.

  == 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 (pls verify ... not yet changed to 0.11):

  For [wiki:TracModWSGI mod_wsgi]:
  {{{
  os.environ['TRAC_ENV_INDEX_TEMPLATE'] = '/path/to/template'
  }}}

  For [wiki:TracFastCgi FastCGI]:
  {{{
  FastCgiConfig -initial-env TRAC_ENV_PARENT_DIR=/parent/dir/of/projects \
                -initial-env TRAC_ENV_INDEX_TEMPLATE=/path/to/template
  }}}

  For [wiki:TracModPython mod_python]:
  {{{
  PythonOption TracEnvParentDir /parent/dir/of/projects
  PythonOption TracEnvIndexTemplate /path/to/template
  }}}

  For [wiki:TracCgi CGI]:
  {{{
  SetEnv TRAC_ENV_INDEX_TEMPLATE /path/to/template
  }}}

  For [wiki: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 (that is, instance of a project) can be customized independently of other projects, even those hosted by the same server. The recommended way is to use a `site.html` template (see [#SiteAppearance]) whenever possible. Using `site.html` means changes are made to the original templates as they are rendered, and you should not normally need to redo modifications whenever Trac is upgraded. If you do make a copy of `theme.html` or any other Trac template, you need to migrate your modifiations to the newer version - if not, new Trac features or bug fixes may not work as expected.

  With that word of caution, any Trac template may be copied and customized. The default Trac templates are located inside the installed Trac egg (`/usr/lib/pythonVERSION/site-packages/Trac-VERSION.egg/trac/templates, .../trac/ticket/templates, .../trac/wiki/templates, ++`). The [#ProjectList] template file is called `index.html`, while the template responsible for main layout is called `theme.html`. Page assets such as images and CSS style sheets are located in the egg's `trac/htdocs` directory.

  However, do not edit templates or site resources inside the Trac egg - installing Trac again can completely delete your modifications. Instead use one of two 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 `[inherit] templates_dir =` trac.ini 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.

  Trac caches templates in memory by default to improve performance. To apply a template you need to restart the server.

  ----
  See also TracGuide, TracIni


name: PageTemplates
author: trac
ipnr: 127.0.0.1
text:
  = Wiki Page Templates = 

    ''(since [http://trac.edgewall.org/milestone/0.11 0.11])''

  The default content for a new wiki page can be chosen from a list of page templates. 

  That list is made up from all the existing 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's actually no wiki pages matching that prefix, the initial content will always be the blank page and the list selector will not be shown (i.e. this matches the behavior we had up to now).

  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 you have created your new template, a drop-down selection box will automatically appear on any new wiki pages that are created.  By default it is located on the right side of the 'Create this page' button.

  Available templates: 
  [[TitleIndex(PageTemplates/)]]
  ----
  See also: TracWiki


name: TracImport
author: trac
ipnr: 127.0.0.1
text:
  = Importing ticket data =

  == Bugzilla ==

  Ticket data can be imported from Bugzilla using the [http://trac.edgewall.org/browser/trunk/contrib/bugzilla2trac.py bugzilla2trac.py] script, available in the contrib/ directory of the Trac distribution.

  {{{
  $ 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 a htpasswd file)

  The script provides a number of features to ease the conversion, such as:

    * PRODUCT_KEYWORDS:  Trac doesn't have the 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.

  == Sourceforge ==

  Ticket data can be imported from Sourceforge using the [http://trac.edgewall.org/browser/trunk/contrib/sourceforge2trac.py sourceforge2trac.py] script, available in the contrib/ directory of the Trac distribution.

  See #Trac3521 for an updated sourceforge2trac script.

  == Mantis ==

  The mantis2trac script now lives at http://trac-hacks.org/wiki/MantisImportScript. You can always get the latest version from http://trac-hacks.org/changeset/latest/mantisimportscript?old_path=/&filename=mantisimportscript&format=zip

  Mantis bugs can be imported using the attached script.

  Currently, the following data is imported from Mantis:
    * bugs
    * bug comments
    * bug activity (field changes)
    * attachments (as long as the files live in the mantis db, not on the filesystem) 

  If you use the script, please read the NOTES section (at the top of the file) and make sure you adjust the config parameters for your environment.

  mantis2trac.py has the same parameters as the bugzilla2trac.py script:
  {{{
  mantis2trac - Imports a bug database from Mantis into Trac.

  Usage: mantis2trac.py [options] 

  Available Options:
    --db <MySQL dbname>              - Mantis database
    --tracenv /path/to/trac/env      - Full path to Trac db environment
    -h | --host <MySQL hostname>     - Mantis DNS host name
    -u | --user <MySQL username>     - Effective Mantis database user
    -p | --passwd <MySQL password>   - Mantis database 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.
  }}} 

  == Jira ==

  The [http://trac-hacks.org/wiki/JiraToTracIntegration Jira2Trac plugin] provides you with 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 [http://trac-hacks.org/wiki/XmlRpcPlugin XmlRpcPlugin]
   - Generates a htpasswd file containing the imported Jira users and their SHA-512 base64 encoded passwords

  == Other ==

  Since trac uses a SQL database to store the data, you can 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 into them from your application.

  === Using a comma delimited file - CSV ===
  See [http://trac.edgewall.org/attachment/wiki/TracSynchronize/csv2trac.2.py] for details.  This approach is particularly useful if one needs 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. 

  === Using an Excel (.xls) or comma delimited file (.csv) ===
  This plugin http://trac-hacks.org/wiki/TicketImportPlugin lets you import into Trac a series of tickets from a CSV file or (if the xlrd library is installed) from an Excel file.

  You can also use it to modify tickets in batch, by saving a report as CSV, editing the CSV file, and re-importing the tickets.

  This plugin is very useful when starting a new project: you can import a list of requirements that may have come from meeting notes, list of features, other ticketing systems... It's also great to review the tickets off-line, or to do massive changes to tickets.

  Based on the ticket id (or, if no id exists, on the summary) in the imported file, tickets are either created or updated. 


name: TracInstall
author: trac
ipnr: 127.0.0.1
text:
  = Trac Installation Guide for 0.12 = 
  [[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.

  Since version 0.12, Trac can also be localized, and there's probably a translation available for your language. If you want to be able to use the Trac interface in other languages, then make sure you **first** have installed the optional package [#OtherPythonPackages Babel]. Lacking Babel, you will only get the default english version, as usual. If you install Babel later on, you will need to re-install Trac.

  If you're interested in contributing new translations for other languages or enhance the existing translations, then please have a look at [trac:wiki:TracL10N TracL10N].

  What follows are generic instructions for installing and setting up Trac and its requirements. While you may find instructions for installing Trac on specific systems at TracInstallPlatforms on the main Trac site, please be sure to '''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.4 and < 3.0
     (note that we dropped the support for Python 2.3 in this release)
   * [http://peak.telecommunity.com/DevCenter/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

  If you're using Python 2.5 or 2.6, you already have everything you need.

  If you're using Python 2.4 and need pysqlite, you can download from 
  [http://code.google.com/p/pysqlite/downloads/list google code] the Windows installers or the tar.gz archive for building from source: 
  {{{
  $ tar xvfz <version>.tar.gz 
  $ cd <version> 
  $ python setup.py build_static install 
  }}}
   
  This will extract the SQLite code and build the bindings. 

  To install SQLite, your system may require the development headers. Without these you will get various GCC related errors when attempting to build:

  {{{
  $ apt-get install libsqlite3-dev
  }}}

  SQLite 2.x is no longer supported, and neither is !PySqlite 1.1.x.

  A known bug !PySqlite versions 2.5.2-4 prohibits upgrade of trac databases
  from 0.11.x to 0.12. Please use versions 2.5.5 and newer or 2.5.1 and
  older. See [trac:#9434] for more detail.

  See additional information in [trac:PySqlite].

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

  See [trac:DatabaseBackend#Postgresql DatabaseBackend] for details.


  ==== For the MySQL database #ForMySQL

  Trac can now work quite 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

  It is '''very''' important to read carefully the  [trac:MySqlDb] page before creating the database.

  === Optional Dependencies

  ==== Version Control System ====

  ===== Subversion =====
   * [http://subversion.apache.org/ Subversion], 1.5.x or 1.6.x and the '''''corresponding''''' Python bindings. Older versions starting from 1.4.0, etc. should still work. For troubleshooting information, check the [trac:TracSubversion#Troubleshooting TracSubversion] page. Versions prior to 1.4.0 won't probably work since trac uses svn core functionality (e.g. svn_path_canonicalize) that is not implemented in the python swig wrapper in svn <= 1.3.x (although it exists in the svn lib itself).

  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. TracSubversion points you to [http://alagazam.net Algazam], which works for me under Python 2.6.)

  Note that Trac '''doesn't''' use [http://pysvn.tigris.org/ PySVN], neither does it work yet with the newer `ctype`-style bindings. [Is there a ticket for implementing ctype bindings?]


  '''Please note:''' if using Subversion, Trac must be installed on the '''same machine'''. Remote repositories are currently [trac:ticket:493 not supported].


  ===== Others =====

  Support for other version control systems is provided via third-parties. See [trac:PluginList] and [trac:VersioningSystemBackend].

  ==== 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 configure Trac to run in any of the following environments.
   * [http://httpd.apache.org/ Apache] with 
     - [http://code.google.com/p/modwsgi/ mod_wsgi], see [wiki:TracModWSGI] and 
       http://code.google.com/p/modwsgi/wiki/IntegrationWithTrac
     - [http://modpython.org/ mod_python 3.3.1], deprecated: 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])
   * 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.5, 
     needed for localization support[[BR]]
     ''Note: '' If you want to be able to use the Trac interface in other languages, then make sure you first have installed the optional package Babel. Lacking Babel, you will only get the default english version, as usual. If you install Babel later on, you will need to re-install Trac. 
   * [http://docutils.sourceforge.net/ docutils], version >= 0.3.9 
     for WikiRestructuredText.
   * [http://pygments.pocoo.org Pygments] for 
     [wiki:TracSyntaxColoring syntax highlighting].
     [http://silvercity.sourceforge.net/ SilverCity] and/or 
     [http://gnu.org/software/enscript/enscript.html Enscript] may still be used
     but are deprecated and you really should be using Pygments.
   * [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.

  '''Attention''': The various available versions of these dependencies are not necessarily interchangable, so please pay attention to the version numbers above. 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'' (there are even some pages that are still talking about Trac 0.8!).


  == Installing Trac ==
  === Using `easy_install`
  One way to install Trac is using [http://pypi.python.org/pypi/setuptools setuptools].
  With setuptools you can install Trac from the subversion repository; 

  A few examples:

   - first install of the latest stable version Trac 0.12.1, with i18n support:
     {{{
     easy_install Babel==0.9.5 Genshi==0.6
     easy_install Trac
     }}}
     ''It's very important to run the two `easy_install` commands separately, otherwise the message catalogs won't be generated.''

   - upgrade to the latest stable version of Trac:
     {{{
     easy_install -U Trac
     }}}

   - upgrade to the latest trunk development version (0.13dev):
     {{{
     easy_install -U Trac==dev
     }}}

  For upgrades, reading the TracUpgrade page is mandatory, of course.

  === From source
  If you want more control, you can download the source in archive form, or do a checkout from one of the official [[Trac:TracRepositories|source code repositories]].

  Be sure to have the prerequisites already installed. You can also obtain the Genshi and Babel source packages from http://www.edgewall.org and follow for them a similar installation procedure, or you can just easy_install those, see [#Usingeasy_install above].

  Once you've unpacked the Trac archive or performed the checkout, move in the top-level folder and do:
  {{{
  $ python ./setup.py install
  }}}

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

  The script will also install the [wiki:TracAdmin trac-admin] command-line tool, used to create and maintain [wiki:TracEnvironment project environments], as well as the [wiki:TracStandalone tracd] standalone server.

  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):
  {{{
  $ python ./setup.py install
  }}}
  Alternatively, you can do a `bdist_egg` and copy the .egg from dist/ to the place of your choice, or you can create a Windows installer (`bdist_wininst`).

  === Advanced Options ===

  To install Trac to a custom location, or find out about other advanced installation options, run:
  {{{
  easy_install --help
  }}}

  Also see [http://docs.python.org/inst/inst.html Installing Python Modules] for detailed information.

  Specifically, you might be interested in:
  {{{
  easy_install --prefix=/path/to/installdir
  }}}
  or, if installing Trac to a Mac OS X system:
  {{{
  easy_install --prefix=/usr/local --install-dir=/Library/Python/2.5/site-packages
  }}}
  Note: If installing on Mac OS X 10.6 running {{{ easy_install http://svn.edgewall.org/repos/trac/trunk }}} will install into {{{ /usr/local }}} and {{{ /Library/Python/2.6/site-packages }}} by default

  The above will place your `tracd` and `trac-admin` commands into `/usr/local/bin` and will install the Trac libraries and dependencies into `/Library/Python/2.5/site-packages`, which is Apple's preferred location for third-party Python application installations.

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

   - 
  {{{
  pip -E /opt/user/trac install trac psycopg2 
  }}}
  or
   - 
  {{{
  pip -E /opt/user/trac 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.) and download the latest packages on 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 [http://pypi.python.org/pypi?:action=search&term=trac&submit=search here]) through pip.



  == Creating a Project Environment ==

  A [TracEnvironment Trac environment] is the backend storage where Trac stores information like wiki pages, tickets, reports, settings, etc. An environment is basically a directory that contains a human-readable [TracIni configuration file], and various other files and directories.

  A new environment is created using [wiki:TracAdmin trac-admin]:
  {{{
  $ trac-admin /path/to/myproject initenv
  }}}

  [TracAdmin trac-admin] will prompt you for the information it needs to create the environment, such as the name of the project and the [TracEnvironment#DatabaseConnectionStrings database connection string]. If you're not sure what to specify for one of these options, just press `<Enter>` to use the default value. 

  Using the default database connection string in particular will always work as long as you have SQLite installed.
  For the other [DatabaseBackend database backends] you should plan ahead and already have a database ready to use at this point.

  Since 0.12, Trac doesn't ask for a [TracEnvironment#SourceCodeRepository source code repository] anymore when creating an environment. Repositories can be [TracRepositoryAdmin added] afterward, or the version control support can be disabled completely if you don't need it.

  Also note that the values you specify here can be changed later by directly editing the [TracIni conf/trac.ini] configuration file.

  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:
  {{{
  # chown -R apache.apache /path/to/myproject
  }}}

  {{{#!div class=important
  '''Warning:''' Please only use ASCII-characters for account name and project path, unicode characters are not supported there.
  }}}


  == Running the Standalone Server ==

  After having created a Trac environment, you can easily try the web interface by running the standalone server [wiki:TracStandalone tracd]:
  {{{
  $ 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:
  {{{
  $ tracd -s --port 8000 /path/to/myproject
  }}}

  == Running Trac on a Web Server ==

  Trac provides various options for connecting to a "real" web server: [wiki:TracCgi CGI], [wiki:TracFastCgi FastCGI], [wiki:TracModWSGI mod_wsgi] and [wiki:TracModPython mod_python]. For decent performance, it is recommended that you use either FastCGI or mod_wsgi.

  Trac also supports [trac:TracOnWindowsIisAjp AJP] which may be your choice if you want to connect to IIS.

  ==== Generating the Trac cgi-bin directory ====

  In order for Trac to function properly with FastCGI you need to have a `trac.fcgi` file and for mod_wsgi a `trac.wsgi` file. These are Python scripts which load the appropriate Python code. They can be generated using the `deploy` option of [wiki:TracAdmin trac-admin].

  There is, however, a bit of a chicken-and-egg problem. The [wiki:TracAdmin trac-admin] command requires an existing environment to function, but complains if the deploy directory already exists. This is a problem, because environments are often stored in a subdirectory of the deploy. The solution is to do something like this:
  {{{
  mkdir -p /usr/share/trac/projects/my-project
  trac-admin /usr/share/trac/projects/my-project initenv
  trac-admin /usr/share/trac/projects/my-project deploy /tmp/deploy
  mv /tmp/deploy/* /usr/share/trac
  }}}

  ==== Setting up the Plugin 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.

  == Configuring Authentication ==

  The process of adding, removing, and configuring user accounts for authentication depends on the specific way you run Trac. The basic procedure is described in the [wiki:TracCgi#AddingAuthentication "Adding Authentication"] section on the TracCgi page. To learn how to setup authentication for the frontend you're using, please refer to one of the following pages:

   * TracStandalone if you use the standalone server, `tracd`.
   * TracCgi if you use the CGI or FastCGI web front ends.
   * [wiki:TracModWSGI] if you use the Apache mod_wsgi web front end.
   * TracModPython if you use the Apache mod_python web front end.


  == Automatic reference to the SVN changesets in Trac tickets ==

  You can configure SVN to automatically add a reference to the changeset into the ticket comments, 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 a post-commit hook to be installed as described in [wiki:TracRepositoryAdmin#ExplicitSync TracRepositoryAdmin], 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.
  {{{
  tracopt.ticket.commit_updater.* = enabled
  }}}
  For more information, see the documentation of the `CommitTicketUpdater` component in the "Plugins" admin panel.

  == 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 most but not all of the features. You will need to configure authentication and grant additional [wiki:TracPermissions permissions] to authenticated users to see the full set of features.

  '' Enjoy! ''

  [trac:TracTeam The Trac Team]

  ----
  See also: [trac:TracInstallPlatforms TracInstallPlatforms], TracGuide, TracCgi, TracFastCgi, TracModPython, [wiki:TracModWSGI], TracUpgrade, TracPermissions


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

   1. Choose a name for your new page. See WikiPageNames for naming conventions.
   2. Edit an existing page (or any other resources that support WikiFormatting and add a [TracLinks link] to your new page. Save your changes.
   3. Follow the link you created to take you to the new page. Trac will display a "describe !PageName here" message.
   4. Click the "Edit this page" button to edit and add content to your new page. Save your changes.
   5. All done. Your new page is published.

  You can skip the second step by entering the CamelCase name of the page in the quick-search field at the top of the page. But note that the page will effectively be "orphaned" unless you link to it from somewhere else.

  == Rename a page #renaming

  While picking up good WikiPageNames is important, you can always change your mind
  and rename the page later.

  You'll need to ask for the WIKI_RENAME permission in order to be allowed to do this.
  When renaming a page, you'll be offered the possibility to create a redirection page, so that links pointing to the old location will not be left dangling.

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


name: TracRepositoryAdmin
author: trac
ipnr: 127.0.0.1
text:
  = Repository Administration =
  [[PageOutline(2-3)]]

  == Quick start == #QuickStart

   * Manage repositories in the "Repository" 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.
   * Set the `[trac] repository_sync_per_request` option to an empty value to disable per-request syncing.
   * Make sure the user under which your Subversion hooks are run has write access to the Trac environment, or use a tool like `sudo` to temporarily elevate privileges.

  == Specifying repositories == #Repositories
  Starting with 0.12, Trac can handle more than one repository per environment. The pre-0.12 way of specifying the repository with the `repository_dir` and `repository_type` options in the `[trac]` section of [wiki:TracIni trac.ini] is still supported, but two new mechanisms allow including additional repositories into an environment.

  It is also possible to define aliases of repositories, that act as "pointers" to real repositories. This can be useful when renaming a repository, to avoid breaking all the links to the old name.

  A number of attributes can be associated with each repository, which 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. ||
  ||`name` ||The `name` attribute specifies the leading path element to the repository. ||
  ||`type` ||The `type` attribute sets the type of version control system used by the repository. Trac supports Subversion 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. ||

  The `name` attribute and one of `alias` or `dir` are mandatory. All others are optional.

  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 a hidden 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
  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
  .hidden = true
  }}}
  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 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 `[trac]  repository_sync_per_request` option in [wiki:TracIni#trac-section trac.ini] to an empty value, 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.

  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"
  }}}
  On Windows (`post-commit.cmd`):
  {{{#!application/x-dos-batch
  @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`):
  {{{#!application/x-dos-batch
  @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`.

  Note that calling `trac-admin` in your Subversion hooks can slow down the commit and log editing operations on the client side. You might want to use the [trac:source:trunk/contrib/trac-svn-hook contrib/trac-svn-hook] script which starts `trac-admin` in an asynchronous way. The script also comes with a number of safety checks and usage advices which should make it easier to set up and test your hooks. There's no equivalent `trac-svn-hook.bat` for Windows yet, but the script can be run by Cygwin's bash.

  See the [http://svnbook.red-bean.com/en/1.5/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. Please see the plugin documentation for specific instructions.

  === 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 `[trac] repository_sync_per_request` option in [wiki:TracIni#trac-section trac.ini] must be set to a comma-separated list of repository names to be synchronized.

  Note that in this case, the changeset listener extension point is not called, and therefore plugins using it will not work correctly.


  == Migration from a single-repository setup (Subversion) == #Migration
  The following procedure illustrates a typical migration from a Subversion single-repository setup to multiple repositories.

   1. Remove the default repository specification from the `[trac] repository_dir` option.
   1. Add the "main" repository as a named repository.
   1. Re-synchronize the main repository.
   1. Set up post-commit and post-revprop-change hooks on the main repository, and set `[trac] repository_sync_per_request` to an empty value.
   1. Add a hidden alias to the main repository as the default repository. This ensures that all links predating the migration still resolve to the main repository.
   1. Repeat steps 2, 3 and 4 to add other (named) repositories as needed.

  == Migration from a single-repository setup (Mercurial) == #MigrationMercurial
  The following procedure illustrates a typical migration from a Mercurial single-repository setup to multiple repositories. Please note that at the time of writing, no initial resynchronization or any hooks are necessary for Mercurial repositories - see #9485 for more information.

   1. Upgrade to the latest version of the TracMercurial plugin.
   1. Remove the default repository specification from the `[trac] repository_dir` option.
   1. Add the "main" repository as a named repository.
   1. Add a hidden alias to the main repository as the default repository. This ensures that all links predating the migration still resolve to the main repository.
   1. Repeat step 3 to add other (named) repositories as needed.

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


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

  [http://www.fastcgi.com/ FastCGI] interface allows Trac to remain resident much like with [wiki:TracModPython mod_python]. It is faster than external CGI interfaces which must start a new process for each request. However, unlike mod_python, FastCGI supports [http://httpd.apache.org/docs/suexec.html Apache SuEXEC], i.e. run with different permissions than web server. Additionally, it is supported by much wider variety of web servers.

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

  == Simple Apache configuration ==

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

  ==== setup with `mod_fastcgi` ====
  `mod_fastcgi` uses `FastCgiIpcDir` and `FastCgiConfig` directives that should be added to an appropriate Apache configuration file:
  {{{
  # 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`.

  You can set up the `TRAC_ENV` as an overall default:
  {{{
  FastCgiConfig -initial-env TRAC_ENV=/path/to/env/trac
  }}}

  Or you can serve multiple Trac projects in a directory like:
  {{{
  FastCgiConfig -initial-env TRAC_ENV_PARENT_DIR=/parent/dir/of/projects
  }}}

  ==== setup with `mod_fcgid` ====
  Configure `ScriptAlias` (see TracCgi for details), but call `trac.fcgi`
  instead of `trac.cgi`. Note that slash at the end - it is important.
  {{{
  ScriptAlias /trac /path/to/www/trac/cgi-bin/trac.fcgi/
  }}}

  To setup Trac environment for `mod_fcgid` it is necessary to use
  `DefaultInitEnv` directive. It cannot be used in `Directory` or
  `Location` context, so if you need to support multiple projects, try
  alternative environment setup below.

  {{{
  DefaultInitEnv TRAC_ENV /path/to/env/trac/
  }}}

  ==== alternative environment setup ====
  A better method to specify path to Trac environment it to embed the path
  into `trac.fcgi` script itself. That doesn't require configuration of server
  environment variables, works for both FastCgi modules
  (and for [http://www.lighttpd.net/ lighttpd] and CGI as well):
  {{{
  import os
  os.environ['TRAC_ENV'] = "/path/to/projectenv"
  }}}
  or
  {{{
  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:
  {{{
  ScriptAlias / /srv/tracsite/cgi-bin/trac.fcgi/
  }}}

  == Simple Cherokee Configuration ==

  The configuration on Cherokee's side is quite simple. You will only need to know that you can 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 ''/chrome/common'' and just set it to the ''Static files'' handler and with a ''Document root'' that points to the appropriate files: ''/usr/share/trac/htdocs/''

  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.\\
  Python-flup is a dependency which provides trac with SCGI capability. You can install it on debian based systems with:
  {{{
  sudo apt-get install python-flup
  }}}

  == Simple 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 #Trac2418. This should be fixed since lighttpd 1.4.23, and you may need to add `"fix-root-scriptname" => "enable"` as 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 field values are different.  If you prefer setting the environment
  variables in the `.fcgi` scripts, then copy/rename `trac.fcgi`, e.g., 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''' It's very important the order on which server.modules are loaded, if mod_auth is not loaded '''BEFORE''' mod_fastcgi, then the server will fail to authenticate the user.
  }}}
  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 (I use version 1.4.3) stopped if 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, i.e. serving out images and CSS directly instead of through FastCGI:
  {{{
  # Aliasing functionality is needed
  server.modules += ("mod_alias")

  # Setup 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's to use TRAC_ENV_PARENT_DIR instead of TRAC_ENV and use global auth, let's see an example:
  {{{
  #  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 [http://trac.lighttpd.net/trac/wiki/TracInstall this updated TracInstall page], [wiki:TracCgi#MappingStaticResources and this] are useful for non-fastcgi specific installation aspects.

  If you use trac-0.9, read [http://lists.edgewall.com/archive/trac/2005-November/005311.html about small bug]

  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.


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

  === Setup ===

   1. Please make sure you have first have a working install of a Trac project. Test install with “tracd” first.

   2. Create a Virtual Host for this setup. From now on we will refer to this vhost as !TracVhost. For this tutorial we will be assuming that your trac project will be accessible via:

  {{{
  http://yourdomain.com/trac/
  }}}

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

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

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

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

   7. Restart !LiteSpeed, “lswsctrl restart”, and access your new Trac project at: 

  {{{
  http://yourdomain.com/trac/
  }}}

  == Simple Nginx Configuration ==

   1. Nginx configuration snippet - confirmed to work on 0.6.32
  {{{
      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;

          # (Or ``^/some/prefix/(.*)``.
          if ($uri ~ ^/(.*)) {
               set $path_info /$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          $path_info;

              ## 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 authentication to work
              fastcgi_param  AUTH_USER          $remote_user;
              fastcgi_param  REMOTE_USER        $remote_user;
          }
      }
  }}}

   2. Modified trac.fcgi:

  {{{
  #!/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()

  }}}

   3. reload nginx and launch trac.fcgi like that:

  {{{
  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 ticket #T7239 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 ticket #T6224

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


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.

  ''(since 0.12)'': 
  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.
  If a default repository has been configured, 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 the '''Repository Index''' will be omitted ^[#note-multirepos (1)]^.

  Directory entries are displayed in a list with sortable columns. The list 
  entries can be sorted by ''Name'', ''Size'', ''Age'' or ''Author'' by clicking on the column
  headers. The sort order can be reversed by clicking on a given column
  header again.

  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'' 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'' column gives a visual indication of the age
  of the last change to a file or directory, following the convention that
  '''[[span(style=color:#88f,blue)]]''' is oldest and '''[[span(style=color:#f88,red)]]'''
  is newest, but this can be [TracIni#browser-section configured].

  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 [TracIni#svn-section configured] 
  for more advanced cases.

  If you're using a Javascript enabled browser, you'll be able to expand and 
  collapse directories in-place by clicking on the arrow head at the right side of a 
  directory. Alternatively, the [trac:TracKeys keyboard] can also be used for this: 
   - use `'j'` and `'k'` to select the next or previous entry, starting with the first
   - `'o'` (open) to toggle between expanded and collapsed state of the selected 
     directory or for visiting the selected file 
   - `'v'` (view, visit) and `'<Enter>'`, same as above
   - `'r'` can be used to force the reload of an already expanded directory
   - `'A'` can be used to directly visit a file in annotate (blame) mode
   - `'L'` to view the log for the selected entry
  If no row has been selected using `'j'` or `'k'` these keys will operate on the entry under the mouse .

  {{{#!comment
  MMM: I guess that some keys are upper case and some lower to avoid conflicts with browser defined keys.
  I find for example in Firefox and IE on windows that 'a' works as well as 'A' but 'l' does not work for 'L'.
   cboos: 'l' is reserved for Vim like behavior, see #7867
  }}}

  For the Subversion backend, some advanced additional features are available:
   - The `svn:needs-lock` property will be displayed
   - Support for the `svn:mergeinfo` property showing the merged and eligible information
   - Support for browsing the `svn:externals` property 
     (which can be [TracIni#svn:externals-section configured])
   - The `svn:mime-type` property is used to select the syntax highlighter for rendering 
     the file. For example, setting `svn:mime-type` to `text/html` will ensure the file is 
     highlighted as HTML, regardless of the file extension. It also allows selecting the character 
     encoding used in the file content. For example, if the file content is encoded in UTF-8, 
     set `svn:mime-type` to `text/html;charset=utf-8`. The `charset=` specification overrides the 
     default encoding defined in the `default_charset` option of the `[trac]` section 
     of [TracIni#trac-section trac.ini].
  {{{#!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...
  }}}


  ----
  {{{#!div style="font-size:85%"
  [=#note-multirepos (1)] -  This means that after upgrading a single-repository Trac of version 
  0.11 (or below) to a multi-repository Trac (0.12), the repository browser will look and feel 
  the same, that single repository becoming automatically the "default" repository.
  }}}

  See also: TracGuide, TracChangeset, TracFineGrainedPermissions


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

  Trac supports using ''reStructuredText'' (RST) as an alternative to wiki markup in any context 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 be displayed as reStructuredText in Trac's source browser, set `text/x-rst` as value for the Subversion property `svn:mime-type`. See [trac:source:/trunk/INSTALL this example].

  === Requirements ===
  Note that to activate RST support in Trac, the python docutils package must be installed. 
  If not already available on your operating system, you can download it at the [http://docutils.sourceforge.net/rst.html RST Website].

  Install docutils using `easy_install docutils`. Do not use the package manager of your OS (e.g. `apt-get install python-docutils`), because Trac will not find docutils then.

  === More information on RST ===

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

  ----

  == 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
       }}}
     }}}

   * Trac allows an even easier way of creating TracLinks in RST, using the custom `:trac:` role.
     ||= 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, please 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 ===

  For doing [WikiMacros Wiki Macros] in RST you use the same directive as for syntax highlighting i.e code-block.

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

    .. code-block:: RecentChanges

       Trac,3

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

    .. code-block:: RecentChanges

       Trac,3

    }}}
  }}}

  Or a more concise Wiki Macro like syntax is also available, using the `:code-block:` role:

  ||= 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 mostly 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: TracNotification
author: trac
ipnr: 127.0.0.1
text:
  = Email Notification of Ticket Changes =
  [[TracGuideToc]]

  Trac supports notification of ticket changes via email. 

  Email notification is useful to keep users up-to-date on tickets/issues of interest, and also provides a convenient way to post all ticket changes to a dedicated mailing list. For example, this is how the [http://lists.edgewall.com/archive/trac-tickets/ Trac-tickets] mailing list is set up.

  Disabled by default, notification can be activated and configured in [wiki:TracIni trac.ini].

  == Receiving Notification Mails ==
  When reporting a new ticket or adding a comment, enter a valid email address or your username in the ''reporter'', ''assigned to/owner'' or ''cc'' field. Trac will automatically send you an email when changes are made to the ticket (depending on how notification is configured).

  This is useful to keep up-to-date on an issue or enhancement request that interests you.

  === How to use your username to receive notification mails ===

  To receive notification mails, you can either enter a full email address or your username. To get notified with a simple username or login, you need to specify a valid email address in the ''Preferences'' page. 

  Alternatively, a default domain name ('''`smtp_default_domain`''') can be set in the TracIni file (see [#ConfigurationOptions Configuration Options] below). In this case, the default domain will be appended to the username, which can be useful for an "Intranet" kind of installation.

  == Configuring SMTP Notification ==

  '''Important:''' For TracNotification to work correctly, the `[trac] base_url` option must be set in [wiki:TracIni trac.ini]. 

  === Configuration Options ===
  These are the available options for the `[notification]` section in trac.ini.

   * '''`smtp_enabled`''': Enable email notification.
   * '''`smtp_from`''': Email address to use for ''Sender''-headers in notification emails.
   * '''`smtp_from_name`''': Sender name to use for ''Sender''-headers in notification emails.
   * '''`smtp_replyto`''': Email address to use for ''Reply-To''-headers in notification emails.
   * '''`smtp_default_domain`''': (''since 0.10'') Append the specified domain to addresses that do not contain one. Fully qualified addresses are not modified. The default domain is appended to all username/login for which an email address cannot be found from the user settings.
   * '''`smtp_always_cc`''': List of email addresses to always send notifications to. ''Typically used to post ticket changes to a dedicated mailing list.''
   * '''`smtp_always_bcc`''': (''since 0.10'') List of email addresses to always send notifications to, but keeps addresses not visible from other recipients of the notification email 
   * '''`smtp_subject_prefix`''': (''since 0.10.1'') Text that is inserted before the subject of the email. Set to "!__default!__" by default.
   * '''`always_notify_reporter`''':  Always send notifications to any address in the reporter field (default: false).
   * '''`always_notify_owner`''': (''since 0.9'') Always send notifications to the address in the owner field (default: false).
   * '''`always_notify_updater`''': (''since 0.10'') Always send a notification to the updater of a ticket (default: true).
   * '''`use_public_cc`''': (''since 0.10'') Addresses in To: (owner, reporter) and Cc: lists are visible by all recipients (default is ''Bcc:'' - hidden copy).
   * '''`use_short_addr`''': (''since 0.10'') Enable delivery of notifications to addresses that do not contain a domain (i.e. do not end with ''@<domain.com>'').This option is useful for intranets, where the SMTP server can handle local addresses and map the username/login to a local mailbox. See also `smtp_default_domain`. Do not use this option with a public SMTP server. 
   * '''`mime_encoding`''': (''since 0.10'') This option allows selecting the MIME encoding scheme. Supported values:
     * `none`: default value, uses 7bit encoding if the text is plain ASCII, or 8bit otherwise. 
     * `base64`: works with any kind of content. May cause some issues with touchy anti-spam/anti-virus engines.
     * `qp` or `quoted-printable`: best for european languages (more compact than base64) if 8bit encoding cannot be used.
   * '''`ticket_subject_template`''': (''since 0.11'') A [http://genshi.edgewall.org/wiki/Documentation/text-templates.html Genshi text template] snippet used to get the notification subject.
   * '''`email_sender`''': (''since 0.12'') Name of the component implementing `IEmailSender`. This component is used by the notification system to send emails. Trac currently provides the following components:
     * `SmtpEmailSender`: connects to an SMTP server (default).
     * `SendmailEmailSender`: runs a `sendmail`-compatible executable.

  Either '''`smtp_from`''' or '''`smtp_replyto`''' (or both) ''must'' be set, otherwise Trac refuses to send notification mails.

  The following options are specific to email delivery through SMTP.
   * '''`smtp_server`''': SMTP server used for notification messages.
   * '''`smtp_port`''': (''since 0.9'') Port used to contact the SMTP server.
   * '''`smtp_user`''': (''since 0.9'') User name for authentication SMTP account.
   * '''`smtp_password`''': (''since 0.9'') Password for authentication SMTP account.
   * '''`use_tls`''': (''since 0.10'') Toggle to send notifications via a SMTP server using [http://en.wikipedia.org/wiki/Transport_Layer_Security TLS], such as GMail.

  The following option is specific to email delivery through a `sendmail`-compatible executable.
   * '''`sendmail_path`''': (''since 0.12'') Path to the sendmail executable. The sendmail program must accept the `-i` and `-f` options.

  === Example Configuration (SMTP) ===
  {{{
  [notification]
  smtp_enabled = true
  smtp_server = mail.example.com
  smtp_from = notifier@example.com
  smtp_replyto = myproj@projects.example.com
  smtp_always_cc = ticketmaster@example.com, theboss+myproj@example.com
  }}}

  === Example Configuration (`sendmail`) ===
  {{{
  [notification]
  smtp_enabled = true
  email_sender = SendmailEmailSender
  sendmail_path = /usr/sbin/sendmail
  smtp_from = notifier@example.com
  smtp_replyto = myproj@projects.example.com
  smtp_always_cc = ticketmaster@example.com, theboss+myproj@example.com
  }}}

  === Customizing the e-mail subject ===
  The e-mail subject can be customized with the `ticket_subject_template` option, which contains a [http://genshi.edgewall.org/wiki/Documentation/text-templates.html Genshi text template] snippet. The default value is:
  {{{
  $prefix #$ticket.id: $summary
  }}}
  The following variables are available in the template:

   * `env`: The project environment (see [trac:source:/trunk/trac/env.py env.py]).
   * `prefix`: The prefix defined in `smtp_subject_prefix`.
   * `summary`: The ticket summary, with the old value if the summary was edited.
   * `ticket`: The ticket model object (see [trac:source:/trunk/trac/ticket/model.py model.py]). Individual ticket fields can be addressed by appending the field name separated by a dot, e.g. `$ticket.milestone`.

  === Customizing the e-mail content ===

  The notification e-mail content is generated based on `ticket_notify_email.txt` in `trac/ticket/templates`.  You can add your own version of this template by adding a `ticket_notify_email.txt` to the templates directory of your environment. The default looks like this:

  {{{
  $ticket_body_hdr
  $ticket_props
  #choose ticket.new
    #when True
  $ticket.description
    #end
    #otherwise
      #if changes_body
  Changes (by $change.author):

  $changes_body
      #end
      #if changes_descr
        #if not changes_body and not change.comment and change.author
  Description changed by $change.author:
        #end
  $changes_descr
  --
      #end
      #if change.comment

  Comment${not changes_body and '(by %s)' % change.author or ''}:

  $change.comment
      #end
    #end
  #end

  -- 
  Ticket URL: <$ticket.link>
  $project.name <${project.url or abs_href()}>
  $project.descr
  }}}
  == Sample Email ==
  {{{
  #42: testing
  ---------------------------+------------------------------------------------
         Id:  42             |      Status:  assigned                
  Component:  report system  |    Modified:  Fri Apr  9 00:04:31 2004
   Severity:  major          |   Milestone:  0.9                     
   Priority:  lowest         |     Version:  0.6                     
      Owner:  anonymous      |    Reporter:  jonas@example.com               
  ---------------------------+------------------------------------------------
  Changes:
    * component:  changset view => search system
    * priority:  low => highest
    * owner:  jonas => anonymous
    * cc:  daniel@example.com =>
           daniel@example.com, jonas@example.com
    * status:  new => assigned

  Comment:
  I'm interested too!

  --
  Ticket URL: <http://example.com/trac/ticket/42>
  My Project <http://myproj.example.com/>
  }}}

  == Using GMail as the SMTP relay host ==

  Use the following configuration snippet
  {{{
  [notification]
  smtp_enabled = true
  use_tls = true
  mime_encoding = base64
  smtp_server = smtp.gmail.com
  smtp_port = 587
  smtp_user = user
  smtp_password = password
  }}}

  where ''user'' and ''password'' match an existing GMail account, ''i.e.'' the ones you use to log in on [http://gmail.com]

  Alternatively, you can use `smtp_port = 25`.[[br]]
  You should not use `smtp_port = 465`. It will not work and your ticket submission may deadlock. Port 465 is reserved for the SMTPS protocol, which is not supported by Trac. See [comment:ticket:7107:2 #7107] for details.
   
  == Filtering notifications for one's own changes ==
  In Gmail, use the filter:

  {{{
  from:(<smtp_from>) (("Reporter: <username>" -Changes) OR "Changes (by <username>)")
  }}}

  For Trac .10, use the filter:
  {{{
  from:(<smtp_from>) (("Reporter: <username>" -Changes -Comment) OR "Changes (by <username>)" OR "Comment (by <username>)")
  }}}

  to delete these notifications.

  In Thunderbird, there is no such solution if you use IMAP
  (see http://kb.mozillazine.org/Filters_(Thunderbird)#Filtering_the_message_body).

  The best you can do is to set "always_notify_updater" in conf/trac.ini to false.
  You will however still get an email if you comment a ticket that you own or have reported.

  You can also add this plugin:
  http://trac-hacks.org/wiki/NeverNotifyUpdaterPlugin

  == Troubleshooting ==

  If you cannot get the notification working, first make sure the log is activated and have a look at the log to find if an error message has been logged. See TracLogging for help about the log feature.

  Notification errors are not reported through the web interface, so the user who submit a change or a new ticket never gets notified about a notification failure. The Trac administrator needs to look at the log to find the error trace.

  === ''Permission denied'' error ===

  Typical error message:
  {{{
    ...
    File ".../smtplib.py", line 303, in connect
      raise socket.error, msg
    error: (13, 'Permission denied')
  }}}

  This error usually comes from a security settings on the server: many Linux distributions do not let the web server (Apache, ...) to post email message to the local SMTP server.

  Many users get confused when their manual attempts to contact the SMTP server succeed:
  {{{
  telnet localhost 25
  }}}
  The trouble is that a regular user may connect to the SMTP server, but the web server cannot:
  {{{
  sudo -u www-data telnet localhost 25
  }}}

  In such a case, you need to configure your server so that the web server is authorized to post to the SMTP server. The actual settings depend on your Linux distribution and current security policy. You may find help browsing the Trac [trac:MailingList MailingList] archive.

  Relevant ML threads:
   * SELinux: http://article.gmane.org/gmane.comp.version-control.subversion.trac.general/7518

  For SELinux in Fedora 10:
  {{{
  $ setsebool -P httpd_can_sendmail 1
  }}}
  === ''Suspected spam'' error ===

  Some SMTP servers may reject the notification email sent by Trac.

  The default Trac configuration uses Base64 encoding to send emails to the recipients. The whole body of the email is encoded, which sometimes trigger ''false positive'' SPAM detection on sensitive email servers. In such an event, it is recommended to change the default encoding to "quoted-printable" using the `mime_encoding` option.

  Quoted printable encoding works better with languages that use one of the Latin charsets. For Asian charsets, it is recommended to stick with the Base64 encoding.

  === ''501, 5.5.4 Invalid Address'' error ===

  On IIS 6.0 you could get a 
  {{{
  Failure sending notification on change to ticket #1: SMTPHeloError: (501, '5.5.4 Invalid Address')
  }}}
  in the trac log. Have a look [http://support.microsoft.com/kb/291828 here] for instructions on resolving it.


  ----
  See also: TracTickets, TracIni, TracGuide


name: WikiDeletePage
author: trac
ipnr: 127.0.0.1
text:
  = Deleting a Wiki Page =

  Existing wiki pages can be completely deleted using the ''Delete Page'' or the ''Delete this Version'' buttons at the bottom of the wiki page. These buttons are only visible for users with `WIKI_DELETE` permissions.

  '''Note:''' Deleting a wiki page is an irreversible operation.

  If you want to delete a page because you actually 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, as to not frustrate the visitor with broken links 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 + delete. 
  The ''Rename'' operation also offers you the possibility to create a redirection page.
  A redirection page is a short page that  contains a link such as  “See !SomeOtherPage”. 

  However, deleting specific versions or even complete pages can make sense to remove spam or other abusive submissions.

  ----
  See also: TracWiki, TracPermissions


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 an ever 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 ''Cheat sheet'' below gives you a quick 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 talks about the various names a wiki page can take, 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


  == Cheat sheet ==

  ||= '''Category''' =||= '''Wiki Markup''' =||= '''Display''' =||
  |-----------------------------------------------------------
  {{{#!th rowspan=3
  [#FontStyles Font Styles]
  }}}
  || `'''bold'''`, `''italic''`, `'''''Wikipedia style'''''` || \
  || '''bold''', ''italic'', '''''Wikipedia style''''' ||
  || {{{`monospaced and ''nowiki''`}}} || \
  || `monospaced and ''nowiki''` ||
  || `**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
   {{{
   * bullets list
     on multiple lines
     1. nested list
       a. different numbering 
          styles
   }}}
  }}}
  {{{#!td
  * bullets 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` ||\
  || ticket:1, ticket:1#comment: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 ||
  || `{{{-}}} curly brackets` ||\
  || {{{-}}} 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)//
    }}}
  }}}
  {{{#!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)//
  }}}

  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 no longer mandatory.

  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, e-mail-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 elaborated 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 "!" character, 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's 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's 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 (e.g. when a custom title is wanted), one can use the Span macro, e.g. `[[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 ==

  An horizontal line can be used to separated different parts of your page:

  ||= Wiki Markup =||= Display =||
  {{{#!td
    {{{
    Four or more dashes will be replaced 
    by an horizontal line (<HR>)
    ----
    See?
    }}}
  }}}
  {{{#!td
  Four or more dashes will be replaced
  by an horizontal line (<HR>)
  ----
  See?
  }}}
  |----------------------------------
  {{{#!td
    {{{
    "macro" style [[br]] line break
    }}}
  }}}
  {{{#!td
  "macro" style [[br]] line break
  }}}
  |----------------------------------
  {{{#!td
    {{{
    !WikiCreole style \\ line\\break
    }}}
  }}}
  {{{#!td
  !WikiCreole style \\ line\\break
  }}}


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

  When you browse the repository, it's always possible to query the 
  ''Revision Log'' view corresponding to the path you're currently seeing.
  This will display 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's 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 taken to be the newest changeset. 

  It's also possible to specify the revision at which the log should
  stop, using the ''back to'' field. By default, it's left empty, 
  which means the revision log will stop as soon as 100 revisions have 
  been listed.

  Also, 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 corresponding to what
  has been done on the branch.

  It's also possible to indicate that one wants to see what happened
  before a ''Copy'' or ''Rename'' change, by selecting the 
  ''Follow copies'' mode. This will cross all copies or renames changes.
  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's 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 corresponds to the mode called 
  ''Show only adds, moves and deletes''. 
  While quite useful at times, be aware that this operation is quite 
  resource intensive.

  Finally, there's also 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, there are 7 columns:
   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 [wiki:TracRevisionLog#viewingtheactualchanges viewing the actual changes].
   1. A color code (similar to the one used for the
      [wiki:TracChangeset#ChangesetHeader changesets]) indicating 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 '''Date''' at which the change was made.
      The date is displayed as the time elapsed from the date of the revision. The time
      elapsed is displayed as the number of hours, days, weeks, months, or years.
   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 (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 a RSS feed to monitor the changes.
  To subscribe to a 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, TracGuide


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

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

  This page was modelled after the MeatBall:InterMapTxt page.
  In addition, an optional comment is allowed after the mapping.


  This page is interpreted in a special way by Trac, in order to support
  !InterWiki links in a flexible and dynamic way.

  The code block after the first line separator in this page
  will be interpreted as a list of !InterWiki specifications:
  {{{
  prefix <space> URL [<space> # comment]
  }}}

  By using `$1`, `$2`, etc. within the URL, it is possible to create 
  InterWiki links which support multiple arguments, e.g. Trac:ticket:40.
  The URL itself can be optionally followed by a comment, 
  which will subsequently be used for decorating the links 
  using that prefix.

  New !InterWiki links can be created by adding to that list, in real time.
  Note however that ''deletions'' are also taken into account immediately,
  so it may be better to use comments for disabling prefixes.

  Also note that !InterWiki prefixes are case insensitive.


  == List of Active Prefixes ==

  [[InterWiki]]


  ----

  == Prefix Definitions ==

  {{{
  PEP     http://www.python.org/peps/pep-$1.html    # Python Enhancement Proposal 
  PythonBug    http://bugs.python.org/issue$1       # Python Issue #$1
  Python-issue http://bugs.python.org/issue$1       # Python Issue #$1

  Trac-ML  http://thread.gmane.org/gmane.comp.version-control.subversion.trac.general/ # Message $1 in Trac Mailing List
  trac-dev http://thread.gmane.org/gmane.comp.version-control.subversion.trac.devel/   # Message $1 in Trac Development Mailing List

  Mercurial http://www.selenic.com/mercurial/wiki/index.cgi/ # the wiki for the Mercurial distributed SCM

  RFC       http://tools.ietf.org/html/rfc$1          # IETF's RFC $1
  ISO       http://en.wikipedia.org/wiki/ISO_         # ISO Standard $1 in Wikipedia
  kb        http://support.microsoft.com/kb/$1/en-us/ # Article $1 in Microsoft's Knowledge Base

  chromium-issue  http://code.google.com/p/chromium/issues/detail?id=

  Django      http://code.djangoproject.com/intertrac/ # Django's Trac

  CreoleWiki   http://wikicreole.org/wiki/
  Creole1Wiki  http://wikicreole.org/wiki/
  Creole2Wiki  http://wiki.wikicreole.org/

  MediaWiki    http://www.mediawiki.org/wiki/

  #
  # A arbitrary pick of InterWiki prefixes...
  #
  Acronym          http://www.acronymfinder.com/af-query.asp?String=exact&Acronym=
  C2find           http://c2.com/cgi/wiki?FindPage&value=
  Cache            http://www.google.com/search?q=cache:
  CPAN             http://search.cpan.org/perldoc?
  DebianBug        http://bugs.debian.org/
  DebianPackage    http://packages.debian.org/
  Dictionary       http://www.dict.org/bin/Dict?Database=*&Form=Dict1&Strategy=*&Query=
  Google           http://www.google.com/search?q=
  lmgtfy           http://lmgtfy.com/?q= # Well, just search for "$1", follow the link to see how to do it...
  GoogleGroups     http://groups.google.com/group/$1/msg/$2        # Message $2 in $1 Google Group
  JargonFile       http://downlode.org/perl/jargon-redirect.cgi?term=
  MeatBall         http://www.usemod.com/cgi-bin/mb.pl?
  MetaWiki         http://sunir.org/apps/meta.pl?
  MetaWikiPedia    http://meta.wikipedia.org/wiki/
  MoinMoin         http://moinmo.in/
  WhoIs            http://www.whois.sc/
  Why              http://clublet.com/c/c/why?
  c2Wiki           http://c2.com/cgi/wiki?
  WikiPedia        http://en.wikipedia.org/wiki/
  }}}


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

  Trac supports logging of system messages using the standard [http://docs.python.org/lib/module-logging.html logging module] that comes with Python.

  Logging is configured in the `[logging]` section in [wiki:TracIni#logging-section trac.ini].

  == Supported Logging Methods ==

  The log method is set using the `log_type` option in [wiki:TracIni#logging-section trac.ini], which takes any of the following values:

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

  == Log Levels ==

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

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

  Note that starting with Trac 0.11.5 you can in addition enable logging of SQL statements, at debug level. This is turned off by default, as it's very verbose (set `[trac] debug_sql = yes` in TracIni to activate).

  == Log Format ==

  Starting with Trac 0.10.4 (see [trac:#2844 #2844]), it is possible to set the output format for log entries. This can be done through the `log_format` option in [wiki:TracIni#logging-section trac.ini]. The format is a string which can contain any of the [http://docs.python.org/lib/node422.html Python logging Formatter variables]. Additonally, the following Trac-specific variables can be used:
   '''$(basename)s''':: The last path component of the current environment.
   '''$(path)s''':: The absolute path for the current environment.
   '''$(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:
  {{{
  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:
  {{{
  log_format = Trac[$(basename)s:$(module)s] $(levelname)s: $(message)s
  }}}

  ----
  See also: TracIni, TracGuide, TracEnvironment


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 must follow these rules:

   1. The name must consist of '''alphabetic characters only'''. No digits, spaces, punctuation, or underscores are allowed.
   2. A name must have at least two capital letters.
   3. The first character must be capitalized.
   4. Every capital letter must be followed by one or more lower-case letters. 
   5. The use of slash ( / ) is permitted in page names (possibly representing a hierarchy).

  If you want to create a wiki page that doesn't 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 new [[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 ''(old !MoinMoin's internal free links style)''
   * even better, the new [[WikiCreole link style]]
     and with a label: [[WikiCreole link style|WikiCreole style links]]
     ''(since 0.12, also now adopted by !MoinMoin)''


  Starting with Trac 0.11, it's also 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 also prevent a CamelCase name to be interpreted as a TracLinks, by quoting it. See TracLinks#EscapingLinks.

  As visible in the example above, one can also append an anchor to a Wiki page name, in order to link to a specific section within that page. The anchor can easily 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's also possible to specify it explicitly: see WikiFormatting#using-explicit-id-in-heading.
  ----
  See also: WikiNewPage, WikiFormatting, TracWiki, TracLinks


name: TracChangeset
author: trac
ipnr: 127.0.0.1
text:
  = Trac Changeset Module =
  [[TracGuideToc]]

  Trac has a built-in functionality for visualizing “diffs” - changes to files.

  There are different kinds of ''change sets''. 
  Some can correspond to revisions made in the repositories,
  others can aggregate changes made in several revisions, 
  but in the end, any kind of differences 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 information such as:

   * 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 
  won't be shown.

  In front of each listed file, you'll find  a colored rectangle. The color
  indicates how the file is affected by the changeset.
   
   * Green: Added
   * Red: Removed
   * Yellow: Modified
   * Blue: Copied
   * Gray: Moved

  The color legend is located below the header as a reminder.

  == Diff Views ==

  Below the header is the main part of the changeset, the diff view. Each file is shown in a separate section, each of which will contain only the regions of the file that are affected by the changeset. There are two different styles of displaying the diffs: ''inline'' or ''side-by-side'' (you can switch between those 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 on the left side 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 (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, respectively), but 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
     (if the value ''all'' is used, then the full file will be shown)
   * You can toggle whether blank lines, case changes and white space changes are ignored, thereby letting you find the functional changes more quickly


  == The Different Ways to Get a Diff ==

  === Examining a Changeset ===

  When viewing a repository check-in, such as when following a
  changeset [wiki:TracLinks link] or a changeset event in the 
  [wiki:TracTimeline timeline], Trac will display the exact changes
  made by the check-in.

  There will be also navigation links to the ''Previous Changeset''
  to and ''Next Changeset''.

  === Examining Differences Between Revisions ===

  Often you'll 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.

  Using the '''View changes ...''' button in the TracBrowser allows you to enter
  ''From:'' and ''To:'' path/revision pairs. The resulting set of differences consist
  of the changes that should be applied to the ''From:'' content in order
  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 ===

  The last possibility for examining 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: 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 keyboard, alternative keyboard or voice input to navigate links, activate form controls, etc. In Trac, we work to assure users may interact with devices other than a pointing device.

  Trac supports accessibility keys for the most common operations. On Windows and Linux platforms, press any of the keys listed below in combination with the `<Alt>` key; on a Mac, use the `<ctrl>` key instead.

  ''Note that when using Internet Explorer on Windows, you need to hit `<Enter>` after having used the access key.''[[BR]]
  ''Note that when using Firefox 2.0 on Windows, you need to hit `<Shift> + <Alt> + <Key>`.''

  == Global Access Keys ==

   * `1` - WikiStart
   * `2` - [wiki:TracTimeline Timeline]
   * `3` - [wiki:TracRoadmap Roadmap]
   * `4` - [wiki:TracSearch Search]
   * `6` - [wiki:TracGuide Trac Guide / Documentation]
   * `7` - [wiki:TracTickets New Ticket]
   * `9` - [/about About Trac]
   * `0` - This page
   * `e` - Edit this page
   * `f` - Search


  ----
  See also: TracGuide


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

  To do this, Trac uses external libraries with support for a great number of programming languages.

  Currently Trac supports syntax coloring using one or more of the following packages:

   * [http://pygments.pocoo.org/ Pygments], by far the preferred system, as it covers a wide range of programming languages and other structured texts and is actively supported
   * [http://www.codento.com/people/mtr/genscript/ GNU Enscript], commonly available on Unix but somewhat unsupported on Windows
   * [http://silvercity.sourceforge.net/ SilverCity], legacy system, some versions can be [http://trac.edgewall.org/wiki/TracFaq#why-is-my-css-code-not-being-highlighted-even-though-i-have-silvercity-installed problematic]


  To activate syntax coloring, simply install either one (or more) of these packages (see [#ExtraSoftware] section below).
  If none of these packages is available, Trac will display the data as plain text. 


  === About Pygments ===

  Starting with trac 0.11 [http://pygments.org/ pygments] will be the new default highlighter. It's 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]. 

  It's very likely that the list below is outdated because the list of supported pygments lexers is growing weekly. Just have a look at the page of [http://pygments.org/docs/lexers/ supported lexers] on the pygments webpage.


  == Syntax Coloring Support ==

  === Known MIME Types

  [[KnownMimeTypes]]


  === List of Languages Supported, by Highlighter #language-supported

  This list is only indicative.

  ||                 ||= !SilverCity   =||= Enscript      =||= Pygments =||
  || Ada             ||                 ||  ✓              ||     ||
  || Asm             ||                 ||  ✓              ||     ||
  || Apache Conf     ||                 ||                 ||  ✓  ||
  || ASP             ||  ✓              ||  ✓              ||     ||
  || C               ||  ✓              ||  ✓              ||  ✓  ||
  || C#              ||                 ||  ✓ ^[#a1 (1)]^  ||  ✓  ||
  || C++             ||  ✓              ||  ✓              ||  ✓  ||
  || Java            ||  ✓ ^[#a2 (2)]^  ||  ✓              ||  ✓  ||
  || Awk             ||                 ||  ✓              ||     ||
  || Boo             ||                 ||                 ||  ✓  ||
  || CSS             ||  ✓              ||                 ||  ✓  ||
  || Python Doctests ||                 ||                 ||  ✓  ||
  || Diff            ||                 ||  ✓              ||  ✓  ||
  || Eiffel          ||                 ||  ✓              ||     ||
  || Elisp           ||                 ||  ✓              ||     ||
  || Fortran         ||                 ||  ✓ ^[#a1 (1)]^  ||  ✓  ||
  || Haskell         ||                 ||  ✓              ||  ✓  ||
  || Genshi          ||                 ||                 ||  ✓  ||
  || HTML            ||  ✓              ||  ✓              ||  ✓  ||
  || IDL             ||                 ||  ✓              ||     ||
  || INI             ||                 ||                 ||  ✓  ||
  || Javascript      ||  ✓              ||  ✓              ||  ✓  ||
  || Lua             ||                 ||                 ||  ✓  ||
  || m4              ||                 ||  ✓              ||     ||
  || Makefile        ||                 ||  ✓              ||  ✓  ||
  || Mako            ||                 ||                 ||  ✓  ||
  || Matlab ^[#a3 (3)]^  ||             ||  ✓              ||  ✓  ||
  || Mygthy          ||                 ||                 ||  ✓  ||
  || Objective-C     ||                 ||  ✓              ||  ✓  ||
  || OCaml           ||                 ||                 ||  ✓  ||
  || Pascal          ||                 ||  ✓              ||  ✓  ||
  || Perl            ||  ✓              ||  ✓              ||  ✓  ||
  || PHP             ||  ✓              ||                 ||  ✓  ||
  || PSP             ||  ✓              ||                 ||     ||
  || Pyrex           ||                 ||  ✓              ||     ||
  || Python          ||  ✓              ||  ✓              ||  ✓  ||
  || Ruby            ||  ✓              ||  ✓ ^[#a1 (1)]^  ||  ✓  ||
  || Scheme          ||                 ||  ✓              ||  ✓  ||
  || Shell           ||                 ||  ✓              ||  ✓  ||
  || Smarty          ||                 ||                 ||  ✓  ||
  || SQL             ||  ✓              ||  ✓              ||  ✓  ||
  || Troff           ||                 ||  ✓              ||  ✓  ||
  || TCL             ||                 ||  ✓              ||     ||
  || Tex             ||                 ||  ✓              ||  ✓  ||
  || Verilog         ||  ✓ ^[#a2 (2)]^  ||  ✓              ||     ||
  || VHDL            ||                 ||  ✓              ||     ||
  || Visual Basic    ||                 ||  ✓              ||  ✓  ||
  || VRML            ||                 ||  ✓              ||     ||
  || XML             ||  ✓              ||                 ||  ✓  ||



  ''[=#a1 (1)] Not included in the Enscript distribution.  Additional highlighting rules can be obtained for
  [http://neugierig.org/software/ruby/ Ruby],
  [http://wiki.hasno.info/index.php/Csharp.st C#],
  [http://wiki.hasno.info/index.php/F90.st Fortran 90x/2003]

  ''[=#a2 (2)] since Silvercity 0.9.7 released on 2006-11-23

  ''[=#a3 (3)] By default `.m` files are considered Objective-C files. In order to treat `.m` files as MATLAB files, add "text/matlab:m" to the "mime_map" setting in the [wiki:TracIni#mimeviewer-section "[mimeviewer] section of trac.ini"].

  == Extra Software ==
   * GNU Enscript -- http://directory.fsf.org/GNU/enscript.html
   * GNU Enscript for Windows -- http://gnuwin32.sourceforge.net/packages/enscript.htm
   * !SilverCity -- http://silvercity.sf.net/
   * Pygments -- http://pygments.org/

  ----
  See also: WikiProcessors, WikiFormatting, TracWiki, TracBrowser


name: TracPlugins
author: trac
ipnr: 127.0.0.1
text:
  = Trac Plugins =
  [[TracGuideToc]]

  Trac is extensible with [trac:PluginList plugins] since version 0.9. The plugin functionality is based on the [trac:TracDev/ComponentArchitecture component architecture] with peculiarities described at [TracDev/PluginDevelopment plugin development] page.

  == Plugin discovery ==

  From the user point of view a Plugin is either standalone .py file or an .egg package. Trac looks for Plugins in a global shared plugins directory (see [TracIni#GlobalConfiguration Global Configuration]) and in `plugins` directory of local TracEnvironment. Components defined in globally installed plugins should be explicitly enabled in the [[TracIni#components-section| [components] ]] section of the trac.ini file.

  == Requirements for Trac eggs  ==

  To use egg based plugins in Trac, you need to have [http://peak.telecommunity.com/DevCenter/setuptools setuptools] (version 0.6) installed.

  To install `setuptools`, download the bootstrap module [http://peak.telecommunity.com/dist/ez_setup.py ez_setup.py] and execute it as follows:
  {{{
  $ python ez_setup.py
  }}}

  If the `ez_setup.py` script fails to install the setuptools release, you can download it from [http://www.python.org/pypi/setuptools PyPI] and install it manually.

  Plugins can also consist of a single `.py` file dropped directly into the root of environment's or into shared `plugins` directory.

  == Installing a Trac Plugin ==

  === For a Single Project ===

  Plugins are packaged as [http://peak.telecommunity.com/DevCenter/PythonEggs Python eggs]. That means they are ZIP archives with the file extension `.egg`. 

  If you have downloaded a source distribution of a plugin, and want to build the `.egg` file, follow this instruction:
   * Unpack the source. It should provide a setup.py. 
   * Run:
  {{{
  $ python setup.py bdist_egg
  }}}

  Then you will have a *.egg file. Examine the output of running python to find where this was created.

  Once you have the plugin archive, you need to copy it into the `plugins` directory of the [wiki:TracEnvironment project environment]. Also, make sure that the web server has sufficient permissions to read the plugin egg. Then, restart the web server (this requirement was not previously mentioned in this document, but in my tests it began working only after I did so).

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

  Note that the Python version that the egg is built with must
  match the Python version with which Trac is run.  If for
  instance you are running Trac under Python 2.5, but have
  upgraded your standalone Python to 2.6, the eggs won't be
  recognized.

  Note also that in a multi-project setup, a pool of Python interpreter instances will be dynamically allocated to projects based on need, and 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 the 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 [trac:SpamFilter SpamFilter]) are downloadable as a `.egg` file which can be installed with the `easy_install` program:
  {{{
  easy_install TracSpamFilter
  }}}

  If `easy_install` is not on your system see the Requirements section above to install it.  Windows users will need to add the `Scripts` directory of their Python installation (for example, `C:\Python24\Scripts`) to their `PATH` environment variable (see [http://peak.telecommunity.com/DevCenter/EasyInstall#windows-notes easy_install Windows notes] for more information).

  If Trac reports permission errors after installing a zipped egg and you would rather not bother providing a 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`:
  {{{
  easy_install --always-unzip TracSpamFilter-0.4.1_r10106-py2.6.egg
  }}}
  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 ''(since 0.10)'', see TracIni#GlobalConfiguration. This is a convenient way to share the installation of plugins across several but not all environments.

  ==== From source ====

  `easy_install` makes installing from source a snap. Just give it the URL to either a Subversion repository or a tarball/zip of the source:
  {{{
  easy_install http://svn.edgewall.com/repos/trac/plugins/0.12/spam-filter-captcha
  }}}

  ==== Enabling the plugin ====
  Unlike plugins installed per-environment, you'll have to explicitly enable globally installed plugins via [wiki:TracIni trac.ini]. This also applies to plugins installed in shared plugins directory, i.e. the path specified in the `[inherit] plugins_dir` configuration option. 

  This is done in the `[components]` section of the configuration file, for example:
  {{{
  [components]
  tracspamfilter.* = 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`.)

  Note: After installing the plugin, you need to restart your web server.

  ==== Uninstalling ====

  `easy_install` or `python setup.py` does not have an uninstall feature. Hower, it is usually quite 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 installed by setuptools.
   1. Delete executables from `/usr/bin`, `/usr/local/bin` or `C:\\Python*\Scripts`. For search what executables are there, you may refer to `[console-script]` section of `setup.py`.
   1. Delete the .egg file or folder from where it is installed, usually inside `$PYTHONLIB/site-packages/`.
   1. Restart web server.

  If you are uncertain about the location of the egg, here is a small tip to help locate an egg (or any package) - replace `myplugin` with whatever namespace the plugin uses (as used when enabling the plugin):
  {{{
  >>> 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 eggs runtime (`pkg_resources`), so that their contents are actual files on the file system. The directory in which they are extracted defaults to '.python-eggs' in the home directory of the current user, which may or may not be a problem. You can however override the default location using the `PYTHON_EGG_CACHE` environment variable.

  To do this from the Apache configuration, use the `SetEnv` directive as follows:
  {{{
  SetEnv PYTHON_EGG_CACHE /path/to/dir
  }}}

  This works whether you are using the [wiki:TracCgi CGI] or the [wiki:TracModPython mod_python] front-end. Put this directive next to where you set the path to the [wiki:TracEnvironment Trac environment], i.e. in the same `<Location>` block.

  For example (for CGI):
  {{{
   <Location /trac>
     SetEnv TRAC_ENV /path/to/projenv
     SetEnv PYTHON_EGG_CACHE /path/to/dir
   </Location>
  }}}

  or (for mod_python):
  {{{
   <Location /trac>
     SetHandler mod_python
     ...
     SetEnv PYTHON_EGG_CACHE /path/to/dir
   </Location>
  }}}

   ''Note: !SetEnv requires the `mod_env` module which needs to be activated for Apache. In this case the !SetEnv directive can also be used in the `mod_python` Location block.''

  For [wiki:TracFastCgi FastCGI], you'll need to `-initial-env` option, or whatever is provided by your web server for setting environment variables. 

   ''Note: that if you already use -initial-env to set the project directory for either a single project or parent you will need to add an additional -initial-env directive to the !FastCgiConfig directive. I.e.

  {{{
  FastCgiConfig -initial-env TRAC_ENV=/var/lib/trac -initial-env PYTHON_EGG_CACHE=/var/lib/trac/plugin-cache
  }}}

  === About hook scripts ===

  If you have set up some subversion hook scripts that call the Trac engine - such as the post-commit hook script provided in the `/contrib` directory - make sure you define the `PYTHON_EGG_CACHE` environment variable within these scripts as well.

  == Troubleshooting ==

  === Is setuptools properly installed? ===

  Try this from the command line:
  {{{
  $ 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 (i.e. ''not'' inside the `plugins` directory of the Trac project environment) you will have to 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
   * the value is “enabled", not e.g. “enable”

  === Check the permissions on the egg file ===

  Trac must be able to read the file. 

  === Check the log files ===

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

  === Verify you have proper permissions ===

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

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

  If you put your plugins inside plugins directories, and certainly if you have more than one project, you need to make sure that the correct version of the plugin is loading. Here are some basic rules:
   * 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 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), then having two versions of a plugin in two different projects will give uncertain results. Only one of them will load, and the one loaded will be shared by both projects. Trac will load the first found - basically 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`) - 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 version number nor 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 ===

  OK, 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 the trac.ini) and it still doesn't work or give any error messages or any other indication as to why? Hop on the [trac:IrcChannel IrcChannel] and ask away.

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


name: TracModPython
author: trac
ipnr: 127.0.0.1
text:
  = Trac and mod_python =
  [[TracGuideToc]]

  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.

  These instructions are for Apache 2; if you are still using Apache 1.3, you may have some luck with [trac:wiki:TracModPython2.7 TracModPython2.7].

  == A Word of Warning ==

  As of 16^th^ June 2010, the mod_python project is officially dead.  If you are considering using mod_python for a new installation, '''please don't'''!  There are known issues which will not be fixed and there are now better alternatives.  Check out the main TracInstall pages for your target version for more information.

  == Simple configuration ==

  If you just installed mod_python, you may have to add a line to load the module in the Apache configuration:
  {{{
  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
  {{{
  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 of the above Load Module directive):
  {{{
  a2enmod python
  }}}
  On Fedora use, using yum:
  {{{
  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+.
  {{{
  #!xml
  <Location /mpinfo>
     SetHandler mod_python
     PythonInterpreter main_interpreter
     PythonHandler mod_python.testhandler
     Order allow,deny
     Allow from all
  </Location>
  }}}

  A simple setup of Trac on mod_python looks like this:
  {{{
  #!xml
  <Location /projects/myproject>
     SetHandler mod_python
     PythonInterpreter main_interpreter
     PythonHandler trac.web.modpython_frontend 
     PythonOption TracEnv /var/trac/myproject
     PythonOption TracUriRoot /projects/myproject
     Order allow,deny
     Allow from all
  </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
  {{{
      # 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 writable an alternate egg cache directory can be specified like this:
  {{{
  PythonOption PYTHON_EGG_CACHE /var/trac/myprojects/egg-cache
  }}}

  or you can uncompress the Genshi egg to resolve problems extracting from it.
  === Configuring Authentication ===

  Creating password files and configuring authentication works similar to the process for [wiki:TracCgi#AddingAuthentication CGI]:
  {{{
  #!xml
  <Location /projects/myproject/login>
    AuthType Basic
    AuthName "myproject"
    AuthUserFile /var/trac/myproject/.htpasswd
    Require valid-user
  </Location>
  }}}

  Configuration for mod_ldap authentication in Apache is a bit tricky (httpd 2.2.x and OpenLDAP: slapd 2.3.19)

  1. You need to load the following modules in Apache httpd.conf
  {{{
  LoadModule ldap_module modules/mod_ldap.so
  LoadModule authnz_ldap_module modules/mod_authnz_ldap.so
  }}}

  2. Your httpd.conf also needs to look something like:

  {{{
  #!xml
  <Location /trac/>
    SetHandler mod_python
    PythonInterpreter main_interpreter
    PythonHandler trac.web.modpython_frontend
    PythonOption TracEnv /home/trac/
    PythonOption TracUriRoot /trac/
    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>
  }}}

  Or the LDAP interface to a Microsoft Active Directory:

  {{{
  #!xml
  <Location /trac/>
    SetHandler mod_python
    PythonInterpreter main_interpreter
    PythonHandler trac.web.modpython_frontend
    PythonOption TracEnv /home/trac/
    PythonOption TracUriRoot /trac/
    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 Global Catalog Server portion of AD (Notice 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: Active Directory requires an authenticating user/password to access records (AuthLDAPBindDN and AuthLDAPBindPassword).

  Note 3: The directive "require ldap-group ..."  specifies an AD group whose members are allowed access.


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

  {{{
  #!xml
  <Location /projects/myproject>
    ...
    PythonOption PYTHON_EGG_CACHE /tmp 
    ...
  </Location>
  }}}


  === Setting the !PythonPath ===

  If the Trac installation isn't installed in your Python path, you'll have to tell Apache where to find the Trac mod_python handler  using the `PythonPath` directive:
  {{{
  #!xml
  <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`:
  {{{
  #!xml
  <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
  {{{
  #!xml
  <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:
  {{{
  #!xml
  <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 (i.e. when you access it at the URLs like
  !http://trac.mycompany.com):

  {{{
  #!xml
  <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 (i.e. you get the infamous Authentication information missing error). If this applies to you, try using a sub-directory for trac instead of the root (i.e. /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 ==

  In general, if you get server error pages, you can either check the Apache error log, or enable the `PythonDebug` option:
  {{{
  #!xml
  <Location /projects/myproject>
    ...
    PythonDebug on
  </Location>
  }}}

  For multiple projects, try restarting the server as well.

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

  See Graham Dumpleton's detailed [http://www.dscpl.com.au/wiki/ModPython/Articles/ExpatCausingApacheCrash explanation and workarounds] for the issue.

  === 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 download any CSS or images/icons. I used <Location /trac> `SetHandler None` </Location> to circumvent the problem, though I do not know if this is 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, try installing Trac using the `--always-unzip` option, like this:

  {{{
  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. Stick to the provided instructions. :)

  A success story: For me it worked out-of-box, with following trivial config:
  {{{
  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 the trac (e.g. 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:

  {{{
  <IfModule mod_rewrite.c>
    RewriteEngine Off
  </IfModule>
  }}}


  === 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, but there's also a patch available for earlier versions [http://www.dscpl.com.au/projects/vampire/patches.html here].

  === SELinux issues ===

  If Trac reports something like: ''Cannot get shared lock on db.lock''
  The security context on the repository may need to be set:

  {{{
  chcon -R -h -t httpd_sys_content_t PATH_TO_REPOSITORY
  }}}

  See also [http://subversion.tigris.org/faq.html#reposperms]

  === FreeBSD issues ===
  Pay attention to the version of the installed mod_python and sqlite packages. Ports have both the new and old ones, but earlier versions of pysqlite and mod_python won't integrate as the former requires threaded support in python, and the latter requires a threadless install.

  If you compiled and installed apache2, apache wouldn´t support threads (cause it doesn´t work very well on FreeBSD). You could force thread support when running ./configure for apache, using --enable-threads, but this isn´t recommendable.
  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 

  {{{
  export LD_PRELOAD=/usr/lib/libc_r.so
  }}}

  === 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. (The 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're using Subversion libraries that are binary incompatible with the apache ones (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. 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:
  {{{
  PythonInterpreter main_interpreter
  }}}
  This is anyway the recommended workaround for other well-known 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:
  {{{
  #!xml
  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, i.e. {{{<Location /myproject />}}}.

  Also, setting `PythonOptimize On` seems to mess up the page headers and footers, in addition to hiding the documentation for macros and plugins (see #Trac8956). Considering how little effect the option has, it is probably a good idea to leave it `Off`.

  === 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:
  {{{
  #!xml
  <VirtualHost * >
      DocumentRoot /var/www/myproject
      ServerName trac.mycompany.com
      SetEnv HTTPS 1
      ....
  </VirtualHost>
  }}}

  === Fedora 7 Issues ===
  Make sure you install the 'python-sqlite2' package as it seems to be required for TracModPython but not for tracd


  === 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 debian bug report [http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=411487]

  Some people also have troubles when using php5 compiled with its own 3rd party libraries instead of system libraries. Check here [http://www.djangoproject.com/documentation/modpython/#if-you-get-a-segmentation-fault]

  ----
  See also:  TracGuide, TracInstall, [wiki:TracModWSGI ModWSGI], [wiki:TracFastCgi FastCGI],  [trac:TracNginxRecipe TracNginxRecipe]


name: TracSearch
author: trac
ipnr: 127.0.0.1
text:
  = Using Search =

  Trac has a built-in search engine to allow finding occurrences of keywords and substrings in wiki pages, tickets and changeset properties (author, revision and log message).

  Using the Trac search facility is straightforward and its interface should be familiar to most users.

  Apart from the [search: Search module], you will also find a small search field above the navigation bar at all time. It provides convenient access to the search module from all pages.

  == "Quickjump" searches ==
  For quick access to various project resources, the quick-search field at the top of every page can be used to enter a [TracLinks wiki link], which will take you directly to the resource identified by that link.

  For example:

   * ![42] -- Opens change set 42
   * !#42 -- Opens ticket number 42
   * !{1} -- Opens report 1
   * /trunk -- Opens the browser for the `trunk` directory

  == Advanced ==

  === Disabling Quickjumps ===
  To disable the quickjump feature for a search keyword - for example when searching for occurences of the literal word !TracGuide - begin the query with an exclamation mark (!).

  === Search Links ===
  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

  ----
  See also: TracGuide, TracLinks, TracQuery


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

  Like in most [http://www.opensource.org/ open source projects], "free" Trac support is available primarily through the community itself, mainly through the [trac:MailingList mailing list] and the [trac: project wiki].

  There is also an [trac:IrcChannel IRC channel], where people might be able to help out. Much of the 'live' development discussions also happen there.

  Before you start a new support query, make sure you've 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.egdewall.org for asking a support question about Trac. Only use it 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:CommercialServices]


name: InterWiki
author: trac
ipnr: 127.0.0.1
text:
  = Support for InterWiki links =

  ''(since [trac:milestone:0.10 0.10])''

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

  At the extreme, InterWiki prefixes can even be used to simply 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 (e.g. `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 InterMapTxt wiki page, 
  modelled after MeatBall:InterMapTxt.

  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.

  == Examples ==

  If the following is an 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` should be rendered as MoinMoin:InterWikiMap
     and the ''title'' for that link would be "!InterWikiMap in !MoinMoin"
   * `Trac-ML:4346` should be rendered as Trac-ML:4346
     and the ''title'' for that link would be "Message 4346 in Trac Mailing List"

  ----
  See also: InterTrac, InterMapTxt


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,
  for various different purposes, like:
   - [#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 [wiki:WikiHtml raw HTML] and
     [wiki: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, 
  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"
  {{{
  {{{
  <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).

  === 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 an arbitrary Wiki content inside a <div> element
               (''since 0.11'').
   `#!span` :: Wrap an arbitrary Wiki content inside a <span> element 
               (''since 0.11''). 

   `#!td` :: Wrap an arbitrary Wiki content inside a <td> element (''since 0.12'')
   `#!th` :: Wrap an arbitrary 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 of better visual grouping
         (''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].


  === Code Highlighting Support ===

  Trac includes processors to provide inline syntax highlighting:
   `#!c` (C), `#!cpp` (C++), `#!python` (Python), `#!perl` (Perl), 
   `#!ruby` (Ruby), `#!php` (PHP), `#!asp` (ASP), `#!java` (Java), 
   `#!js` (Javascript), `#!sql (SQL)`, `#!xml` (XML or HTML),
   `#!sh` (!Bourne/Bash shell), etc.

  Trac relies on external software packages for syntax coloring,
  like [http://pygments.org Pygments]. 

  See TracSyntaxColoring for information about which languages
  are supported and how to enable support for more languages.

  Note also that by using the MIME type as processor, it is possible to syntax-highlight the same languages that are supported when browsing source code. For example, you can write:
  {{{
  {{{
  #!text/html
  <h1>text</h1>
  }}}
  }}}

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


  For more processor macros developed and/or contributed by users, visit: 
   * [trac:ProcessorBazaar]
   * [trac:MacroBazaar]
   * [th:WikiStart 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: WikiStart
author: adrpo
ipnr: 80.217.143.184
text:
  = TLMPlugin trac =

  TLMPLugin is a sub-project of OpenModelica supported by Vinnova in the MODRIO project.

  = Repository =
  The TLMPlugin repository is here: https://openmodelica.org/hg/TLMPlugin/.\\
  You can also browse it in Trac via [Browse Source: https://trac.openmodelica.org/TLMPlugin/browser]

  = Contact =
  If you need a Trac/Mercurial contact [Adrian Pop http://www.ida.liu.se/~adrpo/].


name: WikiStart
author: adrpo
ipnr: 80.217.143.184
text:
  = TLMPlugin trac =

  TLMPLugin is a sub-project of OpenModelica supported by Vinnova in the MODRIO project.

  = Repository =
  The TLMPlugin repository is here: https://openmodelica.org/hg/TLMPlugin/.\\
  You can also browse it in Trac via [Browse Source: https://trac.openmodelica.org/TLMPlugin/browser]

  = Contact =
  If you need a Trac/Mercurial user contact [Adrian Pop http://www.ida.liu.se/~adrpo/].


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. This text markup is also used in all other parts of the system, not only in [wiki:TitleIndex wiki pages], but also in [wiki:TracTickets ticket] description and comments, [wiki:TracChangeset check-in log messages], [wiki:TracRoadmap milestone] descriptions and [wiki:TracReports report] descriptions, even in third-party extensions.
  It allows for formatted text and hyperlinks in and between all Trac modules.

  Editing wiki text is easy, using any web browser and a simple [WikiFormatting formatting system], rather than more complex markup languages like HTML.  The reasoning behind its design 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 though that Trac also supports [WikiHtml HTML], [WikiRestructuredText reStructuredText] and [http://www.textism.com/tools/textile/ Textile] as alternative markup formats, which can eventually be used in parts of a page (so called wiki “blocks”).

  The main goal of the wiki is to make editing text easier and ''encourage'' people to contribute and annotate text content for 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 ''[http://www.w3.org/Provider/Style Style Guide for online hypertext]'' explains how to think about the
  [http://www.w3.org/Provider/Style/Structure.html overall structure of a work] 
  and how to organize information [http://www.w3.org/Provider/Style/WithinDocument.html within each document]. One of the most important tip is “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 in a precise way to any resource within Trac

  If you want to practice editing, please use the SandBox. Note that not all Trac wikis 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 the Changes'' you've made.
  You can get an automatic preview of the formatting as you type when you activate the ''Edit Side-by-side'' mode (you have to Preview the page for the setting to take effect). '' There is a [wiki:/TracIni#trac-section 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 [http://wikipedia.org/wiki/Wiki Wiki], in a famous wiki encyclopedia
   * The [http://c2.com/cgi/wiki?WikiHistory History] of the original wiki
   * A wiki page explaining [http://www.usemod.com/cgi-bin/mb.pl?WhyWikiWorks why wiki works]

  ----
  See also: TracGuide


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 [http://trac.edgewall.org 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 strives to help developers write great software while staying out of the way. Trac should impose as little as possible on a team's established development process and policies.

  It provides an interface to Subversion (and 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 used throughout.
     * 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 — The roadmap helps tracking project progress.
       * TracReports — Writing and using reports.
       * TracQuery — Executing custom ticket queries.
       * TracBatchModify - Modifying a batch of tickets in one request.
     * Other modules and general topics
       * TracSearch — Full text search in all content.
       * TracTimeline — The timeline provides a historic perspective on a project.
       * TracRss — RSS content syndication in Trac.
       * TracAccessibility — Accessibility keys support


  == 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, look no further than the [http://trac.edgewall.org/wiki/MailingList MailingList]. It provides a friendly environment to discuss openly among Trac users and developers.


name: TracBatchModify
author: trac
ipnr: 127.0.0.1
text:
  = Trac Ticket Batch Modification =
  [[TracGuideToc]]

  From [wiki:TracQuery custom query] results Trac provides support for modifying a batch of tickets in one request.

  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 in addition of replacing the entire list value. All list field controls accept multiple items (i.e. multiple keywords or cc addresses).


name: WikiMacros
author: trac
ipnr: 127.0.0.1
text:
  = Trac Macros =

  [[PageOutline]]

  Trac macros are plugins to extend the Trac engine with custom 'functions' written in Python. A macro inserts dynamic HTML data in any context supporting WikiFormatting. Its syntax is `[[macro-name(optional-arguments)]]`.

  The WikiProcessors are another kind of macros. They typically deal with alternate markup formats and transformation of larger "blocks" of information (like source code highlighting). They are used for processing the multiline `{{{#!wiki-processor-name ... }}}` blocks.

  == Using Macros ==

  Macro calls are enclosed in two ''square brackets''. Like Python functions, macros can also have arguments, 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 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 style="font-size: 80%" class="trac-macrolist">
  <h3><code>[[Image]]</code></h3>Embed an image in wiki-formatted text.

  The first argument is the file …
  <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>.
  Can be …</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're looking for new macros, or have written one that you'd like to share with the world, please don't hesitate to 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 with Trac 0.11. 

  Also, have a look at [trac:source:tags/trac-0.11/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 a little more insight about the transition.

  === Macro without arguments ===
  To test the following code, you should saved 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 genshi.builder import tag

  from trac.util.datefmt import format_datetime, utc
  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.b(format_datetime(t, '%c'))
  }}}

  === Macro with arguments ===
  To test the following code, you should saved it in a `helloworld_sample.py` file located in the TracEnvironment's `plugins/` directory.
  {{{
  #!python
  from genshi.core 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's 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. On the contrary, 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 by yourself (using `return Markup.escape(result)`) or, if this is indeed HTML, wrap it in a Markup object (`return Markup(result)`) with `Markup` coming from Genshi, (`from genshi.core import Markup`).  

  You can also recursively use a wiki Formatter (`from trac.wiki import Formatter`) to process the `text` as wiki markup, for example by doing:

  {{{
  #!python
  from genshi.core 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())
  }}}


