scripts/lib/cp.py
Nicolas Dandrimont 9e4d3f9ab4 [cherrypy] Trop merci les chaines unicode pour logguer
Ignore-this: 822a4cd893d813004a6f172495e46a6f

darcs-hash:20120806180546-ffbb2-0236bc541234aed5d94df386a865d917f2d79252.gz
2012-08-06 20:05:46 +02:00

41 lines
1.5 KiB
Python
Executable file

#!/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)