Пример #1
0
def backupCurVol():
    vol=cfgvol.upgmsg['curRunVol']
    src=rbcfg.apppath
    ptar=dfile.joinPath(cfgvol.upg['workpath']['pworkex'], vol)
    
    dfile.copyDirToDir(src, ptar, umode.bckdirmode, umode.bckfilemode)
    
    bcktar=dfile.joinPath(cfgvol.upg['workpath']['pback'], vol+umode.filefix["backup"])
    dfile.tarADir(bcktar, ptar, "RemoteBox") # dfile.tarADir(bcktar, ptar, vol)
    dfile.delete_file_folder(ptar)
    return
Пример #2
0
def onPath(curpath):
    if(curpath is None ):curpath= os.getcwd()
    rbcfg.apppath=dfile.joinPath(curpath, rbcfg.apppath)
    rbcfg.basepath=dfile.joinPath(curpath, rbcfg.basepath)
    rbcfg.webroot=dfile.joinPath(rbcfg.basepath,rbcfg.webroot)
    rbcfg.cfgpath=dfile.joinPath(rbcfg.basepath,rbcfg.cfgpath)
    
    #after 0.8.7
    cfgvol.onWorkPath(curpath)
    
    return
Пример #3
0
def onPath(curpath):
    if (curpath is None): curpath = os.getcwd()
    rbcfg.apppath = dfile.joinPath(curpath, rbcfg.apppath)
    rbcfg.basepath = dfile.joinPath(curpath, rbcfg.basepath)
    rbcfg.webroot = dfile.joinPath(rbcfg.basepath, rbcfg.webroot)
    rbcfg.cfgpath = dfile.joinPath(rbcfg.basepath, rbcfg.cfgpath)

    #after 0.8.7
    cfgvol.onWorkPath(curpath)

    return
Пример #4
0
def backupCurVol():
    vol = cfgvol.upgmsg['curRunVol']
    src = rbcfg.apppath
    ptar = dfile.joinPath(cfgvol.upg['workpath']['pworkex'], vol)

    dfile.copyDirToDir(src, ptar, umode.bckdirmode, umode.bckfilemode)

    bcktar = dfile.joinPath(cfgvol.upg['workpath']['pback'],
                            vol + umode.filefix["backup"])
    dfile.tarADir(bcktar, ptar,
                  "RemoteBox")  # dfile.tarADir(bcktar, ptar, vol)
    dfile.delete_file_folder(ptar)
    return
Пример #5
0
 def _mkNames(self):
     self._ffn= getWFFileName(self._filen)
     self._fpfn=dfile.joinPath(self._path, self._ffn)
     
     self._rfn= getRFileName(self._filen)
     self._rpfn= dfile.joinPath(self._path, self._rfn)
     
     self._dfn= getRDFileName(self._filen)
     self._dpfn=dfile.joinPath(self._path, self._dfn)
     
     self._zip= getZipFileName(self._filen)
     self._pzip=dfile.joinPath(self._path, self._zip)
     
     return
Пример #6
0
    def _mkNames(self):
        self._ffn = getWFFileName(self._filen)
        self._fpfn = dfile.joinPath(self._path, self._ffn)

        self._rfn = getRFileName(self._filen)
        self._rpfn = dfile.joinPath(self._path, self._rfn)

        self._dfn = getRDFileName(self._filen)
        self._dpfn = dfile.joinPath(self._path, self._dfn)

        self._zip = getZipFileName(self._filen)
        self._pzip = dfile.joinPath(self._path, self._zip)

        return
Пример #7
0
 def ftpDowns(self,oftp,ftpdir,wkpath,funW,funF):
     if(oftp is None or funW is None or funF is None):return
     
     bn=dirf.joinPath(wkpath, ftpdir)
     
     ftpfs=[]
     try:
         ftpfs=oftp.nlst()
     except:
         wlog.doTraceBack()
         raise errs.RbFtpErr("error get ftp files")
     
     for ftpf in ftpfs:
         if(ftpw.ignorFile(ftpf) or ftpw.existFile(ftpf,wkpath)):continue
         localW=funW(bn)
         localF=funF(bn)
         
         try:
             ##wlog.getLogger().debug("from ftp:"+ftpf)
             ftpw.downFile(oftp,ftpf,localW)
             ##wlog.getLogger().debug("ftp ok:"+localW)
         except:
             wlog.doTraceBack()
             continue
         
         try:
             ftpw.delFile(oftp,ftpf)
         except:
             wlog.doTraceBack()
             continue
         
         dirf.fileRename(localW, localF)
         
     return
           
