[Zope] Java class doesn't load correctly under windows

Chris Withers chris at simplistix.co.uk
Tue Aug 24 04:52:17 EDT 2004


Josef Meile wrote:
>   #Remove leading slash
>   if (zopePath[-1]=='/') and (pathLen>1):
>     zopePath=zopePath[0:pathLen-1]

maybe you should use os.sep instead of '/' there?

>   if zopePath[0]!='/':

...and here.

>     zopePath='/'+zopePath

...and here, but i can't see where zopePath comes from so I may be wrong.

>   if folder!='':
>     try:
>       manage_addFolder(fileContainer,folder,'JMFiles')
>     except:
>       #The Folder already exists
>       pass

This is an EXTREMELY silly piece of code. Bare excepts like this are 
asking for all manner of trouble.

>     fileFolder=getattr(fileContainer,folder)
>   absolutePath=os.path.join(filePath,fileName)
>   data=file(absolutePath)

oops, that'll be the main source of your problem.

should be:
data = file(absolutePath,'rb')

>   try:
>     manage_addFile(fileFolder,fileName,file=data,
>                    title=title)
>   except:
>     #The file was already created on a previous session
>     pass

More brain-dead-ed-ness :-(

cheers,

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk


More information about the Zope mailing list