Tom, On Mon, 23 Dec 2002 09:39:19 -0500, Passin, Tom wrote:
So the files are located in the file system and not in the Zope database. I would search the archives for the "localFS" product, and see how to get it to give you a list of the file names it controls. Then you can refer to them by title.
Well, the files were intended to sit in file system folder but in order to achieve my goals I was to move them to a Zope folder. I didn't specify, sorry.
Do you mean that each file is supposed to be tagged with some code, and that the file name is not adequate for listing in a menu?
Yes , this is exactly what I meant.
Seems like you have three types of things you can do to discover the code value:
1) ...
2) Put the code into the html file itself. The best place for this would be a <meta> element. This requires you to extract the code value from the HTML file as you started out asking about. It also requires the people generating the file to insert the code value correctly. This approach is the most markup-language like approach.
Yes ! This was my idea. So I didn't express it so bad, after all. ;-) Thanks for the comprehension effort you're doing, you know, I'm doing an effort to write in English too and sometimes I don't have clear what I want to do myself !! ;)
If you put it into a META element, you ought to be able to retrieve it using a regular expression. That would probably be the simplest thing to do. You would probably do that using a python external method.
3) Compute the right code value usng some algorithm. ...
Once you know what the code value is, you want to use it somehow. That is the subject of your next questions, I take it -
My idea is that I have 2 alternative ways:
1) add a field property to each file and fill it with the code, then adding an index to my ZCatalog. Boring, error prone and time consuming.
2) ask my collagues to inclue the codes in the html files and get Zope access and index that values.
Another approach would be to create a DTML method that returns a dictionary of code file identifiers keyed by the codes. You would use that dictionary when you build the menu. I have never done this programatically but it ought to be possible. Otherwise, you could write an external method to do the same thing by reading a file that contains the dictionary in text form (you create the dictionary by using eval()).
When you receive a new file (or periodically using a scheduled task) you would look through the directory and build a new version of the dictionary. It ought to be easy.
Tom I really have to thank you for your suggestions. I didn't even know about the existence of these "dictionaries" Now the problem became obsolete since I decided for a different strategy: 1) I'm going to add a property to all my files. I already managed to write a python script that successfully does this ;) This made me discover the niceties of python. The semantical use of identation is really smart, I always hated the {} parenteses. I also learned to read documentation to discover WHAT a function returns (tuples, in my case) and I learned to access tuples ! Nice! 2) I'm going to prepare a web page with a form to fill with the codes associate to the files. So my collages can help me in the filling work ! I'm going to put this form online !!! 3) Setting a ZCatalog in order to show a drop down menu containing the codes. Choosing a code, the user will be pointed to the associated file. I want to do so because gradually I want to move to a fully dinamical html creation process, no more DreamWeaver. So starting to get my collagues used to introduce information in Zope is not bad. Also I'm not forced to recur to external stuff, this way, I still can't deal with external stuff. I tried to put an xml product in my products folder but I got some error messages from the consolle and I can't deal with them. So what to add? Thanks so much for your help. really. Hear you soon Bye Catonano