Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge branch 'staging' of github.com:sunlightlabs/billy into staging

  • Loading branch information...
commit a127e1c08b34c52f6a650268d3f587ac1f01b2e0 2 parents 63e9b3c + bd5d0ef
Thom Neale twneale authored
25 billy/fulltext.py
@@ -15,14 +15,19 @@ def pdfdata_to_text(data):
15 15
16 16
17 17 def worddata_to_text(data):
18   - _, txtfile = tempfile.mkstemp(prefix='tmp-worddata-', suffix='.txt')
19   - with tempfile.NamedTemporaryFile(delete=True) as tmpf:
20   - tmpf.write(data)
21   - subprocess.check_call('abiword --to=%s %s' % (txtfile, tmpf.name),
22   - shell=True)
23   - tmpf.flush()
24   - text = open(txtfile).read()
25   - os.remove(txtfile)
  18 + desc, txtfile = tempfile.mkstemp(prefix='tmp-worddata-', suffix='.txt')
  19 + try:
  20 + with tempfile.NamedTemporaryFile(delete=True) as tmpf:
  21 + tmpf.write(data)
  22 + tmpf.flush()
  23 + subprocess.check_call(['abiword', '--to=%s' %txtfile, tmpf.name])
  24 + f = open(txtfile)
  25 + text = f.read()
  26 + tmpf.close()
  27 + f.close()
  28 + finally:
  29 + os.remove(txtfile)
  30 + os.close(desc)
26 31 return text.decode('utf8')
27 32
28 33 def text_after_line_numbers(lines):
@@ -55,5 +60,7 @@ def _clean_text(text):
55 60 def oyster_text(function):
56 61 @wraps(function)
57 62 def wrapper(oyster_doc, data):
58   - return _clean_text(function(oyster_doc, data))
  63 + data = function(oyster_doc, data)
  64 + if data:
  65 + return _clean_text(data)
59 66 return wrapper
4 billy/schemas/bill.json
@@ -15,11 +15,13 @@
15 15 "versions": {"type": "array", "items": {"type": "object", "properties": {
16 16 "name": {"type": "string"},
17 17 "url": {"type": "string", "blank": true},
  18 + "mimetype": {"type": "string", "required": false},
18 19 "title": {"type": "string", "required": false}
19 20 }}},
20 21 "documents": {"type": "array", "items": {"type": "object", "properties": {
21 22 "name": {"type": "string"},
22   - "url": {"type": "string"}
  23 + "url": {"type": "string"},
  24 + "mimetype": {"type": "string", "required": false}
23 25 }}},
24 26 "sponsors": {"type": "array", "items": {"type": "object", "properties": {
25 27 "type": {"type": "string"},
3  billy/web/admin/templates/billy/legislator.html
@@ -38,7 +38,8 @@
38 38 {% endif %}
39 39
40 40 {% if role.type == 'committee member' %}
41   - member of the {{ role.committee }} Committee
  41 + member of the {{ role.committee }} Committee
  42 + {% if role.subcommittee %}, {{role.subcommittee}} Subcommittee {% endif %}
42 43 {% endif %}
43 44 </li>
44 45 {% endfor %}

0 comments on commit a127e1c

Please sign in to comment.
Something went wrong with that request. Please try again.