Random number, perhaps?
http://www.python.org/doc/2.5.2/lib/module-random.html
I'm wondering if you actually need the ID, or if it just makes it more
convenient to write some javascript or something. How do you use it?
Ted
On Sun, Oct 26, 2008 at 11:13 AM, Martin Scharrer <[EMAIL PROTECTED]
> wrote:
>
> Hi,
> I'm writing on a macro for trac 0.11 and have to return a div tag with
> an HTML id attribute. This have to be unique per HTML page, so I can't
> use a fixed predefined string, e.g. the macro name, because this would
> produce problems when the macro is used twice on the same wiki page.
>
> My first idea is to put the macro arguments through an hash algorithm,
> e.g. MD5, and use this and the macro name as id. This allows for
> multiple macro calls with different arguments, but still produces an
> invalid HTML output (i.e. multiple indentical IDs) if the macro is
> called with the same arguments twice.
>
> My knowledge of the trac API and python itself is limited, so I need a
> little help here.
> Is there something in the trac environment which is unique for every
> single macro call on a wiki page? Maybe the position or something like
> this.
>
> Could I just introduce a class variable which counts up every time the
> macro is called and use this as part of the ID?
>
> Thanks in advance for your help.
> Martin
>
>
>
> >
>
--
+ -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Trac
Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/trac-users?hl=en
-~----------~----~----~----~------~----~------~--~---