> Chris Withers wrote:
I'm having trouble with the precondition field of a fileobject. I've got a 
fileobject (a PDF-file) and its precondition field states myPrecondition, which 
is a DTML Method and its code is:

This is insane...

Why is this insane? Because of using a precondition, the code of the method or the hole idea?

Note: Using the security setting and assigning roles is not an option because the fileobject is recreated every night.

Rubbish. Two options:

- don't recreate the file each night, just edit its contents.

I'm thinking of manage_upload or update_data to edit the file content, but I can't figure out how to apply them. Hell, I can't even figure out how to select the file that is to be updated!
I use the following two objects for replacing the existing file.

1. External Method 'printbestand'

def printbestand():
   return filebody

if __name__ == "__main__":
   print printbestand()

2. Script (Python) 'printbestand_upload':

fileobject = context.printbestand()
context.manage_addFile('printbestand.pdf',file=fileobject, content_type='application/pdf')
return 0

As you can see in 'printbestand_upload', the file is deleted first and then the new file is added. Obviously the existing file should not be deleted but its content updatad/edited/replaced.

My question are:
Q1: How do I select the file that is to be updated?
Q2: How do I update the content of that file with the content of the new file?

- when you recreate the file, set the role to permission mapping in the same lump of code.

OK, how do I do that?



Kind regards,

Zope maillist  -  Zope@zope.org
**   No cross posts or HTML encoding!  **
(Related lists - http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )

Reply via email to