def mobid_vote_data(b64vote): import bdocpythonutils bdocdata = base64.b64decode(b64vote) bdocfile = None try: bdocfile = StringIO.StringIO(bdocdata) bdoc = bdocpythonutils.BDocContainer() bdoc.load(bdocfile) bdoc.validateflex() _doc_count = len(bdoc.documents) if _doc_count == 0: raise Exception("BDoc ei sisalda ühtegi andmefaili") ret = {} for el in bdoc.documents: evlog.log(evlogdata.get_vote(el, bdoc.documents[el])) ret[el] = bdoc.documents[el] return ret finally: if bdocfile is not None: bdocfile.close()
def mobid_vote_data(b64vote): import bdocpythonutils bdocdata = base64.b64decode(b64vote) bdocfile = None try: bdocfile = StringIO.StringIO(bdocdata) bdoc = bdocpythonutils.BDocContainer() bdoc.load(bdocfile) bdoc.validateflex() _doc_count = len(bdoc.documents) if _doc_count == 0: raise Exception, "BDoc ei sisalda ühtegi andmefaili" ret = {} for el in bdoc.documents: evlog.log(evlogdata.get_vote(el, bdoc.documents[el])) ret[el] = base64.b64encode(bdoc.documents[el]) return ret finally: if bdocfile != None: bdocfile.close()
def log_documents(self): for el in self.bdoc.documents: self.alines.append(evlogdata.get_vote(el, self.bdoc.documents[el]))