Reference files in a product folder
How do I do that? =] Example: Product LotsOfImages has 50 images within it's main ZClass, main; How do you get the URL of the images from within a DTML Document, in main? -Morten
You're going to have to acquire the image objects from within an instance of the 'main' ZClass to get a working URL to them. So in a DTML document within an instance of zclass 'main' called 'maininstance': <dtml-var "myimagename.absolute_url()"> will work. You can;t just go grab these things' URLs right out of the Product by traversing the Control_Panel.Products.ProductName.ZClassName.ImageName and calling absolute_url on that. The reason is that though images are capable of being placed in a zclass, they are not really methods, and as such, the returned absolute_url from this traversal is wrong (it omits an intermediate 'propertysheets' path member). You *can* use handwritten HTML to go grab the image like: <img src="Control_Panel/Products/LotsOfImages/main/propertysheets/methods/myimagename"> But you can;'t programatically generate this string using absolute_url(). This *might* be considered a bug if we were sure that we really, truly wanted to allow images to be methods of zclasses. But I think for now it's one of those grey areas. On Sat, 22 Apr 2000, Morten W. Petersen wrote:
How do I do that? =]
Example:
Product LotsOfImages has 50 images within it's main ZClass, main; How do you get the URL of the images from within a DTML Document, in main?
-Morten
_______________________________________________ Zope-Dev maillist - Zope-Dev@zope.org http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
So in a DTML document within an instance of zclass 'main' called 'maininstance':
<dtml-var "myimagename.absolute_url()">
will work.
Mm, but that wasn't my problem. (I apologize for being vague).
This *might* be considered a bug if we were sure that we really, truly wanted to allow images to be methods of zclasses. But I think for now it's one of those grey areas.
Okay. What about script-files? I've got a product up (devel) under Members/morphex, that relies on a couple of JavaScript files (which are too big to include on every page). The product is a JavaScript news-roller, btw, that utilizes a hack I did on Zope 2.1.3 (yes, the patches are there). It's works for NS4,IE4 and IE5; and has appropiate fallbacks for old javascript-enabled browsers and browsers without support for javascript. -Morten
On Sat, 22 Apr 2000, Morten W. Petersen wrote:
This *might* be considered a bug if we were sure that we really, truly wanted to allow images to be methods of zclasses. But I think for now it's one of those grey areas.
Okay. What about script-files? I've got a product up (devel) under Members/morphex, that relies on a couple of JavaScript files (which are too big to include on every page).
The product is a JavaScript news-roller, btw, that utilizes a hack I did on Zope 2.1.3 (yes, the patches are there). It's works for NS4,IE4 and IE5; and has appropiate fallbacks for old javascript-enabled browsers and browsers without support for javascript.
Any object in a zclass that's not a method (a DTML method, a pythonmethod, an external method, and probably a SQL method) will exhibit the same characteristics. Its absolute_url() return value and its output in dtml-var when you walk up to it via traversal of Control_Panel will omit the propertysheets path member which will cause the path to be wrong. Does this answer your question?
This *might* be considered a bug if we were sure that we really, truly wanted to allow images to be methods of zclasses. But I think for now it's one of those grey areas.
Hmm, I think it's obvious that this will be required in the future, (when) XML,XUL,JS,CSS etc., will (probably) be an integral part of many products. Is there maybe an easy way of referencing files when you write products in python? -Morten
On Sun, 23 Apr 2000, Morten W. Petersen wrote:
This *might* be considered a bug if we were sure that we really, truly wanted to allow images to be methods of zclasses. But I think for now it's one of those grey areas.
Hmm, I think it's obvious that this will be required in the future, (when) XML,XUL,JS,CSS etc., will (probably) be an integral part of many products.
Is there maybe an easy way of referencing files when you write products in python?
Sure. Just open() them.
Sure. Just open() them.
Heh, again, I need to take advantage of caching of files. So, in this instance, I need a way to reference, solid files. I don't need the content, I need to be able to reference a _file_ _in_ a product. (So I can take advantage of client-side caching) -Morten
participants (2)
-
Chris McDonough -
Morten W. Petersen