Sorry, the first "from .. import" line is useless (copy n' paste...)
On 8/17/06, Emmanuel Blot <[EMAIL PROTECTED]> wrote:
Importing the code won't give you access to the req (request) instance.
The request object is not available from the macro body.
The authname is also available from the hdf instance.
Michael, you could try something this:
#----- Link.py ---
from trac.wiki.formatter import Formatter
import string
def execute(hdf, args, env):
(url, name) = map(string.strip, args.split(','))
return '<a href="%s?user=%s">%s</a>' % (url, hdf['trac.authname'], name)
#-----
Example:
[[Link(http://example.com, Example)]]
Of course, you probably need to deal with error cases (authname not
defined when user is not logged in, etc.)
Cheers,
Manu
_______________________________________________
Trac mailing list
[email protected]
http://lists.edgewall.com/mailman/listinfo/trac