Plan 9 from Bell Labs’s /usr/web/sources/contrib/bichued/root/sys/lib/python/mercurial/hgweb/hgweb_mod.pyc

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


�
�c
@sddkZddklZlZlZlZlZlZddkl	Z	l
Z
ddklZlZl
Z
lZddklZlZddklZddkZddkZddkZhdd<dd	<d
d<dd<Zd
efd��YZdS(i�N(tuithgthookterrortencodingt	templater(t	get_mtimet
ErrorResponse(tHTTP_OKtHTTP_BAD_REQUESTtHTTP_NOT_FOUNDtHTTP_SERVER_ERROR(tHTTP_UNAUTHORIZEDtHTTP_METHOD_NOT_ALLOWED(twsgirequesttpulltchangegrouptchangegroupsubsettpushtunbundlet
stream_outthgwebcBs�eZdd�Zded�Zeed�Zded�Zd�Z	d�Z
d�Zd�Zd�Z
d	�Zhdd
<dd<dd<Zd�ZRS(cCs�t|t�oKti�}|iddd�|iddd�ti||�|_n
||_tit	�d|_
||_d|_d	|_
|id
d�|_dS(
NRtreport_untrustedtofftinteractivei�tziptgztbz2itwebt	templates(szipsgzsbz2(t
isinstancetstrRt	setconfigRt
repositorytrepoRtredirecttTruetmtimetreponametarchiveststripecounttconfigttemplatepath(tselfR"tnametu((s,/sys/lib/python/mercurial/hgweb/hgweb_mod.pyt__init__s	
				cCs|iii|||d|�S(Nt	untrusted(R"RR)(R+tsectionR,tdefaultR/((s,/sys/lib/python/mercurial/hgweb/hgweb_mod.pyR)-scCs|iii|||d|�S(NR/(R"Rt
configbool(R+R0R,R1R/((s,/sys/lib/python/mercurial/hgweb/hgweb_mod.pyR21scCs|iii|||d|�S(NR/(R"Rt
configlist(R+R0R,R1R/((s,/sys/lib/python/mercurial/hgweb/hgweb_mod.pyR35scCs�t|ii�}||ijo�||_ti|ii|ii�|_t|iddd��|_	t|iddd��|_
t|iddd��|_t|iddd��|_|i
dd	t�|_|idd
ti�t_ndS(NRt
maxchangesi
tstripesitmaxshortchangesi<tmaxfilest	allowpullR(RR"trootR%RR!RtintR)R4R(R6R7R2R$R8R(R+R%((s,/sys/lib/python/mercurial/hgweb/hgweb_mod.pytrefresh9s	!cCsRtiidd�id�ptd��nddkii}|i|�dS(NtGATEWAY_INTERFACEtsCGI/1.sJThis function is only intended to be called while running as a CGI script.i�(	tostenvirontgett
startswithtRuntimeErrortmercurial.hgweb.wsgicgiRtwsgicgitlaunch(R+RD((s,/sys/lib/python/mercurial/hgweb/hgweb_mod.pytrunFscCst||�}|i|�S(N(Rtrun_wsgi(R+tenvtrespondtreq((s,/sys/lib/python/mercurial/hgweb/hgweb_mod.pyt__call__MscCs|i�|id|_|iid�p|id7_nd|ijo|i|idd7_nd|ijo{|idid�id�}|iidd�id�}|t|� |jo|t|�}ndi|�}n4|ididd�d	}|id
d�d	}|i	iddg�d	}|o�t
ijo�|ott
��ny�|tjoRy|i|t|�Wq�tj
o'}|djo|i�n�q�Xntt
|�}||i|�SWqGtj
o<}|i|t
i�|ipgSnd
|ifSqGXn|idd�}d|i	jo�|o�|d	o�|id	�}|id�}	|	djo&||	 g|i	d<||	d}ntt|�o|g|i	d<nd}|djodi|�g|i	d<nN|o.|d	o#|id	�}
|
g|i	d<n|o||i	d<n|djo~|i	dd	}xj|ii�D]U\}}
|
d}|i|�o/|t|� g|i	d<|g|i	d<q�q�Wq�y8|i|�}|ddti�}ti|�}|djo|i|d�n|djo,|i dg|i	d<|i	dd	}n|tijod|}tt!|��nw|djo>d|i	idg�jo"||_"ti#|||�}n,tt|�|||�}|it$|�|SWn�t%i&j
oS}|it
|�t'|�}d|jod|i(}n|dd|�Snt%i)t%i*fj
o/}|it+|�|ddt'|��Sn9tj
o,}|i||�|dd|i�SnXdS(NtSCRIPT_NAMEt/t	REPO_NAMEt	PATH_INFOR=tQUERY_STRINGt&iit;tcmdRs0
%s
it-i�tstyletstatictfiletnodetarchivettypetmimetypeRR1sno such method: %strawtmanifestsrevision not found: %sR(,R;RHturltendswithtstriptsplitR@tlentjointformtprotocolt__all__RR
tpermst
check_permtdraintgetattrR"RItHGTYPEtmessagetpoptrfindthasattrtwebcommandst
archive_specst	iteritemsRRt	stringifytNonetcacheR	tctypetrawfileRRtLookupErrorRR,t	RepoErrortRevlogErrorR(R+RJtpartst
repo_partstqueryRStinsttmethodtargsRURXtfnttype_tspectextttmplRvtmsgtcontentterr((s,/sys/lib/python/mercurial/hgweb/hgweb_mod.pyRGQs�



"



 


)	
c
s:|iid�}|djod}d}n
d}d}|id}||jod|pd}d	||id
|f}�idd�p|id
}|id�p|d7}n�fd�}�fd�}�fd�}	h}
�iddd�}d|ijo|idd}||
d<n|iddjodpd}ti|
|�}
ti	|�i
�}�ipL�idd�p0|iid�p|iid�p
�i
i�_nti|dh|id<|d<|d<�id<|d<|d<|	d <|
d!<���S("Nswsgi.url_schemethttpst443thttpt80tSERVER_PORTt:R=s	%s://%s%stSERVER_NAMERt	staticurlsstatic/RMc;s�ddti|�VdS(NtheaderR(R(tmap(R�(s,/sys/lib/python/mercurial/hgweb/hgweb_mod.pyR��sc;s�d|�VdS(Ntfooter((R�(R�(s,/sys/lib/python/mercurial/hgweb/hgweb_mod.pyR��sc;s�iddd�VdS(NRtmotdR=(R)(R�(R+(s,/sys/lib/python/mercurial/hgweb/hgweb_mod.pyR��sRUtpaperii�t?RQR,RNtdefaultsR^turlbaseR"R�R�R�tsessionvars(RHR@R)R^R_RdtwebutilR�RtstylemapR*R&R`R"R9(R+RJtprototdefault_porttportR�R�R�R�R�tvarsRUtstartR�tmapfile((R+R�s,/sys/lib/python/mercurial/hgweb/hgweb_mod.pyR�sJ


 !
&					ccs�|idd�}xi|ii�D]X\}}||jp|idd|�o(h|d<|dd<|d<Vq"q"WdS(NRt
allow_archivetallowRZit	extensionRX(R3RqRrR2(R+tnodeidtallowedtiR�((s,/sys/lib/python/mercurial/hgweb/hgweb_mod.pytarchivelists
$sapplication/x-tarttbz2s.tar.bz2Rttgzs.tar.gzRsapplication/zipRs.zipcCs|iid�}|idd�}|o8|p|dgjp
||jottd��n|idd�}|p
|dgj}|p
||jpttd��n|djo|iottd��n#|djp
|d	jod	Sn|id
djod}tt|��n|iid
�}|iddt	�o |djott
d��n|idd�}	|	o8|p|	dgjp
||	jottd��n|idd�}
|
o|
dgjp
||
j}|pttd��nd	S(s�Check permission for operation based on request data (including
        authentication info). Return if op allowed, else raise an ErrorResponse
        exception.tREMOTE_USERRt	deny_readt*sread not authorizedt
allow_readRspull not authorizedNtREQUEST_METHODtPOSTspush requires POST requestswsgi.url_schemetpush_sslR�sssl requiredt	deny_pushspush not authorizedt
allow_push(RHR@R3RRR8RtR
R2R$R(R+RJtoptuserR�R�tresultR�tschemetdenyR�((s,/sys/lib/python/mercurial/hgweb/hgweb_mod.pyRhs2,#,#N(sapplication/x-tarstbz2s.tar.bz2N(sapplication/x-tarstgzs.tar.gzN(sapplication/zipszips.zipN(t__name__t
__module__RtR.R$R)tFalseR2R3R;RFRKRGRR�RqRh(((s,/sys/lib/python/mercurial/hgweb/hgweb_mod.pyRs	
			y	>			(R>t	mercurialRRRRRRtcommonRRRR	R
RRR
trequestRRpReR�RgtobjectR(((s,/sys/lib/python/mercurial/hgweb/hgweb_mod.pys<module>	s."$			

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.