I am working on yet another templating system (yeah, I know, but the
ratio of web frameworks to templating systems has just gotten too
high).  Its primary focus is not really the web, although it would be
nice to make it "just work" on the web, as well.

With that in mind, I thought I would make sure that I could easily
support the TurboGears/Buffet plugin architecture, but after reading
the documentation at
http://www.turbogears.org/docs/plugins/template.html, I have several
questions.

(Disclaimer: I haven't used TurboGears, although I have used CherryPy
in the past, so these questions are from the perspective of somebody
who is just reading this documentation webpage, who has not been
steeped in TurboGears lore and practices.  If the answers are't too
self-evident to TurboGearHeads, perhaps the doc page could be
updated...)

Questions on the example YourPlugin class:

   1. In __init__(), it specifies that "the options should be prefixed
with the engine's scheme name...".  Is this prefixing done with a
colon, or a period, or any separator at all?  (I thought I saw both
dots and colons used to separate prefixes for various different
purposes in the TurboGears docs.)

   2. In render(), the "template" parameter is not described.  Is this
the same as the load_template() "templatename" parameter, or is it an
actual template, as returned by load_template()?  (The documentation
would appear to indicate it is not the latter, but then why isn't it
clearly named "templatename" like the load_template() parameter?)  The
default is "None" -- is "None" ever passed in, and if so what should
the function do with it -- use the result of the most recent call to
load_template()?

   3. I guess some of my confusion (about what happens in question 2)
revolves around the lack of discussion about the use of the YourPlugin
class by the system. Is it instantiated once?  Once per thread?  Once
per template used?

   4. I assume that render() should return a string.  This is certainly
implied by the docstring comment, but is not spelled out in black and
white.

   5. Template context data is defined in two ways -- the info
parameter passed to render(), and by calling the optional
extra_vars_func().
         a. Is the template engine allowed to modify the dictionary
returned from extra_vars_func?
         b. Is the template engine allowed to modify the info parameter
dictionary? (e.g. by adding __builtins__)
         c. If there is a name collision between these two
dictionaries, which one takes precedence?
         d. Although the fact that extra_vars_func() should be called
on every render() is documented at __init__(), this should probably be
reinforced at the documentation for render().

   6. How is the result from the transform() method used?  (e.g.
directly by TurboGears, or by piping it back into the templating
package?) If it's the latter, does the transform() method have to
return an elementtree representation, or could it return some other
representation which is meaningful to the templating package and
efficient to generate and use?

Additional questions:

7. In the setup.py entry point section it shows "schemename =
yourpackage.yourmodule:YourPluginClass".  I would assume that it should
really be "yourschemename" as well, but I hate making those kinds of
assumptions.

8. There is scant discussion on caching templates.  Should they always
be cached?  How are stale templates flushed out of the cache?  I was
under the impression from something I read earlier that changing a
template would cause TurboGears to reload, but I don't see anything in
the interface for this.

Thanks in advance for any light you can shed on these issues.

Regards,
Pat


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

Reply via email to