Skip to content

Commit

Permalink
Revert "only save doc after any text content changes have been made"
Browse files Browse the repository at this point in the history
This reverts commit 5085513.
  • Loading branch information
lgessler committed Jan 16, 2019
1 parent 11cbc23 commit e8a28b1
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,6 +249,19 @@ 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 @@ -305,19 +318,6 @@ 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 e8a28b1

Please sign in to comment.