예제 #1
0
파일: base.py 프로젝트: j2labs/tobin
 def create_one(self, cls, datum):
     if datum['id'] in self.db_conn:
         status = self.MSG_UPDATED
     else:
         status = self.MSG_CREATED
     datum_key = str(getattr(datum, self.api_id))
     self.db_conn[datum_key] = to_native(cls, datum)
     return (status, datum)
예제 #2
0
 def create_one(self, cls, datum):
     if datum['id'] in self.db_conn:
         status = self.MSG_UPDATED
     else:
         status = self.MSG_CREATED
     datum_key = str(getattr(datum, self.api_id))
     self.db_conn[datum_key] = to_native(cls, datum)
     return (status, datum)
예제 #3
0
def test_to_native():

    m = M(primitives)
    output = m.to_native()
    assert type(output) is dict
    assert output == natives

    assert to_native(M, natives) == natives
예제 #4
0
파일: base.py 프로젝트: j2labs/tobin
 def update_one(self, cls, datum):
     datum_key = str(getattr(datum, self.api_id))
     self.db_conn[datum_key] = to_native(cls, datum)
     return (self.MSG_UPDATED, datum)
예제 #5
0
 def update_one(self, cls, datum):
     datum_key = str(getattr(datum, self.api_id))
     self.db_conn[datum_key] = to_native(cls, datum)
     return (self.MSG_UPDATED, datum)