def load(self, sFilePath):

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

        self.__dict__.update(loadedVars)
Beispiel #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
Beispiel #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
Beispiel #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)
Beispiel #5
0
def readPackContent(sPackDirPath):
    return jsonRead(mkPackFilePath(sPackDirPath))
Beispiel #6
0
    def loggedUser(self):

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

        return {}