예제 #1
0
    def serialize_many(self, instances, *args, **kw):
        """Immediately raises a :exc:`SerializationException`.

        This function requires `instances` to be non-empty.

        """
        raise SerializationException(instances[0])
예제 #2
0
def raise_s_exception(instance, *args, **kw):
    """Immediately raises a :exc:`SerializationException` with access to
    the provided `instance` of a SQLAlchemy model.

    This function is useful for use in tests for serialization
    exceptions.

    """
    raise SerializationException(instance)
예제 #3
0
 def serialize(self, instance, *args, **kwargs):
     raise SerializationException(instance, resource_id=instance.id, resource_type=resource_type)
예제 #4
0
 def serialize(self, instance, *args, **kwargs):
     raise SerializationException(instance, message='foo')
예제 #5
0
    def serialize(self, instance, *args, **kw):
        """Immediately raises a :exc:`SerializationException` with
        access to the provided `instance` of a SQLAlchemy model.

        """
        raise SerializationException(instance)
예제 #6
0
 def _dump(self, instance, *args, **kw):
     message = 'failed on {0}'.format(instance.id)
     raise SerializationException(instance, message=message)
예제 #7
0
 def serialize_many(self, instances, *args, **kw):
     instance1, instance2 = instances[:2]
     exception1 = SerializationException(instance1, message='foo')
     exception2 = SerializationException(instance2, message='bar')
     exceptions = [exception1, exception2]
     raise MultipleExceptions(exceptions)
예제 #8
0
 def raise_with_msg(instance, *args, **kw):
     raise SerializationException(instance, message='foo')