Ejemplo n.º 1
0
class WarningState(CommunicationState):
    """Superclass for all states which that something didnt work as expected
    but its not that bad ;)

    """

    localized_name = _(u'WarningState')
Ejemplo n.º 2
0
class ObjectNotFoundForMovingWarning(WarningState):
    """Could not move a object because we could not find it. That's maybe
    not a problem, since we usually move unpublished objects too.

    """

    localized_name = _(u'ObjectNotFoundForMovingWarning')
Ejemplo n.º 3
0
class UnexpectedError(ErrorState):
    """
    Any exception which is not catched will raise a UnexpectedError containing
    the Exception information.
    """

    localized_name = _(u'UnexpectedError')
Ejemplo n.º 4
0
class SuccessState(CommunicationState):
    """
    Superclass for all states which indicate that the communication was
    successful.
    """

    localized_name = _(u'SuccessState')
Ejemplo n.º 5
0
class UnknownActionError(ErrorState):
    """
    An UnknownActionError is raised if the action is not one of the defined
    actions (push, move or delete).
    """

    localized_name = _(u'UnknownActionError')
Ejemplo n.º 6
0
class DecodeError(ErrorState):
    """
    Indicates that the decoder was not able to decode the request data to
    json.
    """

    localized_name = _(u'DecodeError')
Ejemplo n.º 7
0
class ObjectNotFoundForDeletingWarning(WarningState):
    """Could not delete a object becaus it couldnt be found. Maybe the object
    wasn't published - but we wanted to delete it anyway - so it's not a
    error.

    """

    localized_name = _(u'ObjectNotFoundForDeletingWarning')
Ejemplo n.º 8
0
class CommunicationState(Exception):
    """
    Superclass for all states used by publisher packages.
    The CommunicationState class inherits from Exception, because
    we want to be able to "raise" a CommunicationState-object.

    >>> raise CommunicationState('test')
    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    states.CommunicationState: test
    """
    def __init__(self, message='', *args, **kwargs):
        """
        Constructs the CommunicationState object. If a message
        is provided, it will be stored for later use.

        @param message:     Status message (optional)
        @type message:      string
        """
        Exception.__init__(self, message, *args, **kwargs)
        self.message = str(message)

    def toString(self):
        """
        Converts a CommunicationState object to a string for printing
        or for sending to a other instance.

        >>> print CommunicationState('Hello World').toString()
        CommunicationState
        Hello World


        @rtype:             string
        @return:            string containing classname and message
        """
        return '\n'.join([
            self.__class__.__name__,
            self.message,
        ])

    localized_name = _(u'CommunicationState')
Ejemplo n.º 9
0
class ObjectNotFoundError(ErrorState):
    """
    Indicates that the object could not be found.
    """

    localized_name = _(u'ObjectNotFoundError')
Ejemplo n.º 10
0
class ObjectMovedState(SuccessState):
    """
    Indicates that the object was renamed/moved successfully.
    """

    localized_name = _(u'ObjectMovedState')
Ejemplo n.º 11
0
class ObjectUpdatedState(SuccessState):
    """
    Indicates that the object was updated successfully.
    """

    localized_name = _(u'ObjectUpdatedState')
Ejemplo n.º 12
0
class ObjectCreatedState(SuccessState):
    """
    Indicates that a new object was created.
    """

    localized_name = _(u'ObjectCreatedState')
Ejemplo n.º 13
0
class ConnectionLost(ErrorState):
    """Connection was lost (e.g. BadStatusLine exception)
    """

    localized_name = _(u'ConnectionLost')
Ejemplo n.º 14
0
class CouldNotMoveError(ErrorState):
    """
    Indicates that the object could not be renamed/moved.
    """

    localized_name = _(u'CouldNotMoveError')
Ejemplo n.º 15
0
class UIDPathMismatchError(ErrorState):
    """The UID is already used for a object with another path.
    """

    localized_name = _(u'UIDPathMismatchError')
Ejemplo n.º 16
0
class PartialError(ErrorState):
    """
    Indicates that the decoded data was not complete, there were parts missing.
    """

    localized_name = _(u'PartialError')
Ejemplo n.º 17
0
class InvalidRequestError(ErrorState):
    """
    Indicates a problem with the submitted request.
    """

    localized_name = _(u'InvalidRequestError')