Changes between Version 4 and Version 5 of MacroMigrationTutorial


Ignore:
Timestamp:
Sep 29, 2005, 12:40:22 PM (9 years ago)
Author:
athomas
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • MacroMigrationTutorial

    v4 v5  
    11= Migrating Trac macros from 0.8.x to 0.9.x =
    22
     3== Changes ==
    34Global macros are now stored in {{{${prefix}/share/trac/wiki-macros}}} instead of {{{${prefix}/pythonX.Y/site-packages/trac/wiki-macros}}}.
    45
    56Global macros are not implicitly loaded. After installing a macro into the global macro directory a {{{trac-admin <env> upgrade}}} must be performed, which will copy the macro into the environments {{{<env>/wiki-macros}}} directory. Unfortunately, trac does not appear to detect outdated macros and will not upgrade existing macros to newer versions. You will need to manually delete the copies of the global macros in each environment, then perform an environment upgrade. With mod_python, as always, this will require an apache restart.
    67
     8== Hints ==
     9
    710If your macro needs to preserve state across an entire page render, place the state variables into the {{{hdf}}} object.
    811
     12== Issues ==
     13
     14Due to Trac [http://projects.edgewall.com/trac/ticket/1562 #1562], there is seemingly no way to pass dynamic variables to reports apart from using a fully qualified link. For example, in a perfect world [report:9?COMPONENT=AddCommentMacro this] would work. This feature did work in 0.8.
     15
     16== API Changes ==
    917Several classes and functions used frequently in macros have changed. This table outlines some of those that I came across while migrating my macros to the 0.9.x object hierarchy:
    1018
    1119||'''0.8.x'''||'''Equivalent in 0.9.x'''||
    1220||{{{trac.WikiFormatter.wiki_to_oneliner(wikitext, hdf, env, db,absurls=0)}}}||{{{trac.wiki.wiki_to_oneliner(wikitext, env, db=None, absurls=0)}}}||
    13 ||{{{trac.WikiFormatter.wiki_to_html(wikitext, hdf, env, db, absurls=0)}}}||{{{trac.wiki.wiki_to_html(wikitext, env, req, db=None, absurls=0, escape_newlines=False)}}}||
     21||{{{trac.WikiFormatter.wiki_to_html(wikitext, hdf, env, db, absurls=0)}}}||{{{trac.wiki.wiki_to_html(wikitext, env, req, db=None, absurls=0, escape_newlines=False)}}} [[FootNote(If you wish to use {{{wiki_to_html}}} with content that itself contains macro's, you will need to create a full plugin. This seems to be because the hdf macro argument is extracted from the req object in the sub-macro.)]]||
    1422
    15 [[TagIt(tutorial,athomas,0.9,0.8)]]
     23[[FootNote]]
    1624
     25[[TagIt(tutorial,athomas,0.8,0.9)]]
     26
     27