Пример #8
0
def ftpDowns(oftp,ftpdir,wkpath,funW,funF):
    if(oftp is None or funW is None or funF is None):return
    
    bn=dirfile.joinPath(wkpath, ftpdir)
    
    for ftpf in oftp.nlst():
        if(ignorFile(ftpf) or existFile(ftpf,wkpath)):continue
        localW=funW(bn)
        localF=funF(bn)
        
        try:
            downFile(oftp,ftpf,localW)
        except:
            wlog.doTraceBack()
            continue
        
        try:
            delFile(oftp,ftpf)
        except:
            wlog.doTraceBack()
            continue
        
        dirfile.fileRename(localW, localF)
        
    return
Пример #9
0
def onStart():
    wrkCtrl.onPath(curpath)

    rbcfg.RUNMSG["COMM"] = "STOP"

    rbcfg.WEB["tpls"] = webroot
    rbcfg.WEB["tplsA"] = dfile.joinPath(webroot, "WEB-INF")
    wlog.getLogger().debug(webroot)

    cfgdb.onCfg()
    #cfgdb.freshConfByDB()

    app = webRun()

    session = tweb.session.Session(app,
                                   tweb.session.DiskStore('sessions'),
                                   initializer={'count': 0})

    import rbsite.CmdRender as CmdRender
    refs4tpl = {
        'context': session,
        "vtypeof": type,
        "cmdsRender": CmdRender.cmdsRender1
    }

    render = tweb.template.render(rbcfg.WEB["tpls"], globals=refs4tpl)
    renderA = tweb.template.render(rbcfg.WEB["tplsA"], globals=refs4tpl)
    rbcfg.WEB["render"] = render
    rbcfg.WEB["renderA"] = renderA

    rbcfg.WEB["app"] = app

    rbsite.RBSite.regPageCtx4Tpls()

    return
Пример #10
0
def chkLogger():
    def buildLogFile(ldir, logFN):
        if (type(logFN) == type(ldir)):
            lf = dfile.joinPath(ldir, logFN)
            fileh = open(lf, 'a')
            fileh.close()

            return lf

        return None

    if (wlog.LOGFILE is None):
        ldir = dfile.joinPath(basepath, wlog.LOG_PATH)
        dfile.chkCreateDir(ldir)
        '''
      wlog.LOGFILE=dfile.joinPath(ldir,wlog.LOG_FILENAME)
      fileh=open(wlog.LOGFILE,'a')
      
      fileh.close()
      '''
        wlog.LOGFILE = buildLogFile(ldir, wlog.LOG_FILENAME)
        for extag in wlog.EXLOGTAGS:
            logfn = buildLogFile(ldir, wlog.defaultEXLogName(extag))
            if (logfn is None): continue
            wlog.initEXLogDef(extag, logfn)
            wlog.getExLogger(extag)

        return
Пример #11
0
    def getTarFile():
        vol = cfgvol.getCurDown()
        if (vol is None):
            return None

        return dfile.joinPath(cfgvol.upg['workpath']['pctar'],
                              vol + umode.filefix["down"])  # todo chk tardir,
Пример #12
0
    def __init__(self,
                 basepath,
                 imptype=None,
                 detaSec=datetime.timedelta(seconds=30),
                 delaySec=0):
        self._basepath = basepath
        self._imptype = imptype
        self._wkpth = basepath

        if (not (imptype is None)):
            if (imptype in rbcfg.IMPLEMENTS):
                refp = rbcfg.IMPLEMENTS[imptype]["PATH"]
                self._wkpth = dfile.joinPath(self._wkpth, refp)

        self._can = True
        self._started = False
        self._stoped = False
        self._posted = False
        self._last = None  # datetime.datetime.now()
        self._now = None

        self._dtdelta = detaSec
        self._timer = None
        if (type(basepath) == type('')):
            self._timer = threading.Timer(delaySec, self._exe)

        return
