|
@@ -17,8 +17,11 @@ heading = """<?xml version="1.0" encoding="UTF-8"?>
|
|
|
|
|
|
@route('/pyapi/random')
|
|
|
def index():
|
|
|
- with conn.cursor() as cur:
|
|
|
- xml = cur.execute(statement).fetchone()[0]
|
|
|
+ try:
|
|
|
+ with conn.cursor() as cur:
|
|
|
+ xml = cur.execute(statement).fetchone()[0]
|
|
|
+ finally:
|
|
|
+ conn.commit()
|
|
|
response.content_type = 'application/xhtml+xml; charset=utf-8'
|
|
|
return f"{heading}{xml}"
|
|
|
|