[Zope-dev] Re: ZPT for CSS, anyone?

Jamie Heilman jamie at audible.transient.net
Tue Mar 30 15:04:09 EST 2004


Tres Seaver wrote:
> >Stylesheets should always be static documents, a dynamic stylesheet
> >defeats browser caching
> 
> Not if the dynamism is based on user preferences, and if the 
> cache-control headers are set appropriately;  in that case, the browser 
> (but not intermediate proxies) will still be able to cache the page.

Yes, even if dynamism is based on user preferences.  Stylesheets are a
combinatory tool, thats what cascading is all about.  Create seperate
stylesheets for every preference value and combine them to achieve the
desired presentation.  Let ZPT and <link> directives handle the user
preference logic, you'll blow less energy on the back-end processing
and your server-side caching will be that much more effective.

> However, consider what happens to cacheability when the URLs of of 
> images referenced in a document are relative;  the same problem can 
> afflict stylesheets, particularly in a setup where virtual hosting is in 
> play.

Nothing happens to cacheability based on URI relativity.  I fail to
see how virtual hosting has anything to do with this either.  If
you're talking about object acquisition, thats a manufactured problem
that Zope enables, but is avoidable by attention to the context your
URIs will appear in.  Just because acquisition lets an object be
addressable by multiple URIs doesn't mean its a good idea to do so.
 
> I strongly favor DTML over ZPT for those cases where you need to 
> generate dynamic "plain" text (mail, CSS, Javascript, etc.)

Python Scripts are better for dynamic plain text, simply because
they're less magical and don't have all the stupid namespace problems
that DTML does.

-- 
Jamie Heilman                     http://audible.transient.net/~jamie/
"Paranoia is a disease unto itself, and may I add, the person standing
 next to you may not be who they appear to be, so take precaution."
						-Sathington Willoughby



More information about the Zope-Dev mailing list