Example #1
0
 def saveconfig(self, skey, config):
     # logging.info('saveconfig (%s, %s)' % (repr(skey), repr(config)))
     prepare = {}
     # for (k, v) in config.iteritems():
     #     prepare[DBBase.tokey(k)] = v
     for (k, v) in config.iteritems():
         prepare[DBBase.tokey(k) + ".type"] = v["type"]
         prepare[DBBase.tokey(k) + ".value"] = v["value"]
         prepare[DBBase.tokey(k) + ".default"] = v["default"]
     # logging.info('saveconfig prepare (%s)' % repr(prepare))
     self.collection.update({"_id": skey}, {"$set": prepare}, True)
     pass
Example #2
0
 def all(self):
     result = {}
     if self.document is not None:
         for (k,v) in self.document.iteritems():
             if k not in ["_id", "__cache__"]:
                 result[DBBase.fromkey(k)] = v
     return result
Example #3
0
 def del_queue(self, key):
     self.reset_cache()
     self.collection.update({"_id": self.key}, {"$unset": {DBBase.tokey(key) + ".queue": ""}})
Example #4
0
 def add_queue(self, key, value):
     self.reset_cache()
     self.collection.update({"_id": self.key}, {"$set": {DBBase.tokey(key) + ".queue": value}}, True)