Did I find the right examples for you? yes no Crawl my project Python Jobs
All Samples(1) | Call(1) | Derive(0) | Import(0)
Decodes the string message from the response containing the state and returns a new state object with its message. @param data: String representation of a state @type data: string @Return: state object (ftw.publisher.core.states.CommunicationState)
def parseResponse(data): """ Decodes the string message from the response containing the state and returns a new state object with its message. @param data: String representation of a state @type data: string @Return: state object (ftw.publisher.core.states.CommunicationState) """ classname = data.split('\n')[0] message = '\n'.join(data.split('\n')[1:]) if classname not in dir(states): msg = 'Could not find state class: %s (message: %s)' % ( classname, message) raise Exception(msg) stateClass = getattr(states, classname) state = stateClass(message) return state
exc = ''.join(traceback.format_exception(*sys.exc_info())) return ConnectionLost(exc) return communication.parseResponse(html)