Em Segunda 08 Maio 2006 17:16, Robin Haswell escreveu: > Jorge Godoy wrote: > > I prefer spending a bit more of my time to make users > > happy. > > Good to know you'll never write for the gnome project then ;-) > > (Sorry)
Why? I won't indeed. ;-) > On a more constructive note, this might sound silly but can't we just do > this by performing a regular expression on quickstarted source? > > Try this: > > $ cat controllers.py|sed -r 's/^(\s+)@([a-z_]+\(.*\))\s*$/\1[\2]/i' > > It only works on single-line decorators (multiline might be a little beyond > my regexp skill) but it seems to do the job. I think the experession for a > python symbol - [a-z_] - is a little off, but someone can easily sort that > out. You could even replace it with [^(] . > > Of course that regexp is fine to just dump in to re.compile() - > re.compile(r's/^(\s+)@([a-z_]+\(.*\))\s*$/\1[\2]/', re.I) > > Quick question - why does the "[expose(...)]" work? I prefer maintaining an English template -- even though English is not my primary language -- than working with regular expressions (and I have a Perl (!!!) background... ;-)). I believe that there's some way to declare it like this: #if python23 #def expose_decorator [turbogears.expose()] #end def #def identity_decorator [identity.require(...)] #end def #else if python24 #def expose_decorator @turbogears.expose() #end def #def identity_decorator @identity.require(...) #end def #end if and then use it like: #expose_decorator or #insert expose_decorator Something like this looks much more maintainable to me and it is easy to use... BUT, I don't know the syntax for this template, so... -- Jorge Godoy <[EMAIL PROTECTED]> --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TurboGears" 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/turbogears -~----------~----~----~----~------~----~------~--~---

