[open-ils-commits] r257 - servres/trunk/conifer/syrup (gfawcett)
svn at svn.open-ils.org
svn at svn.open-ils.org
Fri Apr 3 22:42:21 EDT 2009
Author: gfawcett
Date: 2009-04-03 22:42:19 -0400 (Fri, 03 Apr 2009)
New Revision: 257
Modified:
servres/trunk/conifer/syrup/models.py
servres/trunk/conifer/syrup/views.py
Log:
on selection of item from catalogue, store whole MARC record
For the moment, I'm storing the MARC in a syrup:marc Metadata
record. The format is not standard yet: I'm writing it out as a JSON
assoc-array.
Modified: servres/trunk/conifer/syrup/models.py
===================================================================
--- servres/trunk/conifer/syrup/models.py 2009-04-04 01:42:04 UTC (rev 256)
+++ servres/trunk/conifer/syrup/models.py 2009-04-04 02:42:19 UTC (rev 257)
@@ -468,6 +468,7 @@
'dc:title': _('Title'),
'dc:type': _('Type'),
'syrup:barcode': _('Barcode'),
+ 'syrup:marc': _('MARC'),
'syrup:enumeration': _('Enumeration'),
'syrup:chronology': _('Chronology')}
Modified: servres/trunk/conifer/syrup/views.py
===================================================================
--- servres/trunk/conifer/syrup/views.py 2009-04-04 01:42:04 UTC (rev 256)
+++ servres/trunk/conifer/syrup/views.py 2009-04-04 02:42:19 UTC (rev 257)
@@ -721,8 +721,8 @@
if request.method != 'POST':
return g.render('item_add_cat_search.xhtml', results=[], query='@and dylan thomas')
query = request.POST.get('query','').strip()
- pickitem = request.POST.get('pickitem', '').strip()
- if not pickitem:
+ _pickitem = request.POST.get('pickitem', '').strip()
+ if not _pickitem:
assert query, 'must provide a query.'
from conifer.libsystems.z3950 import yaz_search
host, db, query = ('dwarf.cs.uoguelph.ca:2210', 'conifer', query)
@@ -742,18 +742,19 @@
if not course.can_edit(request.user):
return _access_denied(_('You are not an editor.'))
- pickitem = eval(pickitem) # fixme, dangerous. cache result server-side instead, or encrypt it.
+ pickitem = eval(_pickitem) # fixme, dangerous. cache result server-side instead, or encrypt it.
item = course.item_set.create(parent_heading=parent_item,
title=pickitem.get('245a', 'Untitled'),
item_type='PHYS')
item.save()
# these are a temporary hack, must replace
meta = [('245a', 'dc:title'), ('100a', 'dc:creator'), ('260b', 'dc:publisher'),
- ('dc:260c', 'dc:date'), ('700a', 'dc:contributor')]
+ ('260c', 'dc:date'), ('700a', 'dc:contributor')]
for marc, dc in meta:
value = pickitem.get(marc)
if value:
md = item.metadata_set.create(item=item, name=dc, value=value)
+ item.metadata_set.create(item=item, name='syrup:marc', value=simplejson.dumps(pickitem))
item.save()
return HttpResponseRedirect('../../../%d/' % item.id)
More information about the open-ils-commits
mailing list