[Zope] Zope and remote caches.

Martijn Pieters mj@digicool.com
Wed, 1 Mar 2000 07:49:48 -0500


From: jiva@devware.com [mailto:jiva@devware.com]
> So, if I am grokking the whole zope thang properly here, then
> theoretically, when I imbed objects within my zope documents, I
> shouldn't hardcode in specific urls to them.  Instead, I should treat
> them almost as if they are always in the current directory, even if
> they are a couple of folders up.  This way, if I want to override some
> behavior in the future, I just copy the object down into the current
> folder and edit it.  I notice however, that if I do this, it plays
> hell with browser caching because the browser winds up pulling things
> from different places all the time even if it's actually winding up
> pulling the same document down.  How do other people deal with this?

Use the absolute_url() method on the objects. 

That way, your generated HTML will contain absolute URLs to the objects,
that are the same across different Folders in your site even when the
object is acquired from elsewhere. Overriding as you described will
still work the same, the URLs will reflect the change accordingly.

Syntax variations (as always from the top of my head, not tested, YMMV):

  <dtml-var "object.absolute_url()">
  <dtml-var object url>
  &dtml.url-object;

The last notation is especially useful in HTML tag attributes, as it
won't break WYSIWYG HTML editors:

  <a href="&dtml.url-object;">Go to object</a>

-- 
Martijn Pieters, Software Engineer 
| Digital Creations http://www.digicool.com 
| Creators of Zope      http://www.zope.org 
| mailto:mj@digicool.com       ICQ: 4532236
| PGP:
http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149 
-------------------------------------------