[ZO-Coll] How to read/write files from Zope??

Sheila María sheiluski at gmail.com
Wed Oct 27 04:24:29 EDT 2004


Hi!!
     I want to save some information of my Zope, exactly, I want to
save the state and the Id, like lists, of my PCNG, because later
(after to have imported and to have exported), I want to restore it.
    Well, I've created a Python Script avec le code:
     listIds = []
     listStatus = []

     rows = context.pcng_catalog(meta_type="issue") 
     for r in rows:
             issue=r.getObject()
             listStatus.append(issue.status())
             listIds.append(issue.getId())

# Now, I try to write into a file
     f = open('EstadosIdsAntesExportar', "w") 
     f.write(listIds) 
     f.write(listStatus) 
     f.close()

return 1

    Well, I have an error with "f.open()", what does I have to do for
to include it??.

    Too, I have seen that in Zope there is an object "File", but, how
can I write or read to/from it??

                                           Thanks very much!!!


More information about the Zopeorg-collector mailing list