trac-users

[Prev] Thread [Next]  |  [Prev] Date [Next]

[Trac] Re: Converting to Trac-- again Matt Good Wed Mar 21 00:07:05 2007

On Mar 20, 11:54 pm, "Stephen Hansen" <[EMAIL PROTECTED]> wrote:
> Now comes the fun part. We had a number of specialized templates for
> formatting certain common data in a visually pleasing way. I'm writing
> simple macros for that (as one-file plugins from WikiMacroBase).

It sounds like you may be putting each macro in a separate .py file
like how the old-style macros were written.  The new style doesn't
depend on the filename for the name of the macro so you're actually
free to define multiple macros in a single class if you prefer.

> The first big hiccup I've noticed? I like to use keyword arguments, since
> otherwise the peers won't remember what's what, and looking over the
> pages... I can't rely upon them ever being able to type them in with the
> proper case.
>
> [[APTBuild(build=256, Revision=4587, date=03/03/2007,
> path=/release/build256)]]
>
> Notice the R. :)
>
> The question: Am I missing anything obvious(a feature, option, etc) to make
> this not an issue? If not, then I'll probably end up making a patch to have
> parse_args return a case-insensitive dict.

No, parse_args just returns them in whatever case was provided.  If
you need to normalize the keyword args to lower-case you can do it
like:

args, kw = parse_args(arg_string)
kw = dict([(k.lower(), v) for k,v in kw.iteritems()])

In Python 2.4 and up the square-brackets in the second line are
optional.  And of course if you're doing this in multiple places you
may want to define that as a function that you can reuse.

-- Matt Good


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---