def load(self, sFilePath): loadedVars = jsonRead(sFilePath) for sName in loadedVars.iterkeys(): getattr(self, sName) self.__dict__.update(loadedVars)
def _readTokenData(self): tokenData = {} sCookieFilePath = self.cookieFilePath if os.path.isfile(sCookieFilePath): cookieData = jsonRead(sCookieFilePath) tokenData = cookieData.get(self._hashedServerURL(), tokenData) return tokenData
def loadPrefs(): global DAVOS_PREFS try: p = pathResolve(r"%USERPROFILE%\davos_prefs.json") DAVOS_PREFS = jsonRead(p) except EnvironmentError: DAVOS_PREFS = {} return DAVOS_PREFS
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)
def readPackContent(sPackDirPath): return jsonRead(mkPackFilePath(sPackDirPath))
def loggedUser(self): if os.path.isfile(self.cookieFilePath): return jsonRead(self.cookieFilePath) return {}