Last active
December 22, 2015 17:39
-
-
Save FelixSchwarz/6507982 to your computer and use it in GitHub Desktop.
sample for https://github.com/arskom/spyne/issues/272 ("Unicode.customize(min_len=6) throws exception")
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from spyne.application import Application | |
from spyne.decorator import rpc | |
from spyne.model import ComplexModel, Unicode, Boolean | |
from spyne.protocol.soap.soap11 import Soap11 | |
from spyne.service import ServiceBase | |
import logging | |
logging.basicConfig(level=logging.WARN) | |
class Header(ComplexModel): | |
__type_name__ = 'header' | |
test = Boolean(min_occurs=0, nillable=False) | |
pw = Unicode.customize(min_occurs=0, nillable=False, min_len=6) | |
class Params(ComplexModel): | |
__namespace__ = 'dumy' | |
sendHeader = Header.customize(nillable=False, min_occurs=1) | |
class DummyService(ServiceBase): | |
@rpc(Params, _returns=Unicode) | |
def loadServices(ctx, serviceParams): | |
return '42' | |
spyne_application = Application([DummyService], | |
tns='dummy', | |
name='DummyService', | |
in_protocol=Soap11(validator='lxml'), | |
out_protocol=Soap11() | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment