ó K4Qc@sdZddlZddlZddlZddlZddljjZddljj Z ddl Z ddl Z ddlZyddlZddlZWn+ek rÇe jdIJe jdƒnXdad„Zd„Zdd„Zd„Zdd „ZdS( sOface - provides the BUI (Browser User Interface) for the image packaging serveriÿÿÿÿNs6Mako 0.2.2 or greater is required to use this program.icCs2tjjj|ƒtjjd|jgƒadS(s,Ensure that the BUI is properly initialized.t directoriesN( tpkgtservertfeedtinittmakotlookuptTemplateLookuptweb_rootttlookup(tdepot((s5/usr/lib/python2.7/vendor-packages/pkg/server/face.pyR1scCsm|jjr$tjtjdƒ‚n|jj|ƒjsQtjtjdƒ‚nt j j j ||||ƒS(Ns/Operation not supported in current server mode.s+No update history; unable to generate feed.( trepotmirrortcherrypyt HTTPErrorthttplibt NOT_FOUNDt get_catalogtupdatestSERVICE_UNAVAILABLERRRthandle(R trequesttresponsetpub((s5/usr/lib/python2.7/vendor-packages/pkg/server/face.pyR7s     cCsItj|ƒ}tj|||ƒ}|jdi|d6|d6|d6ƒS(Ntg_varstbaseRt http_depot(R t get_templatetapit BaseInterfacetrender_unicode(R RtpathRRttemplateR((s5/usr/lib/python2.7/vendor-packages/pkg/server/face.pyt__render_template@scCs9|tjkr)tjd|dtƒntjƒ‚dS(Ns0Error encountered while processing template: %s t traceback(RRR tlogtTruetNotFound(Rterror((s5/usr/lib/python2.7/vendor-packages/pkg/server/face.pyt__handle_errorFs c CsÑ|jjdƒ}|rEtjjtjj|j|ƒƒrEd}n'|rl||jj krlt j ƒ‚n|r|j |dƒjdƒ}n'|jj jddƒ}|s·d}n|dkrÌd}nQ|jdƒddkr|jjidd6d d 6d d 6ƒt||||ƒS|jd ƒsµtj|ƒ}tjj|j|ƒ}tjj|ƒjtjj|jƒƒst|tjƒSt jjjtjj|j|ƒƒSny?|jjidd6d d 6d d 6ƒt|||||ƒSWnÖtj k rN}t j!di|d6t"|ƒd6ƒt j!dƒt|jtjƒSt#k rm}t|tj$ƒSt%j&j'k r’}t|tjƒStj(k r¹}t j)|j*ƒ‚nt|tj$ƒSXdS(s¥'http_depot' if set should be the resource that points to the top level of repository being served (referred to as the repo_prefix in depot_index.py)t/tt publishertprefixs index.shtmliRtExpiressno-cachetPragmas'no-cache, no-transform, must-revalidates Cache-Controls.shtmlsFTemplate '%(path)s' is incompatible with current server api: %(error)sRR&sGEnsure that the correct --content-root has been provided to pkg.depotd.N(+t path_infotstriptosRtexiststjoinRtNoneR t publishersR R%treplacetcfgt get_propertytsplittheaderstupdateRtendswithturllibtunquotetnormpatht startswithR'RRtlibtstatict serve_fileR!tsaetVersionExceptionR#tstrtIOErrortINTERNAL_SERVER_ERRORRt exceptionstTemplateLookupExceptiontRedirectExceptiont HTTPRedirecttdata( R RRRRRtspathtfnamete((s5/usr/lib/python2.7/vendor-packages/pkg/server/face.pytrespondPsT*         (t__doc__R tcherrypy.lib.staticRR0tpkg.server.apiRRtpkg.server.api_errorst api_errorsRCtpkg.server.feedRtsysR<tmako.exceptionsRt mako.lookupt ImportErrortstderrtexitR3R RRR!R'RP(((s5/usr/lib/python2.7/vendor-packages/pkg/server/face.pyts*