Esempio 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')
Esempio 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')
Esempio n. 3
0
class UnexpectedError(ErrorState):
    """
    Any exception which is not catched will raise a UnexpectedError containing
    the Exception information.
    """

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

    localized_name = _(u'SuccessState')
Esempio 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')
Esempio n. 6
0
class DecodeError(ErrorState):
    """
    Indicates that the decoder was not able to decode the request data to
    json.
    """

    localized_name = _(u'DecodeError')
Esempio 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')
Esempio 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')
Esempio n. 9
0
class ObjectNotFoundError(ErrorState):
    """
    Indicates that the object could not be found.
    """

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

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

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

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

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

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

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

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

    localized_name = _(u'InvalidRequestError')