Skip to content

Commit

Permalink
avoid generating whole dictionary XML in memory when downloading
Browse files Browse the repository at this point in the history
  • Loading branch information
mjakubicek committed Jan 3, 2020
1 parent 9dbf518 commit 685e259
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions website/ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -780,7 +780,7 @@ def download(dictDB, dictID, configs):
rootname = dictID.lstrip(" 0123456789")
if rootname == "":
rootname = "lexonomy"
resxml = "<"+rootname+">"
yield "<"+rootname+">"
c = dictDB.execute("select id, xml from entries")

transform = download_xslt(configs)
Expand All @@ -791,11 +791,10 @@ def download(dictDB, dictID, configs):
if not success:
return xml_xsl, 400

resxml += xml_xsl
resxml += "\n"
yield xml_xsl
yield "\n"

resxml += "</"+rootname+">"
return resxml
yield "</"+rootname+">"

def purge(dictDB, email, historiography):
dictDB.execute("insert into history(entry_id, action, [when], email, xml, historiography) select id, 'purge', ?, ?, xml, ? from entries", (str(datetime.datetime.utcnow()), email, json.dumps(historiography)))
Expand Down

0 comments on commit 685e259

Please sign in to comment.