On 2/21/07, Shaar Gabriel <[EMAIL PROTECTED]> wrote:
a little thought about zc.resourcelibrary. shouldn't the added
resources (at least javascript) be closer to </head> than to <head>.
this way the specific javascript resources can make use of the more
general ones included in the skin with the template. does this make
sense ?

Like Gary, I don't put more general items in the main template. I
shout out my need from the head of the main template::

   <tal:resources replace="resource_library:brcms-rsrc" />

So I would want my items to be towards the top. Usually. The more
specific resources should be wired to require `brcms-rsrc` or one of
its dependents. This is how I've always expected resourcelibrary to

But I've been thinking about resourcelibrary. In fact, I logged in to
GMail to ask some questions about it. It's such a useful tool, in some
regards, but it falls short in others. I don't know how to fix it
properly without changing the paradigm (which I would like to do).

One of my complaints is similar to yours, but I want better control of
the positioning. I've thought of making a second pipeline in the
result that would look for very simple markers - just a kind of string
insertion template language (no conditionals, loops, etc). So that
instead of looking for a ``<head>`` tag, it might look for
``<!--#resourcelibrary:all-->`` or something like that... maybe even
an XML processing instruction?

Short of an aggressively object-oriented system like Seaside, where
one is building a document page out of objects instead of just
rendering a template / raw string, I guess I really want some kind of
pipelining. I don't want the pipelining to bound to ZPT in any way.
But I imagine there might be some kind of lesson that could be
extracted from how resourcelibrary mucks with the implicit result; or
even with explicit results?


   def _implicitResult(self, body):
       #figure out the content type -- this is straight from resourcelibrary
       content_type = self.getHeader('content-type')
       if content_type is None:
           if isHTML(body):
               content_type = 'text/html'

       # now we veer off in the land of hypotheticals
       postprocessor = queryAdapter(self, IResultPostProcessor,
       if postprocessor:
           # the resourcelibrary code that writes all the <script> and
           # <style> tags would be in this `process` code.
           body = postprocessor.process(body)

       return super(Response, self)._implicitResult(body)

That might be easier to customize. Resourcelibrary is falling short of
my needs / wants in a few areas. Having an easier plug-in point for
tweaking the response would be dreamy.

Jeff Shell
Zope3-dev mailing list
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com

Reply via email to