예제 #1
0
파일: removeItem.py 프로젝트: weijia/ufs
#import libs.utils.stringTools as stringTools
import shutil
import os
import uuid
import localLibSys
import localLibs.cache.localFileSystemCache as localFileSystemCache
import libs.ufsDb.dbSys as dbSys

import libs.utils.misc as misc
import libs.utils.transform as transform



if __name__=='__main__':
    fields = libs.http.queryParam.queryInfo().getAllFieldStorageUnicode()
    h = libs.html.response.html()
    h.genTxtHead()
    dbSysInst = dbSys.dbSysSmart()
    fullPath = urllib.unquote(fields[u"path"][0])
    fullPath = transform.transformDirToInternal(fullPath)
    
    rootPath = configurationTools.getRootDir()
    recyclePath = os.path.join(rootPath, 'recycle')
    misc.ensureDir(recyclePath)

    dst = os.path.join(recyclePath, str(uuid.uuid4())+os.path.basename(fullPath))
    localFileSystemCache.localFileSystemCache(dbSysInst).moveCached(fullPath, dst)
    #print fullPath
    h.write(u'{"path":"%s","removed":"true"}'%fullPath)
    h.end()
예제 #2
0
파일: dictShoveDb.py 프로젝트: weijia/ufs
import libSys
import os
import libs.utils.misc as misc

gAppPath = 'd:/tmp/fileman/'
gDbPath = os.path.join(gAppPath, 'db')

misc.ensureDir(gAppPath)
misc.ensureDir(gDbPath)

#------------------------------------------------------------------
#Local database
try:
    import libs.GAE.ufsDbGaeListShove as listShove
    import libs.GAE.ufsDbGaeShove as shove
except ImportError:
    import sys
    import os
    c = os.getcwd()
    while c.find('prodRoot') != -1:
      c = os.path.dirname(c)
    #print c
    sys.path.insert(0, os.path.join(c,'prodRoot'))
    import localLibs.localDb.sqliteShoveV2 as shove
    import libs.shove.encryptedListShove as encryptedListShove
    import libs.shove.encryptedShoveV4 as encryptedShove


def getListDbLocal(dbName):
    s = shove.Shove(os.path.join(gDbPath,'%s.sqliteDict'%dbName)+'.enc')
    return encryptedListShove.ShoveLike(s)