On vire cp.py et cranslib/mail/__init__.py qui sont moches et ne servent qu'à l'intranet1.
On en profite pour déplacer quota.py
This commit is contained in:
parent
670b3616b8
commit
93f35d0aa4
3 changed files with 0 additions and 41 deletions
|
@ -1,41 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: iso-8859-15 -*-
|
||||
# #############################################################
|
||||
# ..
|
||||
# .... ............ ........
|
||||
# . ....... . .... ..
|
||||
# . ... .. .. .. .. ..... . ..
|
||||
# .. .. ....@@@. .. . ........ .
|
||||
# .. . .. ..@.@@..@@. .@@@@@@@ @@@@@@. ....
|
||||
# .@@@@. .@@@@. .@@@@..@@.@@..@@@..@@@..@@@@.... ....
|
||||
# @@@@... .@@@.. @@ @@ .@..@@..@@...@@@. .@@@@@. ..
|
||||
# .@@@.. . @@@. @@.@@..@@.@@..@@@ @@ .@@@@@@.. .....
|
||||
# ...@@@.... @@@ .@@.......... ........ ..... ..
|
||||
# . ..@@@@.. . .@@@@. .. ....... . .............
|
||||
# . .. .... .. .. . ... ....
|
||||
# . . .... ............. .. ...
|
||||
# .. .. ... ........ ... ...
|
||||
# ................................
|
||||
#
|
||||
# #############################################################
|
||||
"""
|
||||
cp.py
|
||||
|
||||
Fonctions pour cherrypy (intranet)
|
||||
|
||||
Copyright (c) 2006 by www.crans.org
|
||||
"""
|
||||
import cherrypy
|
||||
|
||||
def log(string, keyword = "INTRANET", level = 0):
|
||||
"""Utilise la fonction log de cherrypy avec quelques modification
|
||||
|
||||
-> introduit le login de la session en cours s'il existe
|
||||
"""
|
||||
try:
|
||||
login = cherrypy.session['uid']
|
||||
string = u"[%s] %s" % ( login, string )
|
||||
except:
|
||||
pass
|
||||
string = string.encode("utf-8")
|
||||
cherrypy.log(string, keyword, level)
|
|
@ -1,50 +0,0 @@
|
|||
|
||||
# -*- coding: utf8 -*-
|
||||
import os
|
||||
|
||||
LABELS = {
|
||||
"/home":u"Dossier personnel",
|
||||
"/var/mail":u"Boite de réception"
|
||||
}
|
||||
|
||||
def getFloat( chose ):
|
||||
chose = chose.replace(',', '.')
|
||||
return float(chose)
|
||||
|
||||
def getUserQuota( userLogin ):
|
||||
pipe = os.popen("sudo quota %s" % userLogin)
|
||||
string_result = pipe.read()
|
||||
pipe.close()
|
||||
string_result = string_result.split("\n")
|
||||
quotas = []
|
||||
for a_line in string_result[2:3]:
|
||||
usage, quota, limite, percentage, fs = a_line.split("\t")
|
||||
line_dict = {
|
||||
"label": "Quota personnel",
|
||||
"usage":getFloat(usage),
|
||||
"quota":getFloat(quota),
|
||||
"limite":getFloat(limite),
|
||||
"%":getFloat(percentage),
|
||||
"filesystem":"rda", # pourquoi pas ?
|
||||
}
|
||||
quotas.append(line_dict)
|
||||
return quotas
|
||||
|
||||
|
||||
|
||||
def fake_getUserQuota( userLogin ):
|
||||
return [
|
||||
{'%': 33.9,
|
||||
'quota': 390.62,
|
||||
'label': u'Dossier personnel (fake)',
|
||||
'limite': 585.94,
|
||||
'filesystem': '/home',
|
||||
'usage': 420.32},
|
||||
{'%': 0.1,
|
||||
'quota': 100.00,
|
||||
'label': u'Boite de r\xe9ception (fake)',
|
||||
'limite': 150.00,
|
||||
'filesystem': '/var/mail',
|
||||
'usage': 0.06}
|
||||
]
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue