def from_orient(self, orient_record): # orient driver returns an instance of # pyorient.types.OrientRecord # which in turn stores its data in # property oRecordData dictionary # and other attributes (like rid) # in private variables orient_class = orient_record._OrientRecord__o_class object_to_return = get_class_from_orient_class_name(orient_class)() object_to_return.rid = orient_record._rid for k in orient_record.oRecordData.keys(): object_to_return._fields[object_to_return._py_to_orient_field_mapping[k]].orient_to_python(orient_record.oRecordData[k]) return object_to_return
def test_get_class_from_orient_class_name(self): # test the whole above shebang wrapper klass = get_class_from_orient_class_name(get_orient_valid_class_name(ClassToInsert)) self.assertEqual(klass, ClassToInsert) klass = get_class_from_orient_class_name(get_orient_valid_class_name(ClassToInsert())) self.assertEqual(klass, ClassToInsert)