def load(self, sFilePath):

        loadedVars = jsonRead(sFilePath)
        for sName in loadedVars.iterkeys():
            getattr(self, sName)

        self.__dict__.update(loadedVars)
示例#2
0
    def _readTokenData(self):

        tokenData = {}
        sCookieFilePath = self.cookieFilePath

        if os.path.isfile(sCookieFilePath):
            cookieData = jsonRead(sCookieFilePath)
            tokenData = cookieData.get(self._hashedServerURL(), tokenData)

        return tokenData
示例#3
0
def loadPrefs():

    global DAVOS_PREFS

    try:
        p = pathResolve(r"%USERPROFILE%\davos_prefs.json")
        DAVOS_PREFS = jsonRead(p)
    except EnvironmentError:
        DAVOS_PREFS = {}

    return DAVOS_PREFS
示例#4
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)
示例#5
0
def readPackContent(sPackDirPath):
    return jsonRead(mkPackFilePath(sPackDirPath))
示例#6
0
    def loggedUser(self):

        if os.path.isfile(self.cookieFilePath):
            return jsonRead(self.cookieFilePath)

        return {}