RE: [Zope] Zope and remote caches.
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 -------------------------------------------
This is highly cool, is there anyplace that this, and other similar methods are documented besides the code itself? On Wed, Mar 01, 2000 at 07:49:48AM -0500, Martijn Pieters wrote:
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>
-- COBOL: Completely Over and Beyond reason Or Logic.
From: <jiva@devware.com>
This is highly cool, is there anyplace that this, and other similar methods are documented besides the code itself?
I'd have thought someone would have answered you by now. Have a look at the Zope Quick Reference: http://www.zope.org/Members/ZQR/ Also, looking over the doc/CHANGES.txt file can give you lots of clues about new features that may not yet have been documented. Martijn Pieters | Software Engineer mailto:mj@digicool.com | Digital Creations http://www.digicool.com/ | Creators of Zope http://www.zope.org/ | The Open Source Web Application Server ---------------------------------------------
participants (2)
-
jiva@devware.com -
Martijn Pieters