def makeFlatMessage(self, headers=None, context=None, sFormat=None): if headers is None: headers = self.DEFAULT_HEADERS if context is None: context = self.DEFAULT_CONTEXT token = self.saveToToken() # First Headers, then Context Specifics, then Lumped-Context data = [makeSerialized(token.get(h, ''), sFormat) for h in headers] data += [makeSerialized(self.getContextValue(h,''), sFormat) for h in context] data += [makeSerialized(token.get(self.CONTEXT_KEY,{}), sFormat)] return data
def makeFlatMessage(self, headers=None, context=None, sFormat=None): if headers is None: headers = self.DEFAULT_HEADERS if context is None: context = self.DEFAULT_CONTEXT token = self.saveToToken() # First Headers, then Context Specifics, then Lumped-Context data = [makeSerialized(token.get(h, ''), sFormat) for h in headers] data += [ makeSerialized(self.getContextValue(h, ''), sFormat) for h in context ] data += [makeSerialized(token.get(self.CONTEXT_KEY, {}), sFormat)] return data
def _save(self, obj): if obj.getId() is None: obj.updateId() token = tokenizeObject(obj) js = makeSerialized(token) dbobj = json.loads(js) dbobj[MONGO_ID_KEY] = token.getId() dbobj[CLASS_ID_KEY] = token.getClassId() #Set index values - note that we use the original object and #not the token idxList = self._listIndexes(obj.__class__) for indexName in idxList: dbobj[indexName] = get_prop(obj, indexName) self._collection.update({MONGO_ID_KEY: dbobj[MONGO_ID_KEY]}, dbobj, upsert=True)