[Zope] python if/else problem
Tom Germaine
tgermaine@upei.ca
Tue, 13 Aug 2002 11:37:15 -0300
Hello All:
I am uploading a DTMLDocument using a form and python script, but I'm
stumped as to why the if/else clause in the script does not work. The script:
import string
request = container.REQUEST
ident=request.ident
myfile=request.myfile
mytitle=request.mytitle
if ident[3:6]=='do_':
client=context.do_
mytitle2 = mytitle + '- AVC, Dean\'s Office'
if ident[6:9]=='adm':
mytitle3=mytitle2 + ', Administrative'
elif ident[6:9]=='hr_':
mytitle3=mytitle2 + '-, Human Resources'
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
if I eliminate the 'if' part and comment out 'else' a new DTMLDocument is added
ok
What am I missing here?
Tom Germaine