From: gfawcett Date: Sun, 5 Apr 2009 15:56:01 +0000 (+0000) Subject: settling on JSON as syrup:marc attribute format. X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=811887ef2425e9524654eecbbc3cbf5de71caf63;p=Syrup.git settling on JSON as syrup:marc attribute format. Also extending my yaz_search general-timeout value. git-svn-id: svn://svn.open-ils.org/ILS-Contrib/servres/trunk@274 6d9bc8c9-1ec2-4278-b937-99fde70a366f --- diff --git a/conifer/TODO b/conifer/TODO index eca65a0..188c0b0 100644 --- a/conifer/TODO +++ b/conifer/TODO @@ -2,6 +2,8 @@ CRITICAL: IMPORTANT: +* does 'move to new heading' show up in the right places? Should be like 'edit'. + * a short-number for physical items. Sort of a barcode, but intended for easier communicatinon between patrons and staff. (Update views.search() when this is in place) @@ -11,14 +13,6 @@ IMPORTANT: * People should be able to register themselves into open courses. That is, actually become a member of them. -* delete Item / delete Heading - -* testing on broken browsers (you know who you are) - -* the code is littered with 'dwarf' refrences. Factor out into config. - -* allow for bulk-import on add-physical-item - MAYBE: * Generating barcodes in emails, printable screens? (3 of 9 enough?) diff --git a/conifer/libsystems/z3950/yaz_search.py b/conifer/libsystems/z3950/yaz_search.py index 64f2996..242dd62 100644 --- a/conifer/libsystems/z3950/yaz_search.py +++ b/conifer/libsystems/z3950/yaz_search.py @@ -12,7 +12,7 @@ from marcxml import marcxml_to_dictionary LOG = sys.stderr #None # for pexpect debugging, try LOG = sys.stderr YAZ_CLIENT = 'yaz-client' -GENERAL_TIMEOUT = 10 +GENERAL_TIMEOUT = 20 PRESENT_TIMEOUT = 30 def search(host, database, query, start=1, limit=None): diff --git a/conifer/syrup/models.py b/conifer/syrup/models.py index 30e87f1..ade38fa 100644 --- a/conifer/syrup/models.py +++ b/conifer/syrup/models.py @@ -480,7 +480,7 @@ metadata_attributes = { 'dc:title': _('Title'), 'dc:type': _('Type'), 'syrup:barcode': _('Barcode'), - 'syrup:marc': _('MARC'), + 'syrup:marc': _('MARC'), # MARC in JSON format. 'syrup:enumeration': _('Enumeration'), 'syrup:chronology': _('Chronology')} @@ -493,7 +493,7 @@ class Metadata(m.Model): item = m.ForeignKey(Item) #fixme, arbitrary sizes. name = m.CharField('Attribute', max_length=128, choices=metadata_attribute_choices) - value = m.CharField(max_length=4096) + value = m.CharField(max_length=8192) # on postgres it doesn't matter how big. #------------------------------------------------------------ # News items diff --git a/conifer/syrup/views.py b/conifer/syrup/views.py index 96013a0..671ee19 100644 --- a/conifer/syrup/views.py +++ b/conifer/syrup/views.py @@ -732,8 +732,8 @@ def item_add_cat_search(request, course_id, item_id): # POST handler query = request.POST.get('query','').strip() - _pickitem = request.POST.get('pickitem', '').strip() - if not _pickitem: + raw_pickitem = request.POST.get('pickitem', '').strip() + if not raw_pickitem: # process the query. assert query, 'must provide a query.' results = lib_integration.cat_search(query) @@ -753,7 +753,7 @@ def item_add_cat_search(request, course_id, item_id): 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 = simplejson.loads(raw_pickitem) dublin = marcxml_dictionary_to_dc(pickitem) item = course.item_set.create(parent_heading=parent_item, @@ -765,7 +765,7 @@ def item_add_cat_search(request, course_id, item_id): md = item.metadata_set.create(item=item, name=dc, value=value) # store the whole darn MARC-dict as well. json = simplejson.dumps(pickitem) - item.metadata_set.create(item=item, name='syrup:marc', value=json) + item.metadata_set.create(item=item, name='syrup:marc', value=raw_pickitem) item.save() return HttpResponseRedirect('../../../%d/' % item.id) diff --git a/conifer/templates/item_add_cat_search.xhtml b/conifer/templates/item_add_cat_search.xhtml index 117d7ef..2681c1a 100644 --- a/conifer/templates/item_add_cat_search.xhtml +++ b/conifer/templates/item_add_cat_search.xhtml @@ -1,4 +1,5 @@ $(function() { $('.pagetable').tablesorter(); }); +

${title}

- +

show more detail

@@ -33,7 +37,7 @@ keys = [('245a', 'Title'), ('100a', 'Author'), ('260b', 'Publisher'), ('260c', '
- +