Преглед изворни кода

Merge branch 'miscellaneous-fixes' of gogsadmin/prayer-generator into master

gogsadmin пре 1 година
родитељ
комит
2f1c47e3bf
2 измењених фајлова са 9 додато и 3 уклоњено
  1. 5 2
      rest/pyapi.py
  2. 4 1
      xml/pg_view_style.xsl

+ 5 - 2
rest/pyapi.py

@@ -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}"
 

+ 4 - 1
xml/pg_view_style.xsl

@@ -81,7 +81,10 @@ All rights reserved.
                 <xsl:when test="$elementtype = 'translation'">
                 </xsl:when>
                 <xsl:otherwise>
-                <td class="opt-md opt-lg opt-xl opt-xxl" style="line-height: 0.5;"><xsl:value-of select="preceding-sibling::translation"/><p/><xsl:value-of select="translate(translate(.,' ','&#160;'),'-','&#8209;')"/></td>
+                  <td class="opt-md opt-lg opt-xl opt-xxl" style="line-height: 0.5;">
+                  <xsl:value-of select="translate(translate(.,' ','&#160;'),'-','&#8209;')"/>
+                  <p/>
+                  <xsl:value-of select="preceding-sibling::translation"/></td>
                 </xsl:otherwise>
                 </xsl:choose>
               </xsl:for-each>