Mercurial > libervia-backend
comparison src/tmp/wokkel/mam.py @ 1784:21f0bcd3b637
tmp (wokkel.mam): MAMErrow now inherit from StanzaError so it can be handler properly by services
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 08 Jan 2016 18:52:28 +0100 |
parents | 0c21dafedd22 |
children | ac73d7456abc |
comparison
equal
deleted
inserted
replaced
1783:e393b96dc553 | 1784:21f0bcd3b637 |
---|---|
31 from zope.interface import Interface | 31 from zope.interface import Interface |
32 | 32 |
33 from twisted.words.protocols.jabber import xmlstream | 33 from twisted.words.protocols.jabber import xmlstream |
34 from twisted.words.xish import domish | 34 from twisted.words.xish import domish |
35 from twisted.words.protocols.jabber import jid | 35 from twisted.words.protocols.jabber import jid |
36 from twisted.words.protocols.jabber import error | |
36 from twisted.internet import defer | 37 from twisted.internet import defer |
37 from twisted.python import log | 38 from twisted.python import log |
38 | 39 |
39 from wokkel import subprotocols | 40 from wokkel import subprotocols |
40 from wokkel import disco | 41 from wokkel import disco |
51 PREFS_GET_REQUEST = "/iq[@type='get']/prefs[@xmlns='%s']" % NS_MAM | 52 PREFS_GET_REQUEST = "/iq[@type='get']/prefs[@xmlns='%s']" % NS_MAM |
52 PREFS_SET_REQUEST = "/iq[@type='set']/prefs[@xmlns='%s']" % NS_MAM | 53 PREFS_SET_REQUEST = "/iq[@type='set']/prefs[@xmlns='%s']" % NS_MAM |
53 | 54 |
54 # TODO: add the tests! | 55 # TODO: add the tests! |
55 | 56 |
56 class MAMError(Exception): | 57 |
58 class MAMError(error.StanzaError): | |
57 """ | 59 """ |
58 MAM error. | 60 MAM error. |
59 """ | 61 """ |
62 def __init__(self, text=None): | |
63 error.StanzaError.__init__(self, 'bad-request', text=text) | |
64 | |
60 | 65 |
61 class Unsupported(MAMError): | 66 class Unsupported(MAMError): |
62 def __init__(self, feature, text=None): | 67 def __init__(self, feature, text=None): |
63 self.feature = feature | 68 self.feature = feature |
64 MAMError.__init__(self, 'feature-not-implemented', | 69 MAMError.__init__(self, 'feature-not-implemented', |