durusmail: quixote-users: Re: PTL docs
Re: PTL docs
2001-06-07
2001-06-07
Re: PTL docs
Goodger, David
2001-06-07
The doc looks good.

One small point you may want to mention is that you need to print or str()
the output of a template call. In the interactive interpreter, you get a
TemplateIO object. I wasted a few frustrating minutes doing this kind of
thing:

    >>> from quixote import imphooks
    >>> imphooks.install()
    >>> import testptl
    >>> dir(testptl)
    ['TemplateIO', '__builtins__', '__doc__', '__file__', '__name__',
'__output', 'test1', 'test2', 'test3']
    >>> testptl.test3()
    

"I thought it was supposed to return a string. That's what the docs (!) say.
Hmm. I wonder what a TemplateIO object is?"

    >>> output = testptl.test3()
    >>> dir(output)
    ['data']

"OK, the output is in the data attribute."

    >>> output.data
    ['hi', ' ', 'there']

"What? I thought it was supposed to return a string! ..."

Before finally figuring out how to do it:

    >>> print output
    hi there

A line of explanation may save many frustrating minutes.

/DG


reply