PEATDB/Extfile.py
def displayFile(self, filerec):
        """Uses a new method of file storage with blobs"""
        #now we just get the blob from the filerecord object...
        from PILView import PILViewer
        from PEATDB.Record import FileRecord
        #check class        
        if not type(filerec) is FileRecord:           
            return False
        myblob = filerec.blob
        ext = filerec.ext
        mtype = filerec.mimetype
        print 'mimetype is', mtype
        if myblob != None:
            f = myblob.open("r")
            filename = f.name
            f.close()
        else:
            return False

        if self.currplatform == 'Linux':
            #try using mailcaps on linux system
            import mailcap, os
            d=mailcap.getcaps()
            print mtype, filename
            f=mailcap.findmatch(d, mtype)[1]
            os.system(f['view'] %filename)
            return
        else:
            import os, tempfile, shutil
            tempname = os.path.normpath(os.path.join(tempfile.gettempdir(), filerec.name))
            if not os.path.exists(tempname):
                #os.remove(tempname)
                shutil.copy(filename, tempname)
            os.startfile(tempname)

        return True
Uses a new method of file storage with blobs
Uses a new method of file storage with blobs
Uses a new method of file storage with blobs
def displayFile(self, filerec):
        from PILView import PILViewer
        from PEATDB.Record import FileRecord
        if not type(filerec) is FileRecord:           
            return False
        myblob = filerec.blob
        ext = filerec.ext
        mtype = filerec.mimetype
        print 'mimetype is', mtype
        if myblob != None:
            f = myblob.open("r")
            filename = f.name
            f.close()
        else:
            return False
        if self.currplatform == 'Linux':
            import mailcap, os
            d=mailcap.getcaps()
            print mtype, filename
            f=mailcap.findmatch(d, mtype)[1]
            os.system(f['view'] %filename)
            return
        else:
            import os, tempfile, shutil
            tempname = os.path.normpath(os.path.join(tempfile.gettempdir(), filerec.name))
            if not os.path.exists(tempname):
                shutil.copy(filename, tempname)
            os.startfile(tempname)
        return True
def displayFile ( self , filerec ) : from PILView import PILViewer from PEATDB . Record import FileRecord if not type ( filerec ) is FileRecord : return False myblob = filerec . blob ext = filerec . ext mtype = filerec . mimetype print 'mimetype is' , mtype if myblob != None : f = myblob . open ( "r" ) filename = f . name f . close ( ) else : return False if self . currplatform == 'Linux' : import mailcap , os d = mailcap . getcaps ( ) print mtype , filename f = mailcap . findmatch ( d , mtype ) [ 1 ] os . system ( f [ 'view' ] % filename ) return else : import os , tempfile , shutil tempname = os . path . normpath ( os . path . join ( tempfile . gettempdir ( ) , filerec . name ) ) if not os . path . exists ( tempname ) : shutil . copy ( filename , tempname ) os . startfile ( tempname ) return True
Uses a new method of file storage with blobs
Uses a new method of file storage with blobs
"""Uses a new method of file storage with blobs""" #now we just get the blob from the filerecord object... #check class         #try using mailcaps on linux system #os.remove(tempname)
self
filerec