Skip to content

Instantly share code, notes, and snippets.

@FelixSchwarz
Last active December 22, 2015 17:39
Show Gist options
  • Save FelixSchwarz/6507982 to your computer and use it in GitHub Desktop.
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")
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