Package suds :: Module soaparray
[hide private]
[frames] | no frames]

Source Code for Module suds.soaparray

 1  # This program is free software; you can redistribute it and/or modify 
 2  # it under the terms of the (LGPL) GNU Lesser General Public License as 
 3  # published by the Free Software Foundation; either version 3 of the  
 4  # License, or (at your option) any later version. 
 5  # 
 6  # This program is distributed in the hope that it will be useful, 
 7  # but WITHOUT ANY WARRANTY; without even the implied warranty of 
 8  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 9  # GNU Library Lesser General Public License for more details at 
10  # ( http://www.gnu.org/licenses/lgpl.html ). 
11  # 
12  # You should have received a copy of the GNU Lesser General Public License 
13  # along with this program; if not, write to the Free Software 
14  # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 
15  # written by: Jeff Ortel ( jortel@redhat.com ) 
16   
17  """ 
18  The I{soaparray} module provides XSD extensions for handling 
19  soap (section 5) encoded arrays. 
20  """ 
21   
22  from suds import * 
23  from logging import getLogger 
24  from suds.xsd.sxbasic import Factory as SXFactory 
25  from suds.xsd.sxbasic import Attribute as SXAttribute 
26   
27   
28 -class Attribute(SXAttribute):
29 """ 30 Represents an XSD <attribute/> that handles special 31 attributes that are extensions for WSDLs. 32 @ivar aty: Array type information. 33 @type aty: The value of wsdl:arrayType. 34 """ 35
36 - def __init__(self, schema, root, aty):
37 """ 38 @param aty: Array type information. 39 @type aty: The value of wsdl:arrayType. 40 """ 41 SXAttribute.__init__(self, schema, root) 42 if aty.endswith('[]'): 43 self.aty = aty[:-2] 44 else: 45 self.aty = aty
46
47 - def autoqualified(self):
48 aqs = SXAttribute.autoqualified(self) 49 aqs.append('aty') 50 return aqs
51
52 - def description(self):
53 d = SXAttribute.description(self) 54 d = d+('aty',) 55 return d
56 57 # 58 # Builder function, only builds Attribute when arrayType 59 # attribute is defined on root. 60 #
61 -def __fn(x, y):
62 ns = (None, "http://schemas.xmlsoap.org/wsdl/") 63 aty = y.get('arrayType', ns=ns) 64 if aty is None: 65 return SXAttribute(x, y) 66 else: 67 return Attribute(x, y, aty)
68 69 # 70 # Remap <xs:attrbute/> tags to __fn() builder. 71 # 72 SXFactory.maptag('attribute', __fn) 73