Exemplo n.º 1
0
 def __setitem__(self, key, value):
   d = dict(value)
   d['_id'] = key
   d['fp'] = base.fingerprint(key)
   if self.update:
     self.collection.update({'_id': key}, d, upsert=True)
   else:
     self.collection.insert(d)
Exemplo n.º 2
0
 def StateFp(cls):
     """Returns a fingerprint of the state defined by the paramers as a string."""
     global state_fp
     global curdir
     state = str(sys.argv) + curdir
     if state_fp is None:
         state_fp = "%08x" % base.fingerprint(state)
     return state_fp