{"action":"created","issue":{"url":"https://api.github.com/repos/mvantellingen/python-zeep/issues/68","repository_url":"https://api.github.com/repos/mvantellingen/python-zeep","labels_url":"https://api.github.com/repos/mvantellingen/python-zeep/issues/68/labels{/name}","comments_url":"https://api.github.com/repos/mvantellingen/python-zeep/issues/68/comments","events_url":"https://api.github.com/repos/mvantellingen/python-zeep/issues/68/events","html_url":"https://github.com/mvantellingen/python-zeep/issues/68","id":159753473,"number":68,"title":"Cannot set sub-type in sequence","user":{"login":"nicholjy","id":9905444,"avatar_url":"https://avatars.githubusercontent.com/u/9905444?v=3","gravatar_id":"","url":"https://api.github.com/users/nicholjy","html_url":"https://github.com/nicholjy","followers_url":"https://api.github.com/users/nicholjy/followers","following_url":"https://api.github.com/users/nicholjy/following{/other_user}","gists_url":"https://api.github.com/users/nicholjy/gists{/gist_id}","starred_url":"https://api.github.com/users/nicholjy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nicholjy/subscriptions","organizations_url":"https://api.github.com/users/nicholjy/orgs","repos_url":"https://api.github.com/users/nicholjy/repos","events_url":"https://api.github.com/users/nicholjy/events{/privacy}","received_events_url":"https://api.github.com/users/nicholjy/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/mvantellingen/python-zeep/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/mvantellingen/python-zeep/labels/xsd","name":"xsd","color":"bfdadc"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-06-11T03:35:49Z","updated_at":"2016-06-14T14:01:04Z","closed_at":"2016-06-11T09:30:24Z","body":"Using sub-types (complex extensions) within a sequence results in a couple of errors:\r\n  - Sequences assume that the input is a mapping\r\n  - xs:type is not written for sequence elements\r\n\r\nHere is a gist with a monkey patch that resolves these issues (it doesn't seem to introduce new issues, but I haven't tested it very exhaustively): https://gist.github.com/nicholjy/436ae857c30ae6a5bf8cafdeb7921ca3\r\n\r\nI'm traveling now, but I should have time in a week or so to submit a pull request with tests.\r\n\r\n##### Repro: #####\r\n```\r\nfrom lxml import etree\r\nfrom zeep import xsd\r\n\r\nnode = etree.fromstring(\"\"\"\r\n    <?xml version=\"1.0\"?>\r\n    <schema\r\n            xmlns=\"http://www.w3.org/2001/XMLSchema\"\r\n            xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"\r\n            xmlns:tns=\"http://tests.python-zeep.org/\"\r\n            elementFormDefault=\"qualified\"\r\n            targetNamespace=\"http://tests.python-zeep.org/\">\r\n      <complexType name=\"BaseType\" abstract=\"true\">\r\n        <sequence>\r\n          <element name=\"name\" type=\"xsd:string\" minOccurs=\"0\"/>\r\n        </sequence>\r\n      </complexType>\r\n      <complexType name=\"SubType1\">\r\n        <complexContent>\r\n          <extension base=\"tns:BaseType\">\r\n            <attribute name=\"attr_1\" type=\"xsd:string\"/>\r\n          </extension>\r\n        </complexContent>\r\n      </complexType>\r\n      <complexType name=\"PolySequenceType\">\r\n        <sequence>\r\n          <element name=\"item\" type=\"tns:BaseType\" maxOccurs=\"unbounded\" minOccurs=\"0\"/>\r\n        </sequence>\r\n      </complexType>\r\n      <element name=\"Seq\" type=\"tns:PolySequenceType\"/>\r\n    </schema>\r\n    \"\"\".strip())\r\n\r\nschema = xsd.Schema(node)\r\nseq = schema.get_type('ns0:PolySequenceType')\r\nsub_type = schema.get_type('ns0:SubType1')\r\nvalue = seq(item=[sub_type(attr_1=\"test\", name=\"name\")])\r\n\r\nnode = etree.Element('document')\r\nseq.render(node, value)\r\nprint(etree.tostring(node))\r\n```"},"comment":{"url":"https://api.github.com/repos/mvantellingen/python-zeep/issues/comments/225889996","html_url":"https://github.com/mvantellingen/python-zeep/issues/68#issuecomment-225889996","issue_url":"https://api.github.com/repos/mvantellingen/python-zeep/issues/68","id":225889996,"user":{"login":"nicholjy","id":9905444,"avatar_url":"https://avatars.githubusercontent.com/u/9905444?v=3","gravatar_id":"","url":"https://api.github.com/users/nicholjy","html_url":"https://github.com/nicholjy","followers_url":"https://api.github.com/users/nicholjy/followers","following_url":"https://api.github.com/users/nicholjy/following{/other_user}","gists_url":"https://api.github.com/users/nicholjy/gists{/gist_id}","starred_url":"https://api.github.com/users/nicholjy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nicholjy/subscriptions","organizations_url":"https://api.github.com/users/nicholjy/orgs","repos_url":"https://api.github.com/users/nicholjy/repos","events_url":"https://api.github.com/users/nicholjy/events{/privacy}","received_events_url":"https://api.github.com/users/nicholjy/received_events","type":"User","site_admin":false},"created_at":"2016-06-14T14:01:04Z","updated_at":"2016-06-14T14:01:04Z","body":"Awesome, thanks for the fast response!"}}
{"actor":{"display_login":"nicholjy"}}