Skip to content

Commit

Permalink
Merge pull request #121 from lgessler/master
Browse files Browse the repository at this point in the history
only save doc after any text content changes have been made
  • Loading branch information
amir-zeldes authored Jan 15, 2019
2 parents 7f917e5 + 5085513 commit 3f1ce88
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,19 +249,6 @@ def load_page(user,admin,theform):

text_content = generic_query("SELECT content FROM docs WHERE id=?",(doc_id,))[0][0]

# In the case of reloading after hitting 'save', either create new doc into db, or update db
# CodeMirror sends the form with its code content in it before 'save' so we just display it again
if theform.getvalue('code'):
text_content = theform.getvalue('code')
text_content = text_content.replace("\r","")
text_content = re.sub(r'&(?!amp;)',r'&',text_content) # Escape unescaped XML &
text_content = unicode(text_content.decode("utf8"))
if user != "demo":
if int(doc_id)>int(max_id):
create_document(doc_id, docname,corpus,status,assignee,repo_name,text_content)
else:
save_changes(doc_id,text_content)

git_status=False

commit_message = ""
Expand Down Expand Up @@ -318,6 +305,19 @@ def load_page(user,admin,theform):
resp = requests.post(api_call, data, auth=HTTPBasicAuth(nlp_user,nlp_password))
text_content=resp.text

# In the case of reloading after hitting 'save', either create new doc into db, or update db
# CodeMirror sends the form with its code content in it before 'save' so we just display it again
if theform.getvalue('code'):
text_content = theform.getvalue('code')
text_content = text_content.replace("\r","")
text_content = re.sub(r'&(?!amp;)',r'&',text_content) # Escape unescaped XML &
text_content = unicode(text_content.decode("utf8"))
if user != "demo":
if int(doc_id)>int(max_id):
create_document(doc_id, docname,corpus,status,assignee,repo_name,text_content)
else:
save_changes(doc_id,text_content)

# Editing options
# Docname
# Filename
Expand Down

0 comments on commit 3f1ce88

Please sign in to comment.