mò Dã¸Ec@sdZdkZdkZdkZdkZdkZdkZdkZdk Zdk Zdk Zdk Zd„Z dd„Zfd„Zdfd„Zd„Zdfd„ƒYZd „Zd efd „ƒYZd efd „ƒYZdfd„ƒYZdfd„ƒYZdS(sSchema loader utility.NcCstƒi|ƒS(N(t SchemaLoadertloadURLturl(R((t-/data/zmath/zope/lib/python/ZConfig/loader.pyt loadSchemascCstƒi||ƒS(N(RtloadFiletfileR(RR((RtloadSchemaFile!scCst||ƒi|ƒS(N(t_get_config_loadertschemat overridesRR(R RR ((Rt loadConfig$scCst||ƒi||ƒS(N(RR R RRR(R RRR ((RtloadConfigFile'scCsU|o>dkl}|i|ƒ}x+|D]}|i|ƒq*Wn t|ƒ}|S(N(scmdline( R tZConfigtcmdlinetExtendedConfigLoaderR tloadertoptt addOptiont ConfigLoader(R R RRR((RR+s  t BaseLoadercBs\tZd„Zd„Zd„Zdd„Zd„Zd„Zd„Z d„Z d „Z RS( NcCsdS(N((tself((Rt__init__7scCs t||ƒS(N(tResourceRR(RRR((RtcreateResource:scCsA|i|ƒ}|i|ƒ}z|i|ƒSWd|iƒXdS(N(Rt normalizeURLRt openResourcetrt loadResourcetclose(RRR((RR=s cCsL|pt|ƒ}n|i||ƒ}z|i|ƒSWd|iƒXdS(N(Rt_url_from_fileRRRRRR(RRRR((RREscCstdƒ‚dS(Ns:BaseLoader.loadResource() must be overridden by a subclass(tNotImplementedError(Rtresource((RRPscCst|ƒ}yti|ƒ}Wn[tij o}|i||i ƒn2t t fj o}|i|t|ƒƒnX|i ||ƒS(N( tstrRturllib2turlopenRtURLErrorteRt_raise_open_errortreasontIOErrortOSErrorR(RRR%R((RRTs cCsc|d iƒdjod}ti|dƒ}n d}|}tid|||f|ƒ‚dS(Nisfile://RtURLserror opening %s %s: %s( Rtlowertwhatturllibt url2pathnametidentR tConfigurationErrortmessage(RRR1R,R/((RR&iscCsl|i|ƒo#dtitii|ƒƒ}ntii |ƒ\}}|oti d|ƒ‚n|S(Nsfile://s&fragment identifiers are not supported( RtisPathRR-t pathname2urltostpathtabspathR t urldefragtnewurltfragmentR0(RRR8R9((RRts#  cCs>d|jo)ti|ƒ\}}t|ƒdjSntSdS(s;Return True iff 's' should be handled as a filesystem path.t:iN(tsR-t splittypetschemetresttlentTrue(RR;R>R=((RR2~s  ( t__name__t __module__RRRtNoneRRRR&RR2(((RR6s      cCsdt|ddƒ}|oC|ddjo2|ddjo!dtitii|ƒƒSndSdS(Ntnameitsfile://( tgetattrRRCRDR-R3R4R5R6(RRD((RR‹s)!RcBs&tZdd„Zd„Zd„ZRS(NcCsC|djotiiƒ}nti|ƒ||_h|_dS(N( tregistryRCR t datatypestRegistryRRRt_cache(RRH((RR”s    cCs]|io*|ii|iƒo|i|i}n&tii||ƒ}||i|i<|S(N(R RRRKthas_keyR R t parseResource(RR R ((RR›s  c Csx|idƒ}|ptid| ƒ‚nd|jotid| ƒ‚n|pd}yt|ƒWn@tj o4}ti d|t |ƒfd|d|ƒ‚nXt i |}t|dƒpti d d|d|ƒ‚nx„|iD]U}tii|ƒ}tii||ƒ}tii|ƒod ti|ƒSq÷q÷Wti d d|d|d |iƒ‚dS( Nt.sillegal schema component name: ts component.xmlscould not load package %s: %stfilenametpackaget__path__s'import name does not refer to a packagesfile://sschema component not foundR5(RQtsplittpartsR t SchemaErrorRt __import__t ImportErrorR%tSchemaResourceErrorR!tsystmodulestpkgthasattrRRtdirR4R5R6tdirnametjointfntexistsR-R3( RRQRR%R]RTR[R`R^((RtschemaComponentSource¥s4      (RARBRCRRRb(((RR“s  RcBsStZd„Zd„Zd„Zd„Zd„Zd„Zd„Zdd„Z RS( NcCsC|iƒotidƒ‚nti|ƒ||_t|_dS(Ns-cannot check a configuration an abstract type( R t isabstractR RURRRtFalset_private_schema(RR ((RRÈs    cCsA|iƒ}|i||ƒ|iƒt|i|iƒf}|S(N( RtcreateSchemaMatchertsmt_parse_resourceR tfinishtCompositeHandlerthandlersR tresult(RR RlRg((RRÐs !cCstii|iƒS(N(R tmatchert SchemaMatcherRR (R((RRfÖscCsG|ii|ƒ}|iƒotid| ƒ‚n|i ||ƒS(NsKconcrete sections cannot match abstract section types; found abstract type ( RR tgettypettypettRcR R0tparenttcreateChildMatcherRD(RRrRpRDRq((Rt startSectionÛs cCs#|iƒ}|i|||ƒdS(N(RmRit sectvalueRrt addSectionRpRD(RRrRpRDRmRu((Rt endSectionãs cCsË|i}|ip@t|iiƒ|_tii|iƒ}t |_||_n|ii |dƒ}|i |ƒodSn|i|ƒ}|i|ƒztii||i|ƒWd|iƒXdS(NRO(RR ReRRHt_loaderR tinfotcreateDerivedSchemaR@RbtpkgnameRt hasComponentRR t addComponenttparseComponentR(RR{R RR ((RtimportSchemaComponentçs     cCsG|i|ƒ}|i|ƒ}z|i|||ƒWd|iƒXdS(N( RRRRRRhtsectiontdefinesR(RR€RRR((RtincludeConfigurationùs cCs)tii|||ƒ}|i|ƒdS(N( R t cfgparsert ZConfigParserR RRtparsertparseRm(RRmR RR…((RRhs( RARBRRRfRtRwRR‚RCRh(((RRÇs       RjcBs#tZd„Zd„Zd„ZRS(NcCs"||_|iidƒ|_dS(Ns basic-key(RkRt _handlersR RHtgett_convert(RRkR ((RR s c Csh}x[|iƒD]M\} }|i| ƒ}|i|ƒot i d| ƒ‚n|||