def doMakoLogin(self,subject=None,visit=None): self.jsonpath = os.path.join(SUBJS,subject,"%s_experiment_info.json"%subject) if os.path.exists(self.jsonpath): self.json = load_json(self.jsonpath) else: if not os.path.exists(os.path.split(self.jsonpath)[0]): os.mkdir(os.path.split(self.jsonpath)[0]) self.json = json self.json['subject_id'] = subject self.json['time'] = time.ctime() ## record new login time visit = [v['active'] for v in self.json['Protocol']].index(True) # auto-get last open tab self.setTab(visit) # activates the tab if self.json["group"] == '': return self.modalthing() return self.renderAndSave() # saves the json, and renders the page
def doMakoLogin(self,subject=None,visit=None): self.jsonpath = os.path.join(SUBJS,subject,"%s_experiment_info.json"%subject) if os.path.exists(self.jsonpath): self.json = load_json(self.jsonpath) else: self.json = get_json(subject) #self.json['subject_id'] = subject self.json['time'] = time.ctime() ## record new login time visit = [v['active'] for v in self.json['Protocol']].index(True) # auto-get last open tab ### if no sessiondir exists, create it if not os.path.exists(os.path.join(SUBJS,subject)): self.history = createSubDir(subject) + self.history if not os.path.exists(os.path.join(SUBJS,"%s/session%s/"%(subject,visit))): history = makeSession(subject,visit) # returns history self.history = history + self.history self.setTab(visit) # activates the tab return self.renderAndSave() # saves the json, and renders the page