Graham's PyZ3950 dependency hack
authorgfawcett <gfawcett@6d9bc8c9-1ec2-4278-b937-99fde70a366f>
Tue, 10 Mar 2009 00:38:42 +0000 (00:38 +0000)
committergfawcett <gfawcett@6d9bc8c9-1ec2-4278-b937-99fde70a366f>
Tue, 10 Mar 2009 00:38:42 +0000 (00:38 +0000)
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

index 3e73dd7..fe09314 100644 (file)
@@ -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)