#4662 NORM Update.: DataStore looses metadata between reboots

Zarro Boogs per Child bugtracker at laptop.org
Thu Nov 15 07:51:46 EST 2007


#4662: DataStore looses metadata between reboots
------------------------+---------------------------------------------------
  Reporter:  uwog       |       Owner:  ApprovalForUpdate
      Type:  defect     |      Status:  new              
  Priority:  normal     |   Milestone:  Update.1         
 Component:  datastore  |     Version:                   
Resolution:             |    Keywords:                   
  Verified:  0          |  
------------------------+---------------------------------------------------
Changes (by tomeu):

  * owner:  erikos => ApprovalForUpdate


Comment:

 This patch should fix the issue of non-model properties getting lost:

 {{{
 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:
 }}}

-- 
Ticket URL: <http://dev.laptop.org/ticket/4662#comment:12>
One Laptop Per Child <http://dev.laptop.org>
OLPC bug tracking system



More information about the Bugs mailing list