Utilisation d'un vrai fichier temporaire
darcs-hash:20080822072741-69ccb-44a5eeca9bc7f441905699bc532e721d372b311a.gz
This commit is contained in:
parent
eeb9d8be58
commit
f328ff6f3b
1 changed files with 5 additions and 9 deletions
|
@ -1,10 +1,10 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
fichier = '/var/lib/munin/tmp/wiki_pages'
|
fichier = '/var/lib/munin/tmp/wiki_pages'
|
||||||
|
|
||||||
|
|
||||||
import sys,os
|
import sys,os
|
||||||
|
import tempfile
|
||||||
from MoinMoin.request import RequestCLI
|
from MoinMoin.request import RequestCLI
|
||||||
|
|
||||||
sys.path.insert(0, '/etc/moin')
|
sys.path.insert(0, '/etc/moin')
|
||||||
|
@ -26,7 +26,6 @@ if arg == "config" :
|
||||||
print 'orphelines.draw AREA'
|
print 'orphelines.draw AREA'
|
||||||
|
|
||||||
elif arg == "fichier" :
|
elif arg == "fichier" :
|
||||||
file = open('%s.next' % fichier,'w')
|
|
||||||
|
|
||||||
request = RequestCLI(u"wiki.crans.org/")
|
request = RequestCLI(u"wiki.crans.org/")
|
||||||
request.form = request.args = request.setup_args()
|
request.form = request.args = request.setup_args()
|
||||||
|
@ -50,16 +49,13 @@ elif arg == "fichier" :
|
||||||
if link in orphaned:
|
if link in orphaned:
|
||||||
del orphaned[link]
|
del orphaned[link]
|
||||||
|
|
||||||
|
fichier_temp = tempfile.mktemp()
|
||||||
# return a list of page links
|
file = open('%s' % fichier_temp,'w')
|
||||||
print
|
|
||||||
|
|
||||||
|
|
||||||
file.write("total.value %d\n" % pages.__len__())
|
file.write("total.value %d\n" % pages.__len__())
|
||||||
|
|
||||||
file.write("orphelines.value %d\n" % orphaned.__len__())
|
file.write("orphelines.value %d\n" % orphaned.__len__())
|
||||||
|
|
||||||
file.close()
|
file.close()
|
||||||
os.system('mv %s.next %s' % (fichier, fichier))
|
|
||||||
|
os.system('mv %s %s' % (fichier_temp, fichier))
|
||||||
else :
|
else :
|
||||||
os.system('cat %s' % fichier)
|
os.system('cat %s' % fichier)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue