Sorry, for backwards compatibility the request structure is not passed to macros. You can use the hdf trick (hdf['trac.authname']), or you can make a new-style plugin.

--Noah

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

I think I'm using the wrong parameters. But I don't know how to do different.

Sorry if this is a stupid question but I become really desperate.
If anyone can tell me how to change this little macro and how to call it from 
the wiki site I would be very happy.
thanks guys

kind regards
Michael


-------- Original-Nachricht --------
Datum: Wed, 16 Aug 2006 08:44:58 -0400
Von: Noah Kantrowitz <[EMAIL PROTECTED]>
An: [email protected]
Betreff: Re: [Trac] Wiki Link

The current user is in req.authname

--Noah

Michael Bösendorfer wrote:
So ... I played a little bit with the writing of macros/plugins and was
successful ;-)
Now I'm trying to get the name of the current logged in user into a
variable but I have no idea how to solve this problem.
I saw that the Trac Database Schema has a table named "session" with
information about user settings, including name, email, and diff options. Can
I use this table to solve the problem or is it useless for my intention? Or
has anybody a better idea?
thanks guys

kind regards
Michael


-------- Original-Nachricht --------
Datum: Wed, 16 Aug 2006 10:30:09 +0200
Von: "Michael Bösendorfer" <[EMAIL PROTECTED]>
An: [email protected]
Betreff: Re: [Trac] Wiki Link

Thanks for the replies!
I'm new to writing plugins/macros and so I don't have any idea how to
start writing a macro which can handle the feature I need.
I already read the egg cooking tutorials but I'm not sure if this is
the
right starting point. Would this kind of macro be very complicated? And
how
much time will this take approximately.
Maybe someone can give me some hints how to start writing such a macro!
Thanks a lot and have a nice day!

kind regards
Michael


-------- Original-Nachricht --------
Datum: Thu, 10 Aug 2006 08:43:43 -0400
Von: Noah Kantrowitz <[EMAIL PROTECTED]>
An: [email protected]
Betreff: Re: [Trac] Wiki Link

You would need to make a macro to render the link, but yes.

--Noah

Michael Bösendorfer wrote:
Hi guys!

Does anyone know if it is possible to have a link on the wiki page
with
the current logged in user as an argument?
should look like this:
www.blabla.com?user=currentUser

thanks a lot

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


Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer
_______________________________________________
Trac mailing list
[email protected]
http://lists.edgewall.com/mailman/listinfo/trac
_______________________________________________
Trac mailing list
[email protected]
http://lists.edgewall.com/mailman/listinfo/trac


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

Reply via email to