From c84c8c6eda49afcda83974e73b653467b3f812fb Mon Sep 17 00:00:00 2001 From: gfawcett Date: Tue, 10 Mar 2009 00:38:42 +0000 Subject: [PATCH] Graham's PyZ3950 dependency hack So I can try out Art's demo code. Will work out the real dependency problem later. git-svn-id: svn://svn.open-ils.org/ILS-Contrib/servres/trunk@163 6d9bc8c9-1ec2-4278-b937-99fde70a366f --- conifer/syrup/views.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/conifer/syrup/views.py b/conifer/syrup/views.py index 3e73dd7..fe09314 100644 --- a/conifer/syrup/views.py +++ b/conifer/syrup/views.py @@ -16,9 +16,25 @@ from gettext import gettext as _ # fixme, is this the right function to import? from django.utils import simplejson import sys +# Graham needs this import hackery to get PyZ3950 working. Presumably +# Art can 'import profile', so this code won't run for him. + +try: + import profile + import lex + import yacc +except ImportError: + sys.modules['profile'] = sys # just get something called profile; + # it's not actually used. + import ply.lex + import ply.yacc # pyz3950 thinks these are toplevel modules + sys.modules['lex'] = ply.lex + sys.modules['yacc'] = ply.yacc + # for Z39.50 support, not sure whether this is the way to go yet but # as generic as it gets -# from PyZ3950 import zoom +from PyZ3950 import zoom + #----------------------------------------------------------------------------- def log(level, msg): print >> sys.stderr, '[%s] %s: %s' % (datetime.now(), level.upper(), msg) -- 2.11.0