django - Attribute 'type': The QName value '{http://www.w3.org/2001/XMLSchema}EmailString' does not resolve to a(n) type definition., line 4 -


i want extend spyne unicode field regex ensure valid e-mail format. when copy-pasting basic example spyne documentation http://spyne.io/docs/2.10/manual/03_types.html, above error (see title) when visiting localhost/my-url-endpoint?wsdl.

i use django 1.6 , spyne 2.10.10. on windows8 64-bit. suggestion why fails?

the code:

from django.views.decorators.csrf import csrf_exempt spyne.protocol.soap import soap11 spyne.interface import wsdl11 spyne.service import servicebase spyne.decorator import srpc, rpc spyne.model.primitive import unicode, integer, mandatory spyne.model.complex import iterable spyne.application import application spyne.server.django import djangoapplication  class emailstring(unicode):     __type_name__ = 'emailstring'      class attributes(unicode.attributes):         max_length = 128         pattern = '[^@]+@[^@]+'  class myservice(servicebase):      @rpc(emailstring, _returns=unicode)     def my_function(ctx, my_email):         return "your email %s" % my_email  application = application(         [                               myservice         ],         tns="http://tempuri.org",         interface=wsdl11(),         in_protocol=soap11(validator='lxml'),         out_protocol=soap11() ) myserviceapp = csrf_exempt(djangoapplication(application)) 

myserviceapp pointed in urls.py:

urlpatterns += patterns('',     (r'^my-url-endpoint$', 'myapp.views.myserviceapp'), ) 

stack trace:

internal server error: /en/wscrmservice traceback (most recent call last):   file "c:\users\anze\virtual environments\my_project\lib\site-packages\django-1.6.1-py2.7.egg\django\core\handlers\base.py", line 101, in get_response     resolver_match = resolver.resolve(request.path_info)   file "c:\users\anze\virtual environments\my_project\lib\site-packages\django-1.6.1-py2.7.egg\django\core\urlresolvers.py", line 320, in resolve     sub_match = pattern.resolve(new_path)   file "c:\users\anze\virtual environments\my_project\lib\site-packages\django-1.6.1-py2.7.egg\django\core\urlresolvers.py", line 320, in resolve     sub_match = pattern.resolve(new_path)   file "c:\users\anze\virtual environments\my_project\lib\site-packages\django-1.6.1-py2.7.egg\django\core\urlresolvers.py", line 320, in resolve     sub_match = pattern.resolve(new_path)   file "c:\users\anze\virtual environments\my_project\lib\site-packages\django-1.6.1-py2.7.egg\django\core\urlresolvers.py", line 222, in resolve     return resolvermatch(self.callback, args, kwargs, self.name)   file "c:\users\anze\virtual environments\my_project\lib\site-packages\django-1.6.1-py2.7.egg\django\core\urlresolvers.py", line 229, in callback     self._callback = get_callable(self._callback_str)   file "c:\users\anze\virtual environments\my_project\lib\site-packages\django-1.6.1-py2.7.egg\django\utils\functional.py", line 32, in wrapper     result = func(*args)   file "c:\users\anze\virtual environments\my_project\lib\site-packages\django-1.6.1-py2.7.egg\django\core\urlresolvers.py", line 96, in get_callable     mod = import_module(mod_name)   file "c:\users\anze\virtual environments\my_project\lib\site-packages\django-1.6.1-py2.7.egg\django\utils\importlib.py", line 40, in import_module     __import__(name)   file "e:\my_project\myapp\views.py", line 146, in <module>     out_protocol=soap11()   file "c:\users\anze\virtual environments\my_project\lib\site-packages\spyne\application.py", line 104, in __init__     self.in_protocol.set_app(self)   file "c:\users\anze\virtual environments\my_project\lib\site-packages\spyne\protocol\xml\_base.py", line 413, in set_app     xml_schema.build_validation_schema()   file "c:\users\anze\virtual environments\my_project\lib\site-packages\spyne\interface\xml_schema\_base.py", line 189, in build_validation_schema     self.validation_schema = etree.xmlschema(etree.parse(f))   file "xmlschema.pxi", line 102, in lxml.etree.xmlschema.__init__ (src\lxml\lxml.etree.c:154067) xmlschemaparseerror: element decl. '{http://tempuri.org}my_email', attribute 'type': qname value '{http://www.w3.org/2001/xmlschema}emailstring' not resolve a(n) type definition., line 4 

please help.

it work if do:

emailstring = unicode(128, pattern='[^@]+@[^@]+', type_name="emailstringtype") 

that pattern example though, can find better ones out there.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

How to get multiresult with multicondition in Sql Server -