Exemple #1
0
 def _get_node_type(self, node):
     relation = node.get('__jsonclass__')
     if not relation is None:
         tpe = get_resource_class_for_relation(relation)
     else:
         # In the absence of class hinting, the best we can do is to
         # look up the member class for the mapped class. For polymorphic
         # types, this will only work if a representer was initialized
         # for every derived class separately.
         tpe = get_member_class(self._mapping.mapped_class)
     return tpe
Exemple #2
0
 def _get_node_type(self, node):
     relation = node.get('__jsonclass__')
     if not relation is None:
         tpe = get_resource_class_for_relation(relation)
     else:
         # In the absence of class hinting, the best we can do is to
         # look up the member class for the mapped class. For polymorphic
         # types, this will only work if a representer was initialized
         # for every derived class separately.
         tpe = get_member_class(self._mapping.mapped_class)
     return tpe
 def test_get_resource_from_relation(self):
     rel = MyEntityMember.relation
     self.assert_equal(get_resource_class_for_relation(rel),
                       MyEntityMember)
Exemple #4
0
 def test_get_resource_from_relation(self):
     rel = MyEntityMember.relation
     self.assert_equal(get_resource_class_for_relation(rel),
                       MyEntityMember)