ó ¾œ~Lc@s»dZddlmZddlmZddlmZmZddlm Z ddl m Z ddl m Z e eƒZddd „ƒYZd efd „ƒYZd efd „ƒYZdS(s' Contains xml document reader classes. iÿÿÿÿ(tParser(tRequest(tCachetNoCache(t DocumentStore(tPluginContainer(t getLoggertReadercBs eZdZd„Zd„ZRS(sy The reader provides integration with cache. @ivar options: An options object. @type options: I{Options} cCs||_t|jƒ|_dS(sV @param options: An options object. @type options: I{Options} N(toptionsRtplugins(tselfR((s//usr/lib/python2.7/site-packages/suds/reader.pyt__init__(s cCs tt|ƒƒ}d||fS(so Mangle the name by hashing the I{name} and appending I{x}. @return: the mangled name. s%s-%s(tabsthash(R tnametxth((s//usr/lib/python2.7/site-packages/suds/reader.pytmangle0s(t__name__t __module__t__doc__R R(((s//usr/lib/python2.7/site-packages/suds/reader.pyR!s tDocumentReadercBs)eZdZd„Zd„Zd„ZRS(so The XML document reader provides an integration between the SAX L{Parser} and the document cache. cCs|jƒ}|j|dƒ}|j|ƒ}|dkr[|j|ƒ}|j||ƒn|jjjd|d|j ƒƒ|S(s¤ Open an XML document at the specified I{url}. First, the document attempted to be retrieved from the I{object cache}. If not found, it is downloaded and parsed using the SAX parser. The result is added to the cache for the next open(). @param url: A document url. @type url: str. @return: The specified XML document. @rtype: I{Document} tdocumentturlN( tcacheRtgettNonetdownloadtputR Rtparsedtroot(R RRtidtd((s//usr/lib/python2.7/site-packages/suds/reader.pytopen?s  "cCs˜tƒ}|j|ƒ}|dkrB|jjjt|ƒƒ}n|jƒ}|jƒ|jj j d|d|ƒ}|j }t ƒ}|j d|ƒS(s¯ Download the docuemnt. @param url: A document url. @type url: str. @return: A file pointer to the docuemnt. @rtype: file-like RRtstringN( RR!RRt transportRtreadtcloseR RtloadedRtparse(R Rtstoretfptcontenttctxtsax((s//usr/lib/python2.7/site-packages/suds/reader.pyRTs      cCs'|jjdkr|jjStƒSdS(sw Get the cache. @return: The I{options} when I{cachingpolicy} = B{0}. @rtype: L{Cache} iN(Rt cachingpolicyRR(R ((s//usr/lib/python2.7/site-packages/suds/reader.pyRgs (RRRR!RR(((s//usr/lib/python2.7/site-packages/suds/reader.pyR9s  tDefinitionsReadercBs)eZdZd„Zd„Zd„ZRS(sõ The WSDL definitions reader provides an integration between the Definitions and the object cache. @ivar fn: A factory function (constructor) used to create the object not found in the cache. @type fn: I{Constructor} cCstj||ƒ||_dS(sé @param options: An options object. @type options: I{Options} @param fn: A factory function (constructor) used to create the object not found in the cache. @type fn: I{Constructor} N(RR tfn(R RR/((s//usr/lib/python2.7/site-packages/suds/reader.pyR |scCs”|jƒ}|j|dƒ}|j|ƒ}|dkra|j||jƒ}|j||ƒn/|j|_x |jD]}|j|j_qwW|S(sÛ Open a WSDL at the specified I{url}. First, the WSDL attempted to be retrieved from the I{object cache}. After unpickled from the cache, the I{options} attribute is restored. If not found, it is downloaded and instantiated using the I{fn} constructor and added to the cache for the next open(). @param url: A WSDL url. @type url: str. @return: The WSDL object. @rtype: I{Definitions} twsdlN( RRRRR/RRtimportstimported(R RRRR timp((s//usr/lib/python2.7/site-packages/suds/reader.pyR!‡s   cCs'|jjdkr|jjStƒSdS(sw Get the cache. @return: The I{options} when I{cachingpolicy} = B{1}. @rtype: L{Cache} iN(RR-RR(R ((s//usr/lib/python2.7/site-packages/suds/reader.pyR s (RRRR R!R(((s//usr/lib/python2.7/site-packages/suds/reader.pyR.ss N((Rtsuds.sax.parserRtsuds.transportRt suds.cacheRRt suds.storeRt suds.pluginRtloggingRRtlogRRR.(((s//usr/lib/python2.7/site-packages/suds/reader.pyts :