[open-ils-commits] r1148 - servres/trunk/conifer/syrup/views (gfawcett)
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Dec 29 10:54:15 EST 2010
Author: gfawcett
Date: 2010-12-29 10:54:12 -0500 (Wed, 29 Dec 2010)
New Revision: 1148
Modified:
servres/trunk/conifer/syrup/views/items.py
Log:
tweaks to RIS import
Modified: servres/trunk/conifer/syrup/views/items.py
===================================================================
--- servres/trunk/conifer/syrup/views/items.py 2010-12-29 15:43:00 UTC (rev 1147)
+++ servres/trunk/conifer/syrup/views/items.py 2010-12-29 15:54:12 UTC (rev 1148)
@@ -113,26 +113,25 @@
ris = defaultdict(list)
for k, v in tmp:
ris[k].append(v)
- def update(field, risfield, xlate=lambda x: x):
- if risfield in ris:
- replacement = '; '.join(ris[risfield])
- POST[field] = xlate(replacement)
+ def update(field, risfields, xlate=lambda x: x):
+ for risfield in risfields:
+ if risfield in ris:
+ replacement = '; '.join(ris[risfield])
+ POST[field] = xlate(replacement)
+ break
def space_comments(names):
# RIS doesn't put spaces after commas in names
return re.sub(',(?=[^ ])', ', ', names)
- update('title', 'TI') # first try TI, then T1
- update('title', 'T1')
- update('source_title', 'JO') # first try JO, then JF
- update('source_title', 'JF')
- update('author', 'AU', space_comments) # first try AU, then A1
- update('author', 'A1', space_comments)
- update('url', 'UR')
- update('volume', 'VL')
- update('issue', 'IS')
+ update('title', ('TI', 'T1'))
+ update('source_title', ('JO', 'JF'))
+ update('author', ('AU', 'A1'), space_comments)
+ update('url', ('UR',))
+ update('volume', ('VL',))
+ update('issue', ('IS',))
+ update('published', ('PY', 'Y1'), lambda v: v.split('/')[0])
if 'SP' in ris and 'EP' in ris:
POST['pages'] = ris['SP'][0] + '-' + ris['EP'][0]
- update('published', 'PY', lambda v: v.split('/')[0])
if item_type == 'HEADING':
More information about the open-ils-commits
mailing list