[Zope] String to object ID

Goodrichs nbd95@macconnect.com
Sun, 5 Dec 1999 16:09:33 -0500


>You wanna design your site around string representations of objects.
>Well, who am I to say no?!

We are always open to other ideas!

But consider this (from a website builders point of view and not a
Zopeista's point of view). I have a website with 2000+ pages and 200+
folders. I want to have a header displayed with a unique set of graphics
for each page based on the page name and the parent directory name.

http://www.mysite.com/firstlevel/firstpage.html

this page would display a graphic named "firstlevelFirstpage.gif"

This makes perfect sense from an organizational standpoint, if I need to
replace one of 1100 images I can find the image just by knowing the page it
would be displayed on. Conversly I know which image every page requires by
virtue of knowing the pages location within the website.

What we are tying to do is write a method that can be sent a string
constructed from the existing properties of a page (document_id and
folder_id), then find and display the appropriate graphic.

This way we can place a single line of common dtml in any page and display
the proper graphic;

<dtml-var myimageMethod(Document_id, Folder_id, "some_identifier")>

Currently Zope is making it very difficult to do this because it will not
accept a string representation of a Zope object. We have tried many
different ways, all wrong, all due to our own lack of understanding the
Zope namespace and python.

Tools like this would make building large group maintained website much
easier, reuseable code, templates, universal methods, all combined give you
the ability to add/subtract/modify pages easily. Dealing with a large
constantly changing website this is very important to us.  We need to be
able to give our artist a simple naming scheme for imagry and our designer
a single tag to use for ALL images.

It seems the code you sent will do this but I don't think you liked it ;^)
. We also went down the same road last night thinking it may be the way to
do what we wanted (converting the string to a url path and returning the
image tag to the calling document)

But, we are open to any suggestions to solve the problem.

Thanks for all the help, we'll give your code a try.

DAve.