14 Aug
2002
14 Aug
'02
12:41 p.m.
Tom Germaine wrote:
if ident: client.manage_delObjects([ident]) client.manage_addDTMLDocument(id=ident,file=myfile,title=mytitle3) else: client.manage_addDTMLDocument(id=ident,file=myfile,title=mytitle3) ------ if file 'ident' exists, no problem, it is deleted and DTMLDocument is added if file 'ident' does not exist I get the error: Error Type: BadRequest Error Value: (filename) does not exist
I think this code will do what you want: if hasattr(client,ident): client.manage_delObjects([ident]) client.manage_addDTMLDocument(id=ident,file=myfile,title=mytitle3) you want to check if client has an attribute with the name stored in ident, not if ident is anything but an empty string ;-) cheers, Chris