Permalink
Browse files

updating setup.py

  • Loading branch information...
1 parent 5e0b7d6 commit 17c7c5a40f23a1961fff0ed4264cfe2e53d2029c @markmacgillivray markmacgillivray committed Sep 28, 2011
Showing with 24 additions and 6 deletions.
  1. +10 −0 bibserver/iomanager.py
  2. +9 −5 bibserver/templates/search/list-view.html
  3. +3 −0 config.json
  4. +2 −1 setup.py
View
@@ -3,6 +3,7 @@
import operator, unicodedata
import bibserver.dao
import bibserver.config
+import re
class IOManager(object):
def __init__(self, results, args):
@@ -67,6 +68,15 @@ def in_args(self, facet, value):
def has_values(self, facet):
return facet in self.config.facet_fields and facet in self.facet_fields
+ def get_result_display(self,counter):
+ disp = self.config.result_display
+ for key,value in self.set()[counter].items():
+ print key, value, disp
+ if '{{'+key+'}}' in disp:
+ disp = disp.replace(str('{{'+key+'}}'),str(self.get_str(self.set()[counter],key)))
+ disp = re.sub('{.*}', '', disp)
+ return disp
+
def get_display_fields(self):
return self.config.display_fields
@@ -1,11 +1,15 @@
<div class="list_view">
{% for i in range(c['io'].set()|length) %}
<div class="list_result_{{'odd' if i % 2 == 0 else 'even'}}">
- {% for field in c['io'].get_display_fields() %}
- {% if c['io'].get_str(c['io'].set()[i], field) != "" %}
- <div class="list_result_field">{{c['io'].get_str(c['io'].set()[i], field)|safe}}</div>
- {% endif %}
- {% endfor %}
+ {% if c['io'].get_result_display(i) != "" %}
+ <div class="list_result_field">{{c['io'].get_result_display(i)|safe}}</div>
+ {% else %}
+ {% for field in c['io'].get_display_fields() %}
+ {% if c['io'].get_str(c['io'].set()[i], field) != "" %}
+ <div class="list_result_field">{{c['io'].get_str(c['io'].set()[i], field)|safe}}</div>
+ {% endif %}
+ {% endfor %}
+ {% endif %}
{% if "type" in c['io'].set()[i] %}
{% if c['io'].set()[i]["type"] == "collection" or c['io'].set()[i]["type"] == "person" %}
View
@@ -52,6 +52,9 @@
# fields to display as headers in search results
"display_fields" : ["author","title","journal","links"],
+ # search result display header
+ "result_display" : "{{author}} ({{year}})<br />{{title}}<br />{{howpublished}} {{journal}} {{pages}} {{booktitle}} {{publisher}}<br />{{links}}",
+
# functions to perform on particular result fields on display
"display_value_functions" : {
"title" : {"wrap" : {"start" : "<a class=\"list_result_field_showall\" href=\"\" alt=\"show more info\" title=\"show more info\"><strong>", "end" : "</strong></a>"}},
View
@@ -9,7 +9,8 @@
"Flask-Login",
"Flask-WTF",
"pyes==0.16",
- ],
+ "chardet",
+ ],
url = 'http://bibserver.okfn.org/',
author = 'Open Knowledge Foundation',
author_email = 'openbiblio@okfn.org',

0 comments on commit 17c7c5a

Please sign in to comment.