Beispiel #1
0
 def update(self, query):
     """Update indexed object running query."""
     # XXX surely not secure
     client = self.client()
     res = client.update(index=self.user_id,
                         doc_type=self.doc_type,
                         id=self.uid,
                         body=to_json(query))
     return res
Beispiel #2
0
 def update(self, query):
     """Update indexed object running query."""
     # XXX surely not secure
     client = self.client()
     res = client.update(index=self.user_id,
                         doc_type=self.doc_type,
                         id=self.uid,
                         body=to_json(query))
     return res
Beispiel #3
0
 def create(cls, core, **kwargs):
     """Create an indexed object."""
     uid = getattr(core, core._pkey_name)
     data = {column: kwargs.get(column, getattr(core, column))
             for column in cls.columns}
     # XXX TOFIX HACKISH : encode UUID using json encoder
     data = json.loads(to_json(data))
     return cls.client().create(index=core.user_id,
                                doc_type=cls.doc_type,
                                id=uid, body=data)
Beispiel #4
0
 def create(cls, core, **kwargs):
     """Create an indexed object."""
     uid = getattr(core, core._pkey_name)
     data = {
         column: kwargs.get(column, getattr(core, column))
         for column in cls.columns
     }
     # XXX TOFIX HACKISH : encode UUID using json encoder
     data = json.loads(to_json(data))
     return cls.client().create(index=core.user_id,
                                doc_type=cls.doc_type,
                                id=uid,
                                body=data)