Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomeu Vizoso <tomeu@tomeuvizoso.net>2007-11-19 18:41:35 (GMT)
committer Tomeu Vizoso <tomeu@tomeuvizoso.net>2007-11-19 18:41:35 (GMT)
commit597cb100bcaccc37c1614b5cfb013da2c43d541d (patch)
tree085244515e12b5cae6890afc43daefd4d2f0ca31
parent88e426a30ad5087e3d4b1418355676555da40494 (diff)
#4662 Correctly fix properties not in the model.
-rw-r--r--NEWS2
-rw-r--r--src/olpc/datastore/model.py1
-rw-r--r--src/olpc/datastore/xapianindex.py7
3 files changed, 9 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index 18a9131..e1c96ab 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,5 @@
+* #4662 Correctly fix properties not in the model. (tomeu)
+
Snapshot ea0764a9e9
* #4662 Add the 'source' property to the model. (marco)
diff --git a/src/olpc/datastore/model.py b/src/olpc/datastore/model.py
index acabae3..cdaee9f 100644
--- a/src/olpc/datastore/model.py
+++ b/src/olpc/datastore/model.py
@@ -399,6 +399,5 @@ defaultModel = Model().addFields(
('icon-color', 'string'),
('preview', 'external'),
('buddies', 'text'),
- ('source', 'text'),
)
diff --git a/src/olpc/datastore/xapianindex.py b/src/olpc/datastore/xapianindex.py
index 06041aa..dfef53c 100644
--- a/src/olpc/datastore/xapianindex.py
+++ b/src/olpc/datastore/xapianindex.py
@@ -104,6 +104,12 @@ class IndexManager(object):
datamodel = kwargs.get('model', model.defaultModel)
datamodel.apply(self)
+ # configure the model according to the database
+ for field_name in self.write_index._field_actions:
+ if field_name not in datamodel.fields:
+ datamodel.addField(field_name, 'string')
+ self.fields.add(field_name)
+
# store a reference
self.datamodel = datamodel
@@ -308,6 +314,7 @@ class IndexManager(object):
d = {}
add_anything = False
for k,v in props.iteritems():
+ k = str(k)
p, added = self.datamodel.fromstring(k, v,
allowAddition=True)
if added is True: