Modify unapi layer for apache
authorArt Rhyno <art632000@yahoo.ca>
Wed, 12 Sep 2012 23:34:34 +0000 (19:34 -0400)
committerArt Rhyno <art632000@yahoo.ca>
Wed, 12 Sep 2012 23:34:34 +0000 (19:34 -0400)
This does not happen in all environments, but apache seems to get hung on
the initialization work for unapi. For now, this has been moved into the
unapi call proper.

conifer/syrup/views/unapi.py

index 56c84cc..faaee68 100644 (file)
@@ -2,12 +2,15 @@ from lxml import etree
 
 from _common import *
 
-stylesheet = etree.parse(
-    file(HERE('templates/unapi/MARC21slim2MODS3-3.xsl')))
+def unapi(request):
+    #sometimes apache does not seem to like doing this as part of the
+    #import step in __init__.py, and will hang on the request, so we
+    #do this each time
+    stylesheet = etree.parse(
+        file(HERE('templates/unapi/MARC21slim2MODS3-3.xsl')))
 
-xform = etree.XSLT(stylesheet)
+    xform = etree.XSLT(stylesheet)
 
-def unapi(request):
     id = request.GET.get('id')
     if not id:
         return g.render_xml('unapi/formats.xml', item=None)