[open-ils-commits] r863 - constrictor/trunk/contrib/evergreen (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Sun Apr 11 22:37:55 EDT 2010
Author: erickson
Date: 2010-04-11 22:37:52 -0400 (Sun, 11 Apr 2010)
New Revision: 863
Modified:
constrictor/trunk/contrib/evergreen/batch_api.txt
constrictor/trunk/contrib/evergreen/eg_batch.py
constrictor/trunk/contrib/evergreen/eg_bib_search.py
constrictor/trunk/contrib/evergreen/eg_checkin.py
constrictor/trunk/contrib/evergreen/eg_checkout.py
constrictor/trunk/contrib/evergreen/eg_checkout_roundtrip.py
constrictor/trunk/contrib/evergreen/eg_circ_misc.py
constrictor/trunk/contrib/evergreen/eg_data.py
constrictor/trunk/contrib/evergreen/eg_renew.py
constrictor/trunk/contrib/evergreen/eg_tasks.py
constrictor/trunk/contrib/evergreen/eg_title_hold.py
constrictor/trunk/contrib/evergreen/eg_user_transactions.py
constrictor/trunk/contrib/evergreen/eg_workflow.py
Log:
fixed bug in property reading from eg_data module. more python style tweaks
Modified: constrictor/trunk/contrib/evergreen/batch_api.txt
===================================================================
--- constrictor/trunk/contrib/evergreen/batch_api.txt 2010-04-11 19:33:44 UTC (rev 862)
+++ constrictor/trunk/contrib/evergreen/batch_api.txt 2010-04-12 02:37:52 UTC (rev 863)
@@ -16,14 +16,14 @@
29 open-ils.circ.money.billable_xact_summary.retrieve.authoritative AUTHTOKEN, XACT_ID
27 open-ils.circ.open_non_cataloged_circulation.user.authoritative AUTHTOKEN, USER_ID
24 open-ils.circ.fleshed.retrieve.authoritative CIRC_ID
-21 open-ils.actor.user.retrieve_id_by_barcode_or_username AUTHTOKEN, USER_BARCODE
+21 open-ils.actor.user.retrieve_id_by_barcode_or_username AUTHTOKEN, PATRON_BARCODE
18 open-ils.actor.ou_setting.ancestor_default ORG_ID, "opac.barcode_regex"
-17 open-ils.actor.user.fleshed.retrieve_by_barcode.authoritative AUTHTOKEN, USER_BARCODE
+17 open-ils.actor.user.fleshed.retrieve_by_barcode.authoritative AUTHTOKEN, PATRON_BARCODE
17 open-ils.search.asset.copy.fleshed2.retrieve 5379864
15 open-ils.search.biblio.copy_counts.summary.retrieve TITLE_ID, 1, 0
15 open-ils.search.biblio.multiclass.query.staff {"org_unit":1,"depth":0,"limit":20,"offset":0,"visibility_limit":3000,"default_class":"keyword"}, DICT_KEYWORD
14 open-ils.search.config.copy_status.retrieve.all
-14 open-ils.actor.user.retrieve_id_by_barcode_or_username AUTHTOKEN, USER_BARCODE
+14 open-ils.actor.user.retrieve_id_by_barcode_or_username AUTHTOKEN, PATRON_BARCODE
13 open-ils.search.biblio.record_entry.slim.retrieve [TITLE_ID]
12 open-ils.circ.hold.details.retrieve.authoritative AUTHTOKEN, HOLD_ID
11 open-ils.search.authority.crossref.batch [["subject",DICT_SUBJECT],["subject",DICT_SUBJECT]]
@@ -67,9 +67,9 @@
1 open-ils.circ.holds.retrieve AUTHTOKEN, HOLD_ID
1 open-ils.actor.container.flesh AUTHTOKEN, "biblio", CONTAINER_ID
1 open-ils.circ.copy_checkout_history.retrieve AUTHTOKEN, COPY_ID, 1
-1 open-ils.actor.user.fleshed.retrieve_by_barcode.authoritative AUTHTOKEN, USER_BARCODE
+1 open-ils.actor.user.fleshed.retrieve_by_barcode.authoritative AUTHTOKEN, PATRON_BARCODE
1 open-ils.circ.money.payment.retrieve.all.authoritative AUTHTOKEN, XACT_ID
1 open-ils.circ.transit.retrieve_by_lib AUTHTOKEN, ORG_ID, "1969-12-31T19:00:00-05:00"
1 open-ils.search.biblio.isbn DICT_ISBN
-1 open-ils.actor.barcode.exists AUTHTOKEN, USER_BARCODE
+1 open-ils.actor.barcode.exists AUTHTOKEN, PATRON_BARCODE
1 open-ils.cat.biblio.record.marc_cn.retrieve TITLE_ID
Modified: constrictor/trunk/contrib/evergreen/eg_batch.py
===================================================================
--- constrictor/trunk/contrib/evergreen/eg_batch.py 2010-04-11 19:33:44 UTC (rev 862)
+++ constrictor/trunk/contrib/evergreen/eg_batch.py 2010-04-12 02:37:52 UTC (rev 863)
@@ -15,13 +15,13 @@
class BatchMethodTask(eg_tasks.AbstractMethodTask):
def __init__(self, service, method):
- eg_tasks.AbstractMethodTask.__init__(self)
+ eg_tasks.AbstractMethodTask.__init__(self, method)
self.service = service
self.method = method
def run(self, **kw):
log.log_info("Batch call: %s %s" % (self.method, osrf.json.to_json(kw['params'])))
- return self.runMethod(*kw['params'])
+ return self.run_method(*kw['params'])
class BatchScript(Script):
@@ -64,7 +64,7 @@
# TODO: fill in props values for all of these, pre-collecting data as necessary
for prop in [
'COPY_BARCODE',
- 'USER_BARCODE',
+ 'PATRON_BARCODE',
'CONTAINER_ID',
'CIRC_ID',
'COPY_ID',
@@ -80,9 +80,10 @@
'ORG_ADDRESS_ID',
'ORG_SHORTNAME' ]:
- value = dm.get_thread_data(prop)
- if value is None:
- value = 1 # sane default
+ value = 1
+ prop_name = 'PROP_%s' % prop
+ if hasattr(eg_data, prop_name):
+ value = dm.get_thread_data(getattr(eg_data, prop_name))
params = params.replace(prop, '"%s"' % value)
Modified: constrictor/trunk/contrib/evergreen/eg_bib_search.py
===================================================================
--- constrictor/trunk/contrib/evergreen/eg_bib_search.py 2010-04-11 19:33:44 UTC (rev 862)
+++ constrictor/trunk/contrib/evergreen/eg_bib_search.py 2010-04-12 02:37:52 UTC (rev 863)
@@ -9,7 +9,7 @@
def run(self):
dm = eg_data.DataManager()
- org_id = dm.get_thread_data(eg_data.PROP_ORG_IDS) or 1
+ org_id = dm.get_thread_data(eg_data.PROP_ORG_ID) or 1
search_args = {
'org_unit' : org_id,
Modified: constrictor/trunk/contrib/evergreen/eg_checkin.py
===================================================================
--- constrictor/trunk/contrib/evergreen/eg_checkin.py 2010-04-11 19:33:44 UTC (rev 862)
+++ constrictor/trunk/contrib/evergreen/eg_checkin.py 2010-04-12 02:37:52 UTC (rev 863)
@@ -13,9 +13,9 @@
def run(self):
dm = DataManager()
- copyBarcode = dm.get_thread_data(PROP_COPY_BARCODES)
+ copyBarcode = dm.get_thread_data(PROP_COPY_BARCODE)
- evt = doCheckin(copyBarcode)
+ evt = do_checkin(copyBarcode)
if not evt: return False
ScriptManager.go(CheckinScript())
Modified: constrictor/trunk/contrib/evergreen/eg_checkout.py
===================================================================
--- constrictor/trunk/contrib/evergreen/eg_checkout.py 2010-04-11 19:33:44 UTC (rev 862)
+++ constrictor/trunk/contrib/evergreen/eg_checkout.py 2010-04-12 02:37:52 UTC (rev 863)
@@ -16,10 +16,10 @@
def run(self):
dm = DataManager()
- patronID = dm.get_thread_data(PROP_PATRON_IDS)
- copyBarcode = dm.get_thread_data(PROP_COPY_BARCODES, True)
+ patronID = dm.get_thread_data(PROP_PATRON_ID)
+ copyBarcode = dm.get_thread_data(PROP_COPY_BARCODE, True)
- evt = doCheckout(copyBarcode, patronID)
+ evt = do_checkout(copyBarcode, patronID)
if not evt: return False
return True
Modified: constrictor/trunk/contrib/evergreen/eg_checkout_roundtrip.py
===================================================================
--- constrictor/trunk/contrib/evergreen/eg_checkout_roundtrip.py 2010-04-11 19:33:44 UTC (rev 862)
+++ constrictor/trunk/contrib/evergreen/eg_checkout_roundtrip.py 2010-04-12 02:37:52 UTC (rev 863)
@@ -16,13 +16,13 @@
def run(self):
dm = DataManager()
- patronID = dm.get_thread_data(PROP_PATRON_IDS)
- copyBarcode = dm.get_thread_data(PROP_COPY_BARCODES, True)
+ patronID = dm.get_thread_data(PROP_PATRON_ID)
+ copyBarcode = dm.get_thread_data(PROP_COPY_BARCODE, True)
- evt = doCheckout(copyBarcode, patronID)
+ evt = do_checkout(copyBarcode, patronID)
if not evt: return False
- evt = doCheckin(copyBarcode)
+ evt = do_checkin(copyBarcode)
if not evt: return False
return True
Modified: constrictor/trunk/contrib/evergreen/eg_circ_misc.py
===================================================================
--- constrictor/trunk/contrib/evergreen/eg_circ_misc.py 2010-04-11 19:33:44 UTC (rev 862)
+++ constrictor/trunk/contrib/evergreen/eg_circ_misc.py 2010-04-12 02:37:52 UTC (rev 863)
@@ -12,27 +12,27 @@
def run(self):
dm = DataManager()
- title_id = dm.get_thread_data(PROP_TITLE_IDS)
- pickup_lib = dm.get_thread_data(PROP_ORG_IDS)
- patron_id = dm.get_thread_data(PROP_PATRON_IDS)
- copy_barcode = dm.get_thread_data(PROP_COPY_BARCODES, True)
+ title_id = dm.get_thread_data(PROP_TITLE_ID)
+ pickup_lib = dm.get_thread_data(PROP_ORG_ID)
+ patron_id = dm.get_thread_data(PROP_PATRON_ID)
+ copy_barcode = dm.get_thread_data(PROP_COPY_BARCODE, True)
bib = eg_tasks.BibRetrieveTask().start(bib_id = title_id)
if not bib: return False
# title hold
- hold_id = doTitleHold(title_id, patron_id, pickup_lib)
+ hold_id = to_title_hold(title_id, patron_id, pickup_lib)
if hold_id:
- doTitleHoldCancel(hold_id)
+ to_title_holdCancel(hold_id)
# checkout/renew/checkin
- evt = doCheckout(copy_barcode, patron_id)
+ evt = do_checkout(copy_barcode, patron_id)
if not evt: return False
- evt = doRenew(copy_barcode)
+ evt = do_renew(copy_barcode)
if not evt: return False
- evt = doCheckin(copy_barcode)
+ evt = do_checkin(copy_barcode)
if not evt: return False
# patron search
Modified: constrictor/trunk/contrib/evergreen/eg_data.py
===================================================================
--- constrictor/trunk/contrib/evergreen/eg_data.py 2010-04-11 19:33:44 UTC (rev 862)
+++ constrictor/trunk/contrib/evergreen/eg_data.py 2010-04-12 02:37:52 UTC (rev 863)
@@ -6,11 +6,11 @@
PROP_USERNAME = 'evergreen.username'
PROP_PASSWORD = 'evergreen.password'
PROP_WORKSTATION = 'evergreen.workstation'
-PROP_COPY_BARCODES = 'evergreen.copyBarcodes'
-PROP_TITLE_IDS = 'evergreen.titleIDs'
-PROP_PATRON_BARCODES = 'evergreen.patronBarcodes'
-PROP_ORG_IDS = 'evergreen.orgIDs'
-PROP_PATRON_IDS = 'evergreen.patronIDs'
+PROP_COPY_BARCODE = 'evergreen.copyBarcodes'
+PROP_TITLE_ID = 'evergreen.titleIDs'
+PROP_PATRON_BARCODE = 'evergreen.patronBarcodes'
+PROP_ORG_ID = 'evergreen.orgIDs'
+PROP_PATRON_ID = 'evergreen.patronIDs'
PROP_CONSTRICTOR_THREADS = 'constrictor.numThreads'
@@ -31,11 +31,11 @@
for p in [
PROP_PASSWORD,
PROP_WORKSTATION,
- PROP_COPY_BARCODES,
- PROP_TITLE_IDS,
- PROP_PATRON_BARCODES,
- PROP_PATRON_IDS,
- PROP_ORG_IDS ]:
+ PROP_COPY_BARCODE,
+ PROP_TITLE_ID,
+ PROP_PATRON_BARCODE,
+ PROP_PATRON_ID,
+ PROP_ORG_ID ]:
s += "\t%s=%s\n" % (p, str(self.data[p]))
return s
@@ -45,11 +45,11 @@
self.readProp(PROP_USERNAME)
self.readProp(PROP_PASSWORD)
self.readProp(PROP_WORKSTATION)
- self.readProp(PROP_COPY_BARCODES, True)
- self.readProp(PROP_TITLE_IDS, True)
- self.readProp(PROP_PATRON_BARCODES, True)
- self.readProp(PROP_PATRON_IDS, True)
- self.readProp(PROP_ORG_IDS, True)
+ self.readProp(PROP_COPY_BARCODE, True)
+ self.readProp(PROP_TITLE_ID, True)
+ self.readProp(PROP_PATRON_BARCODE, True)
+ self.readProp(PROP_PATRON_ID, True)
+ self.readProp(PROP_ORG_ID, True)
def readProp(self, prop, split=False):
v = self.props.get_property(prop)
Modified: constrictor/trunk/contrib/evergreen/eg_renew.py
===================================================================
--- constrictor/trunk/contrib/evergreen/eg_renew.py 2010-04-11 19:33:44 UTC (rev 862)
+++ constrictor/trunk/contrib/evergreen/eg_renew.py 2010-04-12 02:37:52 UTC (rev 863)
@@ -16,9 +16,9 @@
def run(self):
dm = DataManager()
- copyBarcode = dm.get_thread_data(PROP_COPY_BARCODES, True)
+ copyBarcode = dm.get_thread_data(PROP_COPY_BARCODE, True)
- evt = doRenew(copyBarcode)
+ evt = do_renew(copyBarcode)
if not evt: return False
return True
Modified: constrictor/trunk/contrib/evergreen/eg_tasks.py
===================================================================
--- constrictor/trunk/contrib/evergreen/eg_tasks.py 2010-04-11 19:33:44 UTC (rev 862)
+++ constrictor/trunk/contrib/evergreen/eg_tasks.py 2010-04-12 02:37:52 UTC (rev 863)
@@ -15,7 +15,7 @@
self.service = None
self.method = None
- def runMethod(self, *args):
+ def run_method(self, *args):
return eg_utils.request(self.service, self.method, *args).send()
class CheckoutTask(AbstractMethodTask):
@@ -30,7 +30,7 @@
kw[patron_id] The user's id
kw[permit_key] The key returned by checkout permit '''
- return self.runMethod(eg_utils.authtoken(), dict(kw))
+ return self.run_method(eg_utils.authtoken(), dict(kw))
class RenewTask(AbstractMethodTask):
@@ -42,7 +42,7 @@
def run(self, **kw):
''' kw[copy_barcode] The item barcode '''
- return self.runMethod(eg_utils.authtoken(), dict(kw))
+ return self.run_method(eg_utils.authtoken(), dict(kw))
class CheckinTask(AbstractMethodTask):
@@ -54,7 +54,7 @@
def run(self, **kw):
''' kw[copy_barcode] '''
- return self.runMethod(eg_utils.authtoken(), dict(kw))
+ return self.run_method(eg_utils.authtoken(), dict(kw))
class AbortTransitTask(AbstractMethodTask):
@@ -65,7 +65,7 @@
def run(self, **kw):
''' kw[copy_barcode] '''
- return self.runMethod(eg_utils.authtoken(), {"barcode":kw['copy_barcode']})
+ return self.run_method(eg_utils.authtoken(), {"barcode":kw['copy_barcode']})
class TitleHoldPermitTask(AbstractMethodTask):
@@ -78,7 +78,7 @@
kw[patron_id]
kw[pickup_lib]
'''
- return self.runMethod(eg_utils.authtoken(), {
+ return self.run_method(eg_utils.authtoken(), {
"patronid" : kw['patron_id'],
"titleid" : kw['title_id'],
"pickup_lib" : kw['pickup_lib']})
@@ -102,7 +102,7 @@
hold.target(kw['title_id'])
hold.hold_type('T')
- return self.runMethod(eg_utils.authtoken(), hold)
+ return self.run_method(eg_utils.authtoken(), hold)
class TitleHoldCancelTask(AbstractMethodTask):
@@ -113,7 +113,7 @@
def run(self, **kw):
''' kw['hold_id'] '''
- return self.runMethod(eg_utils.authtoken(), kw['hold_id'])
+ return self.run_method(eg_utils.authtoken(), kw['hold_id'])
class TitleHoldFetchAllTask(AbstractMethodTask):
@@ -125,7 +125,7 @@
def run(self, **kw):
''' kw['patron_id'] '''
- return self.runMethod(eg_utils.authtoken(), kw['patron_id'])
+ return self.run_method(eg_utils.authtoken(), kw['patron_id'])
class BibSearchTask(AbstractMethodTask):
@@ -135,7 +135,7 @@
self.method = 'open-ils.search.biblio.multiclass.query'
def run(self, **kw):
- return self.runMethod(kw['search_args'], kw['search_term'], True)
+ return self.run_method(kw['search_args'], kw['search_term'], True)
class BibRetrieveTask(AbstractMethodTask):
@@ -145,7 +145,7 @@
self.method = 'open-ils.search.biblio.record.mods_slim.retrieve'
def run(self, **kw):
- return self.runMethod(kw['bib_id'])
+ return self.run_method(kw['bib_id'])
class UserTransactionsByType(AbstractMethodTask):
@@ -156,7 +156,7 @@
def run(self, **kw):
self.method = kw['method']
- return self.runMethod(eg_utils.authtoken(), kw['user_id'])
+ return self.run_method(eg_utils.authtoken(), kw['user_id'])
class UserSearchTask(AbstractMethodTask):
@@ -166,5 +166,5 @@
self.method = 'open-ils.actor.patron.search.advanced'
def run(self, **kw):
- return self.runMethod(eg_utils.authtoken(), kw['search_args'], 100)
+ return self.run_method(eg_utils.authtoken(), kw['search_args'], 100)
Modified: constrictor/trunk/contrib/evergreen/eg_title_hold.py
===================================================================
--- constrictor/trunk/contrib/evergreen/eg_title_hold.py 2010-04-11 19:33:44 UTC (rev 862)
+++ constrictor/trunk/contrib/evergreen/eg_title_hold.py 2010-04-12 02:37:52 UTC (rev 863)
@@ -10,13 +10,13 @@
def run(self):
dm = DataManager()
- title_id = dm.get_thread_data(PROP_TITLE_IDS)
- pickup_lib = dm.get_thread_data(PROP_ORG_IDS)
- patron_id = dm.get_thread_data(PROP_PATRON_IDS)
+ title_id = dm.get_thread_data(PROP_TITLE_ID)
+ pickup_lib = dm.get_thread_data(PROP_ORG_ID)
+ patron_id = dm.get_thread_data(PROP_PATRON_ID)
- hold_id = doTitleHold(title_id, patron_id, pickup_lib)
+ hold_id = to_title_hold(title_id, patron_id, pickup_lib)
if hold_id:
- doTitleHoldCancel(hold_id)
+ to_title_holdCancel(hold_id)
ScriptManager.go(CreateTitleHoldScript())
Modified: constrictor/trunk/contrib/evergreen/eg_user_transactions.py
===================================================================
--- constrictor/trunk/contrib/evergreen/eg_user_transactions.py 2010-04-11 19:33:44 UTC (rev 862)
+++ constrictor/trunk/contrib/evergreen/eg_user_transactions.py 2010-04-12 02:37:52 UTC (rev 863)
@@ -25,7 +25,7 @@
def run(self):
dm = eg_data.DataManager()
- user_id = dm.get_thread_data(eg_data.PROP_PATRON_IDS)
+ user_id = dm.get_thread_data(eg_data.PROP_PATRON_ID)
for type in types:
log_info('Loading patron(%s) transactions with %s' % (int(user_id), type))
Modified: constrictor/trunk/contrib/evergreen/eg_workflow.py
===================================================================
--- constrictor/trunk/contrib/evergreen/eg_workflow.py 2010-04-11 19:33:44 UTC (rev 862)
+++ constrictor/trunk/contrib/evergreen/eg_workflow.py 2010-04-12 02:37:52 UTC (rev 863)
@@ -9,7 +9,7 @@
SUCCESS = {'text_code':'SUCCESS', 'ilsevent':0}
-def doCheckout(copyBarcode, patronID, recurse=False):
+def do_checkout(copyBarcode, patronID, recurse=False):
evt = eg_tasks.CheckoutTask().start(
copy_barcode=copyBarcode, patron_id=patronID)
@@ -22,15 +22,15 @@
if recurse: return None
if evt_txt == 'OPEN_CIRCULATION_EXISTS':
- evt = doCheckin(copyBarcode)
+ evt = do_checkin(copyBarcode)
if evt_txt == OILS_EVENT_SUCCESS:
- return doCheckout(copyBarcode, patronID, True)
+ return do_checkout(copyBarcode, patronID, True)
log_info("* Unable to checkin open circ: %s" % copyBarcode)
return None
-def doRenew(copyBarcode):
+def do_renew(copyBarcode):
evt = eg_tasks.RenewTask().start(copy_barcode=copyBarcode)
if evt:
@@ -44,7 +44,7 @@
-def doCheckin(copyBarcode):
+def do_checkin(copyBarcode):
evt = eg_tasks.CheckinTask().start(copy_barcode=copyBarcode)
evt_txt = Event.parse_event(evt).text_code
@@ -68,7 +68,7 @@
-def doTitleHoldPermit(titleID, patronID, pickupLib):
+def do_title_hold_permit(titleID, patronID, pickupLib):
evt = eg_tasks.TitleHoldPermitTask().start(
title_id=titleID, patron_id=patronID, pickup_lib=pickupLib)
@@ -87,9 +87,9 @@
return True
-def doTitleHold(titleID, patronID, pickupLib):
+def to_title_hold(titleID, patronID, pickupLib):
- if not doTitleHoldPermit(titleID, patronID, pickupLib):
+ if not do_title_hold_permit(titleID, patronID, pickupLib):
return
evt = eg_tasks.TitleHoldTask().start(title_id=titleID, patron_id=patronID, pickup_lib=pickupLib)
@@ -115,7 +115,7 @@
log_info('TitleHold(%s, %s, %s) -> SUCCESS' % (titleID, patronID, pickupLib))
return int(evt) # new hold ID
-def doTitleHoldCancel(holdID):
+def to_title_holdCancel(holdID):
evt = eg_tasks.TitleHoldCancelTask().start(hold_id=holdID)
@@ -129,7 +129,7 @@
log_info('TitleHoldCancel(%s) -> SUCCESS' % holdID)
return True
-def doTitleHoldFetchAll(patronID):
+def to_title_holdFetchAll(patronID):
evt = eg_tasks.TitleHoldFetchAllTask().start(patron_id=patronID)
if Event.parse_event(evt):
raise ILSEventException(
More information about the open-ils-commits
mailing list