Trees | Index | Help |
---|
|
1 2 # All extension functions for SRW should be imported into this space 3 # even if they're defined elsewhere. 4 5 # Functions should modify extra*Data in place. 6 # Add DOM node for serialization by ZSI. 7 # Fr'ex: 8 # object.extraFooData.append(r.fromString('<a:b c="d">e</a:b>')) 9 10 # Configuration in SRW ZeeRex file should look like: 11 # 12 # <zeerex:supports type="extension" 13 # c3:type="record" 14 # c3:function="docidRecordHandler" 15 # c3:sruName="x-info2-docid" 16 # c3:sruFunction="docidRequestXform"> 17 # info:srw/extensions/2/docid-v1.0 docid 18 # </zeerex:/supports> 19 # 20 # Where c3:type is one of: record, term, search, scan, explain, response 21 22 # Useful tools: 23 from xml.sax.saxutils import escape 24 from utils import reader 25 r = reader() 26 27 # Simple SRU->SRW transformation 2830 data = config.sruExtensionMap.get(item[0], None) 31 if data: 32 xml = '<ns1:%s xmlns:ns1="%s">%s</ns1:%s>' % (data[1], data[0], item[1], data[1]) 33 val = r.fromString(xml) 34 return val 35 return None36 37 # Extension Handler Functions: 3840 # Put our implementation id into the response 41 # Stored in ZeeRex, so on config object 42 # XXX Make dynamic 43 txt = """ 44 <ident:serverInfo xmlns:ident="info:srw/extensions/1/ident-v1.0"> 45 <ident:institution>University of Liverpool</ident:institution> 46 <ident:vendor>Cheshire3 Project</ident:vendor> 47 <ident:application>Cheshire3 SRW Server</ident:application> 48 <ident:version>0.7.9</ident:version> 49 </ident:serverInfo> 50 """ 51 resp.extraResponseData.append(r.fromString(txt))5254 # Put the record identifier into extraRecordData 55 txt = '<docid:recordIdentifier xmlns:docid="info:srw/extensions/2/docid-v1.0">%s</docid:recordIdentifier>' % escape(str(other)) 56 ro.extraRecordData.append(r.fromString(txt))57
Trees | Index | Help |
---|
Generated by Epydoc 3.0alpha2 on Wed Aug 9 18:10:59 2006 | http://epydoc.sf.net |