diff options
author | Benjamin Saller <bcsaller@objectrealms.net> | 2007-07-13 08:25:31 (GMT) |
---|---|---|
committer | Benjamin Saller <bcsaller@objectrealms.net> | 2007-07-13 08:25:31 (GMT) |
commit | d4f36128d2e5ff470ee6fa96c361d11e401d7346 (patch) | |
tree | a5b2cb1e6a4a2c4e56348931f04fd64ea3d65f23 | |
parent | d08f6882e4f64759210663ba03eca182f5dea105 (diff) |
mimetype -> mime_type
-rw-r--r-- | src/olpc/datastore/model.py | 2 | ||||
-rw-r--r-- | src/olpc/datastore/xapianindex.py | 2 | ||||
-rw-r--r-- | tests/test_xapianindex.py | 4 | ||||
-rw-r--r-- | tests/xapianindex.txt | 4 |
4 files changed, 6 insertions, 6 deletions
diff --git a/src/olpc/datastore/model.py b/src/olpc/datastore/model.py index ebdfcee..38c1e50 100644 --- a/src/olpc/datastore/model.py +++ b/src/olpc/datastore/model.py @@ -276,7 +276,7 @@ defaultModel = Model().addFields( # Title has additional weight ('title', 'text', {'weight' : 2 }), ('url', 'string'), - ('mimetype', 'string'), + ('mime_type', 'string'), ('author', 'string'), ('language', 'string'), ('ctime', 'date'), diff --git a/src/olpc/datastore/xapianindex.py b/src/olpc/datastore/xapianindex.py index ec7206d..c0f1665 100644 --- a/src/olpc/datastore/xapianindex.py +++ b/src/olpc/datastore/xapianindex.py @@ -239,7 +239,7 @@ class IndexManager(object): # enque async file processing # XXX: to make sure the file is kept around we could keep # and open fp? - mimetype = props.get("mimetype") + mimetype = props.get("mime_type") mimetype = mimetype and mimetype.value or 'text/plain' filestuff = (filename, mimetype) diff --git a/tests/test_xapianindex.py b/tests/test_xapianindex.py index db6afef..f9039e6 100644 --- a/tests/test_xapianindex.py +++ b/tests/test_xapianindex.py @@ -24,7 +24,7 @@ def index_file(iconn, filepath): - props = {'mimetype' : mimetype, 'mtime:date' : mtime, + props = {'mime_type' : mimetype, 'mtime:date' : mtime, 'ctime:date' : ctime,} if filepath: @@ -77,7 +77,7 @@ class Test(unittest.TestCase): # we expected assert 'test.pdf' in set(r.get_property('filename') for r in results) - assert im.search('mimetype:application/pdf filename:test.pdf peek')[1] == 1 + assert im.search('mime_type:application/pdf filename:test.pdf peek')[1] == 1 def test_suite(): diff --git a/tests/xapianindex.txt b/tests/xapianindex.txt index 354d7a8..5638851 100644 --- a/tests/xapianindex.txt +++ b/tests/xapianindex.txt @@ -20,7 +20,7 @@ First clean up any old test data. Now add the file to the index. >>> props = dict(title="PDF Document", -... mimetype="application/pdf") +... mime_type="application/pdf") >>> uid = im.index(props, "test.pdf") @@ -57,7 +57,7 @@ title works as well. Searching for documents that are PDF works as expected here. Here we use the dictionary form of the query where each field name is given and creates a search. ->>> assert expect_single(im.search(dict(mimetype='application/pdf'))).id == uid +>>> assert expect_single(im.search(dict(mime_type='application/pdf'))).id == uid Punctuation is fine. |