Пример #13
0
 def getCurs():
     ret=[]
     base=cfgvol.upg['workpath']['pctar']
     cfgvol.upgmsg['downloads'].sort()
     for r in cfgvol.upgmsg['downloads']:
        ret.append(dfile.joinPath(base, r+umode.filefix["down"])) 
        
     return ret
Пример #14
0
    def getCurs():
        ret = []
        base = cfgvol.upg['workpath']['pctar']
        cfgvol.upgmsg['downloads'].sort()
        for r in cfgvol.upgmsg['downloads']:
            ret.append(dfile.joinPath(base, r + umode.filefix["down"]))

        return ret
Пример #15
0
def fullCurTarDirFile():
        base=cfgvol.upg['workpath']['pworkex']
        vol=cfgvol.getLastOKVol()
        if(vol is None):
            return [None,None]
        
        dir=dfile.joinPath(base, vol) 
        file=dir+umode.filefix["cdown"]
        return [dir,file] 
Пример #16
0
def fullCurTarDirFile():
    base = cfgvol.upg['workpath']['pworkex']
    vol = cfgvol.getLastOKVol()
    if (vol is None):
        return [None, None]

    dir = dfile.joinPath(base, vol)
    file = dir + umode.filefix["cdown"]
    return [dir, file]
Пример #17
0
    def buildLogFile(ldir, logFN):
        if (type(logFN) == type(ldir)):
            lf = dfile.joinPath(ldir, logFN)
            fileh = open(lf, 'a')
            fileh.close()

            return lf

        return None
Пример #18
0
def afterCommCfgCtx(*arg, **karg):
    ctx = karg['ctx']
    pg = arg[0]
    ctx["action"] = dfile.joinPath('/A/', pg)

    if ("pri" in ctx):
        pg = ctx["tpl"]

    return pg, [ctx], {}
Пример #19
0
def afterCommCfgCtx(* arg,** karg):
    ctx=karg['ctx']
    pg=arg[0]
    ctx["action"]=dfile.joinPath('/A/', pg)
    
    if("pri" in ctx):
       pg=ctx["tpl"]
    
    return pg,[ctx],{}
Пример #20
0
def onWorkPath(bpath):
    #rbcfg.cfgpath=dfile.joinPath(rbcfg.basepath,rbcfg.cfgpath)
    def isSPath(pp):
        return type(pp) == type('') and pp.startswith('upg/')

    for pp in upg['workpath']:
        if (isSPath(upg['workpath'][pp])):
            upg['workpath'][pp] = dfile.joinPath(bpath, upg['workpath'][pp])
            dfile.chkCreateDir(upg['workpath'][pp])
    return
Пример #21
0
 def getExCurs():
     ret=[]
     base=cfgvol.upg['workpath']['ptestex']
     cfgvol.upgmsg['downloads'].sort()
     for r in cfgvol.upgmsg['downloads']:
        exdir=dfile.joinPath(base, r)
        if(os.path.exists(exdir)):
            ret.append(exdir) 
        
     return ret
Пример #22
0
    def getExCurs():
        ret = []
        base = cfgvol.upg['workpath']['ptestex']
        cfgvol.upgmsg['downloads'].sort()
        for r in cfgvol.upgmsg['downloads']:
            exdir = dfile.joinPath(base, r)
            if (os.path.exists(exdir)):
                ret.append(exdir)

        return ret
Пример #23
0
def onStart():
    wrkCtrl.onPath(curpath)

    rbcfg.RUNMSG["COMM"] = "STOP"

    rbcfg.WEB["tpls"] = webroot
    rbcfg.WEB["tplsA"] = dfile.joinPath(webroot, "WEB-INF")

    cfgdb.onCfg()

    return
