def log_project_issue(self,filepath,filename,problem="",detail="",desc=None,opens_with=None):
cursor = self.conn.cursor()
matches=re.search(u'(\.[^\.]+)$',filename)
file_xtn = ""
if matches is not None:
file_xtn=str(matches.group(1))
else:
raise ArgumentError("Filename %s does not appear to have a file extension" % filename)
typenum=self.project_type_for_extension(file_xtn,desc=desc,opens_with=opens_with)
try:
cursor.execute("""insert into edit_projects (filename,filepath,type,problem,problem_detail,lastseen,valid)
values (%s,%s,%s,%s,%s,now(),false) returning id""", (filename,filepath,typenum,problem,detail))
except psycopg2.IntegrityError as e:
print str(e)
print traceback.format_exc()
self.conn.rollback()
cursor.execute("""update edit_projects set lastseen=now(), valid=false, problem=%s, problem_detail=%s where filename=%s and filepath=%s returning id""", (problem,detail,filename,filepath))
#print cursor.mogrify("""update edit_projects set lastseen=now(), valid=false, problem=%s, problem_detail=%s where filename=%s and filepath=%s returning id""", (problem,detail,filename,filepath))
result=cursor.fetchone()
id = result[0]
self.conn.commit()
return id
评论列表
文章目录