[open-ils-commits] r292 - in servres/trunk/conifer: . libsystems/evergreen syrup templates (gfawcett)
svn at svn.open-ils.org
svn at svn.open-ils.org
Sun Apr 5 21:01:29 EDT 2009
Author: gfawcett
Date: 2009-04-05 21:01:28 -0400 (Sun, 05 Apr 2009)
New Revision: 292
Modified:
servres/trunk/conifer/genshi_support.py
servres/trunk/conifer/libsystems/evergreen/support.py
servres/trunk/conifer/settings.py
servres/trunk/conifer/syrup/views.py
servres/trunk/conifer/templates/master.xhtml
servres/trunk/conifer/urls.py
Log:
baby steps toward a good mod_python deployment.
This works as is, with a overly-controlling Apache environment:
<Location "/">
SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE conifer.settings
#PythonOption django.root /syrup
PythonOption django.root
PythonDebug Off
PythonPath "['/home/graham/projects/evergreen/servres/'] + sys.path"
</Location>
Modified: servres/trunk/conifer/genshi_support.py
===================================================================
--- servres/trunk/conifer/genshi_support.py 2009-04-06 01:01:12 UTC (rev 291)
+++ servres/trunk/conifer/genshi_support.py 2009-04-06 01:01:28 UTC (rev 292)
@@ -26,7 +26,7 @@
template.filters.insert(0, Translator(_))
-dirs = ['templates']
+dirs = [settings.HERE('templates')]
loader = TemplateLoader(dirs, auto_reload=True, callback=template_loaded)
Modified: servres/trunk/conifer/libsystems/evergreen/support.py
===================================================================
--- servres/trunk/conifer/libsystems/evergreen/support.py 2009-04-06 01:01:12 UTC (rev 291)
+++ servres/trunk/conifer/libsystems/evergreen/support.py 2009-04-06 01:01:28 UTC (rev 292)
@@ -4,7 +4,7 @@
import simplejson as json
from xml.etree import ElementTree
import re
-import sys
+import sys, os
#------------------------------------------------------------
# Configuration
@@ -24,6 +24,8 @@
# FM_IDL_LOCATION = 'file:fm_IDL.xml'
FM_IDL_LOCATION = 'http://dwarf.cs.uoguelph.ca/reports/fm_IDL.xml'
+here = lambda s: os.path.join(os.path.dirname(__file__), s)
+FM_IDL_LOCATION = 'file:' + here('fm_IDL.xml')
#------------------------------------------------------------
# parse fm_IDL, to build a field-name-lookup service.
Modified: servres/trunk/conifer/settings.py
===================================================================
--- servres/trunk/conifer/settings.py 2009-04-06 01:01:12 UTC (rev 291)
+++ servres/trunk/conifer/settings.py 2009-04-06 01:01:28 UTC (rev 292)
@@ -5,10 +5,10 @@
import os
-BASE_DIRECTORY = os.path.abspath(os.getcwd())
+BASE_DIRECTORY = os.path.abspath(os.path.dirname(__file__))
HERE = lambda s: os.path.join(BASE_DIRECTORY, s)
-DEBUG = True
+DEBUG = False
TEMPLATE_DEBUG = DEBUG
ADMINS = (
@@ -130,3 +130,5 @@
from private_local_settings import SIP_HOST, SIP_CREDENTIALS
except:
pass
+
+CACHE_BACKEND = 'locmem:///'
Modified: servres/trunk/conifer/syrup/views.py
===================================================================
--- servres/trunk/conifer/syrup/views.py 2009-04-06 01:01:12 UTC (rev 291)
+++ servres/trunk/conifer/syrup/views.py 2009-04-06 01:01:28 UTC (rev 292)
@@ -1379,3 +1379,9 @@
return g.render('phys/mark_arrived_outcome.xhtml')
+
+def custom_error_handler(request):
+ cls, inst, tb = sys.exc_info()
+ #fixme, set 50x code.
+ return simple_message(_('Error: %s') % repr(inst),
+ repr((request.__dict__, inst)))
Modified: servres/trunk/conifer/templates/master.xhtml
===================================================================
--- servres/trunk/conifer/templates/master.xhtml 2009-04-06 01:01:12 UTC (rev 291)
+++ servres/trunk/conifer/templates/master.xhtml 2009-04-06 01:01:28 UTC (rev 292)
@@ -1,6 +1,7 @@
<?python
app_name = _('Syrup E-Reserve System')
search = _('search...')
+import os
?>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:py="http://genshi.edgewall.org/"
@@ -22,6 +23,7 @@
<div id="outer">
<div id="brandheader">
<div style="float: right; font-size: x-large; padding: 12; color: #888;">
+ ${os.getpid()}
${app_name}
</div>
<img src="/static/institution-logo.png" style="height: 50;"/>
Modified: servres/trunk/conifer/urls.py
===================================================================
--- servres/trunk/conifer/urls.py 2009-04-06 01:01:12 UTC (rev 291)
+++ servres/trunk/conifer/urls.py 2009-04-06 01:01:28 UTC (rev 292)
@@ -20,7 +20,10 @@
{'document_root': settings.MEDIA_ROOT}),
(r'^accounts/(?P<path>.*)$', 'conifer.syrup.views.auth_handler'),
- (r'^syrup/setlang', 'conifer.syrup.views.setlang'),
+# (r'^syrup/setlang', 'conifer.syrup.views.setlang'),
(r'^syrup/i18n/', include('django.conf.urls.i18n')),
)
+
+if not settings.DEBUG:
+ handler500 = 'conifer.syrup.views.custom_error_handler'
More information about the open-ils-commits
mailing list