Michael Bösendorfer wrote:
> Sorry guys that I'm that stupid but I'm such a newbie so I am not able to get 
> the macro run the way I want.
> Thanks Noah for your help and I'm sure everybody else would know how to get 
> the current user name with req.authname but I played a bit arround and always 
> got some error messages.
> 
> I tried the following macro and copied it into the wiki-macros folder:
> 
> # bla.py -- The world's simplest macro
> def execute(hdf, args, env):
>     muh = req.authname
>     return "Hello Michi: called with args: %s" % muh
> 
> When I call [[bla]] on the wiki page I get the following error message:
> 
> Error: Macro bla(None) failed 
> global name 'req' is not defined
> 

Just looking at the error message from the python code -- without
knowing about macro development for trac -- the instance req is not
defined. You need to import it from somewhere, probably the trac module.

Try adding:

 from trac.core import *

at the top of your file.

I got that from some code snip I found by following the help link of a
trac webpage.


Cheers,

Guenter

_______________________________________________
Trac mailing list
[email protected]
http://lists.edgewall.com/mailman/listinfo/trac

Reply via email to