[open-ils-commits] r590 - in servres/trunk/conifer: . custom (artunit)
svn at svn.open-ils.org
svn at svn.open-ils.org
Fri Jul 17 21:14:48 EDT 2009
Author: artunit
Date: 2009-07-17 21:14:47 -0400 (Fri, 17 Jul 2009)
New Revision: 590
Modified:
servres/trunk/conifer/README
servres/trunk/conifer/custom/lib_integration.py
Log:
extracting yax and expect dependencies, some info on running under windows
Modified: servres/trunk/conifer/README
===================================================================
--- servres/trunk/conifer/README 2009-07-17 20:14:25 UTC (rev 589)
+++ servres/trunk/conifer/README 2009-07-18 01:14:47 UTC (rev 590)
@@ -1,101 +1,99 @@
-Syrup: A Reserves application
-------------------------------
-
-For more information, see
-http://open-ils.org/dokuwiki/doku.php?id=scratchpad:reserves
-
-or contact
-Art Rhyno <artrhyno at uwindsor.ca>
-Graham Fawcett <graham.fawcett at gmail.com>
-
-
-State of the application
-------------------------------
-
-Coming along nicely, thank you! With a bit of patience, you ought to
-be able to get a basic Syrup system running in no time. Integrating it
-with your backend library and other systems will take longer, of
-course.
-
-Required components
-------------------------------
-
-Most likely you will need a Unix-like system: Linux, BSD, or OS X
-ought all to work. Most development and testing is being done on
-Linux. No testing on Windows has been done.
-
-You need Python. Probably Python 2.5, I haven't tested with other
-versions. You also need sqlite3 or another Django-compatible
-database. Sqlite3 is recommended for kicking the tires, PostgreSQL for
-production.
-
-Third-party Python dependencies:
-
- sudo easy_install Django Genshi Babel BabelDjango pexpect
-
-(You'll need 'setuptools' in order to have 'easy_install'.)
-
-Graham has the following versions installed. Not saying you need these
-exact ones, just that they are known to work.
-
- Django-1.0.1_final-py2.5
- Babel-0.9.4-py2.5
- BabelDjango-0.2.2-py2.5
- Genshi-0.5.1-py2.5
- pexpect-2.4-py2.5
-
-You will need 'yaz-client' for the Z39.50 stuff. On Ubuntu, this works:
-
- sudo apt-get install yaz libyaz3
-
-
-Getting this thing to run
-------------------------------
-
-This might work:
-
-* Review settings.py. Maybe you need to edit stuff. Probably not for a
- quick test.
-
-* ./manage.py syncdb
-
-* During syncdb, create yourself a superuser account.
-
-* ./pybabel-extract (currently, this is optional)
-
-* ./manage.py runserver
-
-* visit http://localhost:8000/ and log in.
-
-* create at least one Term and one Department under Admin Options.
-
-* make yourself a course.
-
-* click on all of the links and see what they do.
-
-
-Contents [out of date -- Ed.]
-------------------------------
-
-syrup/ -- the reserves app
-middleware/ -- middleware component to integrate Genshi
-locale/ -- the gettext files
-templates/ -- the Genshi templates
-static/ -- static JS, CSS, image files
-doc/ -- documentation on the app
-
-local_settings.py.in -- a template for local_settings.py
-genshi_support.py -- Genshi template integration
-pybabel-extract -- a "make all" for the i18n files
-babel.cfg -- Babel (i18n) configuration file
-
-The rest is straightforward Django stuff.
-
-
-Customization
-------------------------------
-
-The 'custom' directory contains (or should contain!) all of the bits
-that you really need to customize for your institution. More
-documentation is needed here, but the source code is mostly
+Syrup: A Reserves application
+------------------------------
+
+For more information, see
+http://open-ils.org/dokuwiki/doku.php?id=scratchpad:reserves
+
+or contact
+Art Rhyno <artrhyno at uwindsor.ca>
+Graham Fawcett <graham.fawcett at gmail.com>
+
+
+State of the application
+------------------------------
+
+Coming along nicely, thank you! With a bit of patience, you ought to
+be able to get a basic Syrup system running in no time. Integrating it
+with your backend library and other systems will take longer, of
+course.
+
+Required components
+------------------------------
+
+You need Python. Probably Python 2.5, I haven't tested with other
+versions. You also need sqlite3 or another Django-compatible
+database. Sqlite3 is recommended for kicking the tires, PostgreSQL for
+production.
+
+Third-party Python dependencies:
+
+ sudo easy_install Django Genshi Babel BabelDjango
+
+(You'll need 'setuptools' in order to have 'easy_install'.)
+
+Windows is very similar, see:
+
+http://groups.google.com/group/syrup-reserves-discuss/web/installing-syrup-in-windows
+
+Graham has the following versions installed. Not saying you need these
+exact ones, just that they are known to work.
+
+ Django-1.0.1_final-py2.5
+ Babel-0.9.4-py2.5
+ BabelDjango-0.2.2-py2.5
+ Genshi-0.5.1-py2.5
+
+Getting this thing to run
+------------------------------
+
+This might work:
+
+* Review settings.py. Maybe you need to edit stuff. Probably not for a
+ quick test.
+
+* ./manage.py syncdb
+
+Note: don't use the "./" syntax in windows for the commands, e.g.:
+
+C:\src\syrup\trunk\conifer>manage.py syncdb
+
+* During syncdb, create yourself a superuser account.
+
+* ./pybabel-extract (currently, this is optional)
+
+* ./manage.py runserver
+
+* visit http://localhost:8000/ and log in.
+
+* create at least one Term and one Department under Admin Options.
+
+* make yourself a course.
+
+* click on all of the links and see what they do.
+
+
+Contents [out of date -- Ed.]
+------------------------------
+
+syrup/ -- the reserves app
+middleware/ -- middleware component to integrate Genshi
+locale/ -- the gettext files
+templates/ -- the Genshi templates
+static/ -- static JS, CSS, image files
+doc/ -- documentation on the app
+
+local_settings.py.in -- a template for local_settings.py
+genshi_support.py -- Genshi template integration
+pybabel-extract -- a "make all" for the i18n files
+babel.cfg -- Babel (i18n) configuration file
+
+The rest is straightforward Django stuff.
+
+
+Customization
+------------------------------
+
+The 'custom' directory contains (or should contain!) all of the bits
+that you really need to customize for your institution. More
+documentation is needed here, but the source code is mostly
well-documented.
\ No newline at end of file
Modified: servres/trunk/conifer/custom/lib_integration.py
===================================================================
--- servres/trunk/conifer/custom/lib_integration.py 2009-07-17 20:14:25 UTC (rev 589)
+++ servres/trunk/conifer/custom/lib_integration.py 2009-07-18 01:14:47 UTC (rev 590)
@@ -1,96 +1,96 @@
-# Our integration-point with back-end library systems.
-
-# This is a work in progress. I'm trying to separate out the actual
-# protocol handlers (in libsystems) from the configuration decicions
-# (in settings.py), and use this as sort of a merge-point between
-# those two decisions.
-
-# TODO: write some documentation about the lib_integration interface.
-
-# Our example configuration:
-# Z39.50 for catalogue search,
-# SIP for patron and item_info, and for item checkout and checkin,
-# OpenSRF for extended item info.
-
-# define a @caching decorator to exploit the Django cache. Fixme, move
-# this somewhere else.
-from django.core.cache import cache
-import cPickle
-def caching(prefix, timeout=60):
- def g(func):
- def f(*args):
- # wtf! Django encodes string-values as
- # unicode-strings. That's bad, like stupid-bad! I'm
- # putting explicit utf8-conversions here to make debugging
- # easier if this code dies.
- key = ','.join([prefix] + map(str, args))
- v = cache.get(key)
- if v:
- return cPickle.loads(v.encode('utf-8'))
- else:
- v = func(*args)
- if v:
- cache.set(key, unicode(cPickle.dumps(v), 'utf-8'), timeout)
- return v
- return f
- return g
-
-
-from django.conf import settings
-
-from conifer.libsystems.evergreen.support import initialize
-EG_BASE = 'http://%s/' % settings.EVERGREEN_GATEWAY_SERVER
-try:
- initialize(EG_BASE)
-except:
- import warnings
- warnings.warn('Evergreen inaccessible! Integration will suck eggs!')
-
-from conifer.libsystems.evergreen import item_status as I
-from conifer.libsystems.sip.sipclient import SIP
-from conifer.libsystems.z3950 import yaz_search
-from conifer.libsystems.z3950.marcxml import marcxml_to_dictionary
-
-
- at caching('patroninfo', timeout=300)
- at SIP
-def patron_info(conn, barcode):
- return conn.patron_info(barcode)
-
- at caching('itemstatus', timeout=300)
- at SIP
-def item_status(conn, barcode):
- return conn.item_info(barcode)
-
- at SIP
-def checkout(conn, patron_barcode, item_barcode):
- return conn.checkout(patron_barcode, item_barcode, '')
-
- at SIP
-def checkin(conn, item_barcode):
- return conn.checkin(item_barcode, institution='', location='')
-
-
- at caching('bcbi', timeout=3600)
-def barcode_to_bib_id(barcode):
- return I.barcode_to_bib_id(barcode)
-
- at caching('bccp', timeout=3600)
-def barcode_to_copy(barcode):
- return I.barcode_to_copy(barcode)
-
- at caching('bimx', timeout=3600)
-def bib_id_to_marcxml(bib_id):
- return I.bib_id_to_marcxml(bib_id)
-
-
-def cat_search(query, start=1, limit=10):
- # this is a total hack for conifer. If the query is a Conifer
- # title-detail URL, then return just that one item.
- if query.startswith(EG_BASE):
- results = marcxml_to_dictionary(I.url_to_marcxml(query), multiples=True)
- numhits = len(results)
- else:
- cat_host, cat_db = settings.Z3950_CONFIG
- results, numhits = yaz_search.search(cat_host, cat_db, query, start, limit)
- return results, numhits
+# Our integration-point with back-end library systems.
+
+# This is a work in progress. I'm trying to separate out the actual
+# protocol handlers (in libsystems) from the configuration decicions
+# (in settings.py), and use this as sort of a merge-point between
+# those two decisions.
+
+# TODO: write some documentation about the lib_integration interface.
+
+# Our example configuration:
+# Z39.50 for catalogue search,
+# SIP for patron and item_info, and for item checkout and checkin,
+# OpenSRF for extended item info.
+
+# define a @caching decorator to exploit the Django cache. Fixme, move
+# this somewhere else.
+from django.core.cache import cache
+import cPickle
+def caching(prefix, timeout=60):
+ def g(func):
+ def f(*args):
+ # wtf! Django encodes string-values as
+ # unicode-strings. That's bad, like stupid-bad! I'm
+ # putting explicit utf8-conversions here to make debugging
+ # easier if this code dies.
+ key = ','.join([prefix] + map(str, args))
+ v = cache.get(key)
+ if v:
+ return cPickle.loads(v.encode('utf-8'))
+ else:
+ v = func(*args)
+ if v:
+ cache.set(key, unicode(cPickle.dumps(v), 'utf-8'), timeout)
+ return v
+ return f
+ return g
+
+
+from django.conf import settings
+
+from conifer.libsystems.evergreen.support import initialize
+EG_BASE = 'http://%s/' % settings.EVERGREEN_GATEWAY_SERVER
+try:
+ initialize(EG_BASE)
+except:
+ import warnings
+ warnings.warn('Evergreen inaccessible! Integration will suck eggs!')
+
+from conifer.libsystems.evergreen import item_status as I
+from conifer.libsystems.sip.sipclient import SIP
+#from conifer.libsystems.z3950 import yaz_search
+from conifer.libsystems.z3950.marcxml import marcxml_to_dictionary
+
+
+ at caching('patroninfo', timeout=300)
+ at SIP
+def patron_info(conn, barcode):
+ return conn.patron_info(barcode)
+
+ at caching('itemstatus', timeout=300)
+ at SIP
+def item_status(conn, barcode):
+ return conn.item_info(barcode)
+
+ at SIP
+def checkout(conn, patron_barcode, item_barcode):
+ return conn.checkout(patron_barcode, item_barcode, '')
+
+ at SIP
+def checkin(conn, item_barcode):
+ return conn.checkin(item_barcode, institution='', location='')
+
+
+ at caching('bcbi', timeout=3600)
+def barcode_to_bib_id(barcode):
+ return I.barcode_to_bib_id(barcode)
+
+ at caching('bccp', timeout=3600)
+def barcode_to_copy(barcode):
+ return I.barcode_to_copy(barcode)
+
+ at caching('bimx', timeout=3600)
+def bib_id_to_marcxml(bib_id):
+ return I.bib_id_to_marcxml(bib_id)
+
+
+def cat_search(query, start=1, limit=10):
+ # this is a total hack for conifer. If the query is a Conifer
+ # title-detail URL, then return just that one item.
+ if query.startswith(EG_BASE):
+ results = marcxml_to_dictionary(I.url_to_marcxml(query), multiples=True)
+ numhits = len(results)
+ else:
+ cat_host, cat_db = settings.Z3950_CONFIG
+ results, numhits = yaz_search.search(cat_host, cat_db, query, start, limit)
+ return results, numhits
More information about the open-ils-commits
mailing list