[Zope] adding database records programitically

Geir Bækholt Hansen Geir B Hansen <geirh@funcom.com>
Fri, 5 May 2000 13:14:11 +0200


on Friday, May 05, 2000 Andy Pahne wrote :

AP> hi, there,

AP> i have a few folders lying around in zope, and each of these folders
AP> contains a set of dtml-methods. each of the folders represents a page inside
AP> the website we are hosting. the dtml-methods hold the content for the pages.

AP> this kind of setup worked nice for a long time, but now there are too much
AP> folders, too much methods to maintain, and I am planning to move the
AP> contents into the database.

AP> I want to avoid typing all the data in again, because that has been done
AP> already. I tried this:

AP> <dtml-in "objectValues(['Folder'])">
AP>   <dtml-with "_['sequence-item']">
AP>      <dtml-call "a_sql_method_to_add_the_thing_into_the_database">
AP>   </dtml-with>
AP> </dtml-in>


AP> but this approach did not work for me. if  i use   <dtml-with nameOfFolder>,
AP> everything works fine, but iterating over the folders and using <dtml-with
"_[sequence-item']">> did not.


 perhaps (untested)  <dtml-in "objectItems(['Folder'])">
 would work better ?

 - and i don't think you need the
 <dtml-with "_['sequence-item']"> line..

Just a shot in  the dark ..


--
Geir Bækholt Hansen
web-developer/designer
geirh@funcom.com
http://www.funcom.com