ok

Mini Shell

Direktori : /proc/self/root/proc/thread-self/root/usr/lib64/python2.7/Demo/scripts/
Upload File :
Current File : //proc/self/root/proc/thread-self/root/usr/lib64/python2.7/Demo/scripts/newslist.pyc

�
V
�Qc@s�ddlZddlZddlZddlZddlZejjd�ZdZdZ	dZ
eZdZdZ
dZd	Zd
ZxXejejdfD]@Zejjed�Zejje�r�eGHee�Pq�q�Wdd
lmZddlTdZdjed�ej���Ziaejjee	�Z	ejjee
�Z
ejjee�Zd�Zd�Z d�Z!d�Z"d�Z#d�Z$d�Z%d�Z&d�Z'd�Z(d�Z)e*dkr�e)�ndS(i����Ns
~/newspagesnews.example.comt	grouptreet
newsgroupsttrootis;... <img src="http://pelican.cl.cam.ac.uk/icons/page.xbm"> itHOMEs.newslistrc.py(tNNTP(t*s
$Revision$t cCs
d|kS(Nt$((ts((s-/usr/lib64/python2.7/Demo/scripts/newslist.pyt<lambda>mscCs6dGHx*|D]"}|jd�}t||�qWdS(NsUpdating tree...t.(tsplittmakeleaf(ttreetgroupstitparts((s-/usr/lib64/python2.7/Demo/scripts/newslist.pyt	addtotreexs
cCst|d}t|�}||kr/i||<n|dkrLd||d<n|dkrpt|||d�ndS(NiiR(tlenR
(Rtpathtjtl((s-/usr/lib64/python2.7/Demo/scripts/newslist.pyR
s

c	Cstjjt|d�}|tkr.d}n
d|}t|d���}|jd�|jd|�|jd�|jd|�|jd	ttf�t||d
|�|jd�|jdt	�|jt
jt
j
��d
�|jd�WdQXdS(Ns.htmlRs under tws<html>
<head>
s&<title>Newsgroups available%s</title>
s</head>
<body>
s <h1>Newsgroups available%s</h1>
s-<a href="%s%s.html">Back to top level</a><p>
is
<p>s7<i>This page automatically created by 'newslist' v. %s.s</i>
s</body>
</html>
(tosRtjointpagedirtrootpagetopentwritethttppreft	printtreetrcsrevttimetctime(RRtptfilenametdetailtf((s-/usr/lib64/python2.7/Demo/scripts/newslist.pyt
createpage�s"	


	
	 cCs�t|�}|tkr}|dkr}|jdt|df�|j|dd�|jdt�t|d||�dS|j�}|dkr�|j�|dkr�|jd|d�n
|jd�|d}nx�|D]�}|dkrQ|jd	|d|df�|dtkrA|jd
t|d�qp|jd�q�t	|||||d|�q�W|dkr�|jd�ndS(
Nis<li><b><a href="%s%s.html">is.*s</a></b>%s
s<li>%s
<ul>s<ul>Rs<li><a href="news:%s">%s</a> s     <i>%s</i>
s
s
</ul>(
RtsublistsizeRRtpagelinkiconR'tkeystsorttdescR(R&RtindentR#RtklR((s-/usr/lib64/python2.7/Demo/scripts/newslist.pyR�s.



#c
Cs�ia|dkrdSy�t|d��}}dGHxn|D]f}|j�}y@|d}dj|d�}t|�dkr�|t|<nWq7tk
r�q7Xq7WWdQXWntk
r�d|GHdSXdS(NRtrsReading descriptions...iRis Failed to open description file (R,RRRRt
IndexErrortIOError(tdescfiletdRtbitstgrptdsc((s-/usr/lib64/python2.7/Demo/scripts/newslist.pytreaddesc�s$



	cCs�tjj|�s�d|GHdGHtjj�ddkrlytj|d�Wq~dGHtjd�q~Xq�dGHtjd�ndS(	NsDirectory %s does not exist.s Shall I create it for you? (y/n)ityi�sSorry - failed!isOK. Exiting.(RRtisdirtsyststdintreadlinetmkdirtexit(R((s-/usr/lib64/python2.7/Demo/scripts/newslist.pyt
checkopdir�s	cCs�dGHi}y tjtj|�t�}Wn'd|GHdGHdGHtjd�nXd|dd|d|d	f}y+t|d
��}tj	|�}WdQXWnt
k
r�d|GHnX||fS(Ns#Reading current local group list...s&
*** Failed to open local group cache s5If this is the first time you have run newslist, thensuse the -a option to create it.is%02d%02d%02diiditrbsCannot open local group list (R!t	localtimeRtstattST_MTIMER:R>RtmarshaltloadR1(ttreefileRttreetimettreedatetdump((s-/usr/lib64/python2.7/Demo/scripts/newslist.pyt
readlocallist�s  	#

cCs`y7t|d��}tj||�}WdQXd|GHWn"dG|GHdGHtjd�nXdS(NtwbsSaved list to %s
s,Sorry - failed to write to local group caches8Does it (or its directory) have the correct permissions?i(RRDRIR:R>(RFRRIR((s-/usr/lib64/python2.7/Demo/scripts/newslist.pytwritelocallists
	cCs�dGHd}|j�d}g}dGHtr4dGHnx`|D]X}|dj�d}tr�t|d�t|d�kr�|dGq;|j|�q;Wd	GHtr�d
GHn|S(NsGetting list of all groups...t010101is
Processing...s!
Ignoring following empty groups:iiRs
s(End of empty groups)(tlistt	skipemptyRtinttappend(tserverRHtinfoRRtgrpname((s-/usr/lib64/python2.7/Demo/scripts/newslist.pytgetallgroupss 
&cCsnd|G|j|d�d}dt|�GHdGg}x+|D]#}|j�d}|j|�q>WdGH|S(Ns/Getting list of new groups since start of %s...t000001isgot %d.s
Processing...itDone(t	newgroupsRRRQ(RRRHRSRRRT((s-/usr/lib64/python2.7/Demo/scripts/newslist.pytgetnewgroups/s
cCs<i}tt�yDdtGHtjddkrAtjt�}ntt�}t}Wn3tj	tj
fk
r�}dG|GHdGHt}nX|r�ttj
�dkr�tj
ddkr�t|�}n*tt�\}}|r�t||�}n|rt||�tt|�ntt�dGHtt|d	�d
GHdS(NsConnecting to %s...it0sError connecting to host:s$I'll try to use just the local list.is-asCreating pages...RRW(R?RtnewshostR:tversionRtinittTruetnntplibt
error_tempt
error_permtFalseRtargvRURJRFRYRRLR7R2R'R(RR	t	connectedtxRRH((s-/usr/lib64/python2.7/Demo/scripts/newslist.pytmain=s0
	
	
.

t__main__(+R:R_RDR!RRt
expanduserttopdirR[RFR2RRRROR)R(tcurdirtenvirontdirRtrcfiletexiststexecfileRRBR tfilterRR,tpageRR
R'RR7R?RJRLRURYRft__name__(((s-/usr/lib64/python2.7/Demo/scripts/newslist.pyt<module>#sJ<	

!				*							)

Zerion Mini Shell 1.0