def owner(self, tid): tif = self.info(tid) ui = UserInfo() ownerPHID = tif['ownerPHID'] if None == ownerPHID: return u"" ret = ui.getUsersRealName([ownerPHID]) if len(ret) == 0: return u"" return ret[0]
def formatSubscribeTransactionToText(fab, transaction): oldVal = transaction['oldValue'] newVal = transaction['newValue'] oldVal = UserInfo().getUsersRealName(oldVal) newVal = UserInfo().getUsersRealName(newVal) if type(oldVal) == list: oldVal = reduce(lambda x, y: x + u' ' + y, oldVal, u"") if type(newVal) == list: newVal = reduce(lambda x, y: x + u' ' + y, newVal, u"") return u"cc:" + oldVal + u" => " + newVal
def formatReassignTransactionToText(fab, transaction): oldVal = transaction['oldValue'] newVal = transaction['newValue'] if oldVal != None: oldVal = UserInfo().getUsersRealName([oldVal]) else: oldVal = u'' if newVal != None: newVal = UserInfo().getUsersRealName([newVal]) else: newVal = u'' if type(oldVal) == list: oldVal = reduce(lambda x, y: x + ' ' + y, oldVal, u"") if type(newVal) == list: newVal = reduce(lambda x, y: x + ' ' + y, newVal, u"") return u"任务分配:" + oldVal + u" => " + newVal
def updateTask(fab, **args): # 获取 tid tid = args.pop('tid') if None == tid: return title = args.pop('task') description = args.pop('description', u"") priority = args.pop('priority', u"Needs Triage") status = args.pop('status', u"Open") owner = args.pop('assigned', u"") projectsStr = unicode(args.pop('tags', u"")) deadline = args.pop('deadline').strip() kickoff = args.pop('kickoff') points = args.pop('points') projectNames = map(lambda x: x.strip(), projectsStr.split(',')) if tid[0] == 'T': tid = int(tid[1:]) else: tid = int(tid) tf = TaskInfoFactory() tif = tf.info(tid) if tif == None: print 'invalid task {tid}'.format(tid=tid) if deadline == 'TBD': deadline = '' pif = ProjectInfoFactory() projects = pif.projectsByName(projectNames) projectPHIDs = map(lambda x: x['phid'], projects) ui = UserInfo() ownerPhid = ui.getUserByRealName(owner)['phid'] updateArgs = {} editArgs = {'objectIdentifier': tif['phid'], 'transactions': []} if title != tif['title']: updateArgs['title'] = title if description != tif['description']: updateArgs['description'] = description if ownerPhid != tif['ownerPHID']: updateArgs['ownerPHID'] = ownerPhid if priority != tif['priority']: updateArgs['priority'] = settings.PRIORITY_VALUES[priority] # 更新 project newProjects = set(projectPHIDs) oldProjects = set(tif['projectPHIDs']) # 整理要添加的project addingProjects = list(newProjects - oldProjects) # 整理要删除的project removingProjects = list(oldProjects - newProjects) if len(addingProjects) > 0: editArgs['transactions'].append({ 'type': 'projects.add', 'value': addingProjects }) if len(removingProjects) > 0: editArgs['transactions'].append({ 'type': 'projects.remove', 'value': removingProjects }) pass if len(removingProjects) > 0: pass if status != tif['statusName']: try: updateArgs['status'] = settings.STATUS_NAMES[status] except Exception, e: if status != tif['status']: updateArgs['status'] = status pass
kickoffFieldName = "std:maniphest:" + settings.CUSTOM_FIELD_KEYS[ 'plans-to-kickoff'] auxDict[kickoffFieldName] = kickoff # pp(dict( # title = title, # description = description, # projectPHIDs = projectPHIDs, # auxiliary = auxDict)) # return theTask = fab.maniphest.createtask(title=title, description=description, projectPHIDs=projectPHIDs, auxiliary=auxDict) taskId = theTask['id'] ui = UserInfo() try: ownerPhid = ui.getUserByRealName(owner)['phid'] except Exception, e: ownerPhid = None theTask = fab.maniphest.update(id=taskId, priority=settings.PRIORITY_VALUES[priority], status=settings.STATUS_NAMES[status], ownerPHID=ownerPhid) if None != parent: mock = FabMock() session = requests.Session() mock = FabMock() resp = session.get(settings.SITE['URL']) csrfToken = mock.getCsrfValue(resp.text) resp = mock.login(settings.USER['username'], settings.USER['password'],
#!/usr/bin/python # coding: utf8 from __future__ import unicode_literals import cgi, cgitb cgitb.enable() import sys import bddHeader from user import UserInfo import detectBingo to_page = bddHeader.to_page bdd = bddHeader.bdd() cursor = bdd.getCursor() user = UserInfo(cursor) #Récupération et typage des paramètres grid_name = cgi.FieldStorage().getvalue('name') grid_x = cgi.FieldStorage().getvalue('x') grid_y = cgi.FieldStorage().getvalue('y') grid_set = cgi.FieldStorage().getvalue('set') if not grid_name or not grid_x or not grid_y or not grid_set: to_page( "Content-type: text/html; charset=utf-8\n\nErreur : paramètres manquants" ) sys.exit() grid_name = grid_name.decode('utf8') grid_x = int(grid_x) grid_y = int(grid_y) if grid_set != '1':
'align': 'center', 'valign': 'vcenter', }) for column, col in zip(columns, range(len(columns))): ws.write(0, col, column[0], titleFormat) summarize = []; def isDisabled(user): try: user['roles'].index('disabled') return True except Exception, e: return False with CacheUsers(users) as cu: ui =UserInfo() for user in filter(lambda x: False == isDisabled(x), ui.orderedUsers()): print user['realName'] tasks = getUserTasks(fab, user) tasks = filter(lambda x: x['isClosed'] != True, tasks) summarize.append(u"{name}手上有{c}个task".format(name = user['realName'], c = len(tasks))) for task in tasks: for column, col in zip(columns, range(len(columns))): func = column[1] ws.write(row, col, func(int(task['id']))) row += 1 summarize.append(u'报告生成时间:{rt}'.format(rt = reportDate.strftime("%Y年%m月%d日 %H:%M").decode('utf-8'))) for summ in summarize: ws.write(row, 0, summ) row += 1 wb.close()
from datetime import datetime import bddHeader from user import UserInfo to_page = bddHeader.to_page #bingoNO_admins: Name (Primary), Password, SID, LastLogin #bingoNO_grids: Name (Primary), Version, Content, SID #bingoNO_cells: CellKey (int, AI, Primary), Cell, Happened (int), Validated (int), Version to_page("Content-type: text/html; charset=utf-8\n") bdd = bddHeader.bdd() cursor = bdd.getCursor() user = UserInfo(cursor) login_ok = False gratin = "" parameters = cgi.FieldStorage() #Connexion passwd = parameters.getvalue('login') tn = parameters.getvalue('tn') if passwd: cursor.execute("SELECT * FROM bingoNO_admins WHERE Password = %s", (passwd)) login_query = cursor.fetchone() if login_query: #Connexion réussie if tn and tn == login_query[0]:
def savePatent(self, evt): judge = 1 '''第一步:获取text中文本;第二步,连接数据库;第三步插入并获得主键;第四步添加到系统中''' password = self.password.GetValue().strip() confirmpd = self.confirmpd.GetValue().strip() name = self.XingMing.GetValue().strip() certNo = self.certNo.GetValue().strip() gender = self.gender # birthday = self.birth.GetValue() birthday_time = self.datetime_to_str(str(birthday)) # job = self.data_translate(self.job.GetValue(), 1) # 职业 graduschool = self.data_translate(self.school.GetValue(), 2) # 毕业学校 degree = self.data_translate(self.degreeType.GetValue(), 3) # 学历/学位 danwei = self.data_translate(self.danwei.GetValue(), 4) # 单位 # zhicheng = self.zhicheng.GetValue().strip() shoujihao = self.phone.GetValue().strip() qq = self.QQ.GetValue().strip() email = self.Email.GetValue().strip() print('电子邮箱', email) # userState = self.data_translate(self.user_state, 5) userClass = self.data_translate(self.user_class, 6) # 判断注册时输入的格式是否正确 true_name = re.search(r"^[\u4E00-\u9FA5]{2,4}$", name) # 姓名 password_test = re.search(r"^[a-zA-Z0-9]{4,10}$", password) # 密码 shenfenzheng = re.search( r"^(\d{6})(\d{4})(\d{2})(\d{2})(\d{3})([0-9]|X)$", certNo) # 身份证号 if name == "": warn = wx.MessageDialog(self, message="姓名不能为空!!!", caption="温馨提示", style=wx.OK | wx.ICON_INFORMATION) warn.ShowModal() # 提示错误 warn.Destroy() judge = 0 elif true_name == None: # 消息对话框 warn = wx.MessageDialog(self, message="真实姓名填写有误", caption="温馨提示", style=wx.OK | wx.ICON_INFORMATION) warn.ShowModal() # 提示错误 warn.Destroy() judge = 0 elif certNo == "": warn = wx.MessageDialog(self, message="身份证号不能为空!!!", caption="温馨提示", style=wx.OK | wx.ICON_INFORMATION) warn.ShowModal() # 提示错误 warn.Destroy() judge = 0 elif shenfenzheng == None: # 消息对话框 warn = wx.MessageDialog(self, message="身份证输入不合法", caption="温馨提示", style=wx.OK | wx.ICON_INFORMATION) warn.ShowModal() # 提示错误 warn.Destroy() judge = 0 elif password == "": # 消息对话框 warn = wx.MessageDialog(self, message="登录密码不能为空!!!", caption="温馨提示", style=wx.OK | wx.ICON_INFORMATION) warn.ShowModal() # 提示错误 warn.Destroy() judge = 0 elif password_test == None: # 消息对话框 warn = wx.MessageDialog(self, message="密码不能含有非法字符,长度在4-10之间", caption="温馨提示", style=wx.OK | wx.ICON_INFORMATION) warn.ShowModal() # 提示错误 warn.Destroy() judge = 0 elif confirmpd == "": # 消息对话框 warn = wx.MessageDialog(self, message="确认密码不能为空!!!", caption="温馨提示", style=wx.OK | wx.ICON_INFORMATION) warn.ShowModal() # 提示错误 warn.Destroy() judge = 0 elif password != confirmpd: # 消息对话框 warn = wx.MessageDialog(self, message="两次密码不同,请重新输入", caption="温馨提示", style=wx.OK | wx.ICON_INFORMATION) warn.ShowModal() # 提示错误 warn.Destroy() judge = 0 # if shoujihao != "": phone = re.search(r"^1[3-9]\d{9}$", shoujihao) # 验证手机号 if phone == None: warn = wx.MessageDialog(self, message="手机号码不正确,请重新输入", caption="温馨提示", style=wx.OK | wx.ICON_INFORMATION) warn.ShowModal() # 提示错误 warn.Destroy() judge = 0 if qq != "": QQ = re.search(r"^[1-9][0-9]{4,11}$", qq) # 验证QQ号 if QQ == None: judge = 0 warn = wx.MessageDialog(self, message="QQ号不正确,例如843278021", caption="温馨提示", style=wx.OK | wx.ICON_INFORMATION) warn.ShowModal() # 提示错误 warn.Destroy() if email != "": email_test = re.search( r"^[\w!#$%&'*+/=?^_`{|}~-]+(?:\.[\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\w](?:[\w-]*[\w])?\.)+[\w](?:[\w-]*[\w])?$", email) # 验证邮箱 if email_test == None: judge = 0 warn = wx.MessageDialog(self, message="Email格式不正确,例如[email protected]", caption="温馨提示", style=wx.OK | wx.ICON_INFORMATION) warn.ShowModal() # 提示错误 warn.Destroy() if password != "" and name != "" and certNo != "" and judge == 1: print('进来了') # 对Applicant进行实例化 user = UserInfo('', password, name, certNo, gender, birthday_time, job[0][0], graduschool[0][0], degree[0][0], danwei[0][0], zhicheng, shoujihao, qq, email) # 判断是否能找到相同身份证号 try: param_1 = (certNo, ) sql_1 = "select IDCard from user_info where IDCard=%s" i = self.dbhelper.SelectRecord(sql_1, param_1) print(i) if i != (): print(i) if i[0][0] == certNo: warn = wx.MessageDialog(self, message="身份证号已存在,请重新输入", caption="温馨提示", style=wx.OK | wx.ICON_INFORMATION) warn.ShowModal() # 提示 warn.Destroy() else: print("开始将用户注册信息插入到数据库中") # 进行数据库的插入 try: param_2 = (userClass[0][0], user.getpassword(), user.getApplicantName(), user.getApplicantID(), user.getgender(), user.getbirthday(), user.getprofession(), user.getgraduationschool(), user.getdegree(), user.getdepartment(), user.getzhicheng(), user.getCellPhoneNumber(), user.getQQ(), user.getemail(), userState[0][0]) sql_2 = "insert into user_info(UserCategory,Password,TrueName,IDCard, Gender, Birthday, Job, School,\ Degree, Unit, Title, Phone, QQ, Email, UserStatus) \ values(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)" self.dbhelper.AddRecord(sql_2, param_2) warn = wx.MessageDialog(self, message="注册成功", caption="温馨提示", style=wx.OK | wx.ICON_INFORMATION) warn.ShowModal() # 提示 warn.Destroy() self.parent.notebook.DeleteAllPages() self.parent._mgr.Update() self.parent.register_state = 0 except Exception as e: print("添加记录失败:", e) except Exception as e: print("查询记录失败:", e)
import bddHeader from user import UserInfo import generateName import getGrid to_page = bddHeader.to_page #bingoNO_admins: Name, Password, SID #bingoNO_grids: Name, Version, Content, SID #bingoNO_cells: CellKey (int, AI), Cell, Happened (int), Validated (int), Version to_page("Content-type: text/html; charset=utf-8") bdd = bddHeader.bdd() cursor = bdd.getCursor() user = UserInfo(cursor) #Récupération de la version et des cases disponibles with open('version_info.txt', 'r') as versionFile: version = versionFile.read().strip() all_cells = { -1: { 'content': "L'admin a pas mis assez de cases", 'happened': 1 } } cursor.execute( "SELECT * FROM bingoNO_cells WHERE Validated = 1" ) #0: CellKey (AI), 1: Cell, 2: Happened (int), 3: Validated (int), 4: Version cells_query = cursor.fetchall() for cell in cells_query:
# Imports # ########### import csv import sys import os from operator import itemgetter sys.path.append("..") from user import UserInfo ########### # Globals # ########### user_info = UserInfo() # flag to determine whether the user passed in a teams csv teams_csv_flag = 0 default = { "teams": "teams.csv", "orgs": "orgs.csv", "powerindices": "powerindices.csv", "rooms": "rooms.csv", "month": "feb", "indiv_room": "10^250" } passed_in = { "teams": None,
def updateTask(fab, **args): # 获取 tid tid = args.pop('tid') if None == tid: return title = args.pop('task') description = args.pop('description', u"") priority = args.pop('priority', u"Needs Triage") status = args.pop('status', u"Open") owner = args.pop('assigned', u"") projectsStr = unicode(args.pop('tags', u"")) deadline = args.pop('deadline').strip() kickoff = args.pop('kickoff') points = args.pop('points') projectNames = map(lambda x: x.strip(), projectsStr.split(',')) if tid[0] == 'T': tid = int(tid[1:]) else: tid = int(tid) tf = TaskInfoFactory() tif = tf.info(tid) if tif == None: print 'invalid task {tid}'.format(tid = tid) if deadline == 'TBD': deadline = '' pif = ProjectInfoFactory() projects = pif.projectsByName(projectNames) projectPHIDs = map(lambda x: x['phid'], projects) ui = UserInfo() ownerPhid = ui.getUserByRealName(owner)['phid'] updateArgs = {} editArgs = {'objectIdentifier': tif['phid'], 'transactions': []} if title != tif['title']: updateArgs['title'] = title if description != tif['description']: updateArgs['description'] = description if ownerPhid != tif['ownerPHID']: updateArgs['ownerPHID'] = ownerPhid if priority != tif['priority']: updateArgs['priority'] = settings.PRIORITY_VALUES[priority] # 更新 project newProjects = set(projectPHIDs) oldProjects = set(tif['projectPHIDs']) # 整理要添加的project addingProjects = list(newProjects - oldProjects) # 整理要删除的project removingProjects = list(oldProjects - newProjects) if len(addingProjects) > 0: editArgs['transactions'].append({'type': 'projects.add', 'value': addingProjects}) if len(removingProjects) > 0: editArgs['transactions'].append({'type': 'projects.remove', 'value': removingProjects}) pass if len(removingProjects) > 0: pass if status != tif['statusName']: try: updateArgs['status'] = settings.STATUS_NAMES[status] except Exception, e: if status != tif['status']: updateArgs['status'] = status pass
r4vByAuthors[author] = set() r4vByAuthors[author].add(tid) print status + ':' for a in r4vByAuthors: print a, len(r4vByAuthors[a]) searchCriterias = [{ 'desc': '5月31号以后所有任务', 'args': dict( constraints={ #"projects": ["儿童脑适能"], #"statuses":["open", "r4v"], "modifiedStart": int( datetime.strptime('2017-05-31 00:00', '%Y-%m-%d %H:%M').strftime("%s")), }), }] criteria = searchCriterias[0] resp = fab.maniphest.search(**criteria['args']).data resp = fab.maniphest.gettasktransactions( ids=map(lambda x: x['id'], resp)).response users = getUsers(fab) with CacheUsers(users): ui = UserInfo() reportStatus(resp, 'r4v', ui) reportStatus(resp, 'resolved', ui)
def deal_cmd(self, cmd_type, buf): logger.debug("receive cmd type %d state %d", cmd_type, self.state) if cmd_type == CmdType.HEARTBEAT: return if self.id == -1: if cmd_type == CmdType.CLIENT_INFO: cmd = IClientInfo() cmd.ParseFromString(buf) if client_mgr.get(cmd.id): logger.error("id %d already in system" % cmd.id) self.send_msg(self.build_cmd(CmdType.LOGIN_FAIL, EmptyMsg())) return self.name = cmd.name self.id = cmd.id self.net_type = cmd.net_type self.avatar = cmd.avatar self.user_info = UserInfo.get_user_by_id(self.id) if not self.user_info: self.user_info = UserInfo() self.user_info.id = self.id logger.debug("client name %s", cmd.name) self.send_msg(self.build_cmd(CmdType.LOGIN_SUCC, EmptyMsg())) return else: logger.debug("client not set client info") self.send_msg(self.build_cmd(CmdType.UNKNOWN_OP, EmptyMsg())) return if cmd_type == CmdType.ON_LINE: self.visible = True elif cmd_type == CmdType.OFF_LINE: self.visible = False elif cmd_type == CmdType.CLIENT_LBS: cmd = IClientLBS() cmd.ParseFromString(buf) if self.latitude != None: client_mgr.remove_client(self) if client_mgr.get(self.id): logger.error("id %d already in system" % self.id) self.send_msg(self.build_cmd(CmdType.UNKNOWN_OP, EmptyMsg())) return self.latitude = cmd.latitude self.longitude = cmd.longitude client_mgr.add_client(self) logger.debug("client lbs lat %f long %f" % (cmd.latitude, cmd.longitude)) elif cmd_type == CmdType.FETCH_PEER_LIST_REQ: if self.latitude == None: self.send_msg(self.build_cmd(CmdType.UNKNOWN_OP, EmptyMsg())) logger.debug("client not set the lbs info") return resp = OPeerListResp() logger.debug("client fetch peer list") clients = client_mgr.get_near(self, 5) for c in clients: if not c.visible: continue u = resp.users.add() u.name = c.name u.id = c.id u.fight_num = c.user_info.fight_num u.win_num = c.user_info.win_num u.avatar = c.avatar u.net_type = c.net_type u.state = c.state self.send_msg(self.build_cmd(CmdType.FETCH_PEER_LIST_RESP, resp)) elif cmd_type == CmdType.FIGHT_REQ and self.state == Client.IDLE: req = IFightReq() req.ParseFromString(buf) today_begin_time = int((time.time() + 8 * 3600) / (24 * 3600)) * 24 * 3600 - 8 * 3600 if self.last_bet_time < today_begin_time: self.bet_num = 0 if req.bet > 0 and self.bet_num >= 5: resp = OFightResp() resp.result = 2 resp.message = 'bet too much' logger.error("bet too much %d" % self.id) self.send_msg(self.build_cmd(CmdType.FIGHT_RESP, resp)) return logger.debug("client fight req %d" % req.id) client = client_mgr.get(req.id) if client: if client.state != Client.IDLE: resp = OFightResp() resp.result = 1 resp.message = u'other is busy' self.send_msg(self.build_cmd(CmdType.FIGHT_RESP, resp)) return self.state = Client.FIGHT_REQ_A self.bet = req.bet client.bet = req.bet resp = OFightReq() resp.user.id = self.id resp.user.name = self.name resp.user.avatar = self.avatar resp.user.net_type = self.net_type resp.user.fight_num = self.user_info.fight_num resp.user.win_num = self.user_info.win_num resp.user.state = self.state resp.bet = req.bet client.send_msg(self.build_cmd(CmdType.FIGHT_REQ, resp)) client.state = Client.FIGHT_REQ_B self.peer_client = client client.peer_client = self self.start_timeout(ONE_MOVE_MAX_TIME) else: resp = OFightResp() resp.result = 1 resp.message = 'no such user' logger.error("not find user %d" % req.id) self.send_msg(self.build_cmd(CmdType.FIGHT_RESP, resp)) elif cmd_type == CmdType.FIGHT_RESP and self.state == Client.FIGHT_REQ_B: req = IFightResp() req.ParseFromString(buf) self.peer_client.cancel_timeout() if req.result == 0: question = OQuestion() question.fight_key = "%d_%d_%d" % (self.peer_client.id, self.id, int(time.time())) self.peer_client.send_msg(self.build_cmd(CmdType.QUESTION, question)) self.send_msg(self.build_cmd(CmdType.QUESTION, question)) self.state = self.peer_client.state = Client.WAIT_FOR_ANSWER self.start_timeout(ONE_MOVE_MAX_TIME) self.question_index = self.peer_client.question_index = 0 self.start_time = self.peer_client.start_time = time.time() self.peer_client.last_answer_time = self.last_answer_time = time.time() self.right = self.peer_client.right = 0 #start game if self.bet > 0: self.peer_client.bet_num += 1 self.peer_client.last_bet_time = time.time() logger.debug("%d bet num %d %d" % (self.peer_client.id, self.peer_client.bet_num, int(self.peer_client.last_bet_time))) else: resp = OFightResp() resp.result = 1 resp.message = 'other does not agree' logger.debug("peer %d disagree") self.peer_client.send_msg(self.build_cmd(CmdType.FIGHT_RESP, resp)) self.state = Client.IDLE self.peer_client.state = Client.IDLE self.peer_client.peer_client = None self.peer_client = None elif cmd_type == CmdType.FIGHT_CANCEL and (self.state == Client.FIGHT_REQ_A or self.state == Client.WAIT_FOR_ANSWER): logger.debug("%d fight cancel" % self.id) self.peer_client.send_msg(self.build_cmd(CmdType.FIGHT_CANCEL, EmptyMsg())) self.peer_client.state = self.state = Client.IDLE self.peer_client.peer_client = None self.peer_client = None elif cmd_type == CmdType.ANSWER and self.state == Client.WAIT_FOR_ANSWER: self.cancel_timeout() self.last_answer_time = time.time() if self.check_answer_timeout(): #timeout end of game return req = IAnswer() req.ParseFromString(buf) if req.index != self.question_index: logger.error("answer is not right index") return self.question_index += 1 logger.debug("%d done %d" % (self.id, self.question_index)) cmd = OFightState() cmd.all = 10 cmd.done = self.question_index if req.right: self.right += 1 cmd.right = self.right self.peer_client.send_msg(self.build_cmd(CmdType.FIGHT_STATE, cmd)) if req.index >= QUESTION_NUM_PER_GAME - 1: logger.debug("%d finish" % self.id) self.end_time = time.time() if self.peer_client.state == Client.WAIT_FOR_RESULT: self.deal_fight_result(self.right > self.peer_client.right) else: self.state = Client.WAIT_FOR_RESULT else: self.start_timeout(ONE_MOVE_MAX_TIME) elif cmd_type == CmdType.FIGHT_QUIT and (self.state == Client.WAIT_FOR_ANSWER or self.state == Client.WAIT_FOR_RESULT): logger.debug("%d quit" % self.id) self.end_time = self.peer_client.end_time = time.time() self.deal_fight_result(0) else: self.send_msg(self.build_cmd(CmdType.UNKNOWN_OP, EmptyMsg()))
def saveUpdate(self, evt): judge = 1 '''保存修改后的信息''' password = self.password.GetValue().strip() # 获得修改后的值 confirmpd = self.confirmpd.GetValue().strip() name = self.XingMing.GetValue().strip() certNo = self.certNo.GetValue().strip() gender = self.gender # birthday = self.birth.GetValue() birthday_time = self.datetime_to_str(str(birthday)) # job = self.data_translate(self.job.GetValue(), 1) # 职业 graduschool = self.data_translate(self.school.GetValue(), 2) degree = self.data_translate(self.degreeType.GetValue(), 3) danwei = self.data_translate(self.danwei.GetValue(), 4) # zhicheng = self.zhicheng.GetValue() shoujihao = self.phone.GetValue().strip() qq = self.QQ.GetValue().strip() email = self.email.GetValue().strip() # 判断注册时输入的格式是否正确 password_test = re.search(r"^[a-zA-Z0-9]{4,10}$", password) # 密码 true_name = re.search(r"^[\u4E00-\u9FA5]{2,4}$", name) # 姓名 shenfenzheng = re.search( r"^(\d{6})(\d{4})(\d{2})(\d{2})(\d{3})([0-9]|X)$", certNo) # 身份证号 if name == "": warn = wx.MessageDialog(self, message="姓名不能为空!!!", caption="温馨提示", style=wx.OK | wx.ICON_INFORMATION) warn.ShowModal() # 提示错误 warn.Destroy() judge = 0 elif true_name == None: # 消息对话框 warn = wx.MessageDialog(self, message="真实姓名填写有误", caption="温馨提示", style=wx.OK | wx.ICON_INFORMATION) warn.ShowModal() # 提示错误 warn.Destroy() judge = 0 elif certNo == "": warn = wx.MessageDialog(self, message="身份证号不能为空!!!", caption="温馨提示", style=wx.OK | wx.ICON_INFORMATION) warn.ShowModal() # 提示错误 warn.Destroy() judge = 0 elif shenfenzheng == None: # 消息对话框 warn = wx.MessageDialog(self, message="身份证输入不合法", caption="温馨提示", style=wx.OK | wx.ICON_INFORMATION) warn.ShowModal() # 提示错误 warn.Destroy() judge = 0 elif password == "": # 消息对话框 warn = wx.MessageDialog(self, message="登录密码不能为空!!!", caption="温馨提示", style=wx.OK | wx.ICON_INFORMATION) warn.ShowModal() # 提示错误 warn.Destroy() judge = 0 elif password_test == None: # 消息对话框 warn = wx.MessageDialog(self, message="密码不能含有非法字符,长度在4-10之间", caption="温馨提示", style=wx.OK | wx.ICON_INFORMATION) warn.ShowModal() # 提示错误 warn.Destroy() judge = 0 elif confirmpd == "": # 消息对话框 warn = wx.MessageDialog(self, message="确认密码不能为空!!!", caption="温馨提示", style=wx.OK | wx.ICON_INFORMATION) warn.ShowModal() # 提示错误 warn.Destroy() judge = 0 elif password != confirmpd: # 消息对话框 warn = wx.MessageDialog(self, message="两次密码不同,请重新输入", caption="温馨提示", style=wx.OK | wx.ICON_INFORMATION) warn.ShowModal() # 提示错误 warn.Destroy() judge = 0 if shoujihao != '': phone = re.search(r"^1[3-9]\d{9}$", shoujihao) # 验证手机号 if phone == None: warn = wx.MessageDialog(self, message="手机号码不正确,请重新输入", caption="温馨提示", style=wx.OK | wx.ICON_INFORMATION) warn.ShowModal() # 提示错误 warn.Destroy() judge = 0 if qq != '': QQ = re.search(r"^[1-9][0-9]{4,11}$", qq) # 验证QQ号 if QQ == None: warn = wx.MessageDialog(self, message="QQ号不正确,例如843278021", caption="温馨提示", style=wx.OK | wx.ICON_INFORMATION) warn.ShowModal() # 提示错误 warn.Destroy() judge = 0 if email != '': email_test = re.search(r"^\w+@\w+(\.[a-zA-Z]{2,3}){1,2}$", email) # 验证邮箱 if email_test == None: warn = wx.MessageDialog(self, message="Email格式不正确,例如[email protected]", caption="温馨提示", style=wx.OK | wx.ICON_INFORMATION) warn.ShowModal() # 提示错误 warn.Destroy() judge = 0 if password != "" and name != "" and certNo != "" and judge == 1: print("开始将修改后的数据保存到数据库中") applicant = UserInfo('', password, name, certNo, gender, birthday_time, job[0][0], graduschool[0][0], degree[0][0], danwei[0][0], zhicheng, shoujihao, qq, email) try: param_2 = (applicant.getpassword(), applicant.getApplicantName(), applicant.getApplicantID(), applicant.getgender(), applicant.getbirthday(), applicant.getprofession(), applicant.getgraduationschool(), applicant.getdegree(), applicant.getdepartment(), applicant.getzhicheng(), applicant.getCellPhoneNumber(), applicant.getQQ(), applicant.getzhicheng(), applicant.getemail(), applicant.getApplicantID()) sql_2 = "update user_info set Password=%s, TrueName=%s, IDCard=%s, Gender=%s, Birthday=%s, " \ "Job=%s,School=%s, Degree=%s, Unit=%s, Title=%s, Phone=%s , QQ=%s, Title=%s, Email=%s" \ " where IDCard=%s" self.dbhelper.UpdateData(sql_2, param_2) # 对话框 warn = wx.MessageDialog(self, message="提交成功", caption="温馨提示", style=wx.OK | wx.ICON_INFORMATION) warn.ShowModal() # 提示 warn.Destroy() except Exception as e: print("查询记录失败:", e)
auxDict[kickoffFieldName] = kickoff # pp(dict( # title = title, # description = description, # projectPHIDs = projectPHIDs, # auxiliary = auxDict)) # return theTask = fab.maniphest.createtask( title = title, description = description, projectPHIDs = projectPHIDs, auxiliary = auxDict) taskId = theTask['id'] ui = UserInfo() try: ownerPhid = ui.getUserByRealName(owner)['phid'] except Exception, e: ownerPhid = None theTask = fab.maniphest.update( id = taskId, priority = settings.PRIORITY_VALUES[priority], status = settings.STATUS_NAMES[status], ownerPHID = ownerPhid) if None != parent: mock = FabMock() session = requests.Session() mock = FabMock() resp = session.get(settings.SITE['URL']) csrfToken = mock.getCsrfValue(resp.text)