Пример #24
0
 def exe(self): 
    wkpath=dirf.joinPath(self._bpath, conff.IMPLEMENTS[self._implType]["PATH"])
    
    dirf.delFile(wkpath, "*"+BaseAction.fileSuffs[4])
    
    self._exe4Path(wkpath, "*"+BaseAction.fileSuffs[2])
    self._exe4Path(wkpath, "*"+BaseAction.fileSuffs[1])
    '''
    for v in glob.glob1(wkpath,"*"+BaseAction.fileSuffs[2]):           
        self._doexe(wkpath,v)
        if
    flc=1    
    for v in glob.glob1(wkpath,"*"+BaseAction.fileSuffs[1]):
        self._doexe(wkpath,v)
    '''    
    return
Пример #25
0
 def __init__(self,basepath,imptype=None,detaSec=datetime.timedelta(seconds=30),delaySec=0):
     self._basepath=basepath
     self._imptype=imptype
     self._wkpth=basepath
     
     if(not (imptype is None) ):
         if(imptype in rbcfg.IMPLEMENTS):
           refp=rbcfg.IMPLEMENTS[imptype]["PATH"]
           self._wkpth=dfile.joinPath(self._wkpth, refp)
           
     self._can=True
     self._started=False
     self._stoped=False
     self._posted=False
     self._last=None   # datetime.datetime.now()
     self._now=None
     
     self._dtdelta=detaSec
     self._timer=None
     if(type(basepath)==type('')):
        self._timer=threading.Timer(delaySec,self._exe)
     
     return
Пример #26
0
 def _initObjs(self):
     a=None
     if("file" in self._wkarg):
         a=self._wkarg["file"] 
         
     if(a is None):
         self._wkarg["file"]=self._tbn
        
     if("delWhere" not in self._wkarg):
        self._wkarg["delWhere"] =None
     
     if(self._imp is None)    :
         self._imp=self._wkarg["ctrlc"]
         
     self._wkpath=dirf.joinPath(self._basepath, conff.IMPLEMENTS[self._imp]["PATH"])
         
     fs=self.getCtrlDef()  #rbdatabase.Pojos.ctrlDef[self._wkarg["ctrlc"]] #  fs=rbdatabase.Pojos.ctrlDef[self._imp]
     
     self._ctrl=fs["ctrl"](self._dbw,self._tbn,self._wkarg["dtfield"])   #todo
     self._pjCaptrue=fs["pjcap"](self._tbn,PAGESIZE=conff.db["PAGESIZE"],** self._wkarg)  #todo fs["pjcap"](self._tbn,** self._wkarg)
     self._lstParse=fs["lstp"](self._wkarg["file"],self._wkarg["fieldsdef"])#todo
     self._wFile=fs["wfile"]()#todo
     
     return
Пример #27
0
def getUserDBF():
    return dfile.joinPath(chkcfgPath(conff.cfgpath), dbuser)
Пример #28
0
def getCommCfg():
    return dfile.joinPath(chkcfgPath(conff.cfgpath), conff.commcfg)
Пример #29
0
def getCfgDBF():
    return dfile.joinPath(chkcfgPath(conff.cfgpath), dbf)
Пример #30
0
def getUserDBF():
    return dfile.joinPath(chkcfgPath(conff.cfgpath), dbuser)
Пример #31
0
def getCommCfg():
    return dfile.joinPath(chkcfgPath(conff.cfgpath), conff.commcfg)
Пример #32
0
def getCfgDBF():
    return dfile.joinPath(chkcfgPath(conff.cfgpath), dbf)
Пример #33
0
def getRbBckModPath(basep,mod="RemoteBox"):
    return dfile.joinPath(basep, mod)
Пример #34
0
def getPathInCtx():  #'PATH_INFO'
    environ = weba.ctx.environ
    path = dfile.joinPath(rbcfg.WEB["tpls"], environ['PATH_INFO'])
    return path
Пример #35
0
def getPathInCtx():#'PATH_INFO'
    environ= weba.ctx.environ
    path= dfile.joinPath(rbcfg.WEB["tpls"], environ['PATH_INFO'] )   
    return path 
Пример #36
0
def getRbBckModPath(basep, mod="RemoteBox"):
    return dfile.joinPath(basep, mod)
Пример #37
0
def getVolDBF():
    return dfile.joinPath(cfgdb.chkcfgPath(conff.cfgpath), cfgvolu)