[open-ils-commits] r274 - in servres/trunk/conifer: . libsystems/z3950 syrup templates (gfawcett)
svn at svn.open-ils.org
svn at svn.open-ils.org
Sun Apr 5 11:56:04 EDT 2009
Author: gfawcett
Date: 2009-04-05 11:56:01 -0400 (Sun, 05 Apr 2009)
New Revision: 274
Modified:
servres/trunk/conifer/TODO
servres/trunk/conifer/libsystems/z3950/yaz_search.py
servres/trunk/conifer/syrup/models.py
servres/trunk/conifer/syrup/views.py
servres/trunk/conifer/templates/item_add_cat_search.xhtml
Log:
settling on JSON as syrup:marc attribute format.
Also extending my yaz_search general-timeout value.
Modified: servres/trunk/conifer/TODO
===================================================================
--- servres/trunk/conifer/TODO 2009-04-05 03:07:26 UTC (rev 273)
+++ servres/trunk/conifer/TODO 2009-04-05 15:56:01 UTC (rev 274)
@@ -2,6 +2,8 @@
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 @@
* 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?)
Modified: servres/trunk/conifer/libsystems/z3950/yaz_search.py
===================================================================
--- servres/trunk/conifer/libsystems/z3950/yaz_search.py 2009-04-05 03:07:26 UTC (rev 273)
+++ servres/trunk/conifer/libsystems/z3950/yaz_search.py 2009-04-05 15:56:01 UTC (rev 274)
@@ -12,7 +12,7 @@
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):
Modified: servres/trunk/conifer/syrup/models.py
===================================================================
--- servres/trunk/conifer/syrup/models.py 2009-04-05 03:07:26 UTC (rev 273)
+++ servres/trunk/conifer/syrup/models.py 2009-04-05 15:56:01 UTC (rev 274)
@@ -480,7 +480,7 @@
'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 @@
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
Modified: servres/trunk/conifer/syrup/views.py
===================================================================
--- servres/trunk/conifer/syrup/views.py 2009-04-05 03:07:26 UTC (rev 273)
+++ servres/trunk/conifer/syrup/views.py 2009-04-05 15:56:01 UTC (rev 274)
@@ -732,8 +732,8 @@
# 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 @@
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 @@
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)
Modified: servres/trunk/conifer/templates/item_add_cat_search.xhtml
===================================================================
--- servres/trunk/conifer/templates/item_add_cat_search.xhtml 2009-04-05 03:07:26 UTC (rev 273)
+++ servres/trunk/conifer/templates/item_add_cat_search.xhtml 2009-04-05 15:56:01 UTC (rev 274)
@@ -1,4 +1,5 @@
<?python
+from django.utils.simplejson import dumps
title = _('Add physical item: Catalogue search')
# I just made up these keys...
keys = [('245a', 'Title'), ('100a', 'Author'), ('260b', 'Publisher'), ('260c', 'PubDate'), ('700a', 'Editor')]
@@ -17,11 +18,14 @@
<!-- !This ought to be in paginate.xhtml, not here. how to do? -->
$(function() { $('.pagetable').tablesorter(); });
</script>
+ <script py:if="request.method != 'POST'"> <!-- !focus on query box if nothing to scroll. -->
+ $(function() { $('#query').focus(); });
+ </script>
</head>
<body>
<h1>${title}</h1>
<form method="POST" action=".">
- <input type="text" name="query" value="${query}" style="font-size: larger;"/>
+ <input type="text" id="query" name="query" value="${query}" style="font-size: larger;"/>
<input type="submit" value="Search"/>
</form>
<p><a href="javascript:$('.lesser').show(); void(0);">show more detail</a></p>
@@ -33,7 +37,7 @@
<tr>
<th/><td>
<form action="." method="POST">
- <input type="hidden" name="pickitem" value="${repr(res)}"/>
+ <input type="hidden" name="pickitem" value="${dumps(res)}"/>
<input type="submit" value="Pick this item"/>
</form>
</td>
More information about the open-ils-commits
mailing list