Beispiel #1
0
def savePrefs():

    global DAVOS_PREFS

    if DAVOS_PREFS:
        p = pathResolve(r"%USERPROFILE%\davos_prefs.json")
        jsonWrite(p, DAVOS_PREFS)
Beispiel #2
0
    def __writeTokenData(self, tokenData):

        cookieData = {}
        sCookieFilePath = self.cookieFilePath
        if os.path.isfile(sCookieFilePath):
            cookieData = jsonRead(sCookieFilePath)

        sFieldList = ("username", "token_iat", "token_exp", "token")
        savedData = dict((f, tokenData[f]) for f in sFieldList)

        cookieData[self._hashedServerURL()] = savedData
        return jsonWrite(sCookieFilePath, cookieData)
Beispiel #3
0
def writePackContent(sPackDirPath, dirStat=None):

    sPackDirPath = pathNorm(sPackDirPath)

    if not dirStat:
        dirStat = os.stat(sPackDirPath)

    sJsonPath = mkPackFilePath(sPackDirPath)

    iMtime = 0
    if not osp.exists(sJsonPath):
        iMtime = dirStat.st_mtime
        iAtime = dirStat.st_atime

    try:
        open(sJsonPath, 'a+b').close() # create json file so it is listed by parseDirContent()
        dirContent = parseDirContent(sPackDirPath)
        jsonWrite(sJsonPath, dirContent, sort_keys=True)
    finally:
        if iMtime:
            os.utime(sPackDirPath, (iAtime, iMtime))

    return dirContent
    def save(self, sFilePath):

        exportDct = dict((k, v) for (k, v) in vars(self).iteritems() if k in ("topRefs", "deferredRefs", "loadedRefs"))
        jsonWrite(sFilePath, exportDct)
Beispiel #5
0
 def logIn(self, sLogin, sPassword, **kwargs):
     userData = {"login":sLogin}
     jsonWrite(self.cookieFilePath, userData)
     return userData