[Grok-dev] Re: Grok Widgets / Fields (Was Re: Re: [grok-br] Grok
1.0 and beyond)
Martijn Faassen
faassen at startifact.com
Fri Jan 11 19:37:38 EST 2008
Sebastian Ware wrote:
[snip]
> Maybe I should try to get into the formlib stuff again. The code seems
> to be well documented, but sometimes I have difficulties translating the
> doctest type documentation into working code.
You're not the only one. It's pretty normal. I always console myself by
saying, well, this doctest is a lot better than having just plain unit
tests (or *nothing*).
Note though that no matter what, doing string concatenation in Python is
not going to be efficient (barring some practical version of PyPy).
Instead the simplest fix is to do:
l = []
l.append('my stuff')
l.append('more stuff')
return ''.join(l)
you could also investigate the StringIO module.
Back to the interpretation of the holy doctests. This is a task for the
Grok community. We take something in Zope 3, and we write a document for
mere mortals to read (and possibly automate the common case).
So, perhaps in the formlib case, one simple enough fix would be for Grok
to include a few macros for people to reuse to draw their forms, and
some documentation about how drawing forms works in the first place.
Regards,
Martijn
More information about the Grok-dev
mailing list