summaryrefslogtreecommitdiffstats
path: root/pykolab
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2013-01-23 13:07:03 +0000
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2013-01-23 13:07:03 +0000
commit5eb47567db404d424f8012ade2b5e07a468d99c2 (patch)
tree253a1368ab53f0fdc57fdee86ff7d64f66411e3f /pykolab
parent20976669015cde7e31319a9e727a4d0750690cc8 (diff)
downloadpykolab-5eb47567db404d424f8012ade2b5e07a468d99c2.tar.gz
Suppress print statements and replace them with better log statements
Diffstat (limited to 'pykolab')
-rw-r--r--pykolab/cli/sieve/cmd_refresh.py22
-rw-r--r--pykolab/plugins/sievemgmt/__init__.py27
2 files changed, 24 insertions, 25 deletions
diff --git a/pykolab/cli/sieve/cmd_refresh.py b/pykolab/cli/sieve/cmd_refresh.py
index 91e19cb..f672410 100644
--- a/pykolab/cli/sieve/cmd_refresh.py
+++ b/pykolab/cli/sieve/cmd_refresh.py
@@ -96,9 +96,8 @@ def execute(*args, **kw):
else:
active, scripts = result
-
- print "Found the following scripts: %s" % (','.join(scripts))
- print "And the following script is active: %s" % (active)
+ log.debug(_("Found the following scripts for user %s: %s") % (address, ','.join(scripts)), level=8)
+ log.deubg(_("And the following script is active for user %s: %s") % (address, active), level=8)
mgmt_required_extensions = []
@@ -354,14 +353,14 @@ def execute(*args, **kw):
mgmt_script = mgmt_script.__str__()
- log.debug(_("MANAGEMENT Script contents: %r") % (mgmt_script), level=9)
+ log.debug(_("MANAGEMENT script for user %s contents: %r") % (address,mgmt_script), level=9)
result = sieveclient.putscript("MANAGEMENT", mgmt_script)
if not result:
- print "Putting in script MANAGEMENT failed...?"
+ log.error(_("Uploading script MANAGEMENT failed for user %s") % (address))
else:
- print "Putting in script MANAGEMENT succeeded"
+ log.debug(_("Uploading script MANAGEMENT for user %s succeeded") % (address), level=8)
user_script = """#
# User
@@ -372,17 +371,18 @@ require ["include"];
for script in scripts:
if not script in [ "MASTER", "MANAGEMENT", "USER" ]:
- print "Including script %s in USER" % (script)
+ log.debug(_("Including script %s in USER (for user %s)") % (script,address) ,level=8)
user_script = """%s
include :personal "%s";
""" % (user_script, script)
result = sieveclient.putscript("USER", user_script)
+
if not result:
- print "Putting in script USER failed...?"
+ log.error(_("Uploading script USER failed for user %s") % (address))
else:
- print "Putting in script USER succeeded"
+ log.debug(_("Uploading script USER for user %s succeeded") % (address), level=8)
result = sieveclient.putscript("MASTER", """#
# MASTER
@@ -410,8 +410,8 @@ include :personal "USER";
""")
if not result:
- print "Putting in script MASTER failed...?"
+ log.error(_("Uploading script MASTER failed for user %s") % (address))
else:
- print "Putting in script MASTER succeeded"
+ log.debug(_("Uploading script MASTER for user %s succeeded") % (address), level=8)
sieveclient.setactive("MASTER")
diff --git a/pykolab/plugins/sievemgmt/__init__.py b/pykolab/plugins/sievemgmt/__init__.py
index 9a47423..df4720c 100644
--- a/pykolab/plugins/sievemgmt/__init__.py
+++ b/pykolab/plugins/sievemgmt/__init__.py
@@ -58,7 +58,6 @@ class KolabSievemgmt(object):
user = auth.find_recipient(address)
- print user, address
log.info("User for address %r: %r" % (address, user))
# Get the main, default backend
@@ -109,9 +108,8 @@ class KolabSievemgmt(object):
else:
active, scripts = result
-
- print "Found the following scripts: %s" % (','.join(scripts))
- print "And the following script is active: %s" % (active)
+ log.debug(_("Found the following scripts for user %s: %s") % (address, ','.join(scripts)), level=8)
+ log.deubg(_("And the following script is active for user %s: %s") % (address, active), level=8)
mgmt_required_extensions = []
@@ -370,9 +368,9 @@ class KolabSievemgmt(object):
result = sieveclient.putscript("MANAGEMENT", mgmt_script)
if not result:
- print "Putting in script MANAGEMENT failed...?"
- #else:
- #print "Putting in script MANAGEMENT succeeded"
+ log.error(_("Uploading script MANAGEMENT failed for user %s") % (address))
+ else:
+ log.debug(_("Uploading script MANAGEMENT for user %s succeeded") % (address), level=8)
user_script = """#
# User
@@ -383,17 +381,18 @@ require ["include"];
for script in scripts:
if not script in [ "MASTER", "MANAGEMENT", "USER" ]:
- #print "Including script %s in USER" % (script)
+ log.debug(_("Including script %s in USER (for user %s)") % (script,address) ,level=8)
user_script = """%s
include :personal "%s";
""" % (user_script, script)
result = sieveclient.putscript("USER", user_script)
+
if not result:
- print "Putting in script USER failed...?"
- #else:
- #print "Putting in script USER succeeded"
+ log.error(_("Uploading script USER failed for user %s") % (address))
+ else:
+ log.debug(_("Uploading script USER for user %s succeeded") % (address), level=8)
result = sieveclient.putscript("MASTER", """#
# MASTER
@@ -421,9 +420,9 @@ include :personal "USER";
""")
if not result:
- print "Putting in script MASTER failed...?"
- #else:
- #print "Putting in script MASTER succeeded"
+ log.error(_("Uploading script MASTER failed for user %s") % (address))
+ else:
+ log.debug(_("Uploading script MASTER for user %s succeeded") % (address), level=8)
sieveclient.setactive("MASTER")