[spyne] Mandatory not being enforced

Burak Arslan burak.arslan at arskom.com.tr
Thu Jun 19 12:30:18 UTC 2014


Hi Joseph,

On 06/13/14 19:04, Joseph L. Casale wrote:
> I have am using @rpc to decorate a service method with an object that has
> _type_info as follows:
>
>     _type_info = [
>         ...,
>         ('xxx', Mandatory(ID)),
>         ...
>     ]
>
> ID points to a class as below.
>
> class ID(ComplexModel):
>     _type_info = [
>         ('ID', Mandatory(XmlAttribute(Unicode(pattern=some_pattern))))
>     ]
>
> A request can still get posted with an xml element <xxx/> not containing the
> ID attribute, is there a better way to setup this requirement?
>


It's supposed to work the other way round:

XmlAttribute(Mandatory(Unicode(pattern=some_pattern))))


Best,
Burak


More information about the people mailing list