[Zope] load_site.py doesn't recognize .jpeg

Paul Winkler slinkp23@yahoo.com
Wed, 21 Feb 2001 22:09:01 -0500


Hi,

Possibly this has been noted and fixed already, but just in case...
In Zope 2.2.2, the utilities/load_site.py script doesn't recognize the
.jpeg extension - it treats them as plain text files. I solved this by
adding one line as shown below.

def upload_file(object, f):
    if os.path.isdir(f): return upload_dir(object, f)
    dir, name = os.path.split(f)
    root, ext = os.path.splitext(name)
    if ext in ('file', 'dir'): ext=''
    else:
        ext=string.lower(ext)
        if ext and ext[0] in '.': ext=ext[1:]
        if ext == 'jpeg': ext = 'jpg' ### THIS IS THE NEW LINE
    if ext and globals().has_key('upload_'+ext):
        if verbose: print 'upload_'+ext, f
        return globals()['upload_'+ext](object, f)
    
    if verbose: print 'upload_file', f, ext
    call(object.manage_addFile, id=name, file=open(f,'rb'))
        

-- 
.................    paul winkler    ..................
slinkP arts:   music, sound, illustration, design, etc.
           web page:  http://www.slinkp.com
      A member of ARMS:   http://www.reacharms.com