[dev] [en] [patch] Better pep8 support, trailing whitespaces/semicolons removal and new-style class everywhere

Emmanuel Gil Peyrot linkmauve at linkmauve.fr
Ven 18 Jan 18:44:31 CET 2013


On Fri, Jan 18, 2013 at 06:34:48PM +0100, Emmanuel Gil Peyrot wrote:
[a mail]

Hum, sorry, I forgot the patches… -_-'

-- 
Emmanuel Gil Peyrot
XMPP: <linkmauve at linkmauve.fr>
OpenPGP: 24B1D609
-------------- section suivante --------------
exporting patches:
# HG changeset patch
# User Emmanuel Gil Peyrot <linkmauve at linkmauve.fr>
# Date 1358527988 -3600
# Node ID 9902ec2d8d9bf52a3f70f82ff75adf322f50398b
# Parent  1524c2c07256d9de1de8db06ae876c267fce033b
Remove useless trailing semicolons.

diff --git a/frontends/src/quick_frontend/quick_app.py b/frontends/src/quick_frontend/quick_app.py
--- a/frontends/src/quick_frontend/quick_app.py
+++ b/frontends/src/quick_frontend/quick_app.py
@@ -298,7 +298,7 @@
     def presenceUpdate(self, jabber_id, show, priority, statuses, profile):
         if not self.check_profile(profile):
             return
-        debug (_("presence update for %(jid)s (show=%(show)s, priority=%(priority)s, statuses=%(statuses)s) [profile:%(profile)s]") % {'jid':jabber_id, 'show':show, 'priority':priority, 'statuses':statuses, 'profile':profile});
+        debug (_("presence update for %(jid)s (show=%(show)s, priority=%(priority)s, statuses=%(statuses)s) [profile:%(profile)s]") % {'jid':jabber_id, 'show':show, 'priority':priority, 'statuses':statuses, 'profile':profile})
         from_jid=JID(jabber_id)
         debug ("from_jid.short=%(from_jid)s whoami.short=%(whoami)s" % {'from_jid':from_jid.short, 'whoami':self.profiles[profile]['whoami'].short})
 
diff --git a/src/memory/persistent.py b/src/memory/persistent.py
--- a/src/memory/persistent.py
+++ b/src/memory/persistent.py
@@ -34,7 +34,7 @@
         """@param namespace: unique namespace for this dictionary
         @param profile: profile which *MUST* exists, or None for general values"""
         if not self.storage:
-            error(_("PersistentDict can't be used before memory initialisation"));
+            error(_("PersistentDict can't be used before memory initialisation"))
             raise MemoryNotInitializedError
         self._cache = {}
         self.namespace = namespace
diff --git a/src/plugins/plugin_exp_pipe.py b/src/plugins/plugin_exp_pipe.py
--- a/src/plugins/plugin_exp_pipe.py
+++ b/src/plugins/plugin_exp_pipe.py
@@ -63,7 +63,7 @@
     def _kill_id(self, approval_id, profile):
         """Delete a waiting_for_approval id, called after timeout
         @param approval_id: id of _pipe_waiting_for_approval"""
-        info(_("SI Pipe Transfer: TimeOut reached for id %s") % approval_id);
+        info(_("SI Pipe Transfer: TimeOut reached for id %s") % approval_id)
         try:
             client = self.host.getClient(profile)
             del client._pipe_waiting_for_approval[approval_id]
diff --git a/src/plugins/plugin_xep_0047.py b/src/plugins/plugin_xep_0047.py
--- a/src/plugins/plugin_xep_0047.py
+++ b/src/plugins/plugin_xep_0047.py
@@ -76,7 +76,7 @@
     def _timeOut(self, sid, profile):
         """Delecte current_stream id, called after timeout
         @param id: id of client.xep_0047_current_stream"""
-        info(_("In-Band Bytestream: TimeOut reached for id %s [%s]") % (sid, profile));
+        info(_("In-Band Bytestream: TimeOut reached for id %s [%s]") % (sid, profile))
         self._killId(sid, False, "TIMEOUT", profile)
     
     def _killId(self, sid, success=False, failure_reason="UNKNOWN", profile=None):
@@ -292,7 +292,7 @@
             raise ProfileNotInCacheError
         if length != None:
             error(_('stream length not managed yet'))
-            return;
+            return
         data = client.xep_0047_current_stream[sid] = {}
         data["timer"] = reactor.callLater(TIMEOUT, self._timeOut, sid)
         data["file_obj"] = file_obj
diff --git a/src/plugins/plugin_xep_0065.py b/src/plugins/plugin_xep_0065.py
--- a/src/plugins/plugin_xep_0065.py
+++ b/src/plugins/plugin_xep_0065.py
@@ -507,7 +507,7 @@
     def _timeOut(self, sid, profile):
         """Delecte current_stream id, called after timeout
         @param id: id of client.xep_0065_current_stream"""
-        info(_("Socks5 Bytestream: TimeOut reached for id %s [%s]") % (sid, profile));
+        info(_("Socks5 Bytestream: TimeOut reached for id %s [%s]") % (sid, profile))
         self._killId(sid, False, "TIMEOUT", profile)
     
     def _killId(self, sid, success=False, failure_reason="UNKNOWN", profile=None):
@@ -561,7 +561,7 @@
         
         if length != None:
             error(_('stream length not managed yet'))
-            return;
+            return
         
         profile_jid = client.jid
         xmlstream = client.xmlstream
diff --git a/src/plugins/plugin_xep_0096.py b/src/plugins/plugin_xep_0096.py
--- a/src/plugins/plugin_xep_0096.py
+++ b/src/plugins/plugin_xep_0096.py
@@ -63,7 +63,7 @@
     def _kill_id(self, approval_id, profile):
         """Delete a waiting_for_approval id, called after timeout
         @param approval_id: id of _xep_0096_waiting_for_approval"""
-        info(_("SI File Transfer: TimeOut reached for id %s") % approval_id);
+        info(_("SI File Transfer: TimeOut reached for id %s") % approval_id)
         try:
             client = self.host.getClient(profile)
             del client._xep_0096_waiting_for_approval[approval_id]
# HG changeset patch
# User Emmanuel Gil Peyrot <linkmauve at linkmauve.fr>
# Date 1358528127 -3600
# Node ID 6a718ede8be1bf3651308788fc2ab7745ddaf376
# Parent  9902ec2d8d9bf52a3f70f82ff75adf322f50398b
Fix coding style in setup.py.

diff --git a/distribute_setup.py b/distribute_setup.py
--- a/distribute_setup.py
+++ b/distribute_setup.py
@@ -30,13 +30,14 @@
     import subprocess
 
     def _python_cmd(*args):
-        args = (sys.executable,) + args
+        args = (sys.executable, ) + args
         return subprocess.call(args) == 0
 
 except ImportError:
+
     # will be used for python 2.3
     def _python_cmd(*args):
-        args = (sys.executable,) + args
+        args = (sys.executable, ) + args
         # quoting arguments if windows
         if sys.platform == 'win32':
             def quote(arg):
@@ -144,17 +145,17 @@
         except ImportError:
             return _do_download(version, download_base, to_dir, download_delay)
         try:
-            pkg_resources.require("distribute>="+version)
+            pkg_resources.require("distribute>=" + version)
             return
         except pkg_resources.VersionConflict:
             e = sys.exc_info()[1]
             if was_imported:
                 sys.stderr.write(
-                "The required version of distribute (>=%s) is not available,\n"
-                "and can't be installed while this script is running. Please\n"
-                "install a more recent version first, using\n"
-                "'easy_install -U distribute'."
-                "\n\n(Currently using %r)\n" % (version, e.args[0]))
+                    "The required version of distribute (>=%s) is not available,\n"
+                    "and can't be installed while this script is running. Please\n"
+                    "install a more recent version first, using\n"
+                    "'easy_install -U distribute'."
+                    "\n\n(Currently using %r)\n" % (version, e.args[0]))
                 sys.exit(2)
             else:
                 del pkg_resources, sys.modules['pkg_resources']    # reload ok
@@ -167,6 +168,7 @@
         if not no_fake:
             _create_fake_setuptools_pkg_info(to_dir)
 
+
 def download_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL,
                         to_dir=os.curdir, delay=15):
     """Download distribute from a specified location and return its filename
@@ -203,6 +205,7 @@
                 dst.close()
     return os.path.realpath(saveto)
 
+
 def _no_sandbox(function):
     def __no_sandbox(*args, **kw):
         try:
@@ -227,6 +230,7 @@
 
     return __no_sandbox
 
+
 def _patch_file(path, content):
     """Will backup the file then patch it"""
     existing_content = open(path).read()
@@ -245,15 +249,18 @@
 
 _patch_file = _no_sandbox(_patch_file)
 
+
 def _same_content(path, content):
     return open(path).read() == content
 
+
 def _rename_path(path):
     new_name = path + '.OLD.%s' % time.time()
     log.warn('Renaming %s into %s', path, new_name)
     os.rename(path, new_name)
     return new_name
 
+
 def _remove_flat_installation(placeholder):
     if not os.path.isdir(placeholder):
         log.warn('Unkown installation at %s', placeholder)
@@ -289,18 +296,20 @@
 
 _remove_flat_installation = _no_sandbox(_remove_flat_installation)
 
+
 def _after_install(dist):
     log.warn('After install bootstrap.')
     placeholder = dist.get_command_obj('install').install_purelib
     _create_fake_setuptools_pkg_info(placeholder)
 
+
 def _create_fake_setuptools_pkg_info(placeholder):
     if not placeholder or not os.path.exists(placeholder):
         log.warn('Could not find the install location')
         return
     pyver = '%s.%s' % (sys.version_info[0], sys.version_info[1])
     setuptools_file = 'setuptools-%s-py%s.egg-info' % \
-            (SETUPTOOLS_FAKED_VERSION, pyver)
+        (SETUPTOOLS_FAKED_VERSION, pyver)
     pkg_info = os.path.join(placeholder, setuptools_file)
     if os.path.exists(pkg_info):
         log.warn('%s already exists', pkg_info)
@@ -323,6 +332,7 @@
 
 _create_fake_setuptools_pkg_info = _no_sandbox(_create_fake_setuptools_pkg_info)
 
+
 def _patch_egg_dir(path):
     # let's check if it's already patched
     pkg_info = os.path.join(path, 'EGG-INFO', 'PKG-INFO')
@@ -343,6 +353,7 @@
 
 _patch_egg_dir = _no_sandbox(_patch_egg_dir)
 
+
 def _before_install():
     log.warn('Before install bootstrap.')
     _fake_setuptools()
@@ -351,7 +362,7 @@
 def _under_prefix(location):
     if 'install' not in sys.argv:
         return True
-    args = sys.argv[sys.argv.index('install')+1:]
+    args = sys.argv[sys.argv.index('install') + 1:]
     for index, arg in enumerate(args):
         for option in ('--root', '--prefix'):
             if arg.startswith('%s=' % option):
@@ -359,7 +370,7 @@
                 return location.startswith(top_dir)
             elif arg == option:
                 if len(args) > index:
-                    top_dir = args[index+1]
+                    top_dir = args[index + 1]
                     return location.startswith(top_dir)
         if arg == '--user' and USER_SITE is not None:
             return location.startswith(USER_SITE)
@@ -406,7 +417,7 @@
         log.warn('Egg installation')
         pkg_info = os.path.join(setuptools_location, 'EGG-INFO', 'PKG-INFO')
         if (os.path.exists(pkg_info) and
-            _same_content(pkg_info, SETUPTOOLS_PKG_INFO)):
+                _same_content(pkg_info, SETUPTOOLS_PKG_INFO)):
             log.warn('Already patched.')
             return
         log.warn('Patching...')
@@ -448,7 +459,7 @@
             # Extract directories with a safe mode.
             directories.append(tarinfo)
             tarinfo = copy.copy(tarinfo)
-            tarinfo.mode = 448 # decimal for oct 0700
+            tarinfo.mode = 448  # decimal for oct 0700
         self.extract(tarinfo, path)
 
     # Reverse sort directories.
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -24,36 +24,41 @@
 from setuptools.command.install import install
 from setuptools import setup
 from distutils.file_util import copy_file
-import os,sys,subprocess
+import os
+import sys
+import subprocess
 from stat import ST_MODE
 
 NAME = 'sat'
 LAUNCH_DAEMON_COMMAND = 'sat'
 
+
 class MercurialException(Exception):
     pass
 
+
 def module_installed(module_name):
     """Try to import module_name, and return False if it failed
     @param module_name: name of the module to test
     @return: True if successful"""
     try:
         __import__(module_name)
-    except:
+    except ImportError:
         return False
     return True
 
-class custom_install(install):
-    
+
+class CustomInstall(install):
+
     def custom_auto_options(self):
         """Change options for twistd in the shell script
         Mainly change the paths"""
         sh_buffer = ""
         run_dir = os.path.dirname(self.sh_script_path)
-        with open(self.sh_script_path,'r') as sh_file:
+        with open(self.sh_script_path, 'r') as sh_file:
             for ori_line in sh_file:
                 if ori_line.startswith('DAEMON='):
-                    dest_line = 'DAEMON=""\n' #we want to launch sat as a daemon
+                    dest_line = 'DAEMON=""\n'  # we want to launch sat as a daemon
                 elif ori_line.startswith('TAP_PATH='):
                     dest_line = 'TAP_PATH="%s/"\n' % run_dir
                 elif ori_line.startswith('PYTHON='):
@@ -61,28 +66,27 @@
                 else:
                     dest_line = ori_line
                 sh_buffer += dest_line
-        
-        with open(self.sh_script_path,'w') as sh_file:
+
+        with open(self.sh_script_path, 'w') as sh_file:
             sh_file.write(sh_buffer)
 
-    
     def custom_create_links(self):
         """Create symbolic links to executables"""
-        #the script which launch the daemon
-        links = [(self.sh_script_path,LAUNCH_DAEMON_COMMAND),]
-        for source,dest in links:
+        # the script which launch the daemon
+        links = [(self.sh_script_path, LAUNCH_DAEMON_COMMAND)]
+        for source, dest in links:
             dest_name, copied = copy_file(source, os.path.join(self.install_scripts, dest), link='sym')
             assert (copied)
-            #we change the perm in the same way as in the original install_scripts
+            # we change the perm in the same way as in the original install_scripts
             mode = ((os.stat(dest_name)[ST_MODE]) | 0555) & 07777
             os.chmod(dest_name, mode)
 
     def run(self):
         install.run(self)
-        sys.stdout.write ('running post installation stuff\n')
+        sys.stdout.write('running post installation stuff\n')
         sys.stdout.flush()
-        self.sh_script_path = os.path.join(self.install_lib,'sat','sat.sh')
-        self.primitivus_path = os.path.join(self.install_lib,'sat_frontends','primitivus')
+        self.sh_script_path = os.path.join(self.install_lib, 'sat', 'sat.sh')
+        self.primitivus_path = os.path.join(self.install_lib, 'sat_frontends', 'primitivus')
         self.custom_auto_options()
         self.custom_create_links()
 
@@ -92,53 +96,53 @@
     This ugly stuff is necessary as distributions are not installed correctly with setuptools/distribute
     Hope to remove this at some point"""
 
-    #modules_tocheck=['twisted', 'twisted.words', 'twisted.web', 'wx', 'urwid']
-    modules_tocheck=['wx','gobject'] #XXX: wx is the only one to be really difficult to install, python-gobject is not up-to-date in PyPi
+    #modules_tocheck = ['twisted', 'twisted.words', 'twisted.web', 'wx', 'urwid']
+    modules_tocheck = ['wx', 'gobject']  # XXX: wx is the only one to be really difficult to install, python-gobject is not up-to-date in PyPi
 
-    package = {'twisted':'python-twisted-core',
-               'twisted.words':'python-twisted-words',
-               'twisted.web':'python-twisted-web',
-               'wx':'python-wxgtk2.8',
-               'urwid':'python-urwid',
-               'gobject':'python-gobject',
-               'mercurial':'mercurial'} #this dict map dependencies to packages names for debian distributions
+    package = {'twisted': 'python-twisted-core',
+               'twisted.words': 'python-twisted-words',
+               'twisted.web': 'python-twisted-web',
+               'wx': 'python-wxgtk2.8',
+               'urwid': 'python-urwid',
+               'gobject': 'python-gobject',
+               'mercurial': 'mercurial'}  # this dict map dependencies to packages names for debian distributions
 
-    sys.stdout.write ("Running pre-installation dependencies check\n")
-    
-    #which modules are not installed ?
-    modules_toinstall = filter(lambda mod:not module_installed(mod),modules_tocheck)
-    """#is mercurial available ?
+    sys.stdout.write("Running pre-installation dependencies check\n")
+
+    # which modules are not installed ?
+    modules_toinstall = [mod for mod in modules_tocheck if not module_installed(mod)]
+    """# is mercurial available ?
     hg_installed = subprocess.call('which hg', stdout=open('/dev/null', 'w'), shell=True) == 0
     if not hg_installed:
-        modules_toinstall.append('mercurial')""" #hg can be installed from pypi
-    
+        modules_toinstall.append('mercurial')"""  # hg can be installed from pypi
+
     if modules_toinstall:
-        #are we on a distribution using apt ?
+        # are we on a distribution using apt ?
         apt_path = subprocess.Popen('which apt-get', stdout=subprocess.PIPE, shell=True).communicate()[0][:-1]
-        not_installed=set()
+        not_installed = set()
         if apt_path:
-            #we have apt, we'll try to use it
+            # we have apt, we'll try to use it
             for module_name in modules_toinstall:
                 package_name = package[module_name]
-                sys.stdout.write ("Installing %s\n" % package_name)
-                success = subprocess.call('%s -qy install %s' % (apt_path,package_name), shell=True) == 0
+                sys.stdout.write("Installing %s\n" % package_name)
+                success = subprocess.call('%s -qy install %s' % (apt_path, package_name), shell=True) == 0
                 if not success:
                     not_installed.add(module_name)
         else:
-            not_installed=set(modules_toinstall)
+            not_installed = set(modules_toinstall)
 
         if not_installed:
-            #some packages can't be automatically installed, we print their name for manual installation
-            sys.stdout.write ("You should install the following dependencies with your distribution recommanded tool before installing %s:\n" % NAME)
+            # some packages can't be automatically installed, we print their name for manual installation
+            sys.stdout.write("You should install the following dependencies with your distribution recommanded tool before installing %s:\n" % NAME)
             for module_name in not_installed:
-                sys.stdout.write ("- %s (Debian name: %s)\n" % (module_name,package[module_name]))
+                sys.stdout.write("- %s (Debian name: %s)\n" % (module_name, package[module_name]))
             sys.exit(2)
-            
 
-if sys.argv[1].lower() in ['egg_info','install']:
-    #we only check dependencies if egg_info or install is used
-    install_opt = os.environ.get("SAT_INSTALL","")
-    if not "nopreinstall" in install_opt: #user can force preinstall skipping 
+
+if sys.argv[1].lower() in ['egg_info', 'install']:
+    # we only check dependencies if egg_info or install is used
+    install_opt = os.environ.get("SAT_INSTALL", "")
+    if not "nopreinstall" in install_opt:  # user can force preinstall skipping
         preinstall_check()
 
 setup(name=NAME,
@@ -155,21 +159,20 @@
                    'License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)',
                    'Operating System :: POSIX :: Linux',
                    'Topic :: Communications :: Chat'],
-      package_dir = {'sat':'src', 'sat_frontends':'frontends/src'},
-      packages=['sat','sat.tools','sat.bridge', 'sat.plugins', 'sat.test', 'sat.core', 'sat.memory',
+      package_dir={'sat': 'src', 'sat_frontends': 'frontends/src'},
+      packages=['sat', 'sat.tools', 'sat.bridge', 'sat.plugins', 'sat.test', 'sat.core', 'sat.memory',
                 'sat_frontends', 'sat_frontends.bridge', 'sat_frontends.quick_frontend',
                 'sat_frontends.primitivus', 'sat_frontends.wix'],
-      package_data = {'sat': ['sat.tac','sat.sh'],
-                      'sat_frontends': ['wix/COPYING']},
-      data_files=[(os.path.join(sys.prefix,'share/locale/fr/LC_MESSAGES'), ['i18n/fr/LC_MESSAGES/sat.mo']),
-                  (os.path.join(sys.prefix,'share/locale/fr/LC_MESSAGES'), ['frontends/i18n/fr/LC_MESSAGES/sat_frontend.mo']),
-                  (os.path.join(sys.prefix,'share/locale/fr/LC_MESSAGES'), ['frontends/src/jp/i18n/fr/LC_MESSAGES/jp.mo']),
+      package_data={'sat': ['sat.tac', 'sat.sh'],
+                    'sat_frontends': ['wix/COPYING']},
+      data_files=[(os.path.join(sys.prefix, 'share/locale/fr/LC_MESSAGES'), ['i18n/fr/LC_MESSAGES/sat.mo']),
+                  (os.path.join(sys.prefix, 'share/locale/fr/LC_MESSAGES'), ['frontends/i18n/fr/LC_MESSAGES/sat_frontend.mo']),
+                  (os.path.join(sys.prefix, 'share/locale/fr/LC_MESSAGES'), ['frontends/src/jp/i18n/fr/LC_MESSAGES/jp.mo']),
                   ('share/doc/%s' % NAME, ['CHANGELOG', 'COPYING', 'INSTALL', 'README', 'README4TRANSLATORS']),
                   ],
       scripts=['frontends/src/jp/jp', 'frontends/src/primitivus/primitivus', 'frontends/src/wix/wix'],
       zip_safe=False,
-      dependency_links = ['http://www.blarg.net/%7Esteveha/pyfeed-0.7.4.tar.gz','http://www.blarg.net/%7Esteveha/xe-0.7.4.tar.gz'],
-      install_requires=['twisted', 'wokkel', 'progressbar', 'urwid', 'urwid-satext','pyfeed','xe', 'mutagen'],
-      cmdclass=dict(install=custom_install),
-      ) #XXX: wxpython doesn't work, it's managed with preinstall_check
-
+      dependency_links=['http://www.blarg.net/%7Esteveha/pyfeed-0.7.4.tar.gz', 'http://www.blarg.net/%7Esteveha/xe-0.7.4.tar.gz'],
+      install_requires=['twisted', 'wokkel', 'progressbar', 'urwid', 'urwid-satext', 'pyfeed', 'xe', 'mutagen'],
+      cmdclass={'install': CustomInstall},
+      )  # XXX: wxpython doesn't work, it's managed with preinstall_check
# HG changeset patch
# User Emmanuel Gil Peyrot <linkmauve at linkmauve.fr>
# Date 1358528134 -3600
# Node ID 952322b1d490665c070feef0355950b6e73ab660
# Parent  6a718ede8be1bf3651308788fc2ab7745ddaf376
Remove trailing whitespaces.

diff --git a/CONTRAT_SOCIAL b/CONTRAT_SOCIAL
--- a/CONTRAT_SOCIAL
+++ b/CONTRAT_SOCIAL
@@ -24,5 +24,5 @@
 
 - L'idée de Fraternité est essentielle, aussi:
 	- nous ferons notre possible pour aider les utilisateurs, quel que soit leur niveau
-    - de même, des efforts seront fait quant à l'accessibilité aux personnes victimes d'un handicap 
+    - de même, des efforts seront fait quant à l'accessibilité aux personnes victimes d'un handicap
 	- « Salut à Toi », XMPP, et les technologies utilisées facilitent les échanges électroniques, mais nous désirons mettre l'accent sur les rencontres réelles et humaines: nous favoriserons toujours le réel sur le virtuel.
diff --git a/INSTALL b/INSTALL
--- a/INSTALL
+++ b/INSTALL
@@ -1,6 +1,6 @@
 ***
 Below are the old manual instructions for installation, you can install SàT automatically using easy_install or pip. The full instructions are available on the wiki: http://wiki.goffi.org/wiki/Salut_%C3%A0_Toi
-*** 
+***
 
 
 The following instructions are for GNU/Linux operating system. Instruction for other OS will come in the future.
diff --git a/README b/README
--- a/README
+++ b/README
@@ -63,7 +63,7 @@
 
 ** Misc **
 
-You can find Primitivus shortcuts on the wiki: 
+You can find Primitivus shortcuts on the wiki:
 http://wiki.goffi.org/wiki/Primitivus
 
 --
diff --git a/frontends/sortilege_old/boxsizer.py b/frontends/sortilege_old/boxsizer.py
--- a/frontends/sortilege_old/boxsizer.py
+++ b/frontends/sortilege_old/boxsizer.py
@@ -62,7 +62,7 @@
                 else:
                     current_row.append([win, h+y-oriY, w+x-oriX, oriY, oriX])
                     oriX=oriX+w
-                    
+
             if oriX!=0:
                 oriY=oriY+h
                 visible_row.append(current_row)
diff --git a/frontends/sortilege_old/chat.py b/frontends/sortilege_old/chat.py
--- a/frontends/sortilege_old/chat.py
+++ b/frontends/sortilege_old/chat.py
@@ -40,7 +40,7 @@
 class Chat(Window, QuickChat):
 
     def __init__(self, to_id, host):
-        QuickChat.__init__(self, to_id, host) 
+        QuickChat.__init__(self, to_id, host)
         self.__parent=host.stdscr
         self.to_id=JID(to_id)
         self.content=[]
@@ -88,7 +88,7 @@
                 att_header=curses.color_pair(1)
             else:
                 att_header=curses.color_pair(2)
-            
+
             while (msg):
                 if part==0:
                     hd=header
@@ -105,7 +105,7 @@
                     next = max + 1  #we skip the LF
                 else:
                     next = max
-                    
+
                 content.insert(part,[att,hd, msg[:max]])
                 msg=msg[next:]   #we erase treated part
                 part=part+1
@@ -116,7 +116,7 @@
 
         if self.__scollIdx>0 and len(content)<self.rHeight+self.__scollIdx:
             self.__scollIdx=abs(len(content)-self.rHeight)  #all the log fit on the screen, we must stop here
-            
+
         idx=0
         for line in content[-self.rHeight-self.__scollIdx : -self.__scollIdx or None]:
             self.addYXStr(idx, 0, line[1], line[0])
@@ -124,12 +124,12 @@
             idx=idx+1
 
         self.noutrefresh()
-    
+
     def scrollIdxUp(self):
         """increment scroll index"""
         self.__scollIdx = self.__scollIdx + 1
         self.update()
-    
+
     def scrollIdxDown(self):
         """decrement scroll index"""
         if self.__scollIdx > 0:
@@ -144,7 +144,7 @@
                 return
         self.content.append([timestamp,jid.short,msg])
         self.update()
-    
+
     def handleKey(self, k):
         if k == C('p'):
             self.scrollIdxUp()
diff --git a/frontends/sortilege_old/editbox.py b/frontends/sortilege_old/editbox.py
--- a/frontends/sortilege_old/editbox.py
+++ b/frontends/sortilege_old/editbox.py
@@ -43,7 +43,7 @@
         self.__replace_mode=False
         self.__parent=parent
         self.__code=code
-        
+
         Window.__init__(self, self.__parent, 1, self.__parent.getmaxyx()[1], self.__parent.getmaxyx()[0]-1,0, code=code)
         self.update()
 
@@ -60,7 +60,7 @@
         """return the text printed on the edit line"""
         width = self.rWidth - len(self.__header) -1
         if self.__curs_pos<width:
-            begin = 0 
+            begin = 0
             end = width
         else:
             begin = self.__curs_pos-width
@@ -71,7 +71,7 @@
         Window.update(self)
         text = self.__getTextToPrint()
         self.addYXStr(0, 0, text, limit=self.rWidth)
-        
+
         self.noutrefresh()
 
     def __dec_cur(self):
@@ -83,7 +83,7 @@
         """move cursor on the right"""
         if self.__curs_pos<len(self.__text):
             self.__curs_pos = self.__curs_pos + 1
-    
+
     def move_cur(self, x):
         pos = x+len(self.__header)
         if pos>=self.rWidth:
@@ -94,7 +94,7 @@
         """Clear the text of the edit box"""
         self.__text=""
         self.__curs_pos=0
-        
+
     def replace_cur(self):
         """must be called earch time the cursor is moved"""
         self.move_cur(self.__curs_pos)
@@ -136,7 +136,7 @@
 
         elif k==curses.KEY_HOME or k==C('a'):
             self.__curs_pos=0
-        
+
         elif k==curses.KEY_END or k==C('e'):
             self.__curs_pos=len(self.__text)
 
diff --git a/frontends/sortilege_old/sortilege b/frontends/sortilege_old/sortilege
--- a/frontends/sortilege_old/sortilege
+++ b/frontends/sortilege_old/sortilege
@@ -39,7 +39,7 @@
 import time
 from curses import ascii
 import locale
-from signal import signal, SIGWINCH 
+from signal import signal, SIGWINCH
 import fcntl
 import struct
 import termios
@@ -68,7 +68,7 @@
 
 class ChatList(QuickChatList):
     """This class manage the list of chat windows"""
-    
+
     def __init__(self, host):
         QuickChatList.__init__(self, host)
         self.sizer=host.sizer
@@ -77,10 +77,10 @@
         chat = Chat(name, self.host)
         self.sizer.appendColum(0,chat)
         self.sizer.update()
-        return chat 
-        
+        return chat
+
 class ContactList(Window, QuickContactList):
-    
+
     def __init__(self, host, CM):
         QuickContactList.__init__(self, CM)
         self.host = host
@@ -97,7 +97,7 @@
         Must be called when stdscr is resized."""
         self.resize(stdscr.getmaxyx()[0]-2,const_CONTACT_WIDTH,0,0)
         self.update()
-        
+
     def registerEnterCB(self, CB):
         self.__enterCB=CB
 
@@ -118,7 +118,7 @@
         if self.__index < len(self.jid_list)-1:  #we dont want to select a missing contact
             self.__index = self.__index + 1
         self.update()
-    
+
     def indexDown(self):
         """decrement select contact index"""
         if self.__index > 0:
@@ -142,7 +142,7 @@
             return
         Window.update(self)
         self.jid_list.sort()
-        begin=0 if self.__index<self.rHeight else self.__index-self.rHeight+1 
+        begin=0 if self.__index<self.rHeight else self.__index-self.rHeight+1
         idx=0
         for item in self.jid_list[begin:self.rHeight+begin]:
             attr = curses.A_REVERSE if ( self.isActive() and (idx+begin) == self.__index ) else 0
@@ -164,9 +164,9 @@
                 self.__enterCB(self.jid_list[self.__index])
             except NameError:
                 pass # TODO: thrown an error here
-            
+
 class SortilegeApp(QuickApp):
-    
+
     def __init__(self):
         #debug(const_APP_NAME+" init...")
 
@@ -245,7 +245,7 @@
             debug (_("Deactivating colors"))
             curses.init_pair(1, curses.COLOR_WHITE, curses.COLOR_BLACK)
             curses.init_pair(2, curses.COLOR_WHITE, curses.COLOR_BLACK)
-            
+
 
     def showChat(self, chat):
         debug (_("show chat"))
@@ -256,7 +256,7 @@
         debug (_("showing %s"), self.currentChat)
         self.chat_wins[self.currentChat].show()
         self.chat_wins[self.currentChat].update()
-        
+
 
     ### EVENTS ###
 
@@ -302,7 +302,7 @@
         if (self.currentChat==None):
             self.currentChat=win.short
             self.showChat(win.short)
-            
+
         # we show the window in the status bar
         if not self.currentChat == win.short:
             self.statusBar.add_item(win.short)
@@ -319,7 +319,7 @@
         height, width = ttysize()
         curses.resizeterm(height, width)
         gobject.idle_add(self.callOnceLoop)
-    
+
     def callOnceLoop(self):
         """Call the loop and return false (for not being called again by gobject mainloop).
         Usefull for calling loop when there is no input in stdin"""
@@ -351,7 +351,7 @@
                     self.editBar.activate(True)
             self.sizer.update()
 
-        ## Chat Params ##    
+        ## Chat Params ##
         elif k == C('c'):
             self.chatParams["color"] = not self.chatParams["color"]
             self.color(self.chatParams["color"])
@@ -376,7 +376,7 @@
                 self.sizer.update() # FIXME: everything need to be managed by the sizer
 
         ## we now throw the key to win handlers ##
-        else: 
+        else:
             for win in self.listWins:
                 if win.isActive():
                     win.handleKey(k)
@@ -391,7 +391,7 @@
             self.__key_handling(pressed)
             self.editBar.replace_cur()
             curses.doupdate()
-            
+
 
         return True
 
diff --git a/frontends/sortilege_old/statusbar.py b/frontends/sortilege_old/statusbar.py
--- a/frontends/sortilege_old/statusbar.py
+++ b/frontends/sortilege_old/statusbar.py
@@ -31,7 +31,7 @@
         self.__parent=parent
         self.__code=code
         self.__items=set()
-        
+
         Window.__init__(self, self.__parent, 1, self.__parent.getmaxyx()[1], self.__parent.getmaxyx()[0]-2,0, code=code)
 
     def __len__(self):
@@ -60,11 +60,11 @@
     def clear_text(self):
         """Clear the text of the edit box"""
         del(self.__items[:])
-       
+
     def add_item(self, item):
         self.__items.add(item)
         self.update()
-       
+
     def remove_item(self, item):
         if item in self.__items:
             self.__items.remove(item)
diff --git a/frontends/sortilege_old/window.py b/frontends/sortilege_old/window.py
--- a/frontends/sortilege_old/window.py
+++ b/frontends/sortilege_old/window.py
@@ -33,7 +33,7 @@
         self.__parent=parent
         self.__code=code
         self.__hide=False
-        
+
         self.resize(height, width, y, x)
         self.oriCoords=self.__coords #FIXME: tres moche, a faire en mieux
 
@@ -88,7 +88,7 @@
         # we check that coordinates are under limits
         self.__coordAdjust(self.__coords)
         height,width,y,x=self.__coords
-       
+
         self.window = self.__parent.subwin(height, width, y, x)
         self.defInsideCoord()
 
@@ -124,15 +124,15 @@
         n = self.rWidth-x if not limit else limit
         encoded = text.encode(self.__code)
         adjust = len(encoded) - len(text) # hack because addnstr doesn't manage unicode
-        try:    
-            self.window.addnstr(y, x, encoded, n + adjust, attr) 
+        try:
+            self.window.addnstr(y, x, encoded, n + adjust, attr)
         except:
             #We have to catch error to write on last line last col FIXME: is there a better way ?
             pass
 
     def move(self, y, x):
         self.window.move(y,x)
-    
+
     def noutrefresh(self):
         self.window.noutrefresh()
 
diff --git a/frontends/src/bridge/DBus.py b/frontends/src/bridge/DBus.py
--- a/frontends/src/bridge/DBus.py
+++ b/frontends/src/bridge/DBus.py
@@ -73,7 +73,7 @@
                 #   - or if the last two arguments are callable
 
                 async = False
-                
+
                 if kwargs:
                     if 'callback' in kwargs and 'errback' in kwargs:
                         async = True
@@ -84,15 +84,15 @@
                     args = list(args)
                     _errback = args.pop()
                     _callback = args.pop()
-                        
+
                 method = getattr(self.db_plugin_iface, name)
-                
+
                 if async:
                     kwargs['reply_handler'] = _callback
                     kwargs['error_handler'] = lambda err:_errback(err._dbus_error_name[len(const_ERROR_PREFIX)+1:])
 
                 return method(*args, **kwargs)
-                
+
             return getPluginMethod
 
     def addContact(self, entity_jid, profile_key="@DEFAULT@"):
@@ -214,12 +214,12 @@
 
 
 #methods from plugins
-    
+
     def joinMUC(self, room_jid, nick, options, profile_key):
         if options == None:
             options = [('', '')] #XXX: we have to do this awful hack because python dbus need to guess the signature
         return self.db_plugin_iface.joinMUC(room_jid, nick, options, profile_key)
-    
+
     def gatewayRegister(self, action, target, data, profile_key):
         if data == None:
             data = [('', '')] #XXX: we have to do this awful hack because python dbus need to guess the signature
diff --git a/frontends/src/jp/jp b/frontends/src/jp/jp
--- a/frontends/src/jp/jp
+++ b/frontends/src/jp/jp
@@ -135,8 +135,8 @@
             self.start_loop = True  #We have to use loop for these options
         else:
             self.start_loop = False
-        
-            
+
+
         return args
 
     def check_jabber_status(self):
@@ -145,7 +145,7 @@
             error(_(u"Can't connect profile"))
             exit(1)
 
-        
+
         self.profile = self.bridge.getProfileName(self.options.profile)
         if not self.profile:
             error(_("The profile asked doesn't exist"))
@@ -293,7 +293,7 @@
                 return
             if self.dest_jids and not JID(data['from']).short in [JID(_jid).short for _jid in self.dest_jids]:
                 return #file is not sent by a filtered jid
-                
+
             answer_data["dest_path"] = os.getcwd()+'/'+data['filename']
 
             if self.options.force or not os.path.exists(answer_data["dest_path"]):
@@ -303,7 +303,7 @@
             else:
                 self.bridge.confirmationAnswer(confirm_id, False, answer_data, profile)
                 warning(_("Refused file [%(filename)s] from %(sender)s: a file with the same name already exist") % {'filename':data['filename'], 'sender':data['from']})
-                
+
 
             if not self.options.multiple and not self.options.progress:
                 #we just accept one file
@@ -313,7 +313,7 @@
                 return
             if self.dest_jids and not JID(data['from']).short in [JID(_jid).short for _jid in self.dest_jids]:
                 return #pipe stream is not sent by a filtered jid
-            
+
             tmp_dir = tempfile.mkdtemp()
             fifopath = os.path.join(tmp_dir,"pipe_in")
             answer_data["dest_path"] = fifopath
@@ -323,8 +323,8 @@
                 shutil.copyfileobj(f, sys.stdout)
             shutil.rmtree(tmp_dir)
             self.loop.quit()
-                
-                
+
+
     def actionResult(self, action_type, action_id, data, profile):
         #FIXME
         info (_("FIXME: actionResult not implemented"))
@@ -333,7 +333,7 @@
         """Auto reply to confirmations requests"""
         #we register incoming confirmation
         self.bridge.register("askConfirmation", self.askConfirmation)
-        
+
         #and we ask those we have missed
         for confirm_id, confirm_type, data in self.bridge.getWaitingConf(self.profile):
             self.askConfirmation(confirm_id, confirm_type, data, self.profile)
@@ -349,7 +349,7 @@
                     #first answer, we must construct the bar
                     self.pbar = ProgressBar(int(data['size']),[_("Progress: "),Percentage()," ",Bar()," ",FileTransferSpeed()," ",ETA()])
                     self.pbar.start()
-                    
+
                 self.pbar.update(int(data['position']))
             elif self.pbar:
                 self.pbar.finish()
diff --git a/frontends/src/primitivus/card_game.py b/frontends/src/primitivus/card_game.py
--- a/frontends/src/primitivus/card_game.py
+++ b/frontends/src/primitivus/card_game.py
@@ -48,9 +48,9 @@
             self.select(not self.__selected)
             self._emit('click')
             return True
-        
+
         return False
-    
+
     def select(self, state=True):
         self.__selected = state
         attr,txt = self.card.getAttrText()
@@ -183,7 +183,7 @@
             self.top = self.left = self.bottom = self.right = None
         setattr(self, location, card)
         self._invalidate()
-    
+
     def rows(self,size,focus=False):
         return self.display_widget(size, focus).rows(size, focus)
 
@@ -203,11 +203,11 @@
                       urwid.Text([margin_center,cards['left'],separator,cards['right']]),
                       urwid.Text([margin,cards['bottom']])]
         return urwid.Pile(render_wid)
-        
+
 
 class CardGame(QuickCardGame,urwid.WidgetWrap):
     """Widget for card games"""
-    
+
     def __init__(self, parent, referee, players, player_nick):
         QuickCardGame.__init__(self, parent, referee, players, player_nick)
         self.loadCards()
@@ -248,13 +248,13 @@
         QuickCardGame.newGame(self, hand)
         self.hand_wid.update(self.hand)
         self.parent.host.redraw()
-    
+
     def contratSelected(self, data):
         """Called when the contrat has been choosed
         @param data: form result"""
         contrat = data[0][1]
         QuickCardGame.contratSelected(self, contrat)
-    
+
     def chooseContrat(self, xml_data):
         """Called when the player as to select his contrat
         @param xml_data: SàT xml representation of the form"""
@@ -297,14 +297,14 @@
         if self._autoplay==None: #No dialog if there is autoplay
             self.parent.host.notify(_('Cards played are invalid !'))
         self.parent.host.redraw()
-    
+
     def cardsPlayed(self, player, cards):
         """A card has been played by player"""
         QuickCardGame.cardsPlayed(self, player, cards)
         self.table.putCard(self.getPlayerLocation(player),self.played[player])
         self._checkState()
         self.parent.host.redraw()
-   
+
     def _checkState(self):
         if isinstance(self.center.widget_list[1].original_widget, Hand): #if we have a hand displayed
             self.center.widget_list[1] = urwid.Filler(self.table) #we show again the table
@@ -317,7 +317,7 @@
                 self.hand.sort()
                 self.to_show = []
                 self.hand_wid.update(self.hand)
-        
+
 
     ##EVENTS##
     def onClick(self, hand, card_wid):
diff --git a/frontends/src/primitivus/chat.py b/frontends/src/primitivus/chat.py
--- a/frontends/src/primitivus/chat.py
+++ b/frontends/src/primitivus/chat.py
@@ -31,7 +31,7 @@
 
 class ChatText(urwid.FlowWidget):
     """Manage the printing of chat message"""
-    
+
     def __init__(self, parent, timestamp, nick, my_mess, message, align='left', is_info=False):
         self.parent = parent
         self.timestamp = time.localtime(timestamp)
@@ -124,8 +124,8 @@
                 self._invalidate()
 
 
-        return super(Chat, self).keypress(size, key) 
-    
+        return super(Chat, self).keypress(size, key)
+
     def getMenu(self):
         """Return Menu bar"""
         menu = sat_widgets.Menu(self.host.loop)
@@ -145,7 +145,7 @@
                 present_widget = self.__buildPresentList()
                 self.present_panel = sat_widgets.VerticalSeparator(present_widget)
                 self.__appendPresentPanel()
-          
+
     def __getDecoration(self, widget):
         return sat_widgets.LabelLine(widget, sat_widgets.SurroundedText(unicode(unescapePrivate(self.target))))
 
@@ -175,16 +175,16 @@
     def __buildPresentList(self):
         self.present_wid = sat_widgets.GenericList([],option_type = sat_widgets.ClickableText, on_click=self._presentClicked)
         return self.present_wid
-   
+
     def __appendPresentPanel(self):
-        self.chat_colums.widget_list.append(self.present_panel) 
+        self.chat_colums.widget_list.append(self.present_panel)
         self.chat_colums.column_types.append(('weight', 2))
 
     def __removePresentPanel(self):
         self.chat_colums.set_focus(0) #necessary as the focus change to the next object, we can go out of range if we are on the last object of self.chat_colums
         self.chat_colums.widget_list.remove(self.present_panel)
         del self.chat_colums.column_types[-1]
-    
+
     def __appendGamePanel(self, widget):
         assert (len(self.pile.widget_list) == 1)
         self.pile.widget_list.insert(0,widget)
@@ -245,13 +245,13 @@
             return
 
         new_text = ChatText(self, timestamp or None, nick, mymess, msg)
-        
+
         if timestamp and self.content:
             for idx in range(len(self.content)-1,-1,-1):
                 current_text = self.content[idx]
                 if new_text.timestamp < current_text.timestamp and idx > 0:
                     continue #the new message is older, we need to insert it upper
-                
+
                 #we discard double messages, to avoid backlog / history conflict
                 if ((idx and self.content[idx-1].message == msg) or
                     (self.content[idx].message == msg) or
@@ -262,7 +262,7 @@
                 break
         else:
             self.content.append(new_text)
-        
+
         if self.text_list.get_focus()[1] == len(self.content)-2:
             #we don't change focus if user is not at the bottom
             #as that mean that he is probably watching discussion history
@@ -271,9 +271,9 @@
         if not self.host.x_notify.hasFocus():
             if self.type=="one2one":
                 self.host.x_notify.sendNotification(_("Primitivus: %s is talking to you") % from_jid)
-            elif self.getUserNick().lower() in msg.lower(): 
+            elif self.getUserNick().lower() in msg.lower():
                 self.host.x_notify.sendNotification(_("Primitivus: Somebody pinged your name in %s room") % self.target)
-    
+
     def printInfo(self, msg, type='normal', timestamp=""):
         """Print general info
         @param msg: message to print
@@ -292,28 +292,28 @@
         if not self.host.x_notify.hasFocus():
             if self.type=="one2one":
                 self.host.x_notify.sendNotification(_("Primitivus: there is a message about you"))
-            elif self.getUserNick().lower() in msg.lower(): 
+            elif self.getUserNick().lower() in msg.lower():
                 self.host.x_notify.sendNotification(_("Primitivus: Somebody is talking about you in %s room") % self.target)
-    
+
     def startGame(self, game_type, referee, players):
         """Configure the chat window to start a game"""
         if game_type=="Tarot":
             self.tarot_wid = CardGame(self, referee, players, self.nick)
             self.__appendGamePanel(self.tarot_wid)
-    
+
     def getGame(self, game_type):
         """Return class managing the game type"""
         #TODO: check that the game is launched, and manage errors
         if game_type=="Tarot":
-            return self.tarot_wid 
+            return self.tarot_wid
 
     #MENU EVENTS#
     def onTarotRequest(self, menu):
         if len(self.occupants) != 4:
-            self.host.showPopUp(sat_widgets.Alert(_("Can't start game"), _("You need to be exactly 4 peoples in the room to start a Tarot game"), ok_cb=self.host.removePopUp)) 
+            self.host.showPopUp(sat_widgets.Alert(_("Can't start game"), _("You need to be exactly 4 peoples in the room to start a Tarot game"), ok_cb=self.host.removePopUp))
         else:
             self.host.bridge.tarotGameCreate(self.id, list(self.occupants), self.host.profile)
-    
+
     def onSendFileRequest(self, menu):
         dialog = FileDialog(ok_cb=self.onFileSelected, cancel_cb=self.host.removePopUp)
         self.host.showPopUp(dialog, 80, 80)
@@ -328,4 +328,4 @@
         else:
             full_jid = self.target
         progress_id = self.host.bridge.sendFile(full_jid, filepath, {}, self.host.profile)
-        self.host.addProgress(progress_id,filepath) 
+        self.host.addProgress(progress_id,filepath)
diff --git a/frontends/src/primitivus/constants.py b/frontends/src/primitivus/constants.py
--- a/frontends/src/primitivus/constants.py
+++ b/frontends/src/primitivus/constants.py
@@ -68,7 +68,7 @@
     ('status', 'yellow', 'default'),
     ('status_focus', 'yellow, bold', 'default'),
     ]
-__builtin__.__dict__['const_SHOW_ICON'] = {"unavailable": (u'⨯', "show_disconnected"), 
+__builtin__.__dict__['const_SHOW_ICON'] = {"unavailable": (u'⨯', "show_disconnected"),
                                           "": (u'✔', "show_normal"),
                                           "chat": (u'✆', "show_chat"),
                                           "away": (u'✈', "show_away"),
diff --git a/frontends/src/primitivus/contact_list.py b/frontends/src/primitivus/contact_list.py
--- a/frontends/src/primitivus/contact_list.py
+++ b/frontends/src/primitivus/contact_list.py
@@ -37,7 +37,7 @@
         self.alert_jid=set()
         self.show_status = False
         self.show_disconnected = False
-        
+
         #we now build the widget
         self.frame = urwid.Frame(self.__buildList())
         self.main_widget = sat_widgets.LabelLine(self.frame, sat_widgets.SurroundedText(_("Contacts")))
@@ -65,8 +65,8 @@
         elif key == "meta d": #user wants to (un)hide disconnected contacts
             self.show_disconnected = not self.show_disconnected
             self.update()
-        return super(ContactList, self).keypress(size, key) 
-    
+        return super(ContactList, self).keypress(size, key)
+
     def __contains__(self, jid):
         for group in self.groups:
             if jid.short in self.groups[group][1]:
@@ -116,9 +116,9 @@
         @param content: widget list, e.g. SimpleListWalker
         @param contacts: list of JID"""
         contacts = list(param_contacts)
-        
+
         widgets = [] #list of built widgets
-        
+
         for contact in contacts:
             if contact.startswith(const_PRIVATE_PREFIX):
                 contact_disp = ('alert' if contact in self.alert_jid else "show_normal", unescapePrivate(contact))
@@ -148,7 +148,7 @@
             widget.data = contact
             widget.comp = contact_disp[1].lower() #value to use for sorting
             widgets.append(widget)
-       
+
         widgets.sort(key=lambda widget: widget.comp)
 
         for widget in widgets:
@@ -160,7 +160,7 @@
         specials = self.specials.keys()
         specials.sort()
         for special in specials:
-            jid=JID(special) 
+            jid=JID(special)
             name = self.getCache(jid, 'name')
             nick = self.getCache(jid, 'nick')
             special_disp = ('alert' if special in self.alert_jid else 'default', nick or name or jid.node or jid.short)
@@ -176,7 +176,7 @@
     def __buildList(self):
         """Build the main contact list widget"""
         content = urwid.SimpleListWalker([])
-        
+
         self.__buildSpecials(content)
         if self.specials:
             content.append(urwid.Divider('='))
@@ -205,7 +205,7 @@
     def getContact(self):
         """Return contact currently selected"""
         return self.selected
-            
+
     def clearContacts(self):
         """clear all the contact list"""
         QuickContactList.clearContacts(self)
@@ -238,7 +238,7 @@
             contacts.sort()
             self.list_wid.changeValues(contacts)
             self._emit('change')"""
-    
+
     def remove(self, jid):
         """remove a contact from the list"""
         QuickContactList.remove(self, jid)
@@ -252,7 +252,7 @@
         for group in groups_to_remove:
             del self.groups[group]
         self.update()
-    
+
     def add(self, jid, param_groups=[None]):
         """add a contact to the list"""
         self.replace(jid,param_groups)
diff --git a/frontends/src/primitivus/gateways.py b/frontends/src/primitivus/gateways.py
--- a/frontends/src/primitivus/gateways.py
+++ b/frontends/src/primitivus/gateways.py
@@ -44,7 +44,7 @@
         list_wid = urwid.ListBox(widget_list)
         decorated = sat_widgets.LabelLine(list_wid, sat_widgets.SurroundedText(title))
         urwid.WidgetWrap.__init__(self, decorated)
-    
+
     def browseExternalServer(self, button):
         """Open the gateway manager on given server"""
         server = self.ext_serv.get_edit_text()
@@ -58,15 +58,15 @@
         self.host.removeWindow()
 
     def addGateway(self, widget_list, gateway, param):
-       
+
         widget_col = []
         widget_col.append(('weight',4,urwid.Text(unicode(param['name'])))) #FIXME: unicode to be remove when DBus bridge will not give dbus.String anymore
-       
+
         #Then the transport type message
         widget_col.append(('weight',6,urwid.Text(self.getGatewayDesc(param['type']))))
 
         #The buttons
-        
+
         reg_button = sat_widgets.CustomButton( _("Register"), self.onRegister)
         reg_button.gateway_jid = JID(gateway)
         widget_col.append(('fixed',reg_button.getSize(),reg_button))
@@ -74,7 +74,7 @@
         unreg_button.gateway_jid = JID(gateway)
         widget_col.append(('fixed',unreg_button.getSize(),unreg_button))
         widget_list.append(urwid.Columns(widget_col,1))
-        
+
     def onRegister(self, button):
         """Called when register button is clicked"""
         gateway_jid = button.gateway_jid
diff --git a/frontends/src/primitivus/notify.py b/frontends/src/primitivus/notify.py
--- a/frontends/src/primitivus/notify.py
+++ b/frontends/src/primitivus/notify.py
@@ -23,13 +23,13 @@
 
 class Notify:
     """Used to send notification and detect if we have focus"""
-    
+
     def __init__(self):
 
         #X11 stuff
         self.display = None
         self.X11_id = -1
-        
+
         try:
             from Xlib import display as X_display
             self.display = X_display.Display()
@@ -44,7 +44,7 @@
             self.freedesktop_int = dbus.Interface(db_object, dbus_interface='org.freedesktop.Notifications')
         except:
             self.freedesktop_int = None
-        
+
 
     def getFocus(self):
         if not self.display:
@@ -62,15 +62,15 @@
         #TODO: check options before sending notifications
         if self.freedesktop_int:
             self.sendFDNotification(summ_mess, body_mess)
-        
+
     def sendFDNotification(self, summ_mess, body_mess=""):
         """Send notification with the FreeDesktop D-Bus API"""
         if self.freedesktop_int:
-            app_name = "Primitivus" 
+            app_name = "Primitivus"
             replaces_id = 0
             app_icon = ""
             summary = summ_mess
-            body = body_mess 
+            body = body_mess
             actions = dbus.Array(signature='s')
             hints = dbus.Dictionary(signature='sv')
             expire_timeout = -1
diff --git a/frontends/src/primitivus/primitivus b/frontends/src/primitivus/primitivus
--- a/frontends/src/primitivus/primitivus
+++ b/frontends/src/primitivus/primitivus
@@ -44,18 +44,18 @@
 logging.basicConfig(level=logging.CRITICAL,  #TODO: configure it to put messages in a log file
                     format='%(message)s')
 ###
-            
+
 class ChatList(QuickChatList):
     """This class manage the list of chat windows"""
-    
+
     def createChat(self, target):
         return Chat(target, self.host)
 
 class PrimitivusApp(QuickApp):
-    
+
     def __init__(self):
         QuickApp.__init__(self)
-        
+
         ## main loop setup ##
         self.main_widget = ProfileManager(self)
         self.loop = urwid.MainLoop(self.main_widget, const_PALETTE, event_loop=urwid.GLibEventLoop(), input_filter=self.inputFilter, unhandled_input=self.keyHandler)
@@ -82,7 +82,7 @@
         """Change mode if make sens (i.e.: if there is nothing in the editBar"""
         if not self.editBar.get_edit_text():
             self.mode = value
-    
+
     def debug(self):
         """convenient method to reset screen and launch p(u)db"""
         try:
@@ -209,9 +209,9 @@
             category,item,type = new_menu
             assert(type=="NORMAL") #TODO: manage other types
             menu.addMenu(unicode(category), unicode(item), add_menu_cb)
-            
+
         menu_roller = sat_widgets.MenuRoller([(_('Main menu'),menu)])
-        return menu_roller 
+        return menu_roller
 
     def __buildMainWidget(self):
         self.contact_list = ContactList(self, on_click = self.contactSelected, on_change=lambda w: self.redraw())
@@ -257,14 +257,14 @@
                     completion_data['last_nick'] = nicks[idx]
                     return text[:space+1] + nicks[idx] + (': ' if space < 0 else '')
         return text
-            
-        
+
+
 
     def plug_profile(self, profile_key='@DEFAULT@'):
         self.loop.widget = self.__buildMainWidget()
         self.redraw()
         QuickApp.plug_profile(self, profile_key)
-    
+
     def removePopUp(self, widget=None):
         "Remove current pop-up, and if there is other in queue, show it"
         self.loop.widget = self.main_widget
@@ -305,7 +305,7 @@
         self.center_part.widget_list[wid_idx] = urwid.Filler(urwid.Text(''))
         self.center_part.set_focus(0)
         self.redraw()
-        
+
     def addProgress (self, id, message):
         """Follow a SàT progress bar
         @param id: SàT id of the progression
@@ -342,13 +342,13 @@
 
     def newMessage(self, from_jid, to_jid, msg, _type, extra, profile):
         QuickApp.newMessage(self, from_jid, to_jid, msg, _type, extra, profile)
-        
+
         if not from_jid in self.contact_list and from_jid.short != self.profiles[profile]['whoami'].short:
             #XXX: needed to show entities which haven't sent any
             #     presence information and which are not in roster
             #TODO: put these entities in a "not in roster" list
             self.contact_list.replace(from_jid)
-        
+
         if JID(self.contact_list.selected).short != from_jid.short:
             self.contact_list.putAlert(from_jid)
 
@@ -363,22 +363,22 @@
         answer_cb = data[0]
         answer_data = [data[1]] if data[1] else []
         answer_cb(False, *answer_data)
-        
+
 
     def showDialog(self, message, title="", type="info", answer_cb = None, answer_data = None):
         if type == 'info':
-            popup = sat_widgets.Alert(unicode(title), unicode(message), ok_cb=answer_cb or self.removePopUp) #FIXME: remove unicode here when DBus Bridge will no return dbus.String anymore 
+            popup = sat_widgets.Alert(unicode(title), unicode(message), ok_cb=answer_cb or self.removePopUp) #FIXME: remove unicode here when DBus Bridge will no return dbus.String anymore
         elif type == 'error':
-            popup = sat_widgets.Alert(unicode(title), unicode(message), ok_cb=answer_cb or self.removePopUp) #FIXME: remove unicode here when DBus Bridge will no return dbus.String anymore 
+            popup = sat_widgets.Alert(unicode(title), unicode(message), ok_cb=answer_cb or self.removePopUp) #FIXME: remove unicode here when DBus Bridge will no return dbus.String anymore
         elif type == 'yes/no':
             popup = sat_widgets.ConfirmDialog(unicode(message),
                     yes_cb=self._dialogOkCb, yes_value = (answer_cb, answer_data),
                     no_cb=self._dialogCancelCb, no_value = (answer_cb, answer_data))
         else:
-            popup = sat_widgets.Alert(unicode(title), unicode(message), ok_cb=answer_cb or self.removePopUp) #FIXME: remove unicode here when DBus Bridge will no return dbus.String anymore 
+            popup = sat_widgets.Alert(unicode(title), unicode(message), ok_cb=answer_cb or self.removePopUp) #FIXME: remove unicode here when DBus Bridge will no return dbus.String anymore
             error(_('unmanaged dialog type: %s'), type)
         self.showPopUp(popup)
-    
+
     def onNotification(self, notBar):
         """Called when a new notification has been received"""
         if not isinstance(self.main_widget, sat_widgets.FocusFrame):
@@ -401,26 +401,26 @@
         if not self.check_profile(profile):
             return
         answer_data={}
-        
+
         def dir_selected_cb(path):
             dest_path = join(path, data['filename'])
-            answer_data["dest_path"] = getNewPath(dest_path) 
-            self.addProgress(confirmation_id, dest_path) 
+            answer_data["dest_path"] = getNewPath(dest_path)
+            self.addProgress(confirmation_id, dest_path)
             accept_cb(None)
 
         def accept_file_transfer_cb(widget):
             self.removePopUp()
-            pop_up_widget = FileDialog(dir_selected_cb, refuse_cb, title=_(u"Where do you want to save the file ?"), style=['dir']) 
+            pop_up_widget = FileDialog(dir_selected_cb, refuse_cb, title=_(u"Where do you want to save the file ?"), style=['dir'])
             self.showPopUp(pop_up_widget)
 
         def accept_cb(widget):
             self.removePopUp()
             self.bridge.confirmationAnswer(confirmation_id, True, answer_data, profile)
-            
+
         def refuse_cb(widget):
             self.removePopUp()
             self.bridge.confirmationAnswer(confirmation_id, False, answer_data, profile)
-        
+
         if confirmation_type == "FILE_TRANSFER":
             pop_up_widget = sat_widgets.ConfirmDialog(_("The contact %(jid)s wants to send you the file %(filename)s\nDo you accept ?") % {'jid':data["from"], 'filename':data["filename"]}, no_cb=refuse_cb, yes_cb=accept_file_transfer_cb)
             self.showPopUp(pop_up_widget)
@@ -432,7 +432,7 @@
     def actionResult(self, type, id, data, profile):
         if not self.check_profile(profile):
             return
-         
+
         if not id in self.current_action_ids:
             debug (_('unknown id, ignoring'))
             return
@@ -455,7 +455,7 @@
                 ui.show('window')
         elif type == "ERROR":
             self.current_action_ids.remove(id)
-            self.showPopUp(sat_widgets.Alert(_("Error"), unicode(data["message"]), ok_cb=self.removePopUp)) #FIXME: remove unicode here when DBus Bridge will no return dbus.String anymore 
+            self.showPopUp(sat_widgets.Alert(_("Error"), unicode(data["message"]), ok_cb=self.removePopUp)) #FIXME: remove unicode here when DBus Bridge will no return dbus.String anymore
         elif type == "RESULT":
             self.current_action_ids.remove(id)
             if self.current_action_ids_cb.has_key(id):
@@ -481,7 +481,7 @@
         else:
             message = _("'%s' is an invalid JID !") % room_jid
             error (message)
-            self.showPopUp(sat_widgets.Alert(_("Error"), message, ok_cb=self.removePopUp)) 
+            self.showPopUp(sat_widgets.Alert(_("Error"), message, ok_cb=self.removePopUp))
 
     def onAddContact(self, button, edit):
         self.removePopUp()
@@ -511,7 +511,7 @@
         def failure(error):
             self.showPopUp(sat_widgets.Alert(_("Error"), _("Can't get parameters"), ok_cb=self.removePopUp))
         self.bridge.getParamsUI(self.profile, callback=success, errback=failure)
-        
+
 
     def onExitRequest(self, menu):
         QuickApp.onExit(self)
@@ -541,8 +541,8 @@
             self.showPopUp(pop_up_widget)
 
     def onAboutRequest(self, menu):
-        self.showPopUp(sat_widgets.Alert(_("About"), const_APP_NAME + " v" + self.bridge.getVersion(), ok_cb=self.removePopUp)) 
-       
+        self.showPopUp(sat_widgets.Alert(_("About"), const_APP_NAME + " v" + self.bridge.getVersion(), ok_cb=self.removePopUp))
+
     #MISC CALLBACKS#
 
     def onGatewaysFound(self, data):
diff --git a/frontends/src/primitivus/profile_manager.py b/frontends/src/primitivus/profile_manager.py
--- a/frontends/src/primitivus/profile_manager.py
+++ b/frontends/src/primitivus/profile_manager.py
@@ -31,11 +31,11 @@
         #profiles list
         profiles = self.host.bridge.getProfilesList()
         profiles.sort()
-        
+
         #login & password box must be created before list because of onProfileChange
         self.login_wid = AdvancedEdit(_('Login:'),align='center')
         self.pass_wid = Password(_('Password:'),align='center')
-        
+
         self.list_profile = List(profiles, style=['single'], align='center', on_change=self.onProfileChange)
 
         #new & delete buttons
@@ -96,7 +96,7 @@
             self.host.bridge.deleteProfile(profile_name)
             self.__refillProfiles()
         self.host.removePopUp()
-        
+
     def onNewProfile(self, e):
         pop_up_widget = InputDialog(_("New profile"), _("Please enter a new profile name"), cancel_cb=self.cancelDialog, ok_cb=self.newProfile)
         self.host.showPopUp(pop_up_widget)
@@ -117,7 +117,7 @@
         if profile_name:
             self.host.bridge.asyncGetParamA("JabberID", "Connection", profile_key=profile_name, callback=setJID, errback=self.getParamError)
             self.host.bridge.asyncGetParamA("Password", "Connection", profile_key=profile_name, callback=setPassword, errback=self.getParamError)
-        
+
     def onConnectProfile(self, button):
         profile_name = self.list_profile.getSelectedValue()
         if not profile_name:
@@ -136,7 +136,7 @@
     def __old_jidReceived(self, old_jid, profile):
         self.host.bridge.asyncGetParamA("Password", "Connection", profile_key=profile,
                                         callback=lambda old_pass: self.__old_passReceived(old_jid, old_pass, profile), errback=self.getParamError)
-    
+
     def __old_passReceived(self, old_jid, old_pass, profile):
         """Check if we have new jid/pass, save them if it is the case, and plug profile"""
         new_jid = self.login_wid.get_edit_text()
@@ -148,7 +148,7 @@
         if old_pass != new_pass:
             self.host.bridge.setParam("Password", new_pass, "Connection", profile)
         self.host.plug_profile(profile)
-            
+
     def getParamError(self, ignore):
         popup = Alert("Error", _("Can't get profile parameter"), ok_cb=self.host.removePopUp)
         self.host.showPopUp(popup)
diff --git a/frontends/src/primitivus/progress.py b/frontends/src/primitivus/progress.py
--- a/frontends/src/primitivus/progress.py
+++ b/frontends/src/primitivus/progress.py
@@ -55,7 +55,7 @@
                 #first answer, we must construct the bar
                 self.progress_dict[(progress_id, profile)]['state'] = 'progress'
                 pbar.done = float(data['size'])
-                
+
             pbar.set_completion(float(data['position']))
             self.updateNotBar()
         else:
@@ -93,4 +93,4 @@
             nb_bars+=1
         av_progress = progress/float(nb_bars)
         self.host.setProgress(av_progress)
-    
+
diff --git a/frontends/src/primitivus/xmlui.py b/frontends/src/primitivus/xmlui.py
--- a/frontends/src/primitivus/xmlui.py
+++ b/frontends/src/primitivus/xmlui.py
@@ -44,12 +44,12 @@
             pile.widget_list.append(widget)
             pile.item_types.append(('weight',getattr(self,'weight_'+str(self.idx))))
         self.idx = (self.idx + 1) % 2
-        
+
 class InvalidXMLUI(Exception):
     pass
 
 class XMLUI(urwid.WidgetWrap):
-    
+
     def __init__(self, host, xml_data, title = None, options = None, misc = None):
         self.host = host
         self.title = title
@@ -72,7 +72,7 @@
             type = elem.getAttribute("type")
             value = elem.getAttribute("value") if elem.hasAttribute('value') else u''
             if type=="empty":
-                ctrl = urwid.Text('') 
+                ctrl = urwid.Text('')
             elif type=="text":
                 try:
                     value = elem.childNodes[0].wholeText
@@ -135,10 +135,10 @@
                     warning(_("Unknown layout, using default one"))
                     self.__parseElems(node, current)
             elif node.nodeName == "category":
-                name = node.getAttribute('name') 
-                label = node.getAttribute('label') 
+                name = node.getAttribute('name')
+                label = node.getAttribute('label')
                 if not name or not isinstance(data,sat_widgets.TabsContainer):
-                    raise InvalidXMLUI 
+                    raise InvalidXMLUI
                 if self.type == 'param':
                     self._current_category = name #XXX: awful hack because params need category and we don't keep parent
                 tab_cont = data
@@ -150,9 +150,9 @@
                 raise NotImplementedError
 
     def constructUI(self, xml_data):
-        
+
         ret_wid = urwid.ListBox(urwid.SimpleListWalker([]))
-        
+
         cat_dom = minidom.parseString(xml_data.encode('utf-8'))
         top=cat_dom.documentElement
         self.type = top.getAttribute("type")
@@ -166,11 +166,11 @@
         self.__parseChilds(ret_wid.body, cat_dom.documentElement)
 
         assert ret_wid.body
-        
+
         if isinstance(ret_wid.body[0],sat_widgets.TabsContainer):
             ret_wid = ret_wid.body[0] #xxx: awfull hack cause TabsContainer is a BoxWidget, can't be inside a ListBox
-        
-        
+
+
         if self.type == 'form':
             buttons = []
             buttons.append(urwid.Button(_('Submit'),self.onFormSubmitted))
@@ -195,7 +195,7 @@
             - popup
             - window"""
         self.__dest = "popup"
-        decorated = sat_widgets.LabelLine(self, sat_widgets.SurroundedText(self.title or '')) 
+        decorated = sat_widgets.LabelLine(self, sat_widgets.SurroundedText(self.title or ''))
         if show_type == 'popup':
             self.host.showPopUp(decorated)
         elif show_type == 'window':
@@ -244,7 +244,7 @@
         else:
             warning (_("The form data is not sent back, the type is not managed properly"))
         self.host.removePopUp()
-    
+
     def onFormCancelled(self, button):
         if self.__dest == 'window':
             self.host.removeWindow()
diff --git a/frontends/src/quick_frontend/quick_app.py b/frontends/src/quick_frontend/quick_app.py
--- a/frontends/src/quick_frontend/quick_app.py
+++ b/frontends/src/quick_frontend/quick_app.py
@@ -37,7 +37,7 @@
         self.profiles = {}
         self.single_profile = single_profile
         self.check_options()
-        
+
         ## bridge ##
         try:
             self.bridge=DBusBridgeFrontend()
@@ -81,11 +81,11 @@
         self.bridge.register("quizGameAnswerResult", self.quizGameAnswerResult, "plugin")
         self.bridge.register("quizGameTimerExpired", self.quizGameTimerExpired, "plugin")
         self.bridge.register("quizGameTimerRestarted", self.quizGameTimerRestarted, "plugin")
-        
+
         self.current_action_ids = set()
         self.current_action_ids_cb = {}
         self.media_dir = self.bridge.getConfig('','media_dir')
-    
+
     def check_profile(self, profile):
         """Tell if the profile is currently followed by the application"""
         return profile in self.profiles.keys()
@@ -93,7 +93,7 @@
     def postInit(self):
         """Must be called after initialization is done, do all automatic task (auto plug profile)"""
         if self.options.profile:
-            if not self.bridge.getProfileName(self.options.profile): 
+            if not self.bridge.getProfileName(self.options.profile):
                 error(_("Trying to plug an unknown profile (%s)" % self.options.profile))
             else:
                 self.plug_profile(self.options.profile)
@@ -116,7 +116,7 @@
 
     def _getParamError(self, ignore):
         error(_("Can't get profile parameter"))
-    
+
     def plug_profile(self, profile_key='@DEFAULT@'):
         """Tell application which profile must be used"""
         if self.single_profile and self.profiles:
@@ -132,11 +132,11 @@
         self.profiles[profile]={}
         if self.single_profile:
             self.profile = profile
-        
+
         ###now we get the essential params###
         self.bridge.asyncGetParamA("JabberID","Connection", profile_key=profile,
                                    callback=lambda _jid: self.plug_profile_2(_jid, profile), errback=self._getParamError)
-        
+
     def plug_profile_2(self, _jid, profile):
         self.profiles[profile]['whoami'] = JID(_jid)
         self.bridge.asyncGetParamA("autoconnect","Connection", profile_key=profile,
@@ -152,7 +152,7 @@
             self.bridge.asyncConnect(profile, callback=lambda: self.plug_profile_5(watched, autoconnect, profile), errback=lambda ignore: error(_('Error during autoconnection')))
         else:
             self.plug_profile_5(watched, autoconnect, profile)
-    
+
     def plug_profile_5(self, watched, autoconnect, profile):
         self.profiles[profile]['watched'] = watched.split() #TODO: put this in a plugin
 
@@ -198,7 +198,7 @@
             for confirm_id, confirm_type, data in self.bridge.getWaitingConf(profile):
                 self.askConfirmation(confirm_id, confirm_type, data, profile)
 
-        
+
 
     def unplug_profile(self, profile):
         """Tell the application to not follow anymore the profile"""
@@ -224,7 +224,7 @@
         debug(_("Disconnected"))
         self.contact_list.clearContacts()
         self.setStatusOnline(False)
-    
+
     def connectionError(self, error_type, profile):
         """called when something goest wrong with the connection"""
         if not self.check_profile(profile):
@@ -250,15 +250,15 @@
             return
         from_jid = JID(from_jid_s)
         to_jid = JID(to_jid_s)
-        
+
         from_me = from_jid.short == self.profiles[profile]['whoami'].short
         win = to_jid if from_me else from_jid
-        
+
         if _type != "groupchat" and self.contact_list.getSpecial(win) == "MUC":
             #we have a private message in a MUC room
             #XXX: normaly we use bare jid as key, here we need the full jid
             #     so we cheat by replacing the "/" before the resource by
-            #     a "@", so the jid is invalid, 
+            #     a "@", so the jid is invalid,
             new_jid = escapePrivate(win)
             if from_me:
                 to_jid = new_jid
@@ -268,11 +268,11 @@
                 self.contact_list.add(new_jid)
 
         self.newMessage(from_jid, to_jid, msg, _type, extra, profile)
-    
+
     def newMessage(self, from_jid, to_jid, msg, _type, extra, profile):
         from_me = from_jid.short == self.profiles[profile]['whoami'].short
         win = to_jid if from_me else from_jid
-        
+
         self.current_action_ids = set()
         self.current_action_ids_cb = {}
 
@@ -291,7 +291,7 @@
         assert alert_type in ['INFO','ERROR']
         self.showDialog(unicode(msg),unicode(title),alert_type.lower())
 
-    
+
     def setStatusOnline(self, online=True):
         pass
 
@@ -309,21 +309,21 @@
                 self.setStatusOnline(False)
             return
 
-        self.contact_list.updatePresence(from_jid, show, priority, statuses) 
-            
+        self.contact_list.updatePresence(from_jid, show, priority, statuses)
+
         if show != 'unavailable':
-            
+
             #FIXME: must be moved in a plugin
             if from_jid.short in self.profiles[profile]['watched'] and not from_jid.short in self.profiles[profile]['onlineContact']:
                 self.showAlert(_("Watched jid [%s] is connected !") % from_jid.short)
 
             self.profiles[profile]['onlineContact'].add(from_jid)  #FIXME onlineContact is useless with CM, must be removed
-           
+
             #TODO: vcard data (avatar)
 
         if show=="unavailable" and from_jid in self.profiles[profile]['onlineContact']:
             self.profiles[profile]['onlineContact'].remove(from_jid)
-    
+
     def roomJoined(self, room_jid, room_nicks, user_nick, profile):
         """Called when a MUC room is joined"""
         if not self.check_profile(profile):
@@ -374,7 +374,7 @@
         if self.chat_wins.has_key(room_jid):
             self.chat_wins[room_jid].setSubject(subject)
             debug (_("new subject for room [%(room_jid)s]: %(subject)s") % {'room_jid':room_jid, "subject":subject})
-    
+
     def tarotGameStarted(self, room_jid, referee, players, profile):
         if not self.check_profile(profile):
             return
@@ -382,7 +382,7 @@
         if self.chat_wins.has_key(room_jid):
             self.chat_wins[room_jid].startGame("Tarot", referee, players)
             debug (_("new Tarot game started by [%(referee)s] in room [%(room_jid)s] with %(players)s") % {'referee':referee, 'room_jid':room_jid, 'players':[str(player) for player in players]})
-       
+
     def tarotGameNew(self, room_jid, hand, profile):
         if not self.check_profile(profile):
             return
@@ -411,8 +411,8 @@
         debug (_("My turn to play"))
         if self.chat_wins.has_key(room_jid):
             self.chat_wins[room_jid].getGame("Tarot").myTurn()
-    
-    def tarotScore(self, room_jid, xml_data, winners, loosers, profile): 
+
+    def tarotScore(self, room_jid, xml_data, winners, loosers, profile):
         """Called when the game is finished and the score are updated"""
         if not self.check_profile(profile):
             return
@@ -426,14 +426,14 @@
         debug (_("Card(s) played (%(player)s): %(cards)s") % {"player":player, "cards":cards})
         if self.chat_wins.has_key(room_jid):
             self.chat_wins[room_jid].getGame("Tarot").cardsPlayed(player, cards)
-   
+
     def tarotInvalidCards(self, room_jid, phase, played_cards, invalid_cards, profile):
         if not self.check_profile(profile):
             return
         debug (_("Cards played are not valid: %s") % invalid_cards)
         if self.chat_wins.has_key(room_jid):
             self.chat_wins[room_jid].getGame("Tarot").invalidCards(phase, played_cards, invalid_cards)
-  
+
     def quizGameStarted(self, room_jid, referee, players, profile):
         if not self.check_profile(profile):
             return
@@ -441,7 +441,7 @@
         if self.chat_wins.has_key(room_jid):
             self.chat_wins[room_jid].startGame("Quiz", referee, players)
             debug (_("new Quiz game started by [%(referee)s] in room [%(room_jid)s] with %(players)s") % {'referee':referee, 'room_jid':room_jid, 'players':[str(player) for player in players]})
-       
+
     def quizGameNew(self, room_jid, data, profile):
         if not self.check_profile(profile):
             return
@@ -477,7 +477,7 @@
             return
         if self.chat_wins.has_key(room_jid):
             self.chat_wins[room_jid].getGame("Quiz").quizGameAnswerResult(player, good_answer, score)
-    
+
     def quizGameTimerExpired(self, room_jid, profile):
         """Called when nobody answered the question in time"""
         if not self.check_profile(profile):
@@ -516,10 +516,10 @@
 
     def showDialog(self, message, title, type="info", answer_cb = None):
         raise NotImplementedError
-    
+
     def showAlert(self, message):
         pass  #FIXME
-    
+
     def paramUpdate(self, name, value, namespace, profile):
         if not self.check_profile(profile):
             return
@@ -556,7 +556,7 @@
 
     def askConfirmation(self, confirm_id, confirm_type, data, profile):
         raise NotImplementedError
-    
+
     def actionResult(self, type, id, data):
         raise NotImplementedError
 
diff --git a/frontends/src/quick_frontend/quick_card_game.py b/frontends/src/quick_frontend/quick_card_game.py
--- a/frontends/src/quick_frontend/quick_card_game.py
+++ b/frontends/src/quick_frontend/quick_card_game.py
@@ -25,7 +25,7 @@
 
 
 class QuickCardGame():
-    
+
     def __init__(self, parent, referee, players, player_nick):
         self._autoplay = None #XXX: use 0 to activate fake play, None else
         self.parent = parent
@@ -58,7 +58,7 @@
         self.state = None
         for pl in self.played:
             self.played[pl] = None
-        
+
     def getPlayerLocation(self, nick):
         """return player location (top,bottom,left or right)"""
         for location in ['top','left','bottom','right']:
@@ -76,7 +76,7 @@
         self.cards["coeur"]={} #heart
         self.cards["carreau"]={} #diamond
         self.cards["trefle"]={} #club
-    
+
     def newGame(self, hand):
         """Start a new game, with given hand"""
         assert (len(self.hand) == 0)
@@ -84,7 +84,7 @@
             self.hand.append(self.cards[suit, value])
         self.hand.sort()
         self.state = "init"
-    
+
     def contratSelected(self, contrat):
         """Called when the contrat has been choosed
         @param data: form result"""
@@ -94,7 +94,7 @@
         """Called when the player as to select his contrat
         @param xml_data: SàT xml representation of the form"""
         raise NotImplementedError
-    
+
     def showCards(self, game_stage, cards, data):
         """Display cards in the middle of the game (to show for e.g. chien ou poignée)"""
         self.to_show = []
@@ -111,7 +111,7 @@
             self.to_show = []
         self.state = "play"
         self.__fakePlay()
-                  
+
     def __fakePlay(self):
         """Convenience method for stupid autoplay
         /!\ don't forgot to comment any interactive dialog for invalid card"""
@@ -131,7 +131,7 @@
         @param winners: list of winners' nicks
         @param loosers: list of loosers' nicks"""
         raise NotImplementedError
-    
+
     def cardsPlayed(self, player, cards):
         """A card has been played by player"""
         if self.to_show:
@@ -143,7 +143,7 @@
         for suit, value in cards:
             pl_cards.append(self.cards[suit, value])
         self.played[player] = pl_cards[0]
-    
+
     def invalidCards(self, phase, played_cards, invalid_cards):
         """Invalid cards have been played
         @param phase: phase of the game
@@ -156,10 +156,10 @@
             self.state = "ecart"
         else:
             error ('INTERNAL ERROR: unmanaged game phase')
-        
+
         for suit, value in played_cards:
             self.hand.append(self.cards[suit, value])
-        
+
         self.hand.sort()
         self.__fakePlay()
 
diff --git a/frontends/src/quick_frontend/quick_chat.py b/frontends/src/quick_frontend/quick_chat.py
--- a/frontends/src/quick_frontend/quick_chat.py
+++ b/frontends/src/quick_frontend/quick_chat.py
@@ -25,7 +25,7 @@
 
 
 class QuickChat():
-    
+
     def __init__(self, target, host, type='one2one'):
         self.target = target
         self.host = host
@@ -49,7 +49,7 @@
             error (_("[INTERNAL] trying to set presents nicks for a non group chat window"))
             raise Exception("INTERNAL ERROR") #TODO: raise proper Exception here
         self.occupants.update(nicks)
-    
+
     def replaceUser(self, nick, show_info=True):
         """Add user if it is not in the group list"""
         debug (_("Replacing user %s") % nick)
@@ -77,7 +77,7 @@
 
     def getUserNick(self):
         return unicode(self.nick)
-    
+
     def changeUserNick(self, old_nick, new_nick):
         """Change nick of a user in group list"""
         debug(_("Changing nick of user %(old_nick)s to %(new_nick)s") % {"old_nick": old_nick, "new_nick": new_nick})
@@ -99,13 +99,13 @@
         """Print the initial history"""
         debug (_("now we print history"))
         def onHistory(history):
-            for line in history: 
+            for line in history:
                 timestamp, from_jid, to_jid, message, _type = line
                 if ((self.type == 'group' and _type != 'groupchat') or
                    (self.type == 'one2one' and _type == 'groupchat')):
                     continue
                 self.printMessage(JID(from_jid), message, profile, timestamp)
-                    
+
         def onHistoryError(err):
             error (_("Can't get history"))
 
@@ -123,11 +123,11 @@
             if jid.startswith(const_PRIVATE_PREFIX) or unescaped.short == jid.short:
                 return unescaped.resource
         return jid.resource if self.type == "group" else (self.host.contact_list.getCache(jid,'nick') or self.host.contact_list.getCache(jid,'name') or jid.node)
-    
+
     def printMessage(self, from_jid, msg, profile, timestamp = ''):
         """Print message in chat window. Must be implemented by child class"""
         jid=JID(from_jid)
-        nick = self._get_nick(jid) 
+        nick = self._get_nick(jid)
         mymess = (jid.resource == self.nick) if self.type == "group" else (jid.short == self.host.profiles[profile]['whoami'].short) #mymess = True if message comes from local user
         if msg.startswith('/me '):
             self.printInfo('* %s %s' % (nick, msg[4:]),type='me', timestamp=timestamp)
@@ -143,12 +143,12 @@
         """
         raise NotImplementedError
 
-    
+
     def startGame(self, game_type, referee, players):
         """Configure the chat window to start a game"""
         #No need to raise an error as game are not mandatory
         warning(_('startGame is not implemented in this frontend'))
-    
+
     def getGame(self, game_type):
         """Return class managing the game type"""
         #No need to raise an error as game are not mandatory
diff --git a/frontends/src/quick_frontend/quick_chat_list.py b/frontends/src/quick_frontend/quick_chat_list.py
--- a/frontends/src/quick_frontend/quick_chat_list.py
+++ b/frontends/src/quick_frontend/quick_chat_list.py
@@ -25,7 +25,7 @@
 class QuickChatList(dict):
     """This class is used to manage the list of chat windows.
     It act as a dict, but create a chat window when the name is found for the first time."""
-    
+
     def __init__(self, host):
         dict.__init__(self)
         self.host = host
diff --git a/frontends/src/quick_frontend/quick_contact_list.py b/frontends/src/quick_frontend/quick_contact_list.py
--- a/frontends/src/quick_frontend/quick_contact_list.py
+++ b/frontends/src/quick_frontend/quick_contact_list.py
@@ -49,16 +49,16 @@
 
     def __contains__(self, jid):
         raise NotImplementedError
-    
+
     def clearContacts(self):
         """Clear all the contact list"""
         self.specials.clear()
-    
+
     def replace(self, jid, groups=None, attributes=None):
         """add a contact to the list if doesn't exist, else update it"""
         if attributes and 'name' in attributes:
             self.setCache(jid, 'name', attributes['name'])
-    
+
     def remove(self, jid):
         """remove a contact from the list"""
         try:
diff --git a/frontends/src/quick_frontend/quick_contact_management.py b/frontends/src/quick_frontend/quick_contact_management.py
--- a/frontends/src/quick_frontend/quick_contact_management.py
+++ b/frontends/src/quick_frontend/quick_contact_management.py
@@ -47,7 +47,7 @@
         if entity.resource in self.__contactlist[entity.short]['resources']:
             self.__contactlist[entity.short]['resources'].remove(entity.resource)
         self.__contactlist[entity.short]['resources'].append(entity.resource)
-   
+
     def getContFromGroup(self, group):
         """Return all contacts which are in given group"""
         result = []
@@ -71,7 +71,7 @@
         else:
             debug(_('Trying to get attribute for an unknown contact'))
         return None
-    
+
     def isConnected(self, entity):
         """Tell if the contact is online"""
         return self.__contactlist.has_key(entity.short)
@@ -101,4 +101,4 @@
 
     def get_full(self, entity):
         return entity.short+'/'+self.__contactlist[entity.short]['resources'][-1]
-        
+
diff --git a/frontends/src/quick_frontend/quick_gateways.py b/frontends/src/quick_frontend/quick_gateways.py
--- a/frontends/src/quick_frontend/quick_gateways.py
+++ b/frontends/src/quick_frontend/quick_gateways.py
@@ -24,7 +24,7 @@
 
 class QuickGatewaysManager():
 
-    
+
     def __init__(self, host, gateways, title=_("Gateways manager"), server=None):
         self.WARNING_MSG = _(u"""Be careful ! Gateways allow you to use an external IM (legacy IM), so you can see your contact as jabber contacts.
 But when you do this, all your messages go throught the external legacy IM server, it is a huge privacy issue (i.e.: all your messages throught the gateway can be monitored, recorded, analyzed by the external server, most of time a private company).""")
diff --git a/frontends/src/wix/card_game.py b/frontends/src/wix/card_game.py
--- a/frontends/src/wix/card_game.py
+++ b/frontends/src/wix/card_game.py
@@ -49,7 +49,7 @@
     def draw(self, dc, x, y):
         """Draw the card on the device context
         @param dc: device context
-        @param x: abscissa 
+        @param x: abscissa
         @param y: ordinate"""
         dc.DrawBitmap(self.bitmap, x, y, True)
 
@@ -152,7 +152,7 @@
 
     def onPaint(self, event):
         dc = wx.PaintDC(self)
-        
+
         #We print the names to know who play where TODO: print avatars when available
         max_x, max_y = self.GetSize()
         border = 10 #border between nick and end of panel
@@ -214,7 +214,7 @@
     def onMouseClick(self, event):
         print "mouse click:",event.GetPosition()
         pos_x,pos_y = event.GetPosition()
-        
+
         if self.state == "chien":
             self.to_show = []
             self.state = "wait"
diff --git a/frontends/src/wix/chat.py b/frontends/src/wix/chat.py
--- a/frontends/src/wix/chat.py
+++ b/frontends/src/wix/chat.py
@@ -41,11 +41,11 @@
 
     def __init__(self, target, host, type='one2one'):
         wx.Frame.__init__(self, None, title=target, pos=(0,0), size=(400,200))
-        QuickChat.__init__(self, target, host, type) 
+        QuickChat.__init__(self, target, host, type)
 
         self.sizer = wx.BoxSizer(wx.VERTICAL)
         self.SetSizer(self.sizer)
-        
+
         self.splitter = wx.SplitterWindow(self, -1)
         self.sizer.Add(self.splitter, 1, flag = wx.EXPAND)
 
@@ -60,7 +60,7 @@
         self.conv_panel.SetSizer(self.conv_panel.sizer)
         self.splitter.Initialize(self.conv_panel)
         self.SetMenuBar(wx.MenuBar())
-        
+
         #events
         self.Bind(wx.EVT_CLOSE, self.onClose, self)
         self.Bind(wx.EVT_TEXT_ENTER, self.onEnterPressed, self.textBox)
@@ -69,14 +69,14 @@
         self.font={}
         self.font["points"] = self.chatWindow.GetFont().GetPointSize()
         self.font["family"] = self.chatWindow.GetFont().GetFamily()
-        
-        
+
+
         #misc
         self.day_change = time.strptime(time.strftime("%a %b %d 00:00:00  %Y")) #struct_time of day changing time
         self.setType(self.type)
         self.textBox.SetFocus()
         self.Hide() #We hide because of the show toggle
-   
+
     def __createPresents(self):
         """Create a list of present people in a group chat"""
         self.present_panel = wx.Panel(self.splitter)
@@ -108,7 +108,7 @@
             self.__eraseMenus()
             self.__createMenus_O2O()
             self.historyPrint(profile=self.host.profile)
-    
+
     def startGame(self, game_type, referee, players):
         """Configure the chat window to start a game"""
         if game_type=="Tarot":
@@ -130,9 +130,9 @@
         """Return class managing the game type"""
         #TODO: check that the game is launched, and manage errors
         if game_type=="Tarot":
-            return self.tarot_panel 
+            return self.tarot_panel
         elif game_type=="Quiz":
-            return self.quiz_panel 
+            return self.quiz_panel
 
     def setPresents(self, nicks):
         """Set the users presents in the contact list for a group chat
@@ -141,7 +141,7 @@
         QuickChat.setPresents(self, nicks)
         for nick in nicks:
             self.present_panel.presents.replace(nick)
-    
+
     def replaceUser(self, nick, show_info=True):
         """Add user if it is not in the group list"""
         debug (_("Replacing user %s") % nick)
@@ -166,7 +166,7 @@
         menuBar = self.GetMenuBar()
         for i in range(menuBar.GetMenuCount()):
             menuBar.Remove(i)
-    
+
     def __createMenus_O2O(self):
         """create menu bar for one 2 one chat"""
         info("Creating menus")
@@ -190,7 +190,7 @@
 
         #events
         wx.EVT_MENU(self, idTAROT, self.onStartTarot)
-    
+
     def __del__(self):
         wx.Frame.__del__(self)
 
@@ -202,7 +202,7 @@
     def onEnterPressed(self, event):
         """Behaviour when enter pressed in send line."""
         self.host.sendMessage(self.target.short if self.type=='group' else self.target,
-                                     event.GetString(), 
+                                     event.GetString(),
                                      mess_type = "groupchat" if self.type=='group' else "chat",
                                      profile_key=self.host.profile)
         self.textBox.Clear()
@@ -236,7 +236,7 @@
         self.chatWindow.AppendText("%s\n" % msg)
         if not mymess:
             self.__blink()
-    
+
     def printInfo(self, msg, type='normal'):
         """Print general info
         @param msg: message to print
@@ -265,7 +265,7 @@
             else:
                 full_jid = self.target
             id = self.host.bridge.sendFile(full_jid, filename, {}, self.host.profile)
-            self.host.waitProgress(id, _("File Transfer"), _("Copying %s") % os.path.basename(filename), self.host.profile) 
+            self.host.waitProgress(id, _("File Transfer"), _("Copying %s") % os.path.basename(filename), self.host.profile)
 
     def onStartTarot(self, e):
         debug (_("Starting Tarot game"))
diff --git a/frontends/src/wix/contact_list.py b/frontends/src/wix/contact_list.py
--- a/frontends/src/wix/contact_list.py
+++ b/frontends/src/wix/contact_list.py
@@ -52,7 +52,7 @@
         self.empty_avatar = join(host.media_dir, 'misc/empty_avatar')
         self.Bind(wx.EVT_LISTBOX, self.onSelected)
         self.Bind(wx.EVT_LISTBOX_DCLICK, self.onActivated)
-    
+
     def __contains__(self, jid):
         return bool(self.__find_idx(jid))
 
@@ -107,7 +107,7 @@
     def __presentItemDefault(self, contact):
         """Make a basic presentation of string contacts in the list."""
         return contact
-    
+
     def __presentItemJID(self, jid):
         """Make a nice presentation of the contact in the list for JID contacts."""
         name = self.getCache(jid,'name')
@@ -116,7 +116,7 @@
         if _show == None or _show == 'unavailable':
             return None
         show =  filter(lambda x : x[0] == _show, const_STATUS)[0]
-            
+
         #show[0]==shortcut
         #show[1]==human readable
         #show[2]==color (or None)
@@ -126,7 +126,7 @@
         #WxPython segfault, and it doesn't without nothing. I couldn't reproduce the case with a basic test script, so it need further investigation before reporting it
         #to WxPython dev. Anyway, the program crash with a segfault, not a python exception, so there is definitely something wrong with WxPython.
         #The case seems to happen when SimpleHtmlListBox parse the HTML with the <img> tag
-        
+
         html = """
         <table border='0'>
         <td>
@@ -140,7 +140,7 @@
         """ % (avatar,
                escape(nick or name or jid.node or jid.short),
                show_html,
-               escape(status)) 
+               escape(status))
 
         return html
 
@@ -163,7 +163,7 @@
                     gp_idx = self.Append(self.__presentGroup(group), Group(group))
                 else:
                     gp_idx = indexes[0]
-                
+
                 _present = self.__presentItem(contact)
                 if _present:
                     self.Insert(_present, gp_idx+1, contact)
@@ -199,7 +199,7 @@
             event.Skip(False)
         else:
             event.Skip()
-    
+
     def onActivated(self, event):
         """Called when a contact is clicked or activated with keyboard."""
         data = self.getSelection()
diff --git a/frontends/src/wix/gateways.py b/frontends/src/wix/gateways.py
--- a/frontends/src/wix/gateways.py
+++ b/frontends/src/wix/gateways.py
@@ -36,7 +36,7 @@
 
         if server:
             self.SetTitle(title+" (%s)" % server)
-            
+
         #Fonts
         self.normal_font = wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL)
         self.bold_font = wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.BOLD)
@@ -61,10 +61,10 @@
         self.sizer.Add(self.panel, 1, flag=wx.EXPAND)
         self.SetSizer(self.sizer)
         self.SetAutoLayout(True)
-        
+
         #events
         self.Bind(wx.EVT_CLOSE, self.onClose, self)
-        
+
         self.MakeModal()
         self.panel.sizer.Add(wx.Window(self.panel, -1))
         title_name = wx.StaticText(self.panel, -1, "Name")
@@ -75,7 +75,7 @@
         self.panel.sizer.Add(title_type)
         self.panel.sizer.Add(wx.Window(self.panel, -1))
         self.panel.sizer.Add(wx.Window(self.panel, -1))
-    
+
         for gateway in gateways:
             self.addGateway(gateway, gateways[gateway])
 
@@ -94,20 +94,20 @@
         self.ext_server_panel.sizer.Add(ext_server_label)
         self.ext_server_panel.sizer.Add(self.ext_server_text, 1, flag=wx.EXPAND)
         self.ext_server_panel.sizer.Add(ext_server_button)
-        
+
         #self.panel.sizer.Fit(self)
         self.sizer.Fit(self)
-        
+
         self.Show()
 
     def browseExternalServer(self, event):
         """Open the gateway manager on given server"""
         server = self.ext_server_text.GetValue()
-        debug(_("Opening gateways manager on [%s]") % server) 
+        debug(_("Opening gateways manager on [%s]") % server)
         id = self.host.bridge.findGateways(server, self.host.profile)
         self.host.current_action_ids.add(id)
         self.host.current_action_ids_cb[id] = self.host.onGatewaysFound
-        self.MakeModal(False) 
+        self.MakeModal(False)
         self.Destroy()
 
 
@@ -121,7 +121,7 @@
 
         label=wx.StaticText(self.panel, -1, param['name'])
         label.SetFont(self.normal_font)
-       
+
         #Then the transport type message
         type_label_txt = self.getGatewayDesc(param['type'])
 
@@ -134,7 +134,7 @@
             gateway_jid = event.GetEventObject().gateway_jid
             id = self.host.bridge.in_band_register(gateway_jid, self.host.profile)
             self.host.current_action_ids.add(id)
-            self.MakeModal(False) 
+            self.MakeModal(False)
             self.Destroy()
 
         def unregister_cb(event):
@@ -142,9 +142,9 @@
             gateway_jid = event.GetEventObject().gateway_jid
             id = self.host.bridge.gatewayRegister("CANCEL",gateway_jid, None, self.host.profile)
             self.host.current_action_ids.add(id)
-            self.MakeModal(False) 
+            self.MakeModal(False)
             self.Destroy()
-        
+
         reg_button = wx.Button(self.panel, -1, _("Register"), size=wx.Size(-1, 8))
         reg_button.SetFont(self.button_font)
         reg_button.gateway_jid = JID(gateway)
@@ -153,7 +153,7 @@
         unreg_button.SetFont(self.button_font)
         unreg_button.gateway_jid = JID(gateway)
         self.panel.Bind(wx.EVT_BUTTON, unregister_cb, unreg_button)
-        
+
         self.panel.sizer.Add(im_icon)
         self.panel.sizer.Add(label)
         self.panel.sizer.Add(type_label)
diff --git a/frontends/src/wix/main_window.py b/frontends/src/wix/main_window.py
--- a/frontends/src/wix/main_window.py
+++ b/frontends/src/wix/main_window.py
@@ -48,10 +48,10 @@
 
 class ChatList(QuickChatList):
     """This class manage the list of chat windows"""
-    
+
     def createChat(self, target):
         return Chat(target, self.host)
-    
+
 class MainWindow(wx.Frame, QuickApp):
     """main app window"""
 
@@ -62,13 +62,13 @@
         #sizer
         self.sizer = wx.BoxSizer(wx.VERTICAL)
         self.SetSizer(self.sizer)
-        
+
         #Frame elements
         self.contact_list = ContactList(self, self)
         self.contact_list.registerActivatedCB(self.onContactActivated)
         self.contact_list.Hide()
         self.sizer.Add(self.contact_list, 1, flag=wx.EXPAND)
-        
+
         self.chat_wins=ChatList(self)
         self.CreateStatusBar()
 
@@ -80,12 +80,12 @@
         self.tools.AddSeparator()
         self.statusTxt=wx.TextCtrl(self.tools, -1, style = wx.TE_PROCESS_ENTER)
         self.tools.AddControl(self.statusTxt)
-        self.Bind(wx.EVT_COMBOBOX, self.onStatusChange, self.statusBox) 
+        self.Bind(wx.EVT_COMBOBOX, self.onStatusChange, self.statusBox)
         self.Bind(wx.EVT_TEXT_ENTER, self.onStatusChange, self.statusTxt)
         self.tools.Disable()
 
-        
-        
+
+
         #tray icon
         ticon = wx.Icon(os.path.join(self.media_dir, 'icons/crystal/tray_icon.xpm'), wx.BITMAP_TYPE_XPM)
         self.tray_icon = wx.TaskBarIcon()
@@ -95,16 +95,16 @@
 
         #events
         self.Bind(wx.EVT_CLOSE, self.onClose, self)
-        
+
         #menus
         self.createMenus()
         for i in range(self.menuBar.GetMenuCount()):
             self.menuBar.EnableTop(i, False)
-        
+
         #profile panel
-        self.profile_pan = ProfileManager(self) 
+        self.profile_pan = ProfileManager(self)
         self.sizer.Add(self.profile_pan, 1, flag=wx.EXPAND)
-      
+
         self.postInit()
 
         self.Show()
@@ -195,7 +195,7 @@
         popup.SetPosition((x,0))
         popup.Show()
         wx.CallLater(5000,popup.Destroy)
-    
+
     def showDialog(self, message, title="", type="info", answer_cb = None, answer_data = None):
         if type == 'info':
             flags = wx.OK | wx.ICON_INFORMATION
@@ -212,7 +212,7 @@
         if answer_cb:
             data = [answer_data] if answer_data else []
             answer_cb(True if (answer == wx.ID_YES or answer == wx.ID_OK) else False, *data)
-       
+
     def setStatusOnline(self, online=True):
         """enable/disable controls, must be called when local user online status change"""
         if online:
@@ -241,12 +241,12 @@
                 if filename:
                     answer_data["dest_path"] = filename
                     self.bridge.confirmationAnswer(confirmation_id, True, answer_data, profile)
-                    self.waitProgress(confirmation_id, _("File Transfer"), _("Copying %s") % os.path.basename(filename), profile) 
+                    self.waitProgress(confirmation_id, _("File Transfer"), _("Copying %s") % os.path.basename(filename), profile)
                 else:
                     answer = wx.ID_NO
             if answer==wx.ID_NO:
                     self.bridge.confirmationAnswer(confirmation_id, False, answer_data, profile)
-            
+
             dlg.Destroy()
 
         elif confirmation_type == "YES/NO":
@@ -323,21 +323,21 @@
             if not self.pbar:
                 #first answer, we must construct the bar
                 self.pbar = wx.ProgressDialog(title, message, float(data['size']), None,
-                    wx.PD_SMOOTH | wx.PD_ELAPSED_TIME | wx.PD_ESTIMATED_TIME | wx.PD_REMAINING_TIME) 
+                    wx.PD_SMOOTH | wx.PD_ELAPSED_TIME | wx.PD_ESTIMATED_TIME | wx.PD_REMAINING_TIME)
                 self.pbar.finish_value = float(data['size'])
-                
+
             self.pbar.Update(int(data['position']))
         elif self.pbar:
             self.pbar.Update(self.pbar.finish_value)
             return
 
         wx.CallLater(10, self.progressCB, progress_id, title, message, profile)
-        
+
     def waitProgress (self, progress_id, title, message, profile):
         self.pbar = None
         wx.CallLater(10, self.progressCB, progress_id, title, message, profile)
-        
-        
+
+
 
     ### events ###
 
@@ -388,7 +388,7 @@
 
     def onExit(self, e):
         self.Close()
-    
+
     def onAddContact(self, e):
         debug(_("Add contact request"))
         dlg = wx.TextEntryDialog(
@@ -439,15 +439,15 @@
             dlg.ShowModal()
             dlg.Destroy()
             return
-        _id = self.bridge.getCard(target.short, profile_key=self.profile) 
+        _id = self.bridge.getCard(target.short, profile_key=self.profile)
         self.current_action_ids.add(_id)
         self.current_action_ids_cb[_id] = self.onProfileReceived
-   
+
     def onProfileReceived(self, data):
         """Called when a profile is received"""
         debug (_('Profile received: [%s]') % data)
         profile=Profile(self, data)
-        
+
     def onJoinRoom(self, e):
         warning('FIXME: temporary menu, must be improved')
         #TODO: a proper MUC room joining dialog with nickname etc
@@ -473,7 +473,7 @@
         target = data['__private__']['target']
         del data['__private__']
         gatewayManager = GatewaysManager(self, data, server=target)
-    
+
     def onClose(self, e):
         QuickApp.onExit(self)
         info(_("Exiting..."))
@@ -489,4 +489,4 @@
             self.Show()
             self.Raise()
         e.Skip()
-    
+
diff --git a/frontends/src/wix/param.py b/frontends/src/wix/param.py
--- a/frontends/src/wix/param.py
+++ b/frontends/src/wix/param.py
@@ -42,15 +42,15 @@
         self.sizer.Add(self.notebook, 1, flag=wx.EXPAND)
         self.SetSizer(self.sizer)
         self.SetAutoLayout(True)
-        
+
         #events
         self.Bind(wx.EVT_CLOSE, self.onClose, self)
-        
+
         self.MakeModal()
 
         for category in self.host.bridge.getParamsCategories():
             self.addCategory(category)
-        
+
         self.Show()
 
     def addCategory(self, category):
@@ -62,7 +62,7 @@
 
         def gotParams(result):
             cat_dom = minidom.parseString(result.encode('utf-8'))
-            
+
             for param in cat_dom.documentElement.getElementsByTagName("param"):
                 name = param.getAttribute("name")
                 label = param.getAttribute("label")
@@ -109,20 +109,20 @@
     def onTextChanged(self, event):
         """Called when a string paramater is modified"""
         self.modified[event.GetEventObject().param_id]=event.GetString()
-        
+
         ### FIXME # Some hacks for better presentation, should be generic # FIXME ###
         if event.GetEventObject().param_id == ('JabberID', 'Connection'):
             domain = JID(event.GetString()).domain
             self.ctl_list[('Server', 'Connection')].SetValue(domain)
-            self.modified[('Server', 'Connection')] = domain 
+            self.modified[('Server', 'Connection')] = domain
 
         event.Skip()
-        
+
     def onCheckBoxClicked(self, event):
         """Called when a bool paramater is modified"""
         self.modified[event.GetEventObject().param_id]="true" if event.GetEventObject().GetValue() else "false"
         event.Skip()
-        
+
     def onButtonClicked(self, event):
         """Called when a button paramater is modified"""
         self.__save_parameters()
diff --git a/frontends/src/wix/profile.py b/frontends/src/wix/profile.py
--- a/frontends/src/wix/profile.py
+++ b/frontends/src/wix/profile.py
@@ -47,24 +47,24 @@
         self.sizer.Add(self.notebook, 1, flag=wx.EXPAND)
         self.SetSizer(self.sizer)
         self.SetAutoLayout(True)
-        
+
         #events
         self.Bind(wx.EVT_CLOSE, self.onClose, self)
-        
+
         self.MakeModal()
         self.showData(data)
         self.Show()
 
     def showData(self, data):
         flags = wx.TE_READONLY
-        
+
         #General tab
         generaltab = wx.Panel(self.notebook)
         sizer = wx.FlexGridSizer(cols=2)
         sizer.AddGrowableCol(1)
         generaltab.SetSizer(sizer)
         generaltab.SetAutoLayout(True)
-        for field in ['fullname','nick', 'birthday', 'phone', 'website', 'email']:        
+        for field in ['fullname','nick', 'birthday', 'phone', 'website', 'email']:
             value = data[field] if data.has_key(field) else ''
             label=wx.StaticText(generaltab, -1, self.name_dict[field]+": ")
             sizer.Add(label)
@@ -80,7 +80,7 @@
             sizer.Add(self.ctl_list['avatar'], 0)
 
 
-        
+
         self.notebook.AddPage(generaltab, _("General"))
 
 
diff --git a/frontends/src/wix/profile_manager.py b/frontends/src/wix/profile_manager.py
--- a/frontends/src/wix/profile_manager.py
+++ b/frontends/src/wix/profile_manager.py
@@ -56,7 +56,7 @@
         self.sizer.Add(button_panel, flag=wx.CENTER)
         self.Bind(wx.EVT_BUTTON, self.onNewProfile, button_new)
         self.Bind(wx.EVT_BUTTON, self.onDeleteProfile, button_del)
-        
+
         login_box = wx.StaticBox(self, -1, _("Login"))
         self.login_sizer = wx.StaticBoxSizer(login_box, wx.VERTICAL)
         self.sizer.Add(self.login_sizer, 1, wx.EXPAND | wx.ALL)
@@ -66,13 +66,13 @@
         self.login_pass = wx.TextCtrl(self, -1, style = wx.TE_PASSWORD)
         self.login_sizer.Add(wx.StaticText(self, -1, _("Password:")), 0, flag=wx.ALIGN_CENTER)
         self.login_sizer.Add(self.login_pass, flag=wx.EXPAND)
-       
+
         loggin_button = wx.Button(self, -1, _("Connect"))
         self.Bind(wx.EVT_BUTTON, self.onConnectButton, loggin_button)
         self.login_sizer.Add(loggin_button, flag=wx.ALIGN_CENTER)
 
         self.sizer.Add(wx.Window(self, -1), 1)
-        
+
         #Now we can set the default value
         self.__setDefault()
 
@@ -82,7 +82,7 @@
         if profile_default:
             self.profile_name.SetValue(profile_default)
             self.onProfileChange(None)
-    
+
     def __refillProfiles(self):
         """Update profiles with current names. Must be called after a profile change"""
         self.profile_name.Clear()
@@ -90,8 +90,8 @@
         profiles.sort()
         for profile in profiles:
             self.profile_name.Append(profile)
-   
- 
+
+
     def onNewProfile(self, event):
         dlg = wx.TextEntryDialog(self, _("Please enter the new profile name"), _("New profile"), style = wx.OK | wx.CANCEL)
         if dlg.ShowModal() == wx.ID_OK:
@@ -104,7 +104,7 @@
                     self.__refillProfiles()
                     self.profile_name.SetValue(name)
         dlg.Destroy()
-        
+
     def onDeleteProfile(self, event):
         name = self.profile_name.GetValue()
         if not name:
@@ -136,12 +136,12 @@
             return
         profile = self.host.bridge.getProfileName(name)
         assert(profile)
-        
+
         self.host.bridge.asyncGetParamA("JabberID", "Connection", profile_key=profile, callback=lambda old_jid: self.__old_jidReceived(old_jid, profile), errback=self.getParamError)
-        
+
     def __old_jidReceived(self, old_jid, profile):
         self.host.bridge.asyncGetParamA("Password", "Connection", profile_key=profile, callback=lambda old_pass: self.__old_passReceived(old_jid, old_pass, profile), errback=self.getParamError)
-    
+
     def __old_passReceived(self, old_jid, old_pass, profile):
         new_jid = self.login_jid.GetValue()
         new_pass = self.login_pass.GetValue()
@@ -153,7 +153,7 @@
             debug(_('Saving new password'))
             self.host.bridge.setParam("Password", new_pass, "Connection", profile)
         self.host.plug_profile(profile)
-        
-        
+
+
     def getParamError(self, ignore):
         wx.MessageDialog(self, _("Can't get profile parameter"), _("Profile error"), wx.ICON_ERROR).ShowModal()
diff --git a/frontends/src/wix/quiz_game.py b/frontends/src/wix/quiz_game.py
--- a/frontends/src/wix/quiz_game.py
+++ b/frontends/src/wix/quiz_game.py
@@ -49,17 +49,17 @@
 
     def __cmp__(self, other):
         return self.zindex.__cmp__(other.zindex)
-    
+
     def draw(self, dc, x=None, y=None):
         """Draw the card on the device context
         @param dc: device context
-        @param x: abscissa 
+        @param x: abscissa
         @param y: ordinate"""
         dc.DrawBitmap(self.bitmap, x or self.x, y or self.y, self.transparent)
 
 class BaseWindow(wx.Window):
     """This is the panel where the game is drawed, under the other widgets"""
-    
+
     def __init__(self, parent):
         wx.Window.__init__(self, parent, pos=(0,0), size=(WIDTH, HEIGHT))
         self.parent = parent
@@ -98,7 +98,7 @@
         for i in range(4):
             answer = self.parent.players_data[i]["answer"]
             score = self.parent.players_data[i]["score"]
-            if answer == None:    
+            if answer == None:
                 device_context.DrawText("%d" % score, 100 + i*184, 355)
             else:
                 device_context.DrawBitmap(self.right_image if answer else self.wrong_image, 39+i*184, 348, True)
@@ -118,14 +118,14 @@
             if left:
                 #we now draw the timer
                 angle = ((-2*pi)*((total-left)/total) + (pi/2))
-                x = center_x + radius * cos(angle) 
+                x = center_x + radius * cos(angle)
                 y = center_y - radius * sin(angle)
                 device_context.DrawArc(center_x, center_y-radius, x, y, center_x, center_y)
 
     def onPaint(self, event):
         dc = wx.PaintDC(self)
         self.fullPaint(dc)
-       
+
 
 
 class QuizPanel(wx.Panel):
@@ -156,7 +156,7 @@
         self.answer.Bind(wx.EVT_TEXT_ENTER, self.answered)
         self.parent.host.bridge.quizGameReady(player_nick, referee, profile_key = self.parent.host.profile)
         self.state = None
-    
+
     def answered(self, event):
         """Called when the player gave an answer in the box"""
         self.last_answer = self.answer.GetValue()
@@ -184,7 +184,7 @@
         self.time_limit = self.time_origin + timer
         self.time_pause = None
         self.__timer_refresh()
-        
+
     def __timer_refresh(self):
         self.Refresh()
         if self.time_left:
@@ -203,14 +203,14 @@
         self.startTimer(timer)
         self.last_answer = None
         self.answer.Clear()
-    
+
     def quizGamePlayerBuzzed(self, player, pause):
         """Called when the player pushed the buzzer
         @param player: player who pushed the buzzer
         @param pause: should we stop the timer ?"""
         if pause:
             self.time_pause = time()
-    
+
     def quizGamePlayerSays(self, player, text, delay):
         """Called when the player says something
         @param player: who is talking
diff --git a/frontends/src/wix/wix b/frontends/src/wix/wix
--- a/frontends/src/wix/wix
+++ b/frontends/src/wix/wix
@@ -25,7 +25,7 @@
 import pdb
 import logging
 from logging import debug, info, error
-from sat_frontends.wix.main_window import MainWindow 
+from sat_frontends.wix.main_window import MainWindow
 
 ### logging configuration FIXME: put this elsewhere ###
 logging.basicConfig(level=logging.DEBUG,
diff --git a/frontends/src/wix/xmlui.py b/frontends/src/wix/xmlui.py
--- a/frontends/src/wix/xmlui.py
+++ b/frontends/src/wix/xmlui.py
@@ -43,11 +43,11 @@
         self.sizer = wx.BoxSizer(wx.VERTICAL)
         self.SetSizer(self.sizer)
         self.SetAutoLayout(True)
-        
+
         #events
         if not 'NO_CANCEL' in self.options:
             self.Bind(wx.EVT_CLOSE, self.onClose, self)
-        
+
         self.MakeModal()
 
         self.constructUI(xml_data)
@@ -83,7 +83,7 @@
             elif type=="password":
                 ctrl = wx.TextCtrl(parent, -1, value, style=wx.TE_PASSWORD)
                 self.ctrl_list[name] = ({'type':type, 'control':ctrl})
-                _proportion = 1 
+                _proportion = 1
             elif type=="textbox":
                 ctrl = wx.TextCtrl(parent, -1, value, style=wx.TE_MULTILINE)
                 self.ctrl_list[name] = ({'type':type, 'control':ctrl})
@@ -142,12 +142,12 @@
                 if parent:
                     parent.sizer.Add(current, _proportion, flag=wx.EXPAND)
             elif node.nodeName == "category":
-                name = node.getAttribute('name') 
-                label = node.getAttribute('label') 
+                name = node.getAttribute('name')
+                label = node.getAttribute('label')
                 if not node.nodeName in wanted or not name or not isinstance(parent,wx.Notebook):
                     raise Exception("Invalid XMLUI") #TODO: make a custom exception
                 notebook = parent
-                tab_panel = wx.Panel(notebook, -1) 
+                tab_panel = wx.Panel(notebook, -1)
                 tab_panel.sizer = wx.BoxSizer(wx.VERTICAL)
                 tab_panel.SetSizer(tab_panel.sizer)
                 notebook.AddPage(tab_panel, label or name)
@@ -162,7 +162,7 @@
     def constructUI(self, xml_data):
         panel=wx.Panel(self)
         panel.sizer = wx.BoxSizer(wx.VERTICAL)
-        
+
         cat_dom = minidom.parseString(xml_data.encode('utf-8'))
         top= cat_dom.documentElement
         self.type = top.getAttribute("type")
@@ -230,13 +230,13 @@
             warning (_("The form data is not sent back, the type is not managed properly"))
         self.MakeModal(False)
         self.Destroy()
-        
+
     def onFormCancelled(self, event):
         """Called when cancel button is clicked"""
         debug(_("Cancelling form"))
         self.MakeModal(False)
         self.Close()
-   
+
     def onClose(self, event):
         """Close event: we have to send the form."""
         debug(_("close"))
diff --git a/src/bridge/DBus.py b/src/bridge/DBus.py
--- a/src/bridge/DBus.py
+++ b/src/bridge/DBus.py
@@ -94,7 +94,7 @@
                 raise DeferredNotAsync
             return result
 
-    ### signals ###    
+    ### signals ###
 
     @dbus.service.signal(const_INT_PREFIX+const_PLUGIN_SUFFIX,
                          signature='')
@@ -175,8 +175,8 @@
         pass
 
 
-    ### methods ###    
-    
+    ### methods ###
+
     @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
                          in_signature='ss', out_signature='',
                          async_callbacks=None)
@@ -411,11 +411,11 @@
     def updateContact(self, entity_jid, name, groups, profile_key="@DEFAULT@"):
         return self._callback("updateContact", unicode(entity_jid), unicode(name), groups, unicode(profile_key))
 
-    
+
     def __attributes(self, in_sign):
         """Return arguments to user given a in_sign
         @param in_sign: in_sign in the short form (using s,a,i,b etc)
-        @return: list of arguments that correspond to a in_sign (e.g.: "sss" return "arg1, arg2, arg3")""" 
+        @return: list of arguments that correspond to a in_sign (e.g.: "sss" return "arg1, arg2, arg3")"""
         i=0
         idx=0
         attr=[]
@@ -454,19 +454,19 @@
 
         _arguments = inspect_args.args
         _defaults = list(inspect_args.defaults or [])
-        
+
         if inspect.ismethod(method):
             #if we have a method, we don't want the first argument (usually 'self')
             del(_arguments[0])
 
         #first arguments are for the _callback method
         arguments_callback = ', '.join([repr(name)] + ((_arguments + ['callback=callback','errback=errback']) if async else _arguments))
-        
+
         if async:
             _arguments.extend(['callback','errback'])
             _defaults.extend([None, None])
-        
-        
+
+
         #now we create a second list with default values
         for i in range(1, len(_defaults)+1):
             _arguments[-i] = "%s = %s" % (_arguments[-i], repr(_defaults[-i]))
@@ -484,7 +484,7 @@
         function = getattr(self, name)
         func_table = self._dbus_class_table[self.__class__.__module__ + '.' + self.__class__.__name__][function._dbus_interface]
         func_table[function.__name__] = function #Needed for introspection
-    
+
     def addSignal(self, name, int_suffix, signature, doc={}):
         """Dynamically add a signal to Dbus Bridge"""
         attributes = ', '.join(self.__attributes(signature))
diff --git a/src/bridge/bridge.py b/src/bridge/bridge.py
--- a/src/bridge/bridge.py
+++ b/src/bridge/bridge.py
@@ -26,7 +26,7 @@
         info ("Bridge initialization")
 
     ##signals
-    def newContact(self, contact): 
+    def newContact(self, contact):
         raise NotImplementedError
 
     def newMessage(self, from_jid, msg, type='chat'):
@@ -45,7 +45,7 @@
 
     def getContacts(self):
         raise NotImplementedError
-    
+
     def getPresenceStatus(self):
         raise NotImplementedError
 
@@ -57,12 +57,12 @@
 
     def setParam(self, name, value, namespace):
         raise NotImplementedError
-        
+
     def getParam(self, name, namespace):
         raise NotImplementedError
 
     def getParams(self, namespace):
         raise NotImplementedError
-    
+
     def getHistory(self, from_jid, to_jid, size):
         raise NotImplementedError
diff --git a/src/bridge/bridge_constructor/bridge_contructor.py b/src/bridge/bridge_constructor/bridge_contructor.py
--- a/src/bridge/bridge_constructor/bridge_contructor.py
+++ b/src/bridge/bridge_constructor/bridge_contructor.py
@@ -53,11 +53,11 @@
 
 
 class ParseError(Exception):
-    #Used when the signature parsing is going wrong (invalid signature ?) 
+    #Used when the signature parsing is going wrong (invalid signature ?)
     pass
 
 class Constructor:
-    
+
     def __init__(self, bridge_template, options):
         self.bridge_template = bridge_template
         self.options = options
@@ -74,14 +74,14 @@
                 value = None
             function[option] = value
         return function
-    
+
     def getDefault(self, name):
         """Return default values of a function in a dict
         @param name: Name of the function to get
         @return: dict, each key is the integer param number (no key if no default value)"""
         default_dict={}
         def_re = re.compile(r"param_(\d+)_default")
-        
+
         for option in self.bridge_template.options(name):
             match = def_re.match(option)
             if match:
@@ -90,7 +90,7 @@
                 except ValueError:
                     raise ParseError("Invalid value [%s] for parameter number" % match.group(1))
                 default_dict[idx] = self.bridge_template.get(name, option)
-        
+
         return default_dict
 
     def getFlags(self, name):
@@ -102,7 +102,7 @@
             if option in FLAGS:
                 flags.append(option)
         return flags
-    
+
     def getArgumentsDoc(self, name):
         """Return documentation of arguments
         @param name: Name of the function to get
@@ -175,10 +175,10 @@
         @param name: dictionary of arguments name like given by getArguments
         @param default: dictionary of default values, like given by getDefault
         @param unicode_protect: activate unicode protection on strings (return strings as unicode(str))
-        @return: list of arguments that correspond to a signature (e.g.: "sss" return "arg1, arg2, arg3")""" 
+        @return: list of arguments that correspond to a signature (e.g.: "sss" return "arg1, arg2, arg3")"""
         idx=0
         attr_string=[]
-        
+
         for arg in self.argumentsParser(signature):
             attr_string.append(("unicode(%(name)s)%(default)s" if (unicode_protect and arg=='s') else "%(name)s%(default)s") % {
                 'name':name[idx][0] if (name and name.has_key(idx)) else "arg_%i" % idx,
@@ -186,7 +186,7 @@
                 }) #give arg_1, arg2, etc or name1, name2=default, etc. \
                    #give unicode(arg_1), unicode(arg_2), etc. if unicode_protect is set and arg is a string
             idx+=1
-        
+
         return ", ".join(attr_string)
 
     def generateCoreSide(self):
@@ -209,7 +209,7 @@
                 os.mkdir(DEST_DIR)
             full_path=os.path.join(DEST_DIR,filename)
             if os.path.exists(full_path) and not self.options.force:
-                print ("The destination file [%s] already exists ! Use --force to overwrite it" % full_path) 
+                print ("The destination file [%s] already exists ! Use --force to overwrite it" % full_path)
             try:
                 with open(full_path,'w') as dest_file:
                     dest_file.write('\n'.join(file_buf))
@@ -223,8 +223,8 @@
 
     def __init__(self, bridge_template, options):
         Constructor.__init__(self, bridge_template, options)
-        self.core_template="mediawiki_template.tpl" 
-        self.core_dest="mediawiki.wiki" 
+        self.core_template="mediawiki_template.tpl"
+        self.core_dest="mediawiki.wiki"
 
     def _addTextDecorations(self, text):
         """Add text decorations like coloration or shortcuts"""
@@ -259,7 +259,7 @@
             if arg_default.has_key(i):
                 wiki.append(":''DEFAULT: %s''" % arg_default[i])
         return "\n".join(wiki)
-         
+
     def _wikiReturn(self, name):
         """Format return doc with the wiki syntax
         @param name: name of the function
@@ -317,7 +317,7 @@
 %(async)s
 {| class="wikitable" style="text-align:left; width:80%%;"
 ! scope=row | category
-| %(category)s 
+| %(category)s
 |-
 %(signature)s
 ! scope=row | parameters
@@ -325,7 +325,7 @@
 %(parameters)s%(return)s
 |}
 """ % completion)
-        
+
         #at this point, signals_part, and methods_part should be filled,
         #we just have to place them in the right part of the template
         core_bridge = []
@@ -342,7 +342,7 @@
                         core_bridge.append(line.replace('\n',''))
         except IOError:
             print ("Can't open template file [%s]" % self.core_template)
-            sys.exit(1) 
+            sys.exit(1)
 
         #now we write to final file
         self.finalWrite(self.core_dest, core_bridge)
@@ -351,9 +351,9 @@
 
     def __init__(self, bridge_template, options):
         Constructor.__init__(self, bridge_template, options)
-        self.core_template="dbus_core_template.py" 
-        self.frontend_template="dbus_frontend_template.py" 
-        self.frontend_dest = self.core_dest="DBus.py" 
+        self.core_template="dbus_core_template.py"
+        self.frontend_template="dbus_frontend_template.py"
+        self.frontend_dest = self.core_dest="DBus.py"
 
     def generateCoreSide(self):
         signals_part = []
@@ -371,7 +371,7 @@
         'sig_in':function['sig_in'] or '',
         'sig_out':function['sig_out'] or '',
         'category':'PLUGIN' if function['category'] == 'plugin' else 'CORE',
-        'name':section, 
+        'name':section,
         'args':self.getArguments(function['sig_in'], name=arg_doc, default=default )
         }
 
@@ -427,7 +427,7 @@
                         core_bridge.append(line.replace('\n',''))
         except IOError:
             print ("Can't open template file [%s]" % self.core_template)
-            sys.exit(1) 
+            sys.exit(1)
 
         #now we write to final file
         self.finalWrite(self.core_dest, core_bridge)
@@ -446,7 +446,7 @@
         'sig_in':function['sig_in'] or '',
         'sig_out':function['sig_out'] or '',
         'category':'plugin' if function['category'] == 'plugin' else 'core',
-        'name':section, 
+        'name':section,
         'args':self.getArguments(function['sig_in'], name=arg_doc, default=default)
         }
 
@@ -483,7 +483,7 @@
                         frontend_bridge.append(line.replace('\n',''))
         except IOError:
             print ("Can't open template file [%s]" % self.frontend_template)
-            sys.exit(1) 
+            sys.exit(1)
 
         #now we write to final file
         self.finalWrite(self.frontend_dest, frontend_bridge)
@@ -493,8 +493,8 @@
 
     def __init__(self, bridge_template, options):
         Constructor.__init__(self, bridge_template, options)
-        
-        self.template="dbus_xml_template.xml" 
+
+        self.template="dbus_xml_template.xml"
         self.core_dest="org.goffi.sat.xml"
         self.default_annotation = { 'a{ss}': 'StringDict',
                                     'a(sa{ss}as)': 'QList<Contact>',
@@ -540,7 +540,7 @@
                         annot_elt.setAttribute('value', self.default_annotation[arg])
                         new_elt.appendChild(annot_elt)
                 idx+=1
-            
+
             if function['sig_out']:
                 arg_elt = doc.createElement('arg')
                 arg_elt.setAttribute('type', function['sig_out'])
@@ -575,7 +575,7 @@
 class BridgeConstructor:
     def __init__(self):
         self.options = None
-    
+
     def check_options(self):
         """Check command line options"""
         _usage="""
@@ -597,7 +597,7 @@
                     help=("Add debug information printing"))
         parser.add_option("--no_unicode", action="store_false", dest="unicode", default=True,
                     help=("Remove unicode type protection from string results"))
-        parser.add_option("--flags", action="store", type="string", 
+        parser.add_option("--flags", action="store", type="string",
                     help=("Constructors' specific flags, comma separated"))
 
 
diff --git a/src/bridge/bridge_constructor/bridge_template.ini b/src/bridge/bridge_constructor/bridge_template.ini
--- a/src/bridge/bridge_constructor/bridge_template.ini
+++ b/src/bridge/bridge_constructor/bridge_template.ini
@@ -35,7 +35,7 @@
 doc_param_0=contact_jid: JID from who the message is comming
 doc_param_1=attributes: Dictionary of attributes where keys are:
  - name: name of the contact
- - to: "True" if the contact give its presence information to us 
+ - to: "True" if the contact give its presence information to us
  - from: "True" if contact is registred to our presence information
  - ask: "True" is subscription is pending
 doc_param_2=groups: Roster's groups where the contact is
@@ -135,7 +135,7 @@
 sig_in=ssa{sa{ss}}s
 doc=Requested result of an action (Extended)
 doc_param_0=answer_type: Same as for [actionResult] but with the following additional one:
- - DICT_DICT: As RESULT, but returned as a dictionary of dictionary 
+ - DICT_DICT: As RESULT, but returned as a dictionary of dictionary
 doc_param_1=id: Id of the action
 doc_param_2=data: answer_type specific data
 doc_param_3=%(doc_profile)s
@@ -319,7 +319,7 @@
 doc=Return presence informations of all contacts
 doc_param_0=%(doc_profile_key)s
 doc_return=Dict of presence with bare JID of contact as key, and value as follow:
- A dict where key is the resource and the value is a tuple with (show, priority, statuses) as for [presenceUpdate] 
+ A dict where key is the resource and the value is a tuple with (show, priority, statuses) as for [presenceUpdate]
 
 [getWaitingSub]
 type=method
@@ -552,7 +552,7 @@
 doc_param_1=%(doc_profile)s
 doc_return=dict with progress information:
  - position: current position
- - size: end position 
+ - size: end position
 
 [getMenus]
 type=method
@@ -564,7 +564,7 @@
  - category: Category of the menu
  - name: Name of the menu
  - menu_type: Type which can be:
-    * NORMAL: Classical application menu 
+    * NORMAL: Classical application menu
 
 [getMenuHelp]
 type=method
diff --git a/src/bridge/bridge_constructor/dbus_core_template.py b/src/bridge/bridge_constructor/dbus_core_template.py
--- a/src/bridge/bridge_constructor/dbus_core_template.py
+++ b/src/bridge/bridge_constructor/dbus_core_template.py
@@ -94,7 +94,7 @@
                 raise DeferredNotAsync
             return result
 
-    ### signals ###    
+    ### signals ###
 
     @dbus.service.signal(const_INT_PREFIX+const_PLUGIN_SUFFIX,
                          signature='')
@@ -106,14 +106,14 @@
 
 ##SIGNALS_PART##
 
-    ### methods ###    
-    
+    ### methods ###
+
 ##METHODS_PART##
-    
+
     def __attributes(self, in_sign):
         """Return arguments to user given a in_sign
         @param in_sign: in_sign in the short form (using s,a,i,b etc)
-        @return: list of arguments that correspond to a in_sign (e.g.: "sss" return "arg1, arg2, arg3")""" 
+        @return: list of arguments that correspond to a in_sign (e.g.: "sss" return "arg1, arg2, arg3")"""
         i=0
         idx=0
         attr=[]
@@ -152,19 +152,19 @@
 
         _arguments = inspect_args.args
         _defaults = list(inspect_args.defaults or [])
-        
+
         if inspect.ismethod(method):
             #if we have a method, we don't want the first argument (usually 'self')
             del(_arguments[0])
 
         #first arguments are for the _callback method
         arguments_callback = ', '.join([repr(name)] + ((_arguments + ['callback=callback','errback=errback']) if async else _arguments))
-        
+
         if async:
             _arguments.extend(['callback','errback'])
             _defaults.extend([None, None])
-        
-        
+
+
         #now we create a second list with default values
         for i in range(1, len(_defaults)+1):
             _arguments[-i] = "%s = %s" % (_arguments[-i], repr(_defaults[-i]))
@@ -182,7 +182,7 @@
         function = getattr(self, name)
         func_table = self._dbus_class_table[self.__class__.__module__ + '.' + self.__class__.__name__][function._dbus_interface]
         func_table[function.__name__] = function #Needed for introspection
-    
+
     def addSignal(self, name, int_suffix, signature, doc={}):
         """Dynamically add a signal to Dbus Bridge"""
         attributes = ', '.join(self.__attributes(signature))
diff --git a/src/bridge/bridge_constructor/dbus_frontend_template.py b/src/bridge/bridge_constructor/dbus_frontend_template.py
--- a/src/bridge/bridge_constructor/dbus_frontend_template.py
+++ b/src/bridge/bridge_constructor/dbus_frontend_template.py
@@ -73,7 +73,7 @@
                 #   - or if the last two arguments are callable
 
                 async = False
-                
+
                 if kwargs:
                     if 'callback' in kwargs and 'errback' in kwargs:
                         async = True
@@ -84,26 +84,26 @@
                     args = list(args)
                     _errback = args.pop()
                     _callback = args.pop()
-                        
+
                 method = getattr(self.db_plugin_iface, name)
-                
+
                 if async:
                     kwargs['reply_handler'] = _callback
                     kwargs['error_handler'] = lambda err:_errback(err._dbus_error_name[len(const_ERROR_PREFIX)+1:])
 
                 return method(*args, **kwargs)
-                
+
             return getPluginMethod
 
 ##METHODS_PART##
 
 #methods from plugins
-    
+
     def joinMUC(self, room_jid, nick, options, profile_key):
         if options == None:
             options = [('', '')] #XXX: we have to do this awful hack because python dbus need to guess the signature
         return self.db_plugin_iface.joinMUC(room_jid, nick, options, profile_key)
-    
+
     def gatewayRegister(self, action, target, data, profile_key):
         if data == None:
             data = [('', '')] #XXX: we have to do this awful hack because python dbus need to guess the signature
diff --git a/src/core/sat_main.py b/src/core/sat_main.py
--- a/src/core/sat_main.py
+++ b/src/core/sat_main.py
@@ -65,7 +65,7 @@
     return "sat_id_"+str(sat_id)
 
 class SAT(service.Service):
-   
+
     def get_next_id(self):
         return sat_next_id()
 
@@ -87,26 +87,26 @@
         """Save a constant"""
         if CONST.has_key(name):
             error(_('Trying to redefine a constant'))
-            raise Exception  
+            raise Exception
         CONST[name] = value
-    
+
     def __init__(self):
         #TODO: standardize callback system
-        
-        self.__general_cb_map = {}  #callback called for general reasons (key = name) 
+
+        self.__general_cb_map = {}  #callback called for general reasons (key = name)
         self.__private_data = {}  #used for internal callbacks (key = id)
         self.profiles = {}
         self.plugins = {}
         self.menus = {} #used to know which new menus are wanted by plugins
-        
+
         self.memory=Memory(self)
-        
+
         local_dir = self.memory.getConfig('', 'local_dir')
         if not os.path.exists(local_dir):
             os.makedirs(local_dir)
 
-        self.trigger = TriggerManager() #trigger are used to change SàT behaviour 
-        
+        self.trigger = TriggerManager() #trigger are used to change SàT behaviour
+
         self.bridge=DBusBridge()
         self.bridge.register("getVersion", lambda: self.get_const('client_version'))
         self.bridge.register("getProfileName", self.memory.getProfileName)
@@ -147,8 +147,8 @@
         self.bridge.register("getMenus", self.getMenus)
         self.bridge.register("getMenuHelp", self.getMenuHelp)
         self.bridge.register("callMenu", self.callMenu)
-    
-        self.memory.initialized.addCallback(self._postMemoryInit) 
+
+        self.memory.initialized.addCallback(self._postMemoryInit)
 
     def _postMemoryInit(self, ignore):
         """Method called after memory initialization is done"""
@@ -159,7 +159,7 @@
     def _import_plugins(self):
         """Import all plugins found in plugins directory"""
         import sat.plugins
-        plugins_path = os.path.dirname(sat.plugins.__file__) 
+        plugins_path = os.path.dirname(sat.plugins.__file__)
         plug_lst = [os.path.splitext(plugin)[0] for plugin in map(os.path.basename,glob(os.path.join(plugins_path,"plugin*.py")))]
         __plugins_to_import = {} #plugins we still have to import
         for plug in plug_lst:
@@ -198,11 +198,11 @@
             self.plugins[import_name].is_handler = False
         #TODO: test xmppclient presence and register handler parent
 
-    
+
     def connect(self, profile_key = '@DEFAULT@'):
         """Connect to jabber server"""
         self.asyncConnect(profile_key)
-    
+
     def asyncConnect(self, profile_key = '@DEFAULT@'):
         """Connect to jabber server with asynchronous reply
         @param profile_key: %(doc_profile)s
@@ -212,7 +212,7 @@
         if not profile:
             error (_('Trying to connect a non-exsitant profile'))
             raise ProfileUnknownError(profile_key)
-        
+
         if (self.isConnected(profile)):
             info(_("already connected !"))
             return defer.succeed("None")
@@ -227,12 +227,12 @@
             current = self.profiles[profile] = xmpp.SatXMPPClient(self, profile,
                 jid.JID(self.memory.getParamA("JabberID", "Connection", profile_key = profile), profile),
                 self.memory.getParamA("Password", "Connection", profile_key = profile),
-                self.memory.getParamA("Server", "Connection", profile_key = profile), 
+                self.memory.getParamA("Server", "Connection", profile_key = profile),
                 port)
 
             current.messageProt = xmpp.SatMessageProtocol(self)
             current.messageProt.setHandlerParent(current)
-            
+
             current.roster = xmpp.SatRosterProtocol(self)
             current.roster.setHandlerParent(current)
 
@@ -247,7 +247,7 @@
             current.versionHandler.setHandlerParent(current)
 
             debug (_("setting plugins parents"))
-            
+
             for plugin in self.plugins.iteritems():
                 if plugin[1].is_handler:
                     plugin[1].getHandler(profile).setHandlerParent(current)
@@ -307,7 +307,7 @@
         info("Salut à toi ô mon frère !")
         #TODO: manage autoconnect
         #self.connect()
-    
+
     def stopService(self):
         self.memory.save()
         info("Salut aussi à Rantanplan")
@@ -315,13 +315,13 @@
     def run(self):
         debug(_("running app"))
         reactor.run()
-    
+
     def stop(self):
         debug(_("stopping app"))
         reactor.stop()
-        
+
     ## Misc methods ##
-   
+
     def getJidNStream(self, profile_key):
         """Convenient method to get jid and stream from profile key
         @return: tuple (jid, xmlstream) from profile, can be None"""
@@ -347,8 +347,8 @@
         serverRegistrer = xmlstream.XmlStreamFactory(xmpp.RegisteringAuthenticator(self, server, login, password, email, next_id, profile))
         connector = reactor.connectTCP(server, port, serverRegistrer)
         serverRegistrer.clientConnectionLost = lambda conn, reason: connector.disconnect()
-        
-        return next_id 
+
+        return next_id
 
     def registerNewAccountCB(self, id, data, profile):
         user = jid.parse(self.memory.getParamA("JabberID", "Connection", profile_key=profile))[0]
@@ -363,7 +363,7 @@
 
         confirm_id = sat_next_id()
         self.__private_data[confirm_id]=(id,profile)
-    
+
         self.askConfirmation(confirm_id, "YES/NO",
             {"message":_("Are you sure to register new account [%(user)s] to server %(server)s ?") % {'user':user, 'server':server, 'profile':profile}},
             self.regisConfirmCB, profile)
@@ -393,7 +393,7 @@
         profile = self.memory.getProfileName(profile_key)
         assert(profile)
         to_jid = jid.JID(target)
-        
+
         iq = compat.IQ(self.profiles[profile].xmlstream, 'set')
         iq["to"] = target
         iq["from"] = self.profiles[profile].jid.full()
@@ -456,7 +456,7 @@
 
 
     ## jabber methods ##
-   
+
     def getWaitingConf(self, profile_key=None):
         assert(profile_key)
         client = self.getClient(profile_key)
@@ -467,22 +467,22 @@
             conf_type, data = client._waiting_conf[conf_id][:2]
             ret.append((conf_id, conf_type, data))
         return ret
-    
+
     def sendMessage(self, to, msg, subject=None, mess_type='auto', profile_key='@DEFAULT@'):
         #FIXME: check validity of recipient
         profile = self.memory.getProfileName(profile_key)
         assert(profile)
         client = self.profiles[profile]
         current_jid = client.jid
-        mess_data = { #we put data in a dict, so trigger methods can change them 
+        mess_data = { #we put data in a dict, so trigger methods can change them
                       "to": jid.JID(to),
                       "message": msg,
                       "subject": subject,
                       "type": mess_type
                     }
-        
+
         if mess_data["type"] == "auto":
-            # we try to guess the type 
+            # we try to guess the type
             if mess_data["subject"]:
                 mess_data["type"] = 'normal'
             elif not mess_data["to"].resource: #if to JID has a resource, the type is not 'groupchat'
@@ -492,7 +492,7 @@
                     #FIXME: should entity_type manage ressources ?
                 except (UnknownEntityError, KeyError):
                     entity_type = "contact"
-                
+
                 if entity_type == "chatroom":
                     mess_data["type"] = 'groupchat'
                 else:
@@ -500,10 +500,10 @@
             else:
                 mess_data["type"] == 'chat'
             mess_data["type"] == "chat" if mess_data["subject"] else "normal"
-        
+
         if not self.trigger.point("sendMessage", mess_data, profile):
             return
-        
+
         debug(_("Sending jabber message of type [%(type)s] to %(to)s...") % {"type": mess_data["type"], "to": to})
         message = domish.Element((None,'message'))
         message["to"] = mess_data["to"].full()
@@ -531,8 +531,8 @@
             del statuses['']
         self.bridge.presenceUpdate(self.profiles[profile].jid.full(),  show,
                 int(priority), statuses, profile)
-        
-    
+
+
     def subscription(self, subs_type, raw_jid, profile_key):
         """Called to manage subscription
         @param subs_type: subsciption type (cf RFC 3921)
@@ -592,31 +592,31 @@
     def serverDiscoItems(self, disco_result, disco_client, profile, initialized):
         """xep-0030 Discovery Protocol.
         @param disco_result: result of the disco item querry
-        @param disco_client: SatDiscoProtocol instance 
-        @param profile: profile of the user 
+        @param disco_client: SatDiscoProtocol instance
+        @param profile: profile of the user
         @param initialized: deferred which must be chained when everything is done"""
-        
+
         def _check_entity_cb(result, entity, profile):
             for category, type in result.identities:
                 debug (_('Identity added: (%(category)s,%(type)s) ==> %(entity)s [%(profile)s]') % {
                          'category':category, 'type':type, 'entity':entity, 'profile':profile})
-                self.memory.addServerIdentity(category, type, entity, profile) 
+                self.memory.addServerIdentity(category, type, entity, profile)
 
         def _errback(result, entity, profile):
             warning(_("Can't get information on identity [%(entity)s] for profile [%(profile)s]") % {'entity':entity, 'profile': profile})
-       
+
         defer_list = []
         for item in disco_result._items:
             if item.entity.full().count('.') == 1: #XXX: workaround for a bug on jabberfr, tmp
                 warning(_('Using jabberfr workaround, be sure your domain has at least two levels (e.g. "example.tld", not "example" alone)'))
                 continue
-            args = [item.entity, profile] 
+            args = [item.entity, profile]
             defer_list.append(disco_client.requestInfo(item.entity).addCallbacks(_check_entity_cb, _errback, args, None, args))
         defer.DeferredList(defer_list).chainDeferred(initialized)
 
-    
-    ## Generic HMI ## 
-    
+
+    ## Generic HMI ##
+
     def actionResult(self, action_id, action_type, data, profile):
         """Send the result of an action
         @param action_id: same action_id used with action
diff --git a/src/core/xmpp.py b/src/core/xmpp.py
--- a/src/core/xmpp.py
+++ b/src/core/xmpp.py
@@ -28,7 +28,7 @@
 
 
 class SatXMPPClient(client.XMPPClient):
-    
+
     def __init__(self, host_app, profile, user_jid, password, host=None, port=5222):
         client.XMPPClient.__init__(self, user_jid, password, host, port)
         self.factory.clientConnectionLost = self.connectionLost
@@ -39,7 +39,7 @@
         self.conn_deferred = defer.Deferred()
         self._waiting_conf = {}  #callback called when a confirmation is received
         self._progress_cb_map = {}  #callback called when a progress is requested (key = progress id)
-        
+
 
     def getConnectionDeferred(self):
         """Return a deferred which fire when the client is connected"""
@@ -53,28 +53,28 @@
         info (_("********** [%s] CONNECTED **********") % self.profile)
         self.streamInitialized()
         self.host_app.bridge.connected(self.profile) #we send the signal to the clients
-   
+
 
     def streamInitialized(self):
         """Called after _authd"""
         debug (_("XML stream is initialized"))
         self.keep_alife = task.LoopingCall(self.xmlstream.send, " ")  #Needed to avoid disconnection (specially with openfire)
         self.keep_alife.start(180)
-        
+
         self.disco = SatDiscoProtocol(self)
         self.disco.setHandlerParent(self)
         self.discoHandler = disco.DiscoHandler()
         self.discoHandler.setHandlerParent(self)
-        
+
         if not self.host_app.trigger.point("Disco Handled", self.profile):
             return
 
         self.roster.requestRoster()
-        
+
         self.presence.available()
-       
+
         self.disco.requestInfo(jid.JID(self.jid.host)).addCallback(self.host_app.serverDisco, self.profile)  #FIXME: use these informations
-        
+
         self.disco.requestItems(jid.JID(self.jid.host)).addCallback(self.host_app.serverDiscoItems, self.disco, self.profile, self.client_initialized)
         self.conn_deferred.callback(None)
 
@@ -90,7 +90,7 @@
 
     def isConnected(self):
         return self.__connected
-    
+
     def connectionLost(self, connector, unused_reason):
         self.__connected=False
         info (_("********** [%s] DISCONNECTED **********") % self.profile)
@@ -103,7 +103,7 @@
 
 
 class SatMessageProtocol(xmppim.MessageProtocol):
-    
+
     def __init__(self, host):
         xmppim.MessageProtocol.__init__(self)
         self.host = host
@@ -128,7 +128,7 @@
                     self.host.memory.addToHistory(jid.JID(message["from"]), jid.JID(message["to"]), mess_body, mess_type, profile=self.parent.profile)
                 self.host.bridge.newMessage(message["from"], mess_body, mess_type, message['to'], extra, profile=self.parent.profile)
                 break
-    
+
 class SatRosterProtocol(xmppim.RosterClientProtocol):
 
     def __init__(self, host):
@@ -138,7 +138,7 @@
         #XXX: the two following dicts keep a local copy of the roster
         self._groups = {} #map from groups to bare jids: key=group value=set of bare jids
         self._jids = {} #map from bare jids to RosterItem: key=jid value=RosterItem
-    
+
     def rosterCb(self, roster):
         for raw_jid, item in roster.iteritems():
             self.onRosterSet(item)
@@ -153,7 +153,7 @@
         """Remove a contact from roster list"""
         xmppim.RosterClientProtocol.removeItem(self, to)
         #TODO: check IQ result
-    
+
     #XXX: disabled (cf http://wokkel.ik.nu/ticket/56))
     #def addItem(self, to):
         #"""Add a contact to roster list"""
@@ -187,7 +187,7 @@
         if item.name:
             item_attr['name'] = item.name
         return item_attr
-    
+
     def onRosterSet(self, item):
         """Called when a new/update roster item is received"""
         #TODO: send a signal to frontends
@@ -199,13 +199,13 @@
             return
         info (_("new contact in roster list: %s"), item.jid.full())
         #self.host.memory.addContact(item.jid, item_attr, item.groups, self.parent.profile)
-       
+
         bare_jid = item.jid.userhost()
         self._jids[bare_jid] = item
         for group in item.groups:
             self._groups.setdefault(group,set()).add(bare_jid)
         self.host.bridge.newContact(item.jid.full(), self.getAttributes(item), item.groups, self.parent.profile)
-    
+
     def onRosterRemove(self, entity):
         """Called when a roster removal event is received"""
         print _("removing %s from roster list") % entity.full()
@@ -226,7 +226,7 @@
             except KeyError:
                 log.warning("there is not cache for the group [%(groups)s] of the removed roster item [%(jid)s]" %
                             {"group": group, "jid": bare_jid})
-                                                                                                                            
+
         #then we send the bridge signal
         self.host.bridge.contactDeleted(entity.userhost(), self.parent.profile)
 
@@ -247,7 +247,7 @@
     def isJidInRoster(self, entity_jid):
         """Return True if jid is in roster"""
         return entity_jid.userhost() in self._jids
-    
+
     def getItems(self):
         """Return all items of the roster"""
         return self._jids.values()
@@ -257,20 +257,20 @@
             return self._groups[group]
         except KeyError:
             return  exceptions.UnknownGroupError
-        
+
 
 class SatPresenceProtocol(xmppim.PresenceClientProtocol):
 
     def __init__(self, host):
         xmppim.PresenceClientProtocol.__init__(self)
         self.host = host
-    
+
     def availableReceived(self, entity, show=None, statuses=None, priority=0):
         debug (_("presence update for [%(entity)s] (available, show=%(show)s statuses=%(statuses)s priority=%(priority)d)") % {'entity':entity, 'show':show, 'statuses':statuses, 'priority':priority})
-        
+
         if not statuses:
             statuses = {}
-        
+
         if statuses.has_key(None):   #we only want string keys
             statuses["default"] = statuses[None]
             del statuses[None]
@@ -281,13 +281,13 @@
         #now it's time to notify frontends
         self.host.bridge.presenceUpdate(entity.full(),  show or "",
                 int(priority), statuses, self.parent.profile)
-    
+
     def unavailableReceived(self, entity, statuses=None):
         debug (_("presence update for [%(entity)s] (unavailable, statuses=%(statuses)s)") % {'entity':entity, 'statuses':statuses})
-        
+
         if not statuses:
             statuses = {}
-        
+
         if statuses.has_key(None):   #we only want string keys
             statuses["default"] = statuses[None]
             del statuses[None]
@@ -295,13 +295,13 @@
 
         #now it's time to notify frontends
         self.host.bridge.presenceUpdate(entity.full(), "unavailable", 0, statuses, self.parent.profile)
-        
-    
+
+
     def available(self, entity=None, show=None, statuses=None, priority=0):
         if not statuses:
             statuses = {}
             # default for us is None for wokkel
-            # so we must temporarily switch to wokkel's convention...	
+            # so we must temporarily switch to wokkel's convention...
             if 'default' in statuses:
                 statuses[None] = statuses['default']
 
@@ -380,10 +380,10 @@
         self.answer_id = answer_id
         self.profile = profile
         print _("Registration asked for"),user_login, user_pass, jabber_host
-    
+
     def connectionMade(self):
         print "connectionMade"
-        
+
         self.xmlstream.namespace = "jabber:client"
         self.xmlstream.sendHeader()
 
@@ -405,7 +405,7 @@
         answer_data={"message":_("Registration successfull")}
         self.host.bridge.actionResult(answer_type, self.answer_id, answer_data, self.profile)
         self.xmlstream.sendFooter()
-        
+
     def registrationFailure(self, failure):
         info (_("Registration failure: %s") % str(failure.value))
         answer_type = "ERROR"
diff --git a/src/memory/memory.py b/src/memory/memory.py
--- a/src/memory/memory.py
+++ b/src/memory/memory.py
@@ -40,7 +40,7 @@
 class Params():
     """This class manage parameters with xml"""
     ### TODO: add desciption in params
-    
+
     #TODO: move Watched in a plugin
     default_xml = u"""
     <params>
@@ -84,7 +84,7 @@
         source_set = set(source_map.keys())
         dest_set = set(dest_map.keys())
         to_add = source_set.difference(dest_set)
-        
+
         for node_key in to_add:
             dest_node.appendChild(source_map[node_key].cloneNode(True))
 
@@ -97,12 +97,12 @@
         self.dom = minidom.parse(xml_file)
         default_dom = minidom.parseString(Params.default_xml.encode('utf-8'))
         self._mergeParams(default_dom.documentElement, self.dom.documentElement)
-    
+
     def loadGenParams(self):
         """Load general parameters data from storage
         @return: deferred triggered once params are loaded"""
         return self.storage.loadGenParams(self.params_gen)
-        
+
     def loadIndParams(self, profile, cache=None):
         """Load individual parameters
         set self.params cache or a temporary cache
@@ -112,7 +112,7 @@
         if cache == None:
             self.params[profile] = {}
         return self.storage.loadIndParams(self.params[profile] if cache==None else cache, profile)
-   
+
     def purgeProfile(self, profile):
         """Remove cache data of a profile
         @param profile: %(doc_profile)s"""
@@ -279,7 +279,7 @@
            @param category: category of the parameter
            @param attr: name of the attribute (default: "value")
            @param profile: owner of the param (@ALL@ for everyone)
-           
+
            @return: attribute"""
         #FIXME: looks really dirty and buggy, need to be reviewed/refactored
         node = self.__getParamNode(name, category)
@@ -290,19 +290,19 @@
         if node[0] == 'general':
             value = self.__getParam(None, category, name, 'general')
             return self.__getAttr(node[1], attr, value)
-        
+
         assert(node[0] == 'individual')
 
         profile = self.getProfileName(profile_key)
         if not profile:
             error(_('Requesting a param for an non-existant profile'))
             raise exceptions.ProfileUnknownError
-        
+
         if profile not in self.params:
             error(_('Requesting synchronous param for not connected profile'))
             raise exceptions.NotConnectedProfileError(profile)
 
-        if attr == "value": 
+        if attr == "value":
             value = self.__getParam(profile, category, name)
             return self.__getAttr(node[1], attr, value)
 
@@ -325,15 +325,15 @@
         if node[0] == 'general':
             value = self.__getParam(None, category, name, 'general')
             return defer.succeed(self.__getAttr(node[1], attr, value))
-        
+
         assert(node[0] == 'individual')
 
         profile = self.getProfileName(profile_key)
         if not profile:
             error(_('Requesting a param for a non-existant profile'))
             return defer.fail()
-        
-        if attr != "value": 
+
+        if attr != "value":
             return defer.succeed(node[1].getAttribute(attr))
         try:
             value = self.__getParam(profile, category, name)
@@ -396,7 +396,7 @@
 
                             for param_node in params:
                                 name = param_node.getAttribute('name')
-                                
+
                                 if name not in dest_params:
                                     dest_params[name] = param_node.cloneNode(True)
                                     dest_cat.appendChild(dest_params[name])
@@ -407,8 +407,8 @@
                             if new_node:
                                 prof_xml.documentElement.appendChild(dest_cat)
             return prof_xml
-        
-        
+
+
         if self.params.has_key(profile):
             d = defer.succeed(None)
             profile_cache = self.params[profile]
@@ -435,13 +435,13 @@
         if not profile:
             error(_("Asking params for inexistant profile"))
             return ""
-        
+
         def returnXML(prof_xml):
             return_xml = prof_xml.toxml()
             prof_xml.unlink()
             return return_xml
 
-        return self.__constructProfileXml(profile).addCallback(returnXML) 
+        return self.__constructProfileXml(profile).addCallback(returnXML)
 
     def getParamsForCategory(self, category, profile_key):
         """Return node's xml for selected category"""
@@ -460,7 +460,7 @@
 
             prof_xml.unlink()
             return "<category />"
-        
+
         d = self.__constructProfileXml(profile)
         return d.addCallback(returnCategoryXml)
 
@@ -475,7 +475,7 @@
         @return: a tuple with the node type and the the node, or None if not found"""
 
         for type_node in self.dom.documentElement.childNodes:
-            if ( ((_type == "@ALL@" or _type == "@GENERAL@") and type_node.nodeName == 'general') 
+            if ( ((_type == "@ALL@" or _type == "@GENERAL@") and type_node.nodeName == 'general')
             or ( (_type == "@ALL@" or _type == "@INDIVIDUAL@") and type_node.nodeName == 'individual') ):
                 for node in type_node.getElementsByTagName('category'):
                     if node.getAttribute("name") == category:
@@ -484,7 +484,7 @@
                             if param.getAttribute("name") == name:
                                 return (type_node.nodeName, param)
         return None
-        
+
     def getParamsCategories(self):
         """return the categories availables"""
         categories=[]
@@ -507,7 +507,7 @@
         if not node:
             error(_('Requesting an unknown parameter (%(category)s/%(name)s)') % {'category':category, 'name':name})
             return
-        
+
         if node[0] == 'general':
             self.params_gen[(category, name)] = value
             self.storage.setGenParam(category, name, value)
@@ -515,10 +515,10 @@
                 if self.host.isConnected(profile):
                     self.host.bridge.paramUpdate(name, value, category, profile)
             return
-        
+
         assert (node[0] == 'individual')
         assert (profile_key != "@NONE@")
-        
+
         _type = node[1].getAttribute("type")
         if _type=="button":
             print "clique",node.toxml()
@@ -533,7 +533,7 @@
 
     def __init__(self, host):
         info (_("Memory manager init"))
-        self.initialized = defer.Deferred() 
+        self.initialized = defer.Deferred()
         self.host = host
         self.entitiesCache={} #XXX: keep presence/last resource/other data in cache
                               #     /!\ an entity is not necessarily in roster
@@ -611,7 +611,7 @@
         @param profile: %(doc_profile)s"""
         info(_("[%s] Profile session started" % profile))
         self.entitiesCache[profile] = {}
-    
+
     def purgeProfileSession(self, profile):
         """Delete cache of data of profile
         @param profile: %(doc_profile)s"""
@@ -628,7 +628,7 @@
         #TODO: need to encrypt files (at least passwords !) and set permissions
         param_file_xml = os.path.expanduser(self.getConfig('','local_dir')+
                                         self.host.get_const('savefile_param_xml'))
-        
+
         self.params.save_xml(param_file_xml)
         debug(_("params saved"))
 
@@ -647,13 +647,13 @@
         @param name: Profile name
         """
         return self.params.createProfile(name)
-    
+
     def asyncCreateProfile(self, name):
         """Create a new profile
         @param name: Profile name
         """
         return self.params.asyncCreateProfile(name)
-    
+
     def deleteProfile(self, name):
         """Delete an existing profile
         @param name: Name of the profile"""
@@ -674,7 +674,7 @@
         if not self.server_features.has_key(profile):
             self.server_features[profile] = []
         self.server_features[profile].append(feature)
-    
+
     def addServerIdentity(self, category, _type, entity, profile):
         """Add an identity discovered from server
         @param feature: string of the feature
@@ -727,7 +727,7 @@
             return self.entitiesCache[profile][entity]["last_resource"]
         except KeyError:
             return ""
-    
+
     def getPresenceStatus(self, profile_key):
         profile = self.getProfileName(profile_key)
         if not profile:
@@ -782,7 +782,7 @@
                  if there is no value of a given key, resulting dict will
                  have nothing with that key nether
         @raise: exceptions.UnknownEntityError if entity is not in cache
-                exceptions.ProfileNotInCacheError if profile is not in cache 
+                exceptions.ProfileNotInCacheError if profile is not in cache
         """
         profile = self.getProfileName(profile_key)
         if not profile:
@@ -819,14 +819,14 @@
         if not self.subscriptions.has_key(profile):
             self.subscriptions[profile] = {}
         self.subscriptions[profile][entity_jid] = _type
-    
+
     def delWaitingSub(self, entity_jid, profile_key):
         """Called when a subcription request is finished"""
         profile = self.getProfileName(profile_key)
         assert(profile)
         if self.subscriptions.has_key(profile) and self.subscriptions[profile].has_key(entity_jid):
             del self.subscriptions[profile][entity_jid]
-    
+
     def getWaitingSub(self, profile_key):
         """Called to get a list of currently waiting subscription requests"""
         profile = self.getProfileName(profile_key)
@@ -835,38 +835,38 @@
             return {}
         if not self.subscriptions.has_key(profile):
             return {}
-        
+
         return self.subscriptions[profile]
 
     def getStringParamA(self, name, category, attr="value", profile_key='@DEFAULT@'):
         return self.params.getStringParamA(name, category, attr, profile_key)
-    
+
     def getParamA(self, name, category, attr="value", profile_key='@DEFAULT@'):
         return self.params.getParamA(name, category, attr, profile_key)
-    
+
     def asyncGetParamA(self, name, category, attr="value", profile_key='@DEFAULT@'):
         return self.params.asyncGetParamA(name, category, attr, profile_key)
-    
+
     def asyncGetStringParamA(self, name, category, attr="value", profile_key='@DEFAULT@'):
         return self.params.asyncGetStringParamA(name, category, attr, profile_key)
-    
+
     def getParamsUI(self, profile_key):
         return self.params.getParamsUI(profile_key)
-  
+
     def getParams(self, profile_key):
-        return self.params.getParams(profile_key) 
-    
+        return self.params.getParams(profile_key)
+
     def getParamsForCategory(self, category, profile_key):
-        return self.params.getParamsForCategory(category, profile_key) 
-    
+        return self.params.getParamsForCategory(category, profile_key)
+
     def getParamsCategories(self):
         return self.params.getParamsCategories()
-    
+
     def setParam(self, name, value, category, profile_key):
         return self.params.setParam(name, value, category, profile_key)
 
     def importParams(self, xml):
         return self.params.importParams(xml)
-    
+
     def setDefault(self, name, category, callback, errback=None):
         return self.params.setDefault(name, category, callback, errback)
diff --git a/src/memory/persistent.py b/src/memory/persistent.py
--- a/src/memory/persistent.py
+++ b/src/memory/persistent.py
@@ -74,7 +74,7 @@
 
     def __cmp__(self, other):
         return self._cache.__cmp__(other)
-    
+
     def __hash__(self):
         return self._cache.__hash__()
 
@@ -117,7 +117,7 @@
 
 class PersistentBinaryDict(PersistentDict):
     """Persistent dict where value can be any python data (instead of string only)"""
-    
+
     def load(self):
         """load persistent data from storage
         """
diff --git a/src/memory/sqlite.py b/src/memory/sqlite.py
--- a/src/memory/sqlite.py
+++ b/src/memory/sqlite.py
@@ -68,7 +68,7 @@
         def fillProfileCache(ignore):
             d = self.dbpool.runQuery("SELECT name,id FROM profiles").addCallback(self._profilesCache)
             d.chainDeferred(self.initialized)
-            
+
         defer.DeferredList(init_defers).addCallback(fillProfileCache)
 
     #Profiles
@@ -77,8 +77,8 @@
         @param profiles_result: result of the sql profiles query"""
         for profile in profiles_result:
             name, id = profile
-            self.profiles[name] = id 
-   
+            self.profiles[name] = id
+
     def getProfilesList(self):
         """"Return list of all registered profiles"""
         return self.profiles.keys()
@@ -87,23 +87,23 @@
         """return True if profile_name exists
         @param profile_name: name of the profile to check"""
         return self.profiles.has_key(profile_name)
-    
+
     def createProfile(self, name):
         """Create a new profile
         @param name: name of the profile
         @return: deferred triggered once profile is actually created"""
         def getProfileId(ignore):
             return self.dbpool.runQuery("SELECT (id) FROM profiles WHERE name = ?", (name,))
-       
+
         def profile_created(profile_id):
             _id = profile_id[0][0]
             self.profiles[name] = _id #we synchronise the cache
-        
+
         d = self.dbpool.runQuery("INSERT INTO profiles(name) VALUES (?)", (name,))
         d.addCallback(getProfileId)
         d.addCallback(profile_created)
         return d
-    
+
     def deleteProfile(self, name):
         """Delete profile
         @param name: name of the profile
@@ -126,7 +126,7 @@
             for param in result:
                 category,name,value = param
                 params_gen[(category, name)] = value
-        debug(_("loading general parameters from database")) 
+        debug(_("loading general parameters from database"))
         return self.dbpool.runQuery("SELECT category,name,value FROM param_gen").addCallback(fillParams)
 
     def loadIndParams(self, params_ind, profile):
@@ -138,7 +138,7 @@
             for param in result:
                 category,name,value = param
                 params_ind[(category, name)] = value
-        debug(_("loading individual parameters from database")) 
+        debug(_("loading individual parameters from database"))
         d = self.dbpool.runQuery("SELECT category,name,value FROM param_ind WHERE profile_id=?", (self.profiles[profile],))
         d.addCallback(fillParams)
         return d
@@ -218,7 +218,7 @@
                 values.append(_jid.resource)
                 return '(%s=? AND %s_res=?)' % (_type, _type)
             return '%s=?' % (_type,)
-        
+
         if between:
             query_parts.append("(%s OR %s) AND (%s or %s)" % (test_jid('source', from_jid),
                                                                test_jid('source', to_jid),
@@ -233,7 +233,7 @@
         if limit:
             query_parts.append("LIMIT ?")
             values.append(limit)
-        
+
         d = self.dbpool.runQuery(" ".join(query_parts), values)
         return d.addCallback(sqliteToDict)
 
@@ -247,7 +247,7 @@
             for private in result:
                 key,value = private
                 private_gen[key] = value
-        debug(_("loading general private values [namespace: %s] from database") % (namespace,)) 
+        debug(_("loading general private values [namespace: %s] from database") % (namespace,))
         d = self.dbpool.runQuery("SELECT key,value FROM private_gen WHERE namespace=?", (namespace,)).addCallback(fillPrivates)
         return d.addErrback(lambda x: debug(_("No data present in database for namespace %s") % namespace))
 
@@ -273,7 +273,7 @@
         @param value: value to set
         @return: deferred"""
         d = self.dbpool.runQuery("REPLACE INTO private_gen(namespace,key,value) VALUES (?,?,?)", (namespace,key,value))
-        d.addErrback(lambda ignore: error(_("Can't set general private value (%(key)s) [namespace:%(namespace)s] in database" % 
+        d.addErrback(lambda ignore: error(_("Can't set general private value (%(key)s) [namespace:%(namespace)s] in database" %
                      {"namespace":namespace, "key":key})))
         return d
 
@@ -295,7 +295,7 @@
         @param key: key of the private value
         @return: deferred"""
         d = self.dbpool.runQuery("DELETE FROM private_gen WHERE namespace=? AND key=?", (namespace,key))
-        d.addErrback(lambda ignore: error(_("Can't delete general private value (%(key)s) [namespace:%(namespace)s] in database" % 
+        d.addErrback(lambda ignore: error(_("Can't delete general private value (%(key)s) [namespace:%(namespace)s] in database" %
                      {"namespace":namespace, "key":key})))
         return d
 
@@ -320,7 +320,7 @@
             for private in result:
                 key,value = private
                 private_gen[key] = pickle.loads(str(value))
-        debug(_("loading general private binary values [namespace: %s] from database") % (namespace,)) 
+        debug(_("loading general private binary values [namespace: %s] from database") % (namespace,))
         d = self.dbpool.runQuery("SELECT key,value FROM private_gen_bin WHERE namespace=?", (namespace,)).addCallback(fillPrivates)
         return d.addErrback(lambda x: debug(_("No binary data present in database for namespace %s") % namespace))
 
@@ -346,7 +346,7 @@
         @param value: value to set
         @return: deferred"""
         d = self.dbpool.runQuery("REPLACE INTO private_gen_bin(namespace,key,value) VALUES (?,?,?)", (namespace,key,pickle.dumps(value,0)))
-        d.addErrback(lambda ignore: error(_("Can't set general private binary value (%(key)s) [namespace:%(namespace)s] in database" % 
+        d.addErrback(lambda ignore: error(_("Can't set general private binary value (%(key)s) [namespace:%(namespace)s] in database" %
                      {"namespace":namespace, "key":key})))
         return d
 
@@ -368,7 +368,7 @@
         @param key: key of the private value
         @return: deferred"""
         d = self.dbpool.runQuery("DELETE FROM private_gen_bin WHERE namespace=? AND key=?", (namespace,key))
-        d.addErrback(lambda ignore: error(_("Can't delete general private binary value (%(key)s) [namespace:%(namespace)s] in database" % 
+        d.addErrback(lambda ignore: error(_("Can't delete general private binary value (%(key)s) [namespace:%(namespace)s] in database" %
                      {"namespace":namespace, "key":key})))
         return d
 
diff --git a/src/plugins/deprecated_misc_cs.py b/src/plugins/deprecated_misc_cs.py
--- a/src/plugins/deprecated_misc_cs.py
+++ b/src/plugins/deprecated_misc_cs.py
@@ -83,7 +83,7 @@
         def dataLoaded(ignore):
             if not self.data[profile]:
                 self.data[profile] = {'cookies':{}}
-                
+
         self.data[profile].load().addCallback(dataLoaded)
 
     def profileDisconnected(self, profile):
@@ -104,10 +104,10 @@
             self.host.bridge.actionResult("ERROR", id, message_data)
             return
 
-        post_data = urllib.urlencode({'auth_login[un]':login,'auth_login[pw]':password,'auth_login[action]':'Login...'}) 
-        
+        post_data = urllib.urlencode({'auth_login[un]':login,'auth_login[pw]':password,'auth_login[action]':'Login...'})
+
         self.data[profile]['cookies'] = {}
-        
+
         d = getPage('http://www.couchsurfing.org/login.html', method='POST', postdata=post_data, headers={'Content-Type':'application/x-www-form-urlencoded'} , agent=AGENT, cookies=self.data[profile]['cookies'])
         d.addCallback(self.__connectionCB, id, profile)
         d.addErrback(self.erroCB, id)
@@ -193,7 +193,7 @@
             friend_id = regex_href.search(unicode(a_tag)).groups()[0]
 
             debug(_("CS friend found: %(friend_name)s (id: %(friend_id)s, link: %(friend_link)s)") % {'friend_name':friend_name, 'friend_id':friend_id, 'friend_link':friend_link})
-            friends[friend_name] = {'link':friend_link,'id':friend_id} 
+            friends[friend_name] = {'link':friend_link,'id':friend_id}
         a = soup.find('td','barmiddle next').a  #is there several pages ?
         if a:
             #yes, we parse the next page
@@ -255,7 +255,7 @@
         message = data['message']
         info(_("sending message to %(friends)s with subject [%(subject)s]" % {'friends':friends, 'subject':subject}))
         self.__sendMessage(None, subject, message, self.data[profile], friends, id, profile)
-     
+
     def __showUnreadMessages2(self, html, id, profile):
         """Called when the inbox page has been received"""
         #FIXME: that's really too fragile, only works if the unread messages are in the first page, and it would be too resources consuming for the website to DL each time all pages. In addition, the show attribute doesn't work as expected.
@@ -269,4 +269,4 @@
         d = getPage("http://www.couchsurfing.org/messages.html?message_status=inbox&show=10000", agent=AGENT, cookies=self.data[profile]['cookies'])
         d.addCallback(self.__showUnreadMessages2, id, profile)
         d.addErrback(self.erroCB, id)
-        
+
diff --git a/src/plugins/plugin_exp_parrot.py b/src/plugins/plugin_exp_parrot.py
--- a/src/plugins/plugin_exp_parrot.py
+++ b/src/plugins/plugin_exp_parrot.py
@@ -24,7 +24,7 @@
 
 
 from sat.core.exceptions import UnknownEntityError
-from sat.tools.misc import SkipOtherTriggers 
+from sat.tools.misc import SkipOtherTriggers
 
 PLUGIN_INFO = {
 "name": "Parrot Plugin",
@@ -57,28 +57,28 @@
     #        _links = client.parrot_links
     #    except AttributeError:
     #        return True
-    #    
+    #
     #    if mess_data['to'].userhostJID() in _links.values():
     #        debug("Parrot link detected, skipping other triggers")
-    #        raise SkipOtherTriggers 
+    #        raise SkipOtherTriggers
 
     def MessageReceivedTrigger(self, message, profile):
         """ Check if source is linked and repeat message, else do nothing  """
         client = self.host.getClient(profile)
         from_jid = jid.JID(message["from"])
-            
+
         try:
             _links = client.parrot_links
         except AttributeError:
             return True
-        
+
         if not from_jid.userhostJID() in _links:
             return True
-       
+
         for e in message.elements():
             if e.name == "body":
                 mess_body = e.children[0] if e.children else ""
-                
+
                 try:
                     entity_type = self.host.memory.getEntityData(from_jid, ['type'], profile)["type"]
                 except (UnknownEntityError, KeyError):
@@ -97,7 +97,7 @@
                 self.host.sendMessage(unicode(linked), msg, None, "auto", profile_key=profile)
         else:
             warning("No body element found in message, following normal behaviour")
-        
+
         return True
 
     def addParrot(self, source_jid, dest_jid, profile):
diff --git a/src/plugins/plugin_exp_pipe.py b/src/plugins/plugin_exp_pipe.py
--- a/src/plugins/plugin_exp_pipe.py
+++ b/src/plugins/plugin_exp_pipe.py
@@ -57,9 +57,9 @@
 
     def profileConnected(self, profile):
         client = self.host.getClient(profile)
-        client._pipe_waiting_for_approval = {} #key = id, value = [transfer data, IdelayedCall Reactor timeout, 
+        client._pipe_waiting_for_approval = {} #key = id, value = [transfer data, IdelayedCall Reactor timeout,
                                         # current stream method, [failed stream methods], profile]
-    
+
     def _kill_id(self, approval_id, profile):
         """Delete a waiting_for_approval id, called after timeout
         @param approval_id: id of _pipe_waiting_for_approval"""
@@ -69,7 +69,7 @@
             del client._pipe_waiting_for_approval[approval_id]
         except KeyError:
             warning(_("kill id called on a non existant approval id"))
-    
+
     def transferRequest(self, iq_id, from_jid, si_id, si_mime_type, si_el, profile):
         """Called when a pipe transfer is requested
         @param iq_id: id of the iq request
@@ -85,12 +85,12 @@
             raise ProfileNotInCacheError
         pipe_elts = filter(lambda elt: elt.name == 'pipe', si_el.elements())
         feature_elts = self.host.plugins["XEP-0020"].getFeatureElt(si_el)
-        
+
         if not pipe_elts:
             warning(_("No pipe element found"))
             self.host.plugins["XEP-0095"].sendBadRequestError(iq_id, from_jid, profile)
             return
-            
+
         if feature_elts:
             feature_el = feature_elts[0]
             form = data_form.Form.fromElement(feature_el.firstChildElement())
@@ -202,7 +202,7 @@
         if not feature_elts:
             warning(_("No feature element"))
             return
-        
+
         choosed_options = self.host.plugins["XEP-0020"].getChoosedOptions(feature_elts[0])
         try:
             stream_method = choosed_options["stream-method"]
@@ -236,9 +236,9 @@
             warning(_("Trying to send a file from an unknown profile"))
             return ""
         feature_elt = self.host.plugins["XEP-0020"].proposeFeatures({'stream-method': self.managed_stream_m})
-       
+
         pipe_transfer_elts = []
-        
+
         pipe_elt = domish.Element((PROFILE, 'pipe'))
         pipe_transfer_elts.append(pipe_elt)
 
diff --git a/src/plugins/plugin_misc_account.py b/src/plugins/plugin_misc_account.py
--- a/src/plugins/plugin_misc_account.py
+++ b/src/plugins/plugin_misc_account.py
@@ -52,12 +52,12 @@
 
 class ProsodyRegisterProtocol(protocol.ProcessProtocol):
     """ Try to register an account with prosody """
-    
+
     def __init__(self, password, deferred = None):
         self.password = password
         self.deferred = deferred
         self.data = ''
-    
+
     def connectionMade(self):
         self.transport.write("%s\n%s" % ((self.password.encode('utf-8'),)*2))
         self.transport.closeStdin()
@@ -65,10 +65,10 @@
 
     def outReceived(self, data):
         self.data += data
-    
+
     def errReceived(self, data):
         self.data += data
-    
+
     def processEnded(self, reason):
         if (reason.value.exitCode == 0):
             info(_('Prosody registration success'))
@@ -97,7 +97,7 @@
                 info(_('Prosody path found: %s') % (self._prosody_path,))
 
     def _registerAccount(self, email, password, profile):
-        
+
         """
         #Password Generation
         #_charset = [chr(i) for i in range(0x21,0x7F)] #XXX: this charset seems to have some issues with openfire
@@ -117,13 +117,13 @@
         return d
 
     def _profileRegistered(self, result, email, password, profile):
-        
+
         #FIXME: values must be in a config file instead of hardcoded
-        self.host.memory.setParam("JabberID", "%s@%s/%s" % (profile, _NEW_ACCOUNT_DOMAIN, _NEW_ACCOUNT_RESOURCE), "Connection", profile) 
+        self.host.memory.setParam("JabberID", "%s@%s/%s" % (profile, _NEW_ACCOUNT_DOMAIN, _NEW_ACCOUNT_RESOURCE), "Connection", profile)
         self.host.memory.setParam("Server", _NEW_ACCOUNT_SERVER, "Connection", profile)
         self.host.memory.setParam("Password", password, "Connection", profile)
         #and the account
-       
+
         #XXX: we use "prosodyctl adduser" because "register" doesn't check conflict
         #     and just change the password if the account already exists
         d = defer.Deferred()
@@ -146,7 +146,7 @@
         def email_ko(ignore):
             #TODO: return error code to user
             error ("Failed to send email to %s" % email)
-        
+
         body = (u"""Welcome to Libervia, a Salut à Toi project part
 
 /!\\ WARNING, THIS IS ONLY A TECHNICAL DEMO, DON'T USE THIS ACCOUNT FOR ANY SERIOUS PURPOSE /!\\
diff --git a/src/plugins/plugin_misc_groupblog.py b/src/plugins/plugin_misc_groupblog.py
--- a/src/plugins/plugin_misc_groupblog.py
+++ b/src/plugins/plugin_misc_groupblog.py
@@ -82,7 +82,7 @@
 
         host.bridge.addMethod("sendGroupBlog", ".plugin", in_sign='sasss', out_sign='',
                                method=self.sendGroupBlog)
-       
+
         host.bridge.addMethod("getLastGroupBlogs", ".plugin",
                               in_sign='sis', out_sign='aa{ss}',
                               method=self.getLastGroupBlogs,
@@ -92,21 +92,21 @@
                               in_sign='sasis', out_sign='a{saa{ss}}',
                               method=self.getMassiveLastGroupBlogs,
                               async = True)
-        
+
         host.bridge.addMethod("subscribeGroupBlog", ".plugin", in_sign='ss', out_sign='',
                                method=self.subscribeGroupBlog,
                                async = True)
-       
+
         host.bridge.addMethod("massiveSubscribeGroupBlogs", ".plugin", in_sign='sass', out_sign='',
                                method=self.massiveSubscribeGroupBlogs,
                                async = True)
-        
+
         host.trigger.add("PubSubItemsReceived", self.pubSubItemsReceivedTrigger)
-       
-    
+
+
     def getHandler(self, profile):
         return GroupBlog_handler()
-       
+
     @defer.inlineCallbacks
     def initialise(self, profile_key):
         """Check that this data for this profile are initialised, and do it else
@@ -115,14 +115,14 @@
         profile = self.host.memory.getProfileName(profile_key)
         if not profile:
             error(_("Unknown profile"))
-            raise Exception("Unknown profile") 
-        
+            raise Exception("Unknown profile")
+
         client = self.host.getClient(profile)
         if not client:
             error(_('No client for this profile key: %s') % profile_key)
-            raise Exception("Unknown profile") 
+            raise Exception("Unknown profile")
         yield client.client_initialized #we want to be sure that the client is initialized
-        
+
         #we first check that we have a item-access pubsub server
         if not hasattr(client,"item_access_pubsub"):
             debug(_('Looking for item-access power pubsub server'))
@@ -136,7 +136,7 @@
                     info(_("item-access powered pubsub service found: [%s]") % entity.full())
                     client.item_access_pubsub = entity
             client._item_access_pubsub_pending.callback(None)
-        
+
         if hasattr(client,"_item_access_pubsub_pending"):
             #XXX: we need to wait for item access pubsub service check
             yield client._item_access_pubsub_pending
@@ -174,7 +174,7 @@
         form_elts = filter(lambda elt: elt.name == "x", item.children)
         for form_elt in form_elts:
             form = data_form.Form.fromElement(form_elt)
-            
+
             if (form.formNamespace == NS_PUBSUB_ITEM_CONFIG):
                 access_model = form.get(OPT_ACCESS_MODEL, 'open')
                 if access_model == "roster":
@@ -183,7 +183,7 @@
                     except KeyError:
                         warning("No group found for roster access-model")
                         microblog_data["groups"] = ''
-                
+
                 break
 
     def item2gbdata(self, item):
@@ -258,12 +258,12 @@
                 raise NotImplementedError
             else:
                 error(_("Unknown access type"))
-                raise BadAccessTypeError 
-            
+                raise BadAccessTypeError
+
         self.initialise(profile_key).addCallback(initialised)
 
 
-        
+
     def getLastGroupBlogs(self, pub_jid, max_items=10, profile_key='@DEFAULT@'):
         """Get the last published microblogs
         @param pub_jid: jid of the publisher
@@ -271,7 +271,7 @@
         @param profile_key: profile key
         @return: list of microblog data (dict)
         """
-        
+
         def initialised(result):
             profile, client = result
             d = self.host.plugins["XEP-0060"].getItems(client.item_access_pubsub, self.getNodeName(jid.JID(pub_jid)),
@@ -292,14 +292,14 @@
         """
         def sendResult(result):
             """send result of DeferredList (list of microblogs to the calling method"""
-            
+
             ret = {}
 
             for (success, value) in result:
                 if success:
                     source_jid, data = value
                     ret[source_jid] = data
-            
+
             return ret
 
         def initialised(result):
@@ -316,9 +316,9 @@
                 jids = publishers
             else:
                 raise UnknownType
-            
+
             mblogs = []
-            
+
             for _jid in jids:
                 d = self.host.plugins["XEP-0060"].getItems(client.item_access_pubsub, self.getNodeName(jid.JID(_jid)),
                                                            max_items=max_items, profile_key=profile_key)
@@ -326,7 +326,7 @@
                 mblogs.append(d)
             dlist = defer.DeferredList(mblogs)
             dlist.addCallback(sendResult)
-            
+
             return dlist
 
 
@@ -391,7 +391,7 @@
 
 class GroupBlog_handler(XMPPHandler):
     implements(iwokkel.IDisco)
-    
+
     def getDiscoInfo(self, requestor, target, nodeIdentifier=''):
         return [disco.DiscoFeature(NS_GROUPBLOG)]
 
diff --git a/src/plugins/plugin_misc_imap.py b/src/plugins/plugin_misc_imap.py
--- a/src/plugins/plugin_misc_imap.py
+++ b/src/plugins/plugin_misc_imap.py
@@ -51,7 +51,7 @@
 
 class IMAP_server():
     #TODO: connect profile on mailbox request, once password is accepted
-    
+
     params = """
     <params>
     <general>
@@ -65,13 +65,13 @@
     def __init__(self, host):
         info(_("Plugin Imap Server initialization"))
         self.host = host
-        
+
         #parameters
         host.memory.importParams(self.params)
 
         port = int(self.host.memory.getParamA("IMAP Port", "Mail Server"))
         info(_("Launching IMAP server on port %d"), port)
-        
+
         self.server_factory = ImapServerFactory(self.host)
         reactor.listenTCP(port, self.server_factory)
 
@@ -84,7 +84,7 @@
         self.flags=flags
         self.mess_fp=mess_fp
         self.message=Parser().parse(mess_fp)
-    
+
     def getUID(self):
         """Retrieve the unique identifier associated with this message.
         """
@@ -221,7 +221,7 @@
         """Called before this mailbox is deleted, permanently.
         """
         debug('destroy')
-        
+
 
     def requestStatus(self, names):
         """Return status information about this mailbox.
@@ -340,7 +340,7 @@
                 setF(mess_id, new_flags)
                 ret[mess_id] = tuple(new_flags)
             return ret
-            
+
         if uid:
             messages.last = self.mailbox.getMaxUid()
             messages.getnext = self.mailbox.getNextExistingUid
@@ -348,7 +348,7 @@
             for listener in self.listeners:
                 listener.flagsChanged(ret)
             return ret
-            
+
         else:
             messages.last = self.getMessageCount()
             ret = updateFlags(self.mailbox.getFlags,self.mailbox.setFlags)
@@ -412,7 +412,7 @@
     credentialInterfaces = (credentials.IUsernamePassword,
                             credentials.IUsernameHashedPassword)
 
-    
+
     def __init__(self, host):
         self.host = host
 
diff --git a/src/plugins/plugin_misc_maildir.py b/src/plugins/plugin_misc_maildir.py
--- a/src/plugins/plugin_misc_maildir.py
+++ b/src/plugins/plugin_misc_maildir.py
@@ -57,7 +57,7 @@
     pass
 
 class MaildirBox():
-    
+
     def __init__(self, host):
         info(_("Plugin Maildir initialization"))
         self.host = host
@@ -184,14 +184,14 @@
             if idx>box_data['cur_idx']:
                 return None
         return idx
-    
+
     def getMaxUid(self, boxname, profile):
         """Give the max existing uid
         @param boxname: name of the box where the message is
         @return: uid"""
         box_data = self.__getBoxData(boxname, profile)
         return box_data['cur_idx']
-    
+
     def getIdFromUid(self, boxname, message_uid, profile):
         """Return the message unique id from it's integer UID
         @param boxname: name of the box where the message is
@@ -251,9 +251,9 @@
         """
         box_data = self.__getBoxData(boxname, profile)
         for mess_id in self.getMessageIdsWithFlag(boxname,"\\Deleted", profile):
-           del(box_data[mess_id]) 
+           del(box_data[mess_id])
         self.data[profile].force(boxname)
-    
+
     def cleanTable(self, boxname, existant_id, profile):
         """Remove mails which no longuer exist from the table
         @param boxname: name of the box to clean
@@ -265,7 +265,7 @@
                 to_remove.append(key)
         for key in to_remove:
             del box_data[key]
-        
+
     def addObserver(self, callback, profile, boxname, signal="NEW_MESSAGE"):
         """Add an observer for maildir box changes
         @param callback: method to call when the the box is updated
@@ -327,7 +327,7 @@
             elif e.name == "subject":
                 mail['Subject'] =  e.children[0].encode('utf-8')
         return mail.as_string()
-    
+
     def __init__(self, _maildir, name, observer=None, profile="@NONE@"):
         """@param _maildir: the main MaildirBox instance
            @param name: name of the mailbox
@@ -350,7 +350,7 @@
         self.mailbox = maildir.MaildirMailbox(mailbox_path)
         self.observer=observer
         self.__uid_table_update()
-        
+
         if observer:
             debug("adding observer for %s (%s)" % (name,profile))
             self.maildir.addObserver(observer, profile, name, "NEW_MESSAGE")
@@ -362,7 +362,7 @@
             existant_id.append(self.getId(mess_idx))
             self.getUid(mess_idx)
         self.maildir.cleanTable(self.name, existant_id, profile=self.profile)
-    
+
 
     def __del__(self):
         if observer:
@@ -417,7 +417,7 @@
             if self.getUid(mess_idx) == mess_uid:
                 return mess_idx
         raise IndexError
-    
+
     def getIdxFromId(self, mess_id):
         """Return the message index from the unique index
         @param mess_id: message unique index as given by MaildirMailbox
@@ -426,7 +426,7 @@
             if self.mailbox.getUidl(mess_idx) == mess_id:
                 return mess_idx
         raise IndexError
-    
+
     def getMessage(self, mess_idx):
         """Return the full message
         @param mess_idx: message index"""
@@ -443,7 +443,7 @@
         @return: list of strings"""
         id = self.getId(mess_idx)
         return self.maildir.getFlags(self.name, id, profile=self.profile)
-    
+
     def getFlagsUid(self, mess_uid):
         """Return the flags of the message
         @param mess_uid: message unique identifier
@@ -487,4 +487,4 @@
         """Delete everything in the .Trash dir"""
         import shutils
         pdb.set_trace()
-         
+
diff --git a/src/plugins/plugin_misc_quiz.py b/src/plugins/plugin_misc_quiz.py
--- a/src/plugins/plugin_misc_quiz.py
+++ b/src/plugins/plugin_misc_quiz.py
@@ -2,7 +2,7 @@
 # -*- coding: utf-8 -*-
 
 """
-SAT plugin for managing Quiz game 
+SAT plugin for managing Quiz game
 Copyright (C) 2009, 2010, 2011, 2012, 2013 Jérôme Poisson (goffi at goffi.org)
 
 This program is free software: you can redistribute it and/or modify
@@ -133,7 +133,7 @@
         for data in game_data:
             data_elt = domish.Element((None,data))
             data_elt.addContent(game_data[data])
-            game_data_elt.addChild(data_elt) 
+            game_data_elt.addChild(data_elt)
         return game_data_elt
 
     def __xml_to_game_data(self, game_data_elt):
@@ -161,17 +161,17 @@
         score = {}
         for player in game_data['players']:
             score[player] = players_data[player]['score']
-        
+
         answer_result_elt = domish.Element((None,'answer_result'))
         answer_result_elt['player'] = player_answering
         answer_result_elt['good_answer'] = str(good_answer)
-        
+
         for player in score:
             score_elt = domish.Element((None,"score"))
             score_elt['player'] = player
             score_elt['score'] = str(score[player])
-            answer_result_elt.addChild(score_elt) 
-        
+            answer_result_elt.addChild(score_elt)
+
         return answer_result_elt
 
     def __create_started_elt(self, players):
@@ -193,7 +193,7 @@
         question_elt['timer'] = str(timer)
         question_elt.addContent(question)
         return question_elt
-    
+
     def __start_play(self, room_jid, game_data, profile):
         """Start the game (tell to the first player after dealer to play"""
         game_data['stage'] = "play"
@@ -231,14 +231,14 @@
             for player in players:
                 self.host.plugins["XEP-0249"].invite(jid.JID(player), room.occupantJID.userhostJID(), {"game":"Quiz"}, profile)
             self.waiting_inv[_room] = (time(), players) #TODO: remove invitation waiting for too long, using the time data
-        
+
         def after_init(ignore):
             room_name = "sat_quiz_%s" % self.host.plugins["XEP-0045"].getUniqueName(profile_key)
             print "\n\n===> room_name:", room_name
             muc_service = None
             for service in self.host.memory.getServerServiceEntities("conference", "text", profile):
                 if not ".irc." in service.userhost():
-                    #FIXME: 
+                    #FIXME:
                     #This awfull ugly hack is here to avoid an issue with openfire: the irc gateway
                     #use "conference/text" identity (instead of "conference/irc"), there is certainly a better way
                     #to manage this, but this hack fill do it for test purpose
@@ -247,7 +247,7 @@
             if not muc_service:
                 error(_("Can't find a MUC service"))
                 return
-            
+
             _jid, xmlstream = self.host.getJidNStream(profile)
             d = self.host.plugins["XEP-0045"].join(jid.JID("%s@%s" % (room_name, muc_service.userhost())), _jid.user, {}, profile).addCallback(quizRoomJoined)
 
@@ -355,18 +355,18 @@
         game_data["timer"] = reactor.callLater(timer, self.timerExpired, room_jid, profile)
         game_data["time_left"] = None
 
-    def checkAnswer(self, room_jid, player, answer, profile): 
+    def checkAnswer(self, room_jid, player, answer, profile):
         """Check if the answer given is right"""
         game_data = self.games[room_jid.userhost()]
         players_data = game_data['players_data']
         good_answer =  game_data['question_id'] == "1" and answer=="42"
         players_data[player]['score'] += 1 if good_answer else -1
         players_data[player]['score'] = min(9, max(0, players_data[player]['score']))
-        
+
         mess = self.createGameElt(room_jid)
         mess.firstChildElement().addChild(self.__answer_result(player, good_answer, game_data))
         self.host.profiles[profile].xmlstream.send(mess)
-        
+
         if good_answer:
             reactor.callLater(4, self.askQuestion, room_jid, profile)
         else:
@@ -382,7 +382,7 @@
 
         for player in players:
             players_data[player]['game_score'] = 0
-        
+
         new_game_data = {"instructions": _(u"""Bienvenue dans cette partie rapide de quizz, le premier à atteindre le score de 9 remporte le jeu
 
 Attention, tu es prêt ?""")}
@@ -393,20 +393,20 @@
         reactor.callLater(10, self.askQuestion, room_jid, profile)
 
     def quiz_game_cmd(self, mess_elt, profile):
-        from_jid = jid.JID(mess_elt['from']) 
+        from_jid = jid.JID(mess_elt['from'])
         room_jid = jid.JID(from_jid.userhost())
         game_elt = mess_elt.firstChildElement()
         game_data = self.games[room_jid.userhost()]
         players_data = game_data['players_data']
-        
+
         for elt in game_elt.elements():
-            
+
             if elt.name == 'started': #new game created
                 players = []
                 for player in elt.elements():
                     players.append(unicode(player))
                 self.host.bridge.quizGameStarted(room_jid.userhost(), from_jid.full(), players, profile)
-            
+
             elif elt.name == 'player_ready': #ready to play
                 player = elt['player']
                 status = self.games[room_jid.userhost()]['status']
@@ -418,10 +418,10 @@
 
             elif elt.name == 'game_data':
                 self.host.bridge.quizGameNew(room_jid.userhost(), self.__xml_to_game_data(elt), profile)
-            
+
             elif elt.name == 'question': #A question is asked
                 self.host.bridge.quizGameQuestion(room_jid.userhost(), elt["id"], unicode(elt), int(elt["timer"]), profile )
-            
+
             elif elt.name == 'player_answer':
                 player = elt['player']
                 pause = game_data['stage'] == 'question' #we pause the game only if we are have a question at the moment
@@ -429,7 +429,7 @@
                 mess = self.createGameElt(room_jid)
                 buzzer_elt = mess.firstChildElement().addElement('player_buzzed')
                 buzzer_elt['player'] = player
-                buzzer_elt['pause'] = str(pause) 
+                buzzer_elt['pause'] = str(pause)
                 self.host.profiles[profile].xmlstream.send(mess)
                 if pause:
                     self.pauseTimer(room_jid)
@@ -442,17 +442,17 @@
                     say_elt['delay'] = "3"
                     reactor.callLater(2, self.host.profiles[profile].xmlstream.send, mess)
                     reactor.callLater(6, self.checkAnswer, room_jid, player, _answer, profile=profile)
-                
+
             elif elt.name == 'player_buzzed':
                 self.host.bridge.quizGamePlayerBuzzed(room_jid.userhost(), elt["player"], elt['pause'] == str(True), profile)
-            
+
             elif elt.name == 'player_says':
                 self.host.bridge.quizGamePlayerSays(room_jid.userhost(), elt["player"], unicode(elt), int(elt["delay"]), profile)
-           
+
             elif elt.name == 'answer_result':
                 player, good_answer, score = self.__answer_result_to_signal_args(elt)
                 self.host.bridge.quizGameAnswerResult(room_jid.userhost(), player, good_answer, score, profile)
-            
+
             elif elt.name == 'timer_expired':
                 self.host.bridge.quizGameTimerExpired(room_jid.userhost(), profile)
 
@@ -461,13 +461,13 @@
 
             else:
                 error (_('Unmanaged game element: %s') % elt.name)
-                
+
     def getHandler(self, profile):
             return QuizGameHandler(self)
 
 class QuizGameHandler (XMPPHandler):
     implements(iwokkel.IDisco)
-   
+
     def __init__(self, plugin_parent):
         self.plugin_parent = plugin_parent
         self.host = plugin_parent.host
diff --git a/src/plugins/plugin_misc_radiocol.py b/src/plugins/plugin_misc_radiocol.py
--- a/src/plugins/plugin_misc_radiocol.py
+++ b/src/plugins/plugin_misc_radiocol.py
@@ -2,7 +2,7 @@
 # -*- coding: utf-8 -*-
 
 """
-SAT plugin for managing Radiocol 
+SAT plugin for managing Radiocol
 Copyright (C) 2009, 2010, 2011, 2012, 2013 Jérôme Poisson (goffi at goffi.org)
 
 This program is free software: you can redistribute it and/or modify
@@ -80,7 +80,7 @@
         elt["type"] = type
         elt.addElement((NC_RADIOCOL, RADIOC_TAG))
         return elt
-    
+
     def __create_started_elt(self):
         """Create a game_started domish element"""
         started_elt = domish.Element((None,'started'))
@@ -122,14 +122,14 @@
             self.radiocolCreate(_room_jid.userhost(), profile_key=profile)
             for occupant in occupants:
                 self.host.plugins["XEP-0249"].invite(jid.JID(occupant), room.occupantJID.userhostJID(), {"game":"Radiocol"}, profile)
-        
+
         def after_init(ignore):
             room_name = "sat_radiocol_%s" % self.host.plugins["XEP-0045"].getUniqueName(profile_key)
             print "\n\n===> room_name:", room_name
             muc_service = None
             for service in self.host.memory.getServerServiceEntities("conference", "text", profile):
                 if not ".irc." in service.userhost():
-                    #FIXME: 
+                    #FIXME:
                     #This awfull ugly hack is here to avoid an issue with openfire: the irc gateway
                     #use "conference/text" identity (instead of "conference/irc"), there is certainly a better way
                     #to manage this, but this hack fill do it for test purpose
@@ -138,7 +138,7 @@
             if not muc_service:
                 error(_("Can't find a MUC service"))
                 return
-            
+
             _jid, xmlstream = self.host.getJidNStream(profile)
             d = self.host.plugins["XEP-0045"].join(jid.JID("%s@%s" % (room_name, muc_service.userhost())), _jid.user, {}, profile)
             d.addCallback(radiocolRoomJoined)
@@ -184,7 +184,7 @@
         client = self.host.getClient(profile)
         if not client:
             error(_("Can't access profile's data"))
-            return 
+            return
         try:
             song = OggVorbis(song_path)
         except OggVorbisHeaderError:
@@ -213,7 +213,7 @@
         self.host.profiles[profile].xmlstream.send(mess)
 
         radio_data = self.radios[jid.JID(referee).userhost()] #FIXME: referee comes from Libervia's client side, it's unsecure
-        radio_data['to_delete'][filename] = song_path #FIXME: works only because of the same host trick, see the note under the docstring  
+        radio_data['to_delete'][filename] = song_path #FIXME: works only because of the same host trick, see the note under the docstring
 
     def playNext(self, room_jid, profile):
         """"Play next sont in queue if exists, and put a timer
@@ -248,22 +248,22 @@
         except KeyError:
             error(_("INTERNAL ERROR: can't find full path of the song to delete"))
             return
-        
-        #we wait more than the song length to delete the file, to manage poorly reactive networks/clients  
+
+        #we wait more than the song length to delete the file, to manage poorly reactive networks/clients
         reactor.callLater(length + 90, unlink, file_to_delete) #FIXME: same host trick (see above)
 
 
     def radiocol_game_cmd(self, mess_elt, profile):
         #FIXME: we should check sender (is it referee ?) here before accepting commands
-        from_jid = jid.JID(mess_elt['from']) 
+        from_jid = jid.JID(mess_elt['from'])
         room_jid = jid.JID(from_jid.userhost())
         radio_elt = mess_elt.firstChildElement()
         radio_data = self.radios[room_jid.userhost()]
         occupants_data = radio_data['occupants_data']
         queue = radio_data['queue']
-        
+
         for elt in radio_elt.elements():
-            
+
             if elt.name == 'started': #new game created
                 self.host.bridge.radiocolStarted(room_jid.userhost(), from_jid.full(), profile)
             elif elt.name == 'preload': #a song is in queue and must be preloaded
@@ -279,7 +279,7 @@
             elif elt.name == 'song_added': #a song has been added
                 #FIXME: we are KISS for the proof of concept: every song is added, to a limit of 3 in queue.
                 #       Need to manage some sort of rules to allow peoples to send songs
-                
+
                 if len(queue) >= QUEUE_LIMIT:
                     #there are already too many songs in queue, we reject this one
                     mess = self.createRadiocolElt(room_jid)
@@ -289,7 +289,7 @@
                     #FIXME: add an error code
                     self.host.profiles[profile].xmlstream.send(mess)
                     return
-                    
+
                 #The song is accepted and added in queue
                 queue.append((elt['filename'], float(elt['length'])))
 
@@ -317,13 +317,13 @@
                     self.playNext(room_jid, profile)
             else:
                 error (_('Unmanaged game element: %s') % elt.name)
-                
+
     def getHandler(self, profile):
             return RadiocolHandler(self)
 
 class RadiocolHandler (XMPPHandler):
     implements(iwokkel.IDisco)
-   
+
     def __init__(self, plugin_parent):
         self.plugin_parent = plugin_parent
         self.host = plugin_parent.host
diff --git a/src/plugins/plugin_misc_smtp.py b/src/plugins/plugin_misc_smtp.py
--- a/src/plugins/plugin_misc_smtp.py
+++ b/src/plugins/plugin_misc_smtp.py
@@ -50,7 +50,7 @@
 }
 
 class SMTP_server():
-    
+
     params = """
     <params>
     <general>
@@ -64,13 +64,13 @@
     def __init__(self, host):
         info(_("Plugin SMTP Server initialization"))
         self.host = host
-        
+
         #parameters
         host.memory.importParams(self.params)
 
         port = int(self.host.memory.getParamA("SMTP Port", "Mail Server"))
         info(_("Launching SMTP server on port %d"), port)
-        
+
         self.server_factory = SmtpServerFactory(self.host)
         reactor.listenTCP(port, self.server_factory)
 
@@ -81,7 +81,7 @@
         self.host=host
         self.profile=profile
         self.message=[]
-    
+
     def lineReceived(self, line):
         """handle another line"""
         self.message.append(line)
@@ -167,7 +167,7 @@
     credentialInterfaces = (credentials.IUsernamePassword,
                             credentials.IUsernameHashedPassword)
 
-    
+
     def __init__(self, host):
         self.host = host
 
@@ -203,7 +203,7 @@
     def clientConnectionLost(self, connector, reason):
         debug (_("SMTP server connection lost (reason: %s)"), reason)
         smtp.SMTPFactory.clientConnectionLost(self, connector, reason)
-    
+
     def buildProtocol(self, addr):
         p = smtp.SMTPFactory.buildProtocol(self, addr)
         # add the challengers from imap4, more secure and complicated challengers are available
diff --git a/src/plugins/plugin_misc_tarot.py b/src/plugins/plugin_misc_tarot.py
--- a/src/plugins/plugin_misc_tarot.py
+++ b/src/plugins/plugin_misc_tarot.py
@@ -98,7 +98,7 @@
             card_elt = domish.Element((None,'card'))
             card_elt['suit'] = card.suit
             card_elt['value'] = card.value
-            cards_list_elt.addChild(card_elt) 
+            cards_list_elt.addChild(card_elt)
         return cards_list_elt
 
     def __xml_to_list(self, cards_list_elt):
@@ -107,7 +107,7 @@
         for card in cards_list_elt.elements():
             cards_list.append((card['suit'], card['value']))
         return cards_list
-            
+
 
     def __create_started_elt(self, players):
         """Create a game_started domish element"""
@@ -164,7 +164,7 @@
         error_elt.addChild(played_elt)
         error_elt.addChild(invalid_elt)
         return error_elt
-        
+
     def __next_player(self, game_data, next_pl = None):
         """Increment player number & return player name
         @param next_pl: if given, then next_player is forced to this one
@@ -180,7 +180,7 @@
         """give the nick of the player who win this trick"""
         players_data = game_data['players_data']
         first = game_data['first_player']
-        first_idx = game_data['players'].index(first) 
+        first_idx = game_data['players'].index(first)
         suit_asked = None
         strongest = None
         winner = None
@@ -225,19 +225,19 @@
         if not excuse in played:
             #the Excuse is not on the table, nothing to do
             return
-        
+
         excuse_player = None #Who has played the Excuse ?
         for player in game_data['players']:
             if players_data[player]['played'] == excuse:
                 excuse_player = player
                 break
-            
+
         if excuse_player == winner:
             return #the excuse player win the trick, nothing to do
-        
+
         #first we remove the excuse from played cards
         played.remove(excuse)
-        #then we give it back to the original owner 
+        #then we give it back to the original owner
         owner_levees = players_data[excuse_player]['levees']
         owner_levees.append(excuse)
         #finally we give a low card to the trick winner
@@ -267,10 +267,10 @@
         for player in game_data['players']:
             scores_str+=_("\n--\n%(player)s:\nscore for this game ==> %(score_game)i\ntotal score ==> %(total_score)i") % {'player':player, 'score_game':0, 'total_score': players_data[player]['score']}
         debug(scores_str)
- 
+
         return (scores_str, [], [])
 
-    
+
     def __calculate_scores(self, game_data):
         """The game is finished, time to know who won :)
         @param game_data: data of the game
@@ -285,7 +285,7 @@
                 nb_bouts +=1
                 bouts.append(card.value)
             score += card.points
-        
+
         #We we do a basic check on score calculation
         check_score = 0
         defenseurs = game_data['players'][:]
@@ -297,7 +297,7 @@
             for card in game_data['chien']:
                 check_score+=card.points
         assert (score + check_score == 91)
-        
+
         point_limit = None
         if nb_bouts == 3:
             point_limit = 36
@@ -340,7 +340,7 @@
         for player in game_data['players']:
             scores_str+=_("\n--\n%(player)s:\nscore for this game ==> %(score_game)i\ntotal score ==> %(total_score)i") % {'player':player, 'score_game':player_score[player], 'total_score': players_data[player]['score']}
         debug(scores_str)
- 
+
         return (scores_str, winners, loosers)
 
     def __invalid_cards(self, game_data, cards):
@@ -437,7 +437,7 @@
             for player in players:
                 self.host.plugins["XEP-0249"].invite(jid.JID(player), room.occupantJID.userhostJID(), {"game":"Tarot"}, profile)
             self.waiting_inv[_room] = (time(), players) #TODO: remove invitation waiting for too long, using the time data
-        
+
         def after_init(ignore):
             room_name = "sat_tarot_%s" % self.host.plugins["XEP-0045"].getUniqueName(profile_key)
             print "\n\n===> room_name:", room_name
@@ -445,7 +445,7 @@
             muc_service = None
             for service in self.host.memory.getServerServiceEntities("conference", "text", profile):
                 if not ".irc." in service.userhost():
-                    #FIXME: 
+                    #FIXME:
                     #This awfull ugly hack is here to avoid an issue with openfire: the irc gateway
                     #use "conference/text" identity (instead of "conference/irc"), there is certainly a better way
                     #to manage this, but this hack fill do it for test purpose
@@ -454,7 +454,7 @@
             if not muc_service:
                 error(_("Can't find a MUC service"))
                 return
-            
+
             _jid, xmlstream = self.host.getJidNStream(profile)
             d = self.host.plugins["XEP-0045"].join(jid.JID("%s@%s" % (room_name, muc_service.userhost())), _jid.user, {}, profile).addCallback(tarotRoomJoined)
 
@@ -580,23 +580,23 @@
         mess = self.createGameElt(to_jid)
         mess.firstChildElement().addChild(self.__ask_contrat())
         self.host.profiles[profile].xmlstream.send(mess)
-            
+
 
     def card_game_cmd(self, mess_elt, profile):
-        from_jid = jid.JID(mess_elt['from']) 
+        from_jid = jid.JID(mess_elt['from'])
         room_jid = jid.JID(from_jid.userhost())
         game_elt = mess_elt.firstChildElement()
         game_data = self.games[room_jid.userhost()]
         players_data = game_data['players_data']
-        
+
         for elt in game_elt.elements():
-            
+
             if elt.name == 'started': #new game created
                 players = []
                 for player in elt.elements():
                     players.append(unicode(player))
                 self.host.bridge.tarotGameStarted(room_jid.userhost(), from_jid.full(), players, profile)
-            
+
             elif elt.name == 'player_ready': #ready to play
                 player = elt['player']
                 status = self.games[room_jid.userhost()]['status']
@@ -605,7 +605,7 @@
                 debug (_('Player %(player)s is ready to start [status: %(status)s]') % {'player':player, 'status':status})
                 if status.values().count('ready') == nb_players: #everybody is ready, we can start the game
                     self.newGame(room_jid, profile)
-            
+
             elif elt.name == 'hand': #a new hand has been received
                 self.host.bridge.tarotGameNew(room_jid.userhost(), self.__xml_to_list(elt), profile)
 
@@ -613,7 +613,7 @@
                 form = data_form.Form.fromElement(elt.firstChildElement())
                 xml_data = dataForm2xml(form)
                 self.host.bridge.tarotGameChooseContrat(room_jid.userhost(), xml_data, profile)
-           
+
             elif elt.name == 'contrat_choosed':
                 #TODO: check we receive the contrat from the right person
                 #TODO: use proper XEP-0004 way for answering form
@@ -648,7 +648,7 @@
                         return
                     debug (_("%(player)s win the bid with %(contrat)s") % {'player':best_contrat[0],'contrat':best_contrat[1]})
                     game_data['contrat'] = best_contrat[1]
-                    
+
                     if game_data['contrat'] == "Garde Sans" or game_data['contrat'] == "Garde Contre":
                         self.__start_play(room_jid, game_data, profile)
                         game_data['attaquant'] = best_contrat[0]
@@ -662,7 +662,7 @@
                         #the attacker (attaquant) get the chien
                         game_data['hand'][best_contrat[0]].extend(game_data['chien'])
                         del game_data['chien'][:]
-                    
+
                     if game_data['contrat'] == "Garde Sans":
                         #The chien go into attaquant's (attacker) levees
                         players_data[best_contrat[0]]['levees'].extend(game_data['chien'])
@@ -693,13 +693,13 @@
                     players_data[elt['player']]['levees'].extend(list_cards) #we add the chien to attaquant's levées
                     for card in list_cards:
                         game_data['hand'][elt['player']].remove(card)
-                    
+
                     self.__start_play(room_jid, game_data, profile)
-                    
+
                 elif game_data['stage'] == "play":
                     current_player = game_data['players'][game_data['current_player']]
                     cards = TarotCard.from_tuples(self.__xml_to_list(elt))
-                    
+
                     if mess_elt['type'] == 'groupchat':
                         self.host.bridge.tarotGameCardsPlayed(room_jid.userhost(), elt['player'], self.__xml_to_list(elt), profile)
                     else:
@@ -719,7 +719,7 @@
                         mess = self.createGameElt(room_jid)
                         playcard_elt = mess.firstChildElement().addChild(elt)
                         self.host.profiles[profile].xmlstream.send(mess)
-                    
+
                         #Did everybody played ?
                         played = [players_data[player]['played'] for player in game_data['players']]
                         if all(played):
@@ -776,13 +776,13 @@
                     error (_('Unmanaged error type: %s') % elt['type'])
             else:
                 error (_('Unmanaged card game element: %s') % elt.name)
-                
+
     def getHandler(self, profile):
             return CardGameHandler(self)
 
 class CardGameHandler (XMPPHandler):
     implements(iwokkel.IDisco)
-   
+
     def __init__(self, plugin_parent):
         self.plugin_parent = plugin_parent
         self.host = plugin_parent.host
diff --git a/src/plugins/plugin_misc_text_commands.py b/src/plugins/plugin_misc_text_commands.py
--- a/src/plugins/plugin_misc_text_commands.py
+++ b/src/plugins/plugin_misc_text_commands.py
@@ -89,29 +89,29 @@
     def cmd_nick(self, mess_data, profile):
         """change nickname"""
         debug("Catched nick command")
-        
+
         if mess_data['type'] != "groupchat":
             #/nick command does nothing if we are not on a group chat
             info("Ignoring /nick command on a non groupchat message")
-            
+
             return True
-         
+
         nick = mess_data["unparsed"].strip()
         room = mess_data["to"]
 
         self.host.plugins["XEP-0045"].nick(room,nick,profile)
 
         return False
-    
+
     def cmd_join(self, mess_data, profile):
         """join a new room (on the same service if full jid is not specified)"""
         debug("Catched join command")
-        
+
         if mess_data['type'] != "groupchat":
             #/leave command does nothing if we are not on a group chat
             info("Ignoring /join command on a non groupchat message")
             return True
-         
+
         if mess_data["unparsed"].strip():
             room = self._getRoomJID(mess_data["unparsed"].strip(), mess_data["to"].host)
             nick = (self.host.plugins["XEP-0045"].getRoomNick(mess_data["to"].userhost(), profile) or
@@ -123,14 +123,14 @@
     def cmd_leave(self, mess_data, profile):
         """quit a room"""
         debug("Catched leave command")
-        
+
         if mess_data['type'] != "groupchat":
             #/leave command does nothing if we are not on a group chat
             info("Ignoring /leave command on a non groupchat message")
             return True
-         
+
         if mess_data["unparsed"].strip():
-            room = self._getRoomJID(mess_data["unparsed"].strip(), mess_data["to"].host) 
+            room = self._getRoomJID(mess_data["unparsed"].strip(), mess_data["to"].host)
         else:
             room = mess_data["to"]
 
@@ -145,14 +145,14 @@
     def cmd_title(self, mess_data, profile):
         """change room's subject"""
         debug("Catched title command")
-        
+
         if mess_data['type'] != "groupchat":
             #/leave command does nothing if we are not on a group chat
             info("Ignoring /title command on a non groupchat message")
             return True
-         
+
         subject = mess_data["unparsed"].strip()
-        
+
         if subject:
             room = mess_data["to"]
             self.host.plugins["XEP-0045"].subject(room, subject, profile)
@@ -167,9 +167,9 @@
         """activate Parrot mode between 2 entities, in both directions."""
         #TODO: these commands must not be hardcoded, an interface should be made
         #      to allow plugins to register simple commands like this.
-        
+
         debug("Catched parrot command")
-       
+
         try:
             link_left_jid = jid.JID(mess_data["unparsed"].strip())
             if not link_left_jid.user or not link_left_jid.host:
@@ -184,13 +184,13 @@
         self.host.plugins["EXP-PARROT"].addParrot(link_right_jid, link_left_jid, profile)
 
         self._feedBack("Parrot mode activated for %s" % (unicode(link_left_jid),), mess_data, profile)
-        
+
         return False
 
     def cmd_unparrot(self, mess_data, profile):
         """remove Parrot mode between 2 entities, in both directions."""
         debug("Catched unparrot command")
-       
+
         try:
             link_left_jid = jid.JID(mess_data["unparsed"].strip())
             if not link_left_jid.user or not link_left_jid.host:
@@ -205,7 +205,7 @@
         self.host.plugins["EXP-PARROT"].removeParrot(link_right_jid, profile)
 
         self._feedBack("Parrot mode deactivated for %s and %s" % (unicode(link_left_jid), unicode(link_right_jid)), mess_data, profile)
-        
+
         return False
 
     def cmd_help(self, mess_data, profile):
@@ -213,7 +213,7 @@
         commands=filter(lambda method: method.startswith('cmd_'), dir(self))
         longuest = max([len(command) for command in commands])
         help_cmds = []
-        
+
         for command in commands:
             method = getattr(self, command)
             try:
@@ -223,7 +223,7 @@
             spaces = (longuest - len(command)) * ' '
             help_cmds.append("    /%s: %s %s" % (command[4:], spaces, help_str))
 
-        help_mess = _(u"Text commands available:\n%s") % (u'\n'.join(help_cmds),) 
+        help_mess = _(u"Text commands available:\n%s") % (u'\n'.join(help_cmds),)
         self._feedBack(help_mess, mess_data, profile)
-        
 
+
diff --git a/src/plugins/plugin_misc_xmllog.py b/src/plugins/plugin_misc_xmllog.py
--- a/src/plugins/plugin_misc_xmllog.py
+++ b/src/plugins/plugin_misc_xmllog.py
@@ -2,7 +2,7 @@
 # -*- coding: utf-8 -*-
 
 """
-SàT plugin for managing raw XML log 
+SàT plugin for managing raw XML log
 Copyright (C) 2011  Jérôme Poisson (goffi at goffi.org)
 
 This program is free software: you can redistribute it and/or modify
@@ -50,10 +50,10 @@
     def dataReceived(self, data):
         self._host.bridge.xmlLog("IN", data.decode('utf-8'), self._profile)
         return XmlStream.dataReceived(self, data)
-    
+
 
 class XmlLog():
-    
+
     params = """
     <params>
     <general>
@@ -67,18 +67,18 @@
     def __init__(self, host):
         info(_("Plugin XML Log initialization"))
         self.host = host
-        
+
         #parameters
         host.memory.importParams(self.params)
-        
+
         #bridge
         host.bridge.addSignal("xmlLog", ".plugin", signature='sss') #args: direction("IN" or "OUT"), xml_data, profile
-        
+
         do_log = self.host.memory.getParamA("Xml log", "Debug")
         if do_log:
             info(_("XML log activated"))
             host.trigger.add("XML Initialized", self.logXml)
-       
+
     def logXml(self, xmlstream, profile):
         xmlstream.__class__ = LoggingXmlStream
         xmlstream._profile = profile
diff --git a/src/plugins/plugin_xep_0020.py b/src/plugins/plugin_xep_0020.py
--- a/src/plugins/plugin_xep_0020.py
+++ b/src/plugins/plugin_xep_0020.py
@@ -48,7 +48,7 @@
 
     def __init__(self, host):
         info(_("Plugin XEP_0020 initialization"))
-    
+
     def getHandler(self, profile):
         return XEP_0020_handler()
 
@@ -106,7 +106,7 @@
 
 class XEP_0020_handler(XMPPHandler):
     implements(iwokkel.IDisco)
-    
+
     def getDiscoInfo(self, requestor, target, nodeIdentifier=''):
         return [disco.DiscoFeature(NS_FEATURE_NEG)]
 
diff --git a/src/plugins/plugin_xep_0045.py b/src/plugins/plugin_xep_0045.py
--- a/src/plugins/plugin_xep_0045.py
+++ b/src/plugins/plugin_xep_0045.py
@@ -106,7 +106,7 @@
             # we have a nickname conflict, we try again with "_" suffixed to current nickname
             nick += '_'
             return self.clients[profile].join(room_jid, nick, history_options, password).addCallbacks(self.__room_joined, self.__err_joining_room, callbackKeywords={'profile':profile}, errbackArgs=[room_jid, nick, history_options, password, profile])
-        
+
         mess = _("Error when joining the room")
         error (mess)
         self.host.bridge.newAlert(mess, _("Group chat error"), "ERROR", profile)
@@ -131,14 +131,14 @@
         if not self.__check_profile(profile) or not self.clients[profile].joined_rooms.has_key(room_jid_s):
             return ''
         return self.clients[profile].joined_rooms[room_jid_s].nick
-  
+
     def isNickInRoom(self, room_jid, nick, profile):
         """Tell if a nick is currently present in a room"""
         profile = self.host.memory.getProfileName(profile)
         if not self.__check_profile(profile):
             raise exceptions.UnknownProfileError("Unknown or disconnected profile")
         if not self.clients[profile].joined_rooms.has_key(room_jid.userhost()):
-            raise UnknownRoom("This room has not been joined") 
+            raise UnknownRoom("This room has not been joined")
         return self.clients[profile].joined_rooms[room_jid.userhost()].inRoster(nick)
 
     def getRoomsSubjects(self, profile_key='@DEFAULT@'):
@@ -152,7 +152,7 @@
         """Return unique name for room, avoiding collision"""
         #TODO: we should use #RFC-0045 10.1.4 when available here
         #TODO: we should be able to select the MUC service here
-        return uuid.uuid1() 
+        return uuid.uuid1()
 
     def join(self, room_jid, nick, options, profile_key='@DEFAULT@'):
         def _errDeferred(exc_obj = Exception, txt='Error while joining room'):
@@ -162,15 +162,15 @@
 
         profile = self.host.memory.getProfileName(profile_key)
         if not self.__check_profile(profile):
-            return _errDeferred() 
+            return _errDeferred()
         if self.clients[profile].joined_rooms.has_key(room_jid.userhost()):
             warning(_('%(profile)s is already in room %(room_jid)s') % {'profile':profile, 'room_jid':room_jid.userhost()})
-            return _errDeferred() 
+            return _errDeferred()
         info (_("[%(profile)s] is joining room %(room)s with nick %(nick)s") % {'profile':profile,'room':room_jid.userhost(), 'nick':nick})
 
         history_options = options["history"] == "True" if options.has_key("history") else None
         password = options["password"] if options.has_key("password") else None
-        
+
         return self.clients[profile].join(room_jid, nick, history_options, password).addCallbacks(self.__room_joined, self.__err_joining_room, callbackKeywords={'profile':profile}, errbackArgs=[room_jid, nick, history_options, password, profile])
 
     def _join(self, room_jid_s, nick, options={}, profile_key='@DEFAULT@'):
@@ -193,23 +193,23 @@
         if not self.__check_profile(profile):
             raise exceptions.UnknownProfileError("Unknown or disconnected profile")
         if not self.clients[profile].joined_rooms.has_key(room_jid.userhost()):
-            raise UnknownRoom("This room has not been joined") 
+            raise UnknownRoom("This room has not been joined")
         return self.clients[profile].nick(room_jid, nick)
-  
-    def leave(self, room_jid, profile_key): 
+
+    def leave(self, room_jid, profile_key):
         profile = self.host.memory.getProfileName(profile_key)
         if not self.__check_profile(profile):
             raise exceptions.UnknownProfileError("Unknown or disconnected profile")
         if not self.clients[profile].joined_rooms.has_key(room_jid.userhost()):
-            raise UnknownRoom("This room has not been joined") 
+            raise UnknownRoom("This room has not been joined")
         return self.clients[profile].leave(room_jid)
 
-    def subject(self, room_jid, subject, profile_key): 
+    def subject(self, room_jid, subject, profile_key):
         profile = self.host.memory.getProfileName(profile_key)
         if not self.__check_profile(profile):
             raise exceptions.UnknownProfileError("Unknown or disconnected profile")
         if not self.clients[profile].joined_rooms.has_key(room_jid.userhost()):
-            raise UnknownRoom("This room has not been joined") 
+            raise UnknownRoom("This room has not been joined")
         return self.clients[profile].subject(room_jid, subject)
 
     def mucNick(self, room_jid_s, nick, profile_key='@DEFAULT@'):
@@ -227,7 +227,7 @@
 
 class SatMUCClient (muc.MUCClient):
     #implements(iwokkel.IDisco)
-   
+
     def __init__(self, plugin_parent):
         self.plugin_parent = plugin_parent
         self.host = plugin_parent.host
@@ -240,7 +240,7 @@
 
     def subject(self, room, subject):
         return muc.MUCClientProtocol.subject(self, room, subject)
-    
+
     def unavailableReceived(self, presence):
         #XXX: we override this method to manage nickname change
         #TODO: feed this back to Wokkel
@@ -274,9 +274,9 @@
             debug (_("user %(nick)s has joined room (%(room_id)s)") % {'nick':user.nick, 'room_id':room.occupantJID.userhost()})
             if not self.host.trigger.point("MUC user joined", room, user, self.parent.profile):
                 return
-            user_data={'entity':user.entity.full() if user.entity else  '', 'affiliation':user.affiliation, 'role':user.role} 
+            user_data={'entity':user.entity.full() if user.entity else  '', 'affiliation':user.affiliation, 'role':user.role}
             self.host.bridge.roomUserJoined(room.roomJID.userhost(), user.nick, user_data, self.parent.profile)
-    
+
     def userLeftRoom(self, room, user):
         if user.nick == room.nick:
             # we left the room
@@ -288,7 +288,7 @@
             self.host.bridge.roomLeft(room.roomJID.userhost(), self.parent.profile)
         else:
             debug (_("user %(nick)s left room (%(room_id)s)") % {'nick':user.nick, 'room_id':room.occupantJID.userhost()})
-            user_data={'entity':user.entity.full() if user.entity else  '', 'affiliation':user.affiliation, 'role':user.role} 
+            user_data={'entity':user.entity.full() if user.entity else  '', 'affiliation':user.affiliation, 'role':user.role}
             self.host.bridge.roomUserLeft(room.roomJID.userhost(), user.nick, user_data, self.parent.profile)
 
     def userChangedNick(self, room, user, new_nick):
@@ -305,10 +305,10 @@
 
     #def connectionInitialized(self):
         #pass
-    
+
     #def getDiscoInfo(self, requestor, target, nodeIdentifier=''):
         #return [disco.DiscoFeature(NS_VCARD)]
 
     #def getDiscoItems(self, requestor, target, nodeIdentifier=''):
         #return []
-    
+
diff --git a/src/plugins/plugin_xep_0047.py b/src/plugins/plugin_xep_0047.py
--- a/src/plugins/plugin_xep_0047.py
+++ b/src/plugins/plugin_xep_0047.py
@@ -72,13 +72,13 @@
         if not client:
             raise ProfileNotInCacheError
         client.xep_0047_current_stream = {} #key: stream_id, value: data(dict)
-    
+
     def _timeOut(self, sid, profile):
         """Delecte current_stream id, called after timeout
         @param id: id of client.xep_0047_current_stream"""
         info(_("In-Band Bytestream: TimeOut reached for id %s [%s]") % (sid, profile))
         self._killId(sid, False, "TIMEOUT", profile)
-    
+
     def _killId(self, sid, success=False, failure_reason="UNKNOWN", profile=None):
         """Delete an current_stream id, clean up associated observers
         @param sid: id of client.xep_0047_current_stream"""
@@ -96,18 +96,18 @@
             client.xep_0047_current_stream[sid]['timer'].cancel()
         if client.xep_0047_current_stream[sid].has_key("size"):
             self.host.removeProgressCB(sid, profile)
-       
+
         file_obj = client.xep_0047_current_stream[sid]['file_obj']
         success_cb = client.xep_0047_current_stream[sid]['success_cb']
         failure_cb = client.xep_0047_current_stream[sid]['failure_cb']
-        
+
         del client.xep_0047_current_stream[sid]
 
         if success:
             success_cb(sid, file_obj, NS_IBB, profile)
         else:
             failure_cb(sid, file_obj, NS_IBB, failure_reason, profile)
-    
+
     def getProgress(self, sid, data, profile):
         """Fill data with position of current transfer"""
         client = self.host.getClient(profile)
@@ -119,7 +119,7 @@
             data["size"] = str(client.xep_0047_current_stream[sid]["size"])
         except:
             pass
-    
+
     def prepareToReceive(self, from_jid, sid, file_obj, size, success_cb, failure_cb, profile):
         """Called when a bytestream is imminent
         @param from_jid: jid of the sender
@@ -174,7 +174,7 @@
 
         #we save the xmlstream, events and observer data to allow observer removal
         client.xep_0047_current_stream[sid]["event_data"] = event_data = (IBB_MESSAGE_DATA if stanza=='message' else IBB_IQ_DATA) % sid
-        client.xep_0047_current_stream[sid]["observer_cb"] = observer_cb = self.messageData if stanza=='message' else self.iqData 
+        client.xep_0047_current_stream[sid]["observer_cb"] = observer_cb = self.messageData if stanza=='message' else self.iqData
         event_close = IBB_CLOSE % sid
         #we now set the stream observer to look after data packet
         client.xmlstream.addObserver(event_data, observer_cb, profile = profile)
@@ -207,16 +207,16 @@
         if not client:
             raise ProfileNotInCacheError
         data_elt = IQ.firstChildElement()
-        
+
         if self._manageDataElt(data_elt, 'iq', IQ['id'], jid.JID(IQ['from']), profile):
             #and send a success answer
             result = domish.Element((None, 'iq'))
             result['type'] = 'result'
             result['id'] = IQ['id']
             result['to'] = IQ['from']
-            
+
             client.xmlstream.send(result)
-   
+
     def messageData(self, message_elt, profile):
         data_elt = message_elt.firstChildElement()
         sid = message_elt.getAttribute('id','')
@@ -272,7 +272,7 @@
         result = domish.Element((None, 'iq'))
         result['type'] = 'result'
         result['id'] = iq_id
-        result['to'] = to_jid 
+        result['to'] = to_jid
         error_el = result.addElement('error')
         error_el['type'] = 'cancel'
         error_el.addElement(('urn:ietf:params:xml:ns:xmpp-stanzas','not-acceptable'))
@@ -323,10 +323,10 @@
             warning(_("Transfer failed"))
             self.terminateStream(sid, "IQ_ERROR")
             return
-        
+
         if data['timer'].active():
             data['timer'].cancel()
-        
+
         buffer = data["file_obj"].read(data["block_size"])
         if buffer:
             next_iq_elt = jabber_client.IQ(client.xmlstream,'set')
@@ -366,10 +366,10 @@
 
 class XEP_0047_handler(XMPPHandler):
     implements(iwokkel.IDisco)
-    
+
     def __init__(self,parent):
         self.plugin_parent = parent
-    
+
     def connectionInitialized(self):
         self.xmlstream.addObserver(IBB_OPEN, self.plugin_parent.streamOpening, profile = self.parent.profile)
 
diff --git a/src/plugins/plugin_xep_0054.py b/src/plugins/plugin_xep_0054.py
--- a/src/plugins/plugin_xep_0054.py
+++ b/src/plugins/plugin_xep_0054.py
@@ -90,9 +90,9 @@
             x_elt = domish.Element((NS_VCARD_UPDATE, 'x'))
             x_elt.addElement('photo', content=self.avatars_cache[client.jid.userhost()])
             presence_elt.addChild(x_elt)
-       
+
         return True
-  
+
     def _fillCachedValues(self, result, client):
         #FIXME: this is really suboptimal, need to be reworked
         #       the current naive approach keeps a map between all jids of all profiles
@@ -101,11 +101,11 @@
         for _jid in client.roster.getBareJids() + [client.jid.userhost()]:
             if _jid in self.avatars_cache:
                 self.host.memory.updateEntityData(jid.JID(_jid), "avatar", self.avatars_cache[_jid], client.profile)
-        
+
     def profileConnected(self, profile):
         client = self.host.getClient(profile)
         client.roster.got_roster.addCallback(self._fillCachedValues, client)
-    
+
     def update_cache(self, jid, name, value, profile):
         """update cache value
         - save value in memory in case of change
@@ -122,7 +122,7 @@
             self.host.memory.updateEntityData(jid, name, value, profile)
             if name == "avatar":
                 self.avatars_cache[jid.userhost()] = value
-            
+
     def get_cache(self, jid, name, profile):
         """return cached value for jid
         @param jid: target contact
@@ -158,7 +158,7 @@
         """Convert a VCard to a dict, and save binaries"""
         debug (_("parsing vcard"))
         dictionary = {}
-        
+
         for elem in vcard.elements():
             if elem.name == 'FN':
                 dictionary['fullname'] = unicode(elem)
@@ -170,7 +170,7 @@
             elif elem.name == 'EMAIL':
                 dictionary['email'] = unicode(elem)
             elif elem.name == 'BDAY':
-                dictionary['birthday'] = unicode(elem) 
+                dictionary['birthday'] = unicode(elem)
             elif elem.name == 'PHOTO':
                 dictionary["avatar"] = yield threads.deferToThread(self.save_photo, elem)
                 if not dictionary["avatar"]:  #can happen in case of e.g. empty photo elem
@@ -202,7 +202,7 @@
         """Called when something is wrong with registration"""
         error (_("Can't find VCard of %s") % failure.value.stanza['from'])
         self.host.bridge.actionResult("SUPPRESS", failure.value.stanza['id'], {}, profile) #FIXME: maybe an error message would be better
-  
+
     def getCard(self, target_s, profile_key='@DEFAULT@'):
         """Ask server for VCard
         @param target_s: jid from which we want the VCard
@@ -219,7 +219,7 @@
         reg_request["to"] = to_jid.userhost()
         reg_request.addElement('vCard', NS_VCARD)
         reg_request.send(to_jid.userhost()).addCallbacks(self.vcard_ok, self.vcard_err, callbackArgs=[profile], errbackArgs=[profile])
-        return reg_request["id"] 
+        return reg_request["id"]
 
     def getAvatarFile(self, avatar_hash):
         """Give the full path of avatar from hash
@@ -258,38 +258,38 @@
         client = self.host.getClient(profile_key)
         if not client:
             raise exceptions.NotConnectedProfileError(_('Trying to set avatar for a non-existant or not connected profile'))
-        
+
         vcard_set = IQ(client.xmlstream,'set')
         d = threads.deferToThread(self._buildSetAvatar, vcard_set, filepath)
-        
+
         def elementBuilt(result):
             """Called once the image is at the right size/format, and the vcard set element is build"""
             set_avatar_elt, img_hash = result
             self.avatars_cache[client.jid.userhost()] = img_hash # we need to update the hash, so we can send a new presence
-                                                                 # element with the right hash 
+                                                                 # element with the right hash
             return set_avatar_elt.send().addCallback(lambda ignore: client.presence.available())
-        
+
         d.addCallback(elementBuilt)
-        
+
         return d
 
 
 class XEP_0054_handler(XMPPHandler):
     implements(iwokkel.IDisco)
-   
+
     def __init__(self, plugin_parent):
         self.plugin_parent = plugin_parent
         self.host = plugin_parent.host
 
     def connectionInitialized(self):
         self.xmlstream.addObserver(VCARD_UPDATE, self.update)
-    
+
     def getDiscoInfo(self, requestor, target, nodeIdentifier=''):
         return [disco.DiscoFeature(NS_VCARD)]
 
     def getDiscoItems(self, requestor, target, nodeIdentifier=''):
         return []
-    
+
     def update(self, presence):
         """Request for VCard's nickname
         return the cached nickname if exists, else get VCard
diff --git a/src/plugins/plugin_xep_0060.py b/src/plugins/plugin_xep_0060.py
--- a/src/plugins/plugin_xep_0060.py
+++ b/src/plugins/plugin_xep_0060.py
@@ -92,7 +92,7 @@
 
     def publish(self, service, nodeIdentifier, items=None, profile_key='@DEFAULT@'):
         profile,client = self.__getClientNProfile(profile_key, 'publish item')
-        return client.publish(service, nodeIdentifier, items, client.parent.jid) 
+        return client.publish(service, nodeIdentifier, items, client.parent.jid)
 
     def getItems(self, service, node, max_items=None, sub_id=None, profile_key='@DEFAULT@'):
         profile,client = self.__getClientNProfile(profile_key, 'get items')
@@ -105,7 +105,7 @@
     def setOptions(self, service, nodeIdentifier, subscriber, options, subscriptionIdentifier=None, profile_key='@DEFAULT@'):
         profile,client = self.__getClientNProfile(profile_key, 'set options')
         return client.setOptions(service, nodeIdentifier, subscriber, options, subscriptionIdentifier)
-    
+
     def createNode(self, service, nodeIdentifier, options, profile_key='@DEFAULT@'):
         profile,client = self.__getClientNProfile(profile_key, 'create node')
         return client.createNode(service, nodeIdentifier, options)
@@ -113,12 +113,12 @@
     def deleteNode(self, service, nodeIdentifier, profile_key='@DEFAULT@'):
         profile,client = self.__getClientNProfile(profile_key, 'delete node')
         return client.deleteNode(service, nodeIdentifier)
-    
+
     def subscribe(self, service, nodeIdentifier, sub_jid = None, options=None, profile_key='@DEFAULT@'):
         profile,client = self.__getClientNProfile(profile_key, 'subscribe node')
-        return client.subscribe(service, nodeIdentifier, sub_jid or client.parent.jid.userhostJID(), options=options) 
+        return client.subscribe(service, nodeIdentifier, sub_jid or client.parent.jid.userhostJID(), options=options)
 
-        
+
 class SatPubSubClient(pubsub.PubSubClient):
     implements(disco.IDisco)
 
@@ -129,7 +129,7 @@
 
     def connectionInitialized(self):
         pubsub.PubSubClient.connectionInitialized(self)
-    
+
     def itemsReceived(self, event):
         if not self.host.trigger.point("PubSubItemsReceived", event, self.parent.profile):
             return
@@ -149,7 +149,7 @@
         _disco_info = []
         self.host.trigger.point("PubSub Disco Info", _disco_info, self.parent.profile)
         return _disco_info
-    
+
     def getDiscoItems(self, requestor, target, nodeIdentifier=''):
         return []
 
diff --git a/src/plugins/plugin_xep_0065.py b/src/plugins/plugin_xep_0065.py
--- a/src/plugins/plugin_xep_0065.py
+++ b/src/plugins/plugin_xep_0065.py
@@ -32,7 +32,7 @@
 
 Here is a copy of the original license:
 
-Copyright (C) 
+Copyright (C)
 2002-2004   Dave Smith (dizzyd at jabber.org)
 2007-2008   Fabio Forno (xmpp:ff at jabber.bluendo.com)
 
@@ -172,7 +172,7 @@
 
             # Trim off front of the buffer
             self.buf = self.buf[nmethod+2:]
-            
+
             # Check for supported auth mechs
             for m in self.supportedAuthMechs:
                 if m in methods:
@@ -219,7 +219,7 @@
         result = struct.pack('!BBBBIH', SOCKS5_VER, errorcode, 0, 1, 0, 0)
         self.transport.write(result)
         self.transport.loseConnection()
-    
+
     def _parseRequest(self):
         debug("_parseRequest")
         try:
@@ -235,7 +235,7 @@
             if self.addressType == ADDR_IPV4:
                 addr, port = struct.unpack('!IH', self.buf[4:10])
                 self.buf = self.buf[10:]
-            elif self.addressType == ADDR_DOMAINNAME:            
+            elif self.addressType == ADDR_DOMAINNAME:
                 nlen = ord(self.buf[4])
                 addr, port = struct.unpack('!%dsH' % nlen, self.buf[5:])
                 self.buf = self.buf[7 + len(addr):]
@@ -282,7 +282,7 @@
             if self.addressType == ADDR_IPV4:
                 addr, port = struct.unpack('!IH', self.buf[4:10])
                 self.buf = self.buf[10:]
-            elif self.addressType == ADDR_DOMAINNAME:            
+            elif self.addressType == ADDR_DOMAINNAME:
                 nlen = ord(self.buf[4])
                 addr, port = struct.unpack('!%dsH' % nlen, self.buf[5:])
                 self.buf = self.buf[7 + len(addr):]
@@ -308,7 +308,7 @@
 
     def connectionMade(self):
         debug("connectionMade (mode = %s)" % "requester" if isinstance(self.factory, Socks5ServerFactory) else "target")
-        
+
         if isinstance(self.factory, Socks5ClientFactory):
             self.sid = self.factory.sid
             self.profile = self.factory.profile
@@ -318,7 +318,7 @@
 
     def connectRequested(self, addr, port):
         debug("connectRequested")
-        
+
         # Check that this session is expected
         if not self.factory.hash_sid_map.has_key(addr):
             #no: we refuse it
@@ -336,7 +336,7 @@
         """Callback called when the result iq is received"""
         d = self.beginFileTransfer(file_obj, self.transport)
         d.addCallback(self.fileTransfered)
-    
+
     def fileTransfered(self, d):
         info(_("File transfer completed, closing connection"))
         self.transport.loseConnection()
@@ -351,10 +351,10 @@
                                  ADDR_DOMAINNAME, len(remotehost), remotehost, remoteport)
         self.transport.write(result)
         self.state = STATE_READY
-    
+
     def bindRequested(self, addr, port):
         pass
-    
+
     def authenticateUserPass(self, user, passwd):
         debug("User/pass: %s/%s", user, passwd)
         return True
@@ -440,7 +440,7 @@
 
 
 class XEP_0065():
-    
+
     NAMESPACE = NS_BS
 
     params = """
@@ -463,10 +463,10 @@
 
     def __init__(self, host):
         info(_("Plugin XEP_0065 initialization"))
-        
+
         #session data
         self.hash_sid_map = {}  #key: hash of the transfer session, value: (session id, profile)
-        
+
         self.host = host
         debug(_("registering"))
         self.server_factory = Socks5ServerFactory(host, self.hash_sid_map, lambda sid, success, profile: self._killId(sid, success, profile=profile))
@@ -475,13 +475,13 @@
         host.memory.importParams(XEP_0065.params)
         host.memory.setDefault("IP", "File Transfer", self.getExternalIP)
         port = int(self.host.memory.getParamA("Port", "File Transfer"))
-        
+
         info(_("Launching Socks5 Stream server on port %d"), port)
         reactor.listenTCP(port, self.server_factory)
-    
+
     def getHandler(self, profile):
-        return XEP_0065_handler(self)  
-   
+        return XEP_0065_handler(self)
+
     def profileConnected(self, profile):
         client = self.host.getClient(profile)
         if not client:
@@ -503,13 +503,13 @@
             data["size"] = str(client.xep_0065_current_stream[sid]["size"])
         except:
             pass
-    
+
     def _timeOut(self, sid, profile):
         """Delecte current_stream id, called after timeout
         @param id: id of client.xep_0065_current_stream"""
         info(_("Socks5 Bytestream: TimeOut reached for id %s [%s]") % (sid, profile))
         self._killId(sid, False, "TIMEOUT", profile)
-    
+
     def _killId(self, sid, success=False, failure_reason="UNKNOWN", profile=None):
         """Delete an current_stream id, clean up associated observers
         @param sid: id of client.xep_0065_current_stream"""
@@ -528,11 +528,11 @@
             client.xep_0065_current_stream[sid]['timer'].cancel()
         if client.xep_0065_current_stream[sid].has_key("size"):
             self.host.removeProgressCB(sid, profile)
-       
+
         file_obj = client.xep_0065_current_stream[sid]['file_obj']
         success_cb = client.xep_0065_current_stream[sid]['success_cb']
         failure_cb = client.xep_0065_current_stream[sid]['failure_cb']
-        
+
         session_hash = client.xep_0065_current_stream[sid].get('hash')
         del client.xep_0065_current_stream[sid]
         if session_hash in self.hash_sid_map:
@@ -558,14 +558,14 @@
         if not client:
             error(_("Unknown profile, this should not happen"))
             raise ProfileNotInCacheError
-        
+
         if length != None:
             error(_('stream length not managed yet'))
             return
-        
+
         profile_jid = client.jid
         xmlstream = client.xmlstream
-        
+
         data = client.xep_0065_current_stream[sid] = {}
         data["timer"] = reactor.callLater(TIMEOUT, self._timeOut, sid, profile)
         data["file_obj"] = file_obj
@@ -615,10 +615,10 @@
         except KeyError:
             error(_("Internal error, can't do transfer"))
             return
-        
+
         if timer.active():
             timer.cancel()
-        
+
         profile_jid, xmlstream = self.host.getJidNStream(profile)
         query_elt = iq_elt.firstChildElement()
         streamhost_elts = filter(lambda elt: elt.name == 'streamhost-used', query_elt.elements())
@@ -686,23 +686,23 @@
         data["timer"] = reactor.callLater(TIMEOUT, self._timeOut, sid, profile)
         data["success_cb"] = success_cb
         data["failure_cb"] = failure_cb
-    
-    
+
+
     def streamQuery(self, iq_elt, profile):
         """Get file using byte stream"""
         debug(_("BS stream query"))
         client = self.host.getClient(profile)
-        
+
         if not client:
             raise ProfileNotInCacheError
-        
+
         xmlstream = client.xmlstream
 
         iq_elt.handled = True
         query_elt = iq_elt.firstChildElement()
         sid = query_elt.getAttribute("sid")
         streamhost_elts = filter(lambda elt: elt.name == 'streamhost', query_elt.elements())
-        
+
         if not sid in client.xep_0065_current_stream:
             warning(_("Ignoring unexpected BS transfer: %s" % sid))
             self.sendNotAcceptableError(iq_elt['id'], iq_elt['from'], xmlstream)
@@ -731,7 +731,7 @@
         info (_("Stream proposed: host=[%(host)s] port=[%(port)s]") % {'host':sh_host, 'port':sh_port})
         factory = Socks5ClientFactory(client.xep_0065_current_stream, sid, iq_elt["id"], self.activateStream, lambda sid, success, profile: self._killId(sid, success, profile=profile), profile=profile)
         reactor.connectTCP(sh_host, int(sh_port), factory)
-                
+
     def activateStream(self, sid, iq_id, profile):
         client = self.host.getClient(profile)
         if not client:
@@ -757,7 +757,7 @@
         result = domish.Element((None, 'iq'))
         result['type'] = 'result'
         result['id'] = iq_id
-        result['to'] = to_jid 
+        result['to'] = to_jid
         error_el = result.addElement('error')
         error_el['type'] = 'modify'
         error_el.addElement(('urn:ietf:params:xml:ns:xmpp-stanzas','not-acceptable'))
@@ -771,7 +771,7 @@
         result = domish.Element((None, 'iq'))
         result['type'] = 'result'
         result['id'] = iq_id
-        result['to'] = to_jid 
+        result['to'] = to_jid
         error_el = result.addElement('error')
         error_el['type'] = 'cancel'
         error_el.addElement(('urn:ietf:params:xml:ns:xmpp-stanzas','bad-request'))
@@ -779,7 +779,7 @@
 
 class XEP_0065_handler(XMPPHandler):
     implements(iwokkel.IDisco)
-    
+
     def __init__(self, plugin_parent):
         self.plugin_parent = plugin_parent
         self.host = plugin_parent.host
@@ -805,7 +805,7 @@
         proxy = self.host.memory.setParam("Proxy host", streamhost_elt.getAttribute("host",""), "File Transfer", self.parent.profile)
         proxy = self.host.memory.setParam("Proxy port", streamhost_elt.getAttribute("port",""), "File Transfer", self.parent.profile)
 
-    
+
     def connectionInitialized(self):
         def after_init(ignore):
             proxy_ent = self.host.memory.getServerServiceEntity("proxy", "bytestreams", self.parent.profile)
@@ -823,7 +823,7 @@
         proxy = self.host.memory.getParamA("Proxy", "File Transfer", profile_key = self.parent.profile)
         if not proxy:
             self.parent.client_initialized.addCallback(after_init)
-            
+
 
 
     def getDiscoInfo(self, requestor, target, nodeIdentifier=''):
diff --git a/src/plugins/plugin_xep_0077.py b/src/plugins/plugin_xep_0077.py
--- a/src/plugins/plugin_xep_0077.py
+++ b/src/plugins/plugin_xep_0077.py
@@ -39,18 +39,18 @@
 }
 
 class XEP_0077():
- 
+
     def __init__(self, host):
         info(_("Plugin XEP_0077 initialization"))
         self.host = host
         self.triggers = {}  #used by other protocol (e.g. XEP-0100) to finish registration. key = target_jid
         host.bridge.addMethod("in_band_register", ".plugin", in_sign='ss', out_sign='s', method=self.in_band_register)
         host.bridge.addMethod("in_band_submit", ".plugin", in_sign='ssa(ss)s', out_sign='s', method=self.in_band_submit)
-   
+
     def addTrigger(self, target, cb, profile):
         """Add a callback which is called when registration to target is successful"""
         self.triggers[target] = (cb, profile)
-    
+
     def reg_ok(self, answer, profile):
         """Called after the first get IQ"""
         try:
@@ -62,7 +62,7 @@
             answer_type = "ERROR"
             self.host.bridge.actionResult(answer_type, answer['id'], answer_data, profile)
             return
-        
+
         form = data_form.Form.fromElement(x_elem)
         xml_data = dataForm2xml(form)
         self.host.bridge.actionResult("XMLUI", answer['id'], {"target":answer["from"], "type":"registration", "xml":xml_data}, profile)
@@ -75,13 +75,13 @@
         answer_data={"message":"%s [code: %s]" % (failure.value.condition, unicode(failure.value))}
         answer_type = "ERROR"
         self.host.bridge.actionResult(answer_type, failure.value.stanza['id'], answer_data, profile)
-   
+
     def unregistrationAnswer(self, answer, profile):
         debug (_("registration answer: %s") % answer.toXml())
         answer_type = "SUCCESS"
         answer_data={"message":_("Your are now unregistred")}
         self.host.bridge.actionResult(answer_type, answer['id'], answer_data, profile)
-        
+
     def unregistrationFailure(self, failure, profile):
         info (_("Unregistration failure: %s") % str(failure.value))
         answer_type = "ERROR"
@@ -89,7 +89,7 @@
         answer_data['reason'] = 'unknown'
         answer_data={"message":_("Unregistration failed: %s") % failure.value.condition}
         self.host.bridge.actionResult(answer_type, failure.value.stanza['id'], answer_data, profile)
-    
+
     def registrationAnswer(self, answer, profile):
         debug (_("registration answer: %s") % answer.toXml())
         answer_type = "SUCCESS"
@@ -99,7 +99,7 @@
             callback,profile = self.triggers[answer["from"]]
             callback(answer["from"], profile)
             del self.triggers[answer["from"]]
-        
+
     def registrationFailure(self, failure, profile):
         info (_("Registration failure: %s") % str(failure.value))
         print failure.value.stanza.toXml()
@@ -120,10 +120,10 @@
         id, deferred = self.host.submitForm(action, target, fields, profile)
         if action == 'CANCEL':
             deferred.addCallbacks(self.unregistrationAnswer, self.unregistrationFailure, callbackArgs=[profile], errbackArgs=[profile])
-        else:    
+        else:
             deferred.addCallbacks(self.registrationAnswer, self.registrationFailure, callbackArgs=[profile], errbackArgs=[profile])
         return id
-    
+
     def in_band_register(self, target, profile_key='@DEFAULT@'):
         """register to a target JID"""
         client = self.host.getClient(profile_key)
@@ -137,4 +137,4 @@
         reg_request["to"] = to_jid.full()
         reg_request.addElement('query', NS_REG)
         reg_request.send(to_jid.full()).addCallbacks(self.reg_ok, self.reg_err, callbackArgs=[client.profile], errbackArgs=[client.profile])
-        return reg_request["id"] 
+        return reg_request["id"]
diff --git a/src/plugins/plugin_xep_0095.py b/src/plugins/plugin_xep_0095.py
--- a/src/plugins/plugin_xep_0095.py
+++ b/src/plugins/plugin_xep_0095.py
@@ -58,9 +58,9 @@
         info(_("Plugin XEP_0095 initialization"))
         self.host = host
         self.si_profiles = {} #key: SI profile, value: callback
-    
+
     def getHandler(self, profile):
-        return XEP_0095_handler(self)  
+        return XEP_0095_handler(self)
 
     def registerSIProfile(self, si_profile, callback):
         """Add a callback for a SI Profile
@@ -107,14 +107,14 @@
         @param to_jid: recipient
         @param profile: %(doc_profile)s"""
         self.sendError(iq_id, to_jid, 400, 'cancel', profile=profile)
-    
+
     def sendFailedError(self, iq_id, to_jid, profile):
         """Helper method to send when we transfer failed
         @param iq_id: IQ id
         @param to_jid: recipient
         @param profile: %(doc_profile)s"""
         self.sendError(iq_id, to_jid, 500, 'cancel', {'custom':'failed'}, profile=profile) #as there is no error code for failed transfer, we use 500 (undefined-condition)
-    
+
     def sendError(self, iq_id, to_jid, err_code, err_type='cancel', data={}, profile='@NONE@'):
         """Send IQ error as a result
         @param iq_id: IQ id
@@ -129,7 +129,7 @@
         result = domish.Element((None, 'iq'))
         result['type'] = 'result'
         result['id'] = iq_id
-        result['to'] = to_jid 
+        result['to'] = to_jid
         error_el = result.addElement('error')
         error_el['err_code'] =  str(err_code)
         error_el['type'] = err_type
@@ -162,7 +162,7 @@
         result = domish.Element((None, 'iq'))
         result['type'] = 'result'
         result['id'] = iq_id
-        result['to'] = to_jid 
+        result['to'] = to_jid
         si = result.addElement('si', NS_SI)
         si.addChild(feature_elt)
         for elt in misc_elts:
@@ -182,9 +182,9 @@
         if not xmlstream:
             error (_('Asking for an non-existant or not connected profile'))
             return ""
-        
+
         offer = client.IQ(xmlstream,'set')
-        sid = str(uuid.uuid4()) 
+        sid = str(uuid.uuid4())
         debug (_("Stream Session ID: %s") % offer["id"])
 
         offer["from"] = current_jid.full()
@@ -200,10 +200,10 @@
         offer.send()
         return sid, offer
 
-    
+
 class XEP_0095_handler(XMPPHandler):
     implements(iwokkel.IDisco)
-    
+
     def __init__(self, plugin_parent):
         self.plugin_parent = plugin_parent
         self.host = plugin_parent.host
diff --git a/src/plugins/plugin_xep_0096.py b/src/plugins/plugin_xep_0096.py
--- a/src/plugins/plugin_xep_0096.py
+++ b/src/plugins/plugin_xep_0096.py
@@ -57,9 +57,9 @@
 
     def profileConnected(self, profile):
         client = self.host.getClient(profile)
-        client._xep_0096_waiting_for_approval = {} #key = id, value = [transfer data, IdelayedCall Reactor timeout, 
+        client._xep_0096_waiting_for_approval = {} #key = id, value = [transfer data, IdelayedCall Reactor timeout,
                                         # current stream method, [failed stream methods], profile]
-    
+
     def _kill_id(self, approval_id, profile):
         """Delete a waiting_for_approval id, called after timeout
         @param approval_id: id of _xep_0096_waiting_for_approval"""
@@ -69,7 +69,7 @@
             del client._xep_0096_waiting_for_approval[approval_id]
         except KeyError:
             warning(_("kill id called on a non existant approval id"))
-    
+
     def transferRequest(self, iq_id, from_jid, si_id, si_mime_type, si_el, profile):
         """Called when a file transfer is requested
         @param iq_id: id of the iq request
@@ -91,7 +91,7 @@
         can_range = False
         file_elts = filter(lambda elt: elt.name == 'file', si_el.elements())
         feature_elts = self.host.plugins["XEP-0020"].getFeatureElt(si_el)
-        
+
         if file_elts:
             file_el = file_elts[0]
             filename = file_el["name"]
@@ -108,7 +108,7 @@
             warning(_("No file element found"))
             self.host.plugins["XEP-0095"].sendBadRequestError(iq_id, from_jid, profile)
             return
-            
+
         if feature_elts:
             feature_el = feature_elts[0]
             form = data_form.Form.fromElement(feature_el.firstChildElement())
@@ -238,7 +238,7 @@
         if not feature_elts:
             warning(_("No feature element"))
             return
-        
+
         choosed_options = self.host.plugins["XEP-0020"].getChoosedOptions(feature_elts[0])
         try:
             stream_method = choosed_options["stream-method"]
@@ -281,9 +281,9 @@
             warning(_("Trying to send a file from an unknown profile"))
             return ""
         feature_elt = self.host.plugins["XEP-0020"].proposeFeatures({'stream-method': self.managed_stream_m})
-       
+
         file_transfer_elts = []
-        
+
         statinfo = os.stat(filepath)
         file_elt = domish.Element((PROFILE, 'file'))
         file_elt['name']=os.path.basename(filepath)
diff --git a/src/plugins/plugin_xep_0100.py b/src/plugins/plugin_xep_0100.py
--- a/src/plugins/plugin_xep_0100.py
+++ b/src/plugins/plugin_xep_0100.py
@@ -48,7 +48,7 @@
 
         if self.__gateways[request_id]['__total_items'] == self.__gateways[request_id]['__handled_items']:
             debug (_("All items checked for id [%s]") % str(request_id))
-            
+
             del self.__gateways[request_id]['__total_items']
             del self.__gateways[request_id]['__handled_items']
             self.host.actionResultExt(request_id,"DICT_DICT",self.__gateways[request_id], profile)
@@ -65,14 +65,14 @@
                 }
 
         self.__inc_handled_items(request_id, profile)
-    
+
     def discoInfoErr(self, failure, entity, request_id, profile):
         """Something is going wrong with disco"""
         failure.trap(jab_error.StanzaError,twisted.internet.error.ConnectionLost)
         error(_("Error when discovering [%(jid)s]: %(error)s") % {'jid':entity.full(), 'error':failure.getErrorMessage()})
         self.__inc_handled_items(request_id, profile)
-        
-    
+
+
     def discoItems(self, disco, request_id, target, client):
         """Look for items with disco protocol, and ask infos for each one"""
         #FIXME: target is used as we can't find the original iq node (parent is None)
@@ -100,7 +100,7 @@
         debug (_("Registration successful, doing the rest"))
         self.host.addContact(target, profile)
         self.host.setPresence(target, profile)
-    
+
     def gatewayRegister(self, action, target, fields, profile_key='@DEFAULT@'):
         """Register gateway using in-band registration, then log-in to gateway"""
         profile = self.host.memory.getProfileName(profile_key)
diff --git a/src/plugins/plugin_xep_0115.py b/src/plugins/plugin_xep_0115.py
--- a/src/plugins/plugin_xep_0115.py
+++ b/src/plugins/plugin_xep_0115.py
@@ -71,7 +71,7 @@
 
     def __str__(self):
         return "%s/%s/%s/%s" % (self.category, self.idType, self.lang, self.name)
-           
+
 
 class XEP_0115():
     cap_hash = None #capabilities hash is class variable as it is common to all profiles
@@ -83,7 +83,7 @@
         host.trigger.add("Disco Handled", self.checkHash)
         self.hash_cache = PersistentBinaryDict(NS_ENTITY_CAPABILITY) #key = hash or jid, value = features
         self.hash_cache.load()
-        self.jid_hash = {} #jid to hash mapping, map to a discoInfo features if the hash method is unknown 
+        self.jid_hash = {} #jid to hash mapping, map to a discoInfo features if the hash method is unknown
 
     def checkHash(self, profile):
         if not XEP_0115.cap_hash:
@@ -91,7 +91,7 @@
         else:
             self.presenceHack(profile)
         return True
-        
+
     def getHandler(self, profile):
         return XEP_0115_handler(self, profile)
 
@@ -127,7 +127,7 @@
         if not client:
             error ('Requesting hash for an inexistant client')
             raise HashGenerationError
-        
+
         def generateHash_2(services, profile):
             _s=[]
             byte_identities = [ByteIdentity(identity) for identity in filter(lambda x:isinstance(x,disco.DiscoIdentity),services)] #FIXME: lang must be managed here
@@ -146,12 +146,12 @@
             XEP_0115.cap_hash = b64encode(sha1(''.join(_s)).digest())
             debug(_('Capability hash generated: [%s]') % XEP_0115.cap_hash)
             self.presenceHack(profile)
-            
+
         services = client.discoHandler.info(client.jid, client.jid, '').addCallback(generateHash_2, profile)
-   
+
 class XEP_0115_handler(XMPPHandler):
     implements(iwokkel.IDisco)
-   
+
     def __init__(self, plugin_parent, profile):
         self.plugin_parent = plugin_parent
         self.host = plugin_parent.host
@@ -159,7 +159,7 @@
 
     def connectionInitialized(self):
         self.xmlstream.addObserver(CAPABILITY_UPDATE, self.update)
-    
+
     def getDiscoInfo(self, requestor, target, nodeIdentifier=''):
         return [disco.DiscoFeature(NS_ENTITY_CAPABILITY)]
 
diff --git a/src/plugins/plugin_xep_0249.py b/src/plugins/plugin_xep_0249.py
--- a/src/plugins/plugin_xep_0249.py
+++ b/src/plugins/plugin_xep_0249.py
@@ -110,7 +110,7 @@
 
 class XEP_0249_handler(XMPPHandler):
     implements(iwokkel.IDisco)
-    
+
     def __init__(self, plugin_parent):
         self.plugin_parent = plugin_parent
         self.host = plugin_parent.host
diff --git a/src/plugins/plugin_xep_0277.py b/src/plugins/plugin_xep_0277.py
--- a/src/plugins/plugin_xep_0277.py
+++ b/src/plugins/plugin_xep_0277.py
@@ -157,7 +157,7 @@
         assert(callback)
         d = self.host.plugins["XEP-0060"].getItems(jid.JID(pub_jid), NS_MICROBLOG, max_items=max_items, profile_key=profile_key)
         d.addCallback(lambda items: map(self.item2mbdata, items))
-        
+
     def setMicroblogAccess(self, access="presence", profile_key='@DEFAULT@'):
         """Create a microblog node on PEP with given access
         If the node already exists, it change options
@@ -169,7 +169,7 @@
             error(_("Can't find profile's jid"))
             return
         _options = {OPT_ACCESS_MODEL:access, OPT_PERSIST_ITEMS:1, OPT_MAX_ITEMS:-1, OPT_DELIVER_PAYLOADS:1, OPT_SEND_ITEM_SUBSCRIBE: 1}
-        
+
         def cb(result):
             #Node is created with right permission
             debug(_("Microblog node has now access %s") % access)
@@ -188,14 +188,14 @@
                 change_node_options().addCallback(cb).addErrback(fatal_err)
             else:
                 fatal_err(s_error)
-        
+
         def create_node():
             return self.host.plugins["XEP-0060"].createNode(_jid.userhostJID(), NS_MICROBLOG, _options, profile_key=profile_key)
-        
+
         def change_node_options():
             return self.host.plugins["XEP-0060"].setOptions(_jid.userhostJID(), NS_MICROBLOG, _jid.userhostJID(), _options, profile_key=profile_key)
 
         create_node().addCallback(cb).addErrback(err_cb)
 
-        
-        
+
+
diff --git a/src/sat.sh b/src/sat.sh
--- a/src/sat.sh
+++ b/src/sat.sh
@@ -58,4 +58,4 @@
 	mkdir $log_dir
 fi
 
-twistd $MAIN_OPTIONS $TAP_PATH$TAP_FILE $ADDITIONAL_OPTIONS 
+twistd $MAIN_OPTIONS $TAP_PATH$TAP_FILE $ADDITIONAL_OPTIONS
diff --git a/src/test/helpers.py b/src/test/helpers.py
--- a/src/test/helpers.py
+++ b/src/test/helpers.py
@@ -22,8 +22,8 @@
 import __builtin__
 from twisted.words.protocols.jabber.jid import JID
 
-TEST_JID_STR = u"test at example.org/SàT" 
-TEST_JID = JID(u"test at example.org/SàT") 
+TEST_JID_STR = u"test at example.org/SàT"
+TEST_JID = JID(u"test at example.org/SàT")
 TEST_PROFILE = 'test_profile'
 
 class DifferentArgsException(Exception):
@@ -35,7 +35,7 @@
     def __init__(self):
         self.bridge = FakeBridge()
         self.memory = FakeMemory()
-        self.trigger = FakeTriggerManager() 
+        self.trigger = FakeTriggerManager()
 
 
 class FakeBridge(object):
@@ -50,7 +50,7 @@
                 print "kwargs\n------\n%s (sent)\n%s (wanted)" % (kwargs, check_kwargs)
                 print "--------------------\n\n"
                 raise DifferentArgsException
-            
+
         setattr(self, name, checkCall)
 
 
@@ -62,16 +62,16 @@
 
     def addToHistory(self, from_jid, to_jid, message, _type='chat', timestamp=None, profile=None):
         pass
-    
+
     def addContact(self, contact_jid, attributes, groups, profile_key='@DEFAULT@'):
         pass
-    
+
     def setPresenceStatus(self, contact_jid, show, priority, statuses, profile_key='@DEFAULT@'):
         pass
-    
+
     def addWaitingSub(self, type, contact_jid, profile_key):
         pass
-    
+
     def delWaitingSub(self, contact_jid, profile_key):
         pass
 
@@ -79,7 +79,7 @@
 
     def add(self, point_name, callback):
         pass
-    
+
     def point(self, point_name, *args, **kwargs):
         """We always return true to continue the action"""
         return True
diff --git a/src/test/test_core_xmpp.py b/src/test/test_core_xmpp.py
--- a/src/test/test_core_xmpp.py
+++ b/src/test/test_core_xmpp.py
@@ -34,8 +34,8 @@
 
     def setUp(self):
         self.host = helpers.FakeSAT()
-        self.client = xmpp.SatXMPPClient(self.host, "test_profile", JID("test at example.org"), "test") 
-        
+        self.client = xmpp.SatXMPPClient(self.host, "test_profile", JID("test at example.org"), "test")
+
     def test_init(self):
         """Check that init values are correctly initialised"""
         self.assertEqual(self.client.profile, "test_profile")
@@ -59,7 +59,7 @@
         stanza = parseXml(xml)
         self.host.bridge.expectCall("newMessage", "sender at example.net/house", "test", "chat", u"test at example.org/SàT", profile="test_profile")
         self.message.onMessage(stanza)
-    
+
 class SatRosterProtocolTest(unittest.TestCase):
 
     def setUp(self):
@@ -99,16 +99,16 @@
     def test_subscribedReceived(self):
         self.host.bridge.expectCall("subscribe", "subscribed", helpers.TEST_JID.userhost(), helpers.TEST_PROFILE)
         self.presence.subscribedReceived(helpers.TEST_JID)
-        
+
     def test_unsubscribedReceived(self):
         self.host.bridge.expectCall("subscribe", "unsubscribed", helpers.TEST_JID.userhost(), helpers.TEST_PROFILE)
         self.presence.unsubscribedReceived(helpers.TEST_JID)
-    
+
     def test_subscribeReceived(self):
         self.host.bridge.expectCall("subscribe", "subscribe", helpers.TEST_JID.userhost(), helpers.TEST_PROFILE)
         self.presence.subscribeReceived(helpers.TEST_JID)
-        
+
     def test_unsubscribeReceived(self):
         self.host.bridge.expectCall("subscribe", "unsubscribe", helpers.TEST_JID.userhost(), helpers.TEST_PROFILE)
         self.presence.unsubscribeReceived(helpers.TEST_JID)
-    
+
diff --git a/src/tools/games.py b/src/tools/games.py
--- a/src/tools/games.py
+++ b/src/tools/games.py
@@ -23,7 +23,7 @@
 
 """This library help manage general games (e.g. card games)"""
 
-    
+
 suits_order = ['pique', 'coeur', 'trefle', 'carreau', 'atout'] #I have switched the usual order 'trefle' and 'carreau' because card are more easy to see if suit colour change (black, red, black, red)
 values_order = map(str,range(1,11))+["valet","cavalier","dame","roi"]
 
diff --git a/src/tools/xml_tools.py b/src/tools/xml_tools.py
--- a/src/tools/xml_tools.py
+++ b/src/tools/xml_tools.py
@@ -27,20 +27,20 @@
 
 """This library help manage XML used in SàT (parameters, registration, etc) """
 
-    
+
 def dataForm2xml(form):
     """Take a data form (xep-0004, Wokkel's implementation) and convert it to a SàT xml"""
-    
+
     form_ui = XMLUI("form", "vertical")
 
     if form.instructions:
         form_ui.addText('\n'.join(form.instructions), 'instructions')
-    
+
     labels = filter(lambda field:field.label,form.fieldList)
     if labels:
         #if there is no label, we don't need to use pairs
         form_ui.changeLayout("pairs")
-    
+
     for field in form.fieldList:
         if field.fieldType == 'fixed':
             __field_type = 'text'
@@ -53,14 +53,14 @@
         else:
             error (u"FIXME FIXME FIXME: Type [%s] is not managed yet by SàT" % field.fieldType)
             __field_type = "string"
-        
+
         if labels:
             if field.label:
                 form_ui.addLabel(field.label)
             else:
                 form_ui.addEmpty()
 
-        elem = form_ui.addElement(__field_type, field.var, field.value, [option.value for option in field.options]) 
+        elem = form_ui.addElement(__field_type, field.var, field.value, [option.value for option in field.options])
     return form_ui.toXml()
 
 def tupleList2dataForm(values):
@@ -104,7 +104,7 @@
 
     return param_ui.toXml()
 
-    
+
 
 
 class XMLUI:
@@ -140,8 +140,8 @@
         self.changeLayout(layout)
 
     def __del__(self):
-        self.doc.unlink() 
-    
+        self.doc.unlink()
+
     def __createLayout(self, layout, parent=None):
         """Create a layout element
         @param type: layout type (cf init doc)
@@ -182,7 +182,7 @@
     def addEmpty(self, name=None):
         """Add a multi-lines text"""
         elem = self.__createElem('empty', name, self.currentLayout)
-    
+
     def addText(self, text, name=None):
         """Add a multi-lines text"""
         elem = self.__createElem('text', name, self.currentLayout)
@@ -199,7 +199,7 @@
         elem = self.__createElem('string', name, self.currentLayout)
         if value:
             elem.setAttribute('value', value)
-    
+
     def addPassword(self, name=None, value=None):
         """Add a password box"""
         elem = self.__createElem('password', name, self.currentLayout)
@@ -211,20 +211,20 @@
         elem = self.__createElem('textbox', name, self.currentLayout)
         if value:
             elem.setAttribute('value', value)
-    
+
     def addBool(self, name=None, value="true"):
         """Add a string box"""
         assert value in ["true","false"]
         elem = self.__createElem('bool', name, self.currentLayout)
         elem.setAttribute('value', value)
-    
+
     def addList(self, options, name=None, value=None, style=set()):
         """Add a list of choices"""
         styles = set(style)
         assert (options)
-        assert (styles.issubset(['multi'])) 
+        assert (styles.issubset(['multi']))
         elem = self.__createElem('list', name, self.currentLayout)
-        self.addOptions(options, elem) 
+        self.addOptions(options, elem)
         if value:
             elem.setAttribute('value', value)
         for style in styles:
@@ -245,7 +245,7 @@
             elem.appendChild(fback_el)
 
 
-    
+
     def addElement(self, type, name = None, value = None, options = None, callback_id = None):
         """Convenience method to add element, the params correspond to the ones in addSomething methods"""
         if type == 'empty':
@@ -299,7 +299,7 @@
         self.parentTabsLayout.appendChild(cat)
 
     def toXml(self):
-        """return the XML representation of the panel""" 
+        """return the XML representation of the panel"""
         return self.doc.toxml()
 
 
@@ -325,4 +325,4 @@
         tmp = domish.Element((None, "s"))
         tmp.addRawXml(s.replace('\n','').replace('\t',''))
         parser.parse(tmp.toXml().encode('utf-8'))
-        return self.result.firstChildElement() 
+        return self.result.firstChildElement()
# HG changeset patch
# User Emmanuel Gil Peyrot <linkmauve at linkmauve.fr>
# Date 1358528135 -3600
# Node ID beaf6bec2fcdc05253ead559a606e77e91846b02
# Parent  952322b1d490665c070feef0355950b6e73ab660
Remove every old-style class.

diff --git a/frontends/sortilege_old/boxsizer.py b/frontends/sortilege_old/boxsizer.py
--- a/frontends/sortilege_old/boxsizer.py
+++ b/frontends/sortilege_old/boxsizer.py
@@ -23,7 +23,7 @@
 from window import Window
 import os,pdb
 
-class BoxSizer:
+class BoxSizer(object):
     """This class manage the position of the window like boxes."""
 
 
diff --git a/frontends/sortilege_old/window.py b/frontends/sortilege_old/window.py
--- a/frontends/sortilege_old/window.py
+++ b/frontends/sortilege_old/window.py
@@ -25,7 +25,7 @@
 import pdb
 
 
-class Window():
+class Window(object):
     def __init__(self, parent, height, width, y, x, border=False, title="", code="utf-8"):
         self.__border=border
         self.__title=title
diff --git a/frontends/src/jp/jp b/frontends/src/jp/jp
--- a/frontends/src/jp/jp
+++ b/frontends/src/jp/jp
@@ -70,7 +70,7 @@
 
 
 
-class JP():
+class JP(object):
     def __init__(self):
         try:
             self.bridge=DBusBridgeFrontend()
diff --git a/frontends/src/primitivus/notify.py b/frontends/src/primitivus/notify.py
--- a/frontends/src/primitivus/notify.py
+++ b/frontends/src/primitivus/notify.py
@@ -21,7 +21,7 @@
 
 import dbus
 
-class Notify:
+class Notify(object):
     """Used to send notification and detect if we have focus"""
 
     def __init__(self):
diff --git a/frontends/src/quick_frontend/quick_card_game.py b/frontends/src/quick_frontend/quick_card_game.py
--- a/frontends/src/quick_frontend/quick_card_game.py
+++ b/frontends/src/quick_frontend/quick_card_game.py
@@ -24,7 +24,7 @@
 
 
 
-class QuickCardGame():
+class QuickCardGame(object):
 
     def __init__(self, parent, referee, players, player_nick):
         self._autoplay = None #XXX: use 0 to activate fake play, None else
diff --git a/frontends/src/quick_frontend/quick_chat.py b/frontends/src/quick_frontend/quick_chat.py
--- a/frontends/src/quick_frontend/quick_chat.py
+++ b/frontends/src/quick_frontend/quick_chat.py
@@ -24,7 +24,7 @@
 from sat_frontends.quick_frontend.quick_utils import unescapePrivate
 
 
-class QuickChat():
+class QuickChat(object):
 
     def __init__(self, target, host, type='one2one'):
         self.target = target
diff --git a/frontends/src/quick_frontend/quick_contact_list.py b/frontends/src/quick_frontend/quick_contact_list.py
--- a/frontends/src/quick_frontend/quick_contact_list.py
+++ b/frontends/src/quick_frontend/quick_contact_list.py
@@ -22,7 +22,7 @@
 from logging import debug
 
 
-class QuickContactList():
+class QuickContactList(object):
     """This class manage the visual representation of contacts"""
 
     def __init__(self):
diff --git a/frontends/src/quick_frontend/quick_contact_management.py b/frontends/src/quick_frontend/quick_contact_management.py
--- a/frontends/src/quick_frontend/quick_contact_management.py
+++ b/frontends/src/quick_frontend/quick_contact_management.py
@@ -24,7 +24,7 @@
 import pdb
 
 
-class QuickContactManagement():
+class QuickContactManagement(object):
     """This helper class manage the contacts and ease the use of nicknames and shortcuts"""
     ### FIXME: is SàT a better place for all this stuff ??? ###
 
diff --git a/frontends/src/quick_frontend/quick_gateways.py b/frontends/src/quick_frontend/quick_gateways.py
--- a/frontends/src/quick_frontend/quick_gateways.py
+++ b/frontends/src/quick_frontend/quick_gateways.py
@@ -22,7 +22,7 @@
 
 
 
-class QuickGatewaysManager():
+class QuickGatewaysManager(object):
 
 
     def __init__(self, host, gateways, title=_("Gateways manager"), server=None):
diff --git a/frontends/src/wix/quiz_game.py b/frontends/src/wix/quiz_game.py
--- a/frontends/src/wix/quiz_game.py
+++ b/frontends/src/wix/quiz_game.py
@@ -34,7 +34,7 @@
 WIDTH = 800
 HEIGHT = 600
 
-class GraphicElement():
+class GraphicElement(object):
     """This class is used to represent a card, graphically and logically"""
 
     def __init__(self, file, x=0, y=0, zindex=10, transparent=True):
diff --git a/src/bridge/bridge_constructor/bridge_contructor.py b/src/bridge/bridge_constructor/bridge_contructor.py
--- a/src/bridge/bridge_constructor/bridge_contructor.py
+++ b/src/bridge/bridge_constructor/bridge_contructor.py
@@ -56,7 +56,7 @@
     #Used when the signature parsing is going wrong (invalid signature ?)
     pass
 
-class Constructor:
+class Constructor(object):
 
     def __init__(self, bridge_template, options):
         self.bridge_template = bridge_template
@@ -561,7 +561,7 @@
 class ConstructorError(Exception):
     pass
 
-class ConstructorFactory:
+class ConstructorFactory(object):
     def create(self, bridge_template, options):
        if options.protocole=='dbus':
            return DbusConstructor(bridge_template, options)
@@ -572,7 +572,7 @@
 
        raise ConstructorError('Unknown constructor type')
 
-class BridgeConstructor:
+class BridgeConstructor(object):
     def __init__(self):
         self.options = None
 
diff --git a/src/memory/memory.py b/src/memory/memory.py
--- a/src/memory/memory.py
+++ b/src/memory/memory.py
@@ -37,7 +37,7 @@
 SAVEFILE_DATABASE="/sat.db"
 
 
-class Params():
+class Params(object):
     """This class manage parameters with xml"""
     ### TODO: add desciption in params
 
@@ -528,7 +528,7 @@
             self.host.bridge.paramUpdate(name, value, category, profile)
             self.storage.setIndParam(category, name, value, profile)
 
-class Memory:
+class Memory(object):
     """This class manage all persistent informations"""
 
     def __init__(self, host):
diff --git a/src/memory/persistent.py b/src/memory/persistent.py
--- a/src/memory/persistent.py
+++ b/src/memory/persistent.py
@@ -24,7 +24,7 @@
 class MemoryNotInitializedError(Exception):
     pass
 
-class PersistentDict:
+class PersistentDict(object):
     """A dictionary which save persistently each value assigned
     /!\ be careful, each assignment means a database write
     /!\ Memory must be initialised before loading/setting value with instances of this class"""
diff --git a/src/memory/sqlite.py b/src/memory/sqlite.py
--- a/src/memory/sqlite.py
+++ b/src/memory/sqlite.py
@@ -27,7 +27,7 @@
 import time
 import cPickle as pickle
 
-class SqliteStorage():
+class SqliteStorage(object):
     """This class manage storage with Sqlite database"""
 
 
diff --git a/src/plugins/deprecated_misc_cs.py b/src/plugins/deprecated_misc_cs.py
--- a/src/plugins/deprecated_misc_cs.py
+++ b/src/plugins/deprecated_misc_cs.py
@@ -54,7 +54,7 @@
 
 AGENT = 'Salut à Toi XMPP/CS Plugin'
 
-class CS_Plugin():
+class CS_Plugin(object):
 
     params = """
     <params>
diff --git a/src/plugins/plugin_exp_parrot.py b/src/plugins/plugin_exp_parrot.py
--- a/src/plugins/plugin_exp_parrot.py
+++ b/src/plugins/plugin_exp_parrot.py
@@ -37,7 +37,7 @@
 "description": _("""Implementation of parrot mode (repeat messages between 2 entities)""")
 }
 
-class Exp_Parrot():
+class Exp_Parrot(object):
     """Parrot mode plugin: repeat messages from one entity or MUC room to another one"""
     #XXX: This plugin can be potentially dangerous if we don't trust entities linked
     #     this is specially true if we have other triggers.
diff --git a/src/plugins/plugin_exp_pipe.py b/src/plugins/plugin_exp_pipe.py
--- a/src/plugins/plugin_exp_pipe.py
+++ b/src/plugins/plugin_exp_pipe.py
@@ -44,7 +44,7 @@
 "description": _("""Implementation of SI Pipe Transfer""")
 }
 
-class Exp_Pipe():
+class Exp_Pipe(object):
     """This is a modified version of XEP-0096 to work with named pipes instead of files"""
 
     def __init__(self, host):
diff --git a/src/plugins/plugin_misc_account.py b/src/plugins/plugin_misc_account.py
--- a/src/plugins/plugin_misc_account.py
+++ b/src/plugins/plugin_misc_account.py
@@ -78,7 +78,7 @@
             self.deferred.errback("INTERNAL")
 
 
-class MiscAccount():
+class MiscAccount(object):
     """Account plugin: create a SàT + Prosody account, used by Libervia"""
     #XXX: This plugin is a Q&D one used for the demo. Something more generic (and not
     #     only focused on Prosody) is planed
diff --git a/src/plugins/plugin_misc_groupblog.py b/src/plugins/plugin_misc_groupblog.py
--- a/src/plugins/plugin_misc_groupblog.py
+++ b/src/plugins/plugin_misc_groupblog.py
@@ -73,7 +73,7 @@
 class UnknownType(Exception):
     pass
 
-class GroupBlog():
+class GroupBlog(object):
     """This class use a SàT PubSub Service to manage access on microblog"""
 
     def __init__(self, host):
diff --git a/src/plugins/plugin_misc_imap.py b/src/plugins/plugin_misc_imap.py
--- a/src/plugins/plugin_misc_imap.py
+++ b/src/plugins/plugin_misc_imap.py
@@ -49,7 +49,7 @@
 "description": _("""Create an Imap server that you can use to read your "normal" type messages""")
 }
 
-class IMAP_server():
+class IMAP_server(object):
     #TODO: connect profile on mailbox request, once password is accepted
 
     params = """
@@ -75,7 +75,7 @@
         self.server_factory = ImapServerFactory(self.host)
         reactor.listenTCP(port, self.server_factory)
 
-class Message():
+class Message(object):
     implements(imap4.IMessage)
 
     def __init__(self, uid, flags, mess_fp):
@@ -151,7 +151,7 @@
         return TypeError
 
 
-class SatMailbox:
+class SatMailbox(object):
     implements(imap4.IMailbox)
 
     def __init__(self,host,name,profile):
@@ -389,7 +389,7 @@
         return SatMailbox(self.host,name,self.profile)
 
 
-class ImapRealm:
+class ImapRealm(object):
     implements(portal.IRealm)
 
     def __init__(self,host):
@@ -402,7 +402,7 @@
             raise NotImplementedError
         return imap4.IAccount, ImapSatAccount(self.host,profile), lambda:None
 
-class SatProfileCredentialChecker:
+class SatProfileCredentialChecker(object):
     """
     This credential checker check against SàT's profile and associated jabber's password
     Check if the profile exists, and if the password is OK
diff --git a/src/plugins/plugin_misc_maildir.py b/src/plugins/plugin_misc_maildir.py
--- a/src/plugins/plugin_misc_maildir.py
+++ b/src/plugins/plugin_misc_maildir.py
@@ -56,7 +56,7 @@
 class MaildirError(Exception):
     pass
 
-class MaildirBox():
+class MaildirBox(object):
 
     def __init__(self, host):
         info(_("Plugin Maildir initialization"))
@@ -306,7 +306,7 @@
             pass
 
 
-class MailboxUser:
+class MailboxUser(object):
     """This class is used to access a mailbox"""
 
     def xmppMessage2mail(self, message):
diff --git a/src/plugins/plugin_misc_quiz.py b/src/plugins/plugin_misc_quiz.py
--- a/src/plugins/plugin_misc_quiz.py
+++ b/src/plugins/plugin_misc_quiz.py
@@ -57,7 +57,7 @@
 }
 
 
-class Quiz():
+class Quiz(object):
 
     def __init__(self, host):
         info(_("Plugin Quiz initialization"))
diff --git a/src/plugins/plugin_misc_radiocol.py b/src/plugins/plugin_misc_radiocol.py
--- a/src/plugins/plugin_misc_radiocol.py
+++ b/src/plugins/plugin_misc_radiocol.py
@@ -56,7 +56,7 @@
 QUEUE_LIMIT = 2
 
 
-class Radiocol():
+class Radiocol(object):
 
     def __init__(self, host):
         info(_("Radio collective initialization"))
diff --git a/src/plugins/plugin_misc_smtp.py b/src/plugins/plugin_misc_smtp.py
--- a/src/plugins/plugin_misc_smtp.py
+++ b/src/plugins/plugin_misc_smtp.py
@@ -49,7 +49,7 @@
 "description": _("""Create a SMTP server that you can use to send your "normal" type messages""")
 }
 
-class SMTP_server():
+class SMTP_server(object):
 
     params = """
     <params>
@@ -74,7 +74,7 @@
         self.server_factory = SmtpServerFactory(self.host)
         reactor.listenTCP(port, self.server_factory)
 
-class SatSmtpMessage:
+class SatSmtpMessage(object):
     implements(smtp.IMessage)
 
     def __init__(self, host, profile):
@@ -103,7 +103,7 @@
         """handle message truncated"""
         raise smtp.SMTPError
 
-class SatSmtpDelivery:
+class SatSmtpDelivery(object):
     implements(smtp.IMessageDelivery)
 
     def __init__(self, host, profile):
@@ -144,7 +144,7 @@
         """
         return origin
 
-class SmtpRealm:
+class SmtpRealm(object):
     implements(portal.IRealm)
 
     def __init__(self,host):
@@ -157,7 +157,7 @@
             raise NotImplementedError
         return smtp.IMessageDelivery, SatSmtpDelivery(self.host,profile), lambda:None
 
-class SatProfileCredentialChecker:
+class SatProfileCredentialChecker(object):
     """
     This credential checker check against SàT's profile and associated jabber's password
     Check if the profile exists, and if the password is OK
diff --git a/src/plugins/plugin_misc_tarot.py b/src/plugins/plugin_misc_tarot.py
--- a/src/plugins/plugin_misc_tarot.py
+++ b/src/plugins/plugin_misc_tarot.py
@@ -54,7 +54,7 @@
 }
 
 
-class Tarot():
+class Tarot(object):
 
     def __init__(self, host):
         info(_("Plugin Tarot initialization"))
diff --git a/src/plugins/plugin_misc_text_commands.py b/src/plugins/plugin_misc_text_commands.py
--- a/src/plugins/plugin_misc_text_commands.py
+++ b/src/plugins/plugin_misc_text_commands.py
@@ -33,7 +33,7 @@
 "description": _("""IRC like text commands""")
 }
 
-class TextCommands():
+class TextCommands(object):
     #FIXME: doc strings for commands have to be translatable
     #       plugins need a dynamic translation system (translation
     #       should be downloadable independently)
diff --git a/src/plugins/plugin_misc_xmllog.py b/src/plugins/plugin_misc_xmllog.py
--- a/src/plugins/plugin_misc_xmllog.py
+++ b/src/plugins/plugin_misc_xmllog.py
@@ -52,7 +52,7 @@
         return XmlStream.dataReceived(self, data)
 
 
-class XmlLog():
+class XmlLog(object):
 
     params = """
     <params>
diff --git a/src/plugins/plugin_xep_0020.py b/src/plugins/plugin_xep_0020.py
--- a/src/plugins/plugin_xep_0020.py
+++ b/src/plugins/plugin_xep_0020.py
@@ -44,7 +44,7 @@
 "description": _("""Implementation of Feature Negotiation""")
 }
 
-class XEP_0020():
+class XEP_0020(object):
 
     def __init__(self, host):
         info(_("Plugin XEP_0020 initialization"))
diff --git a/src/plugins/plugin_xep_0045.py b/src/plugins/plugin_xep_0045.py
--- a/src/plugins/plugin_xep_0045.py
+++ b/src/plugins/plugin_xep_0045.py
@@ -49,7 +49,7 @@
 class UnknownRoom(Exception):
     pass
 
-class XEP_0045():
+class XEP_0045(object):
 
     def __init__(self, host):
         info(_("Plugin XEP_0045 initialization"))
diff --git a/src/plugins/plugin_xep_0047.py b/src/plugins/plugin_xep_0047.py
--- a/src/plugins/plugin_xep_0047.py
+++ b/src/plugins/plugin_xep_0047.py
@@ -57,7 +57,7 @@
 "description": _("""Implementation of In-Band Bytestreams""")
 }
 
-class XEP_0047():
+class XEP_0047(object):
     NAMESPACE = NS_IBB
 
     def __init__(self, host):
diff --git a/src/plugins/plugin_xep_0054.py b/src/plugins/plugin_xep_0054.py
--- a/src/plugins/plugin_xep_0054.py
+++ b/src/plugins/plugin_xep_0054.py
@@ -64,7 +64,7 @@
 "description": _("""Implementation of vcard-temp""")
 }
 
-class XEP_0054():
+class XEP_0054(object):
     #TODO: - check that nickname is ok
     #      - refactor the code/better use of Wokkel
     #      - get missing values
diff --git a/src/plugins/plugin_xep_0060.py b/src/plugins/plugin_xep_0060.py
--- a/src/plugins/plugin_xep_0060.py
+++ b/src/plugins/plugin_xep_0060.py
@@ -40,7 +40,7 @@
 "description": _("""Implementation of PubSub Protocol""")
 }
 
-class XEP_0060():
+class XEP_0060(object):
 
     def __init__(self, host):
         info(_("PubSub plugin initialization"))
diff --git a/src/plugins/plugin_xep_0065.py b/src/plugins/plugin_xep_0065.py
--- a/src/plugins/plugin_xep_0065.py
+++ b/src/plugins/plugin_xep_0065.py
@@ -439,7 +439,7 @@
         self.finishedCb(self.sid, reason.type == jab_error.ConnectionDone, self.profile) #TODO: really check if the state is actually successful
 
 
-class XEP_0065():
+class XEP_0065(object):
 
     NAMESPACE = NS_BS
 
diff --git a/src/plugins/plugin_xep_0077.py b/src/plugins/plugin_xep_0077.py
--- a/src/plugins/plugin_xep_0077.py
+++ b/src/plugins/plugin_xep_0077.py
@@ -38,7 +38,7 @@
 "description": _("""Implementation of in-band registration""")
 }
 
-class XEP_0077():
+class XEP_0077(object):
 
     def __init__(self, host):
         info(_("Plugin XEP_0077 initialization"))
diff --git a/src/plugins/plugin_xep_0095.py b/src/plugins/plugin_xep_0095.py
--- a/src/plugins/plugin_xep_0095.py
+++ b/src/plugins/plugin_xep_0095.py
@@ -52,7 +52,7 @@
 "description": _("""Implementation of Stream Initiation""")
 }
 
-class XEP_0095():
+class XEP_0095(object):
 
     def __init__(self, host):
         info(_("Plugin XEP_0095 initialization"))
diff --git a/src/plugins/plugin_xep_0096.py b/src/plugins/plugin_xep_0096.py
--- a/src/plugins/plugin_xep_0096.py
+++ b/src/plugins/plugin_xep_0096.py
@@ -45,7 +45,7 @@
 "description": _("""Implementation of SI File Transfer""")
 }
 
-class XEP_0096():
+class XEP_0096(object):
 
     def __init__(self, host):
         info(_("Plugin XEP_0096 initialization"))
diff --git a/src/plugins/plugin_xep_0100.py b/src/plugins/plugin_xep_0100.py
--- a/src/plugins/plugin_xep_0100.py
+++ b/src/plugins/plugin_xep_0100.py
@@ -34,7 +34,7 @@
 "description": _("""Implementation of Gateways protocol""")
 }
 
-class XEP_0100():
+class XEP_0100(object):
 
     def __init__(self, host):
         info(_("Gateways plugin initialization"))
diff --git a/src/plugins/plugin_xep_0115.py b/src/plugins/plugin_xep_0115.py
--- a/src/plugins/plugin_xep_0115.py
+++ b/src/plugins/plugin_xep_0115.py
@@ -73,7 +73,7 @@
         return "%s/%s/%s/%s" % (self.category, self.idType, self.lang, self.name)
 
 
-class XEP_0115():
+class XEP_0115(object):
     cap_hash = None #capabilities hash is class variable as it is common to all profiles
     #TODO: this code is really dirty, need to clean it and try to move it to Wokkel
 
diff --git a/src/plugins/plugin_xep_0163.py b/src/plugins/plugin_xep_0163.py
--- a/src/plugins/plugin_xep_0163.py
+++ b/src/plugins/plugin_xep_0163.py
@@ -42,7 +42,7 @@
 "description": _("""Implementation of Personal Eventing Protocol""")
 }
 
-class XEP_0163():
+class XEP_0163(object):
 
     def __init__(self, host):
         info(_("PEP plugin initialization"))
diff --git a/src/plugins/plugin_xep_0249.py b/src/plugins/plugin_xep_0249.py
--- a/src/plugins/plugin_xep_0249.py
+++ b/src/plugins/plugin_xep_0249.py
@@ -49,7 +49,7 @@
 "description": _("""Implementation of Direct MUC Invitations""")
 }
 
-class XEP_0249():
+class XEP_0249(object):
 
     def __init__(self, host):
         info(_("Plugin XEP_0249 initialization"))
diff --git a/src/plugins/plugin_xep_0277.py b/src/plugins/plugin_xep_0277.py
--- a/src/plugins/plugin_xep_0277.py
+++ b/src/plugins/plugin_xep_0277.py
@@ -53,7 +53,7 @@
 class NodeAccessChangeException(Exception):
     pass
 
-class XEP_0277():
+class XEP_0277(object):
 
     def __init__(self, host):
         info(_("Microblogging plugin initialization"))
diff --git a/src/tools/games.py b/src/tools/games.py
--- a/src/tools/games.py
+++ b/src/tools/games.py
@@ -27,7 +27,7 @@
 suits_order = ['pique', 'coeur', 'trefle', 'carreau', 'atout'] #I have switched the usual order 'trefle' and 'carreau' because card are more easy to see if suit colour change (black, red, black, red)
 values_order = map(str,range(1,11))+["valet","cavalier","dame","roi"]
 
-class TarotCard():
+class TarotCard(object):
     """This class is used to represent a car logically"""
     #TODO: move this in a library in tools, and share this with frontends (e.g. card_game in wix use the same class)
 
diff --git a/src/tools/misc.py b/src/tools/misc.py
--- a/src/tools/misc.py
+++ b/src/tools/misc.py
@@ -31,7 +31,7 @@
         followind triggers list """
     pass
 
-class TriggerManager:
+class TriggerManager(object):
     """This class manage triggers: code which interact to change de behaviour of SàT"""
 
     def __init__(self):
diff --git a/src/tools/xml_tools.py b/src/tools/xml_tools.py
--- a/src/tools/xml_tools.py
+++ b/src/tools/xml_tools.py
@@ -107,7 +107,7 @@
 
 
 
-class XMLUI:
+class XMLUI(object):
     """This class is used to create a user interface (form/window/parameters/etc) using SàT XML"""
 
     def __init__(self, panel_type, layout="vertical", title=None):
# HG changeset patch
# User Emmanuel Gil Peyrot <linkmauve at linkmauve.fr>
# Date 1358528135 -3600
# Node ID d1b4805124a12e6887d3a9b58afd88690f1ebee3
# Parent  beaf6bec2fcdc05253ead559a606e77e91846b02
Fix pep8 support in src/core.

diff --git a/src/core/default_config.py b/src/core/default_config.py
--- a/src/core/default_config.py
+++ b/src/core/default_config.py
@@ -20,9 +20,9 @@
 """
 
 CONST = {
-    'client_name' : u'SàT (Salut à toi)',
-    'client_version' : u'0.3.0',   #Please add 'D' at the end for dev versions
-    'local_dir' : '~/.sat'
+    'client_name': u'SàT (Salut à toi)',
+    'client_version': u'0.3.0',  # Please add 'D' at the end for dev versions
+    'local_dir': '~/.sat'
 }
 
 ### Defaut configuration values ###
diff --git a/src/core/exceptions.py b/src/core/exceptions.py
--- a/src/core/exceptions.py
+++ b/src/core/exceptions.py
@@ -19,23 +19,30 @@
 along with this program.  If not, see <http://www.gnu.org/licenses/>.
 """
 
+
 class ProfileUnknownError(Exception):
     pass
 
+
 class ProfileNotInCacheError(Exception):
     pass
 
+
 class NotConnectedProfileError(Exception):
     pass
 
+
 class UnknownEntityError(Exception):
     pass
 
+
 class UnknownGroupError(Exception):
     pass
 
+
 class NotFound(Exception):
     pass
 
+
 class DataError(Exception):
     pass
diff --git a/src/core/sat_main.py b/src/core/sat_main.py
--- a/src/core/sat_main.py
+++ b/src/core/sat_main.py
@@ -50,19 +50,19 @@
 except ImportError:
     from wokkel.subprotocols import XMPPHandler
 
-
 ### logging configuration FIXME: put this elsewhere ###
 logging.basicConfig(level=logging.DEBUG,
                     format='%(message)s')
 ###
 
+sat_id = 0
 
-sat_id = 0
 
 def sat_next_id():
     global sat_id
-    sat_id+=1
-    return "sat_id_"+str(sat_id)
+    sat_id += 1
+    return "sat_id_" + str(sat_id)
+
 
 class SAT(service.Service):
 
@@ -74,18 +74,18 @@
         try:
             _const = os.environ['SAT_CONST_%s' % name]
             if _const:
-                debug(_("Constant %(name)s overrided with [%(value)s]") % {'name':name, 'value': _const})
+                debug(_("Constant %(name)s overrided with [%(value)s]") % {'name': name, 'value': _const})
                 return _const
         except KeyError:
             pass
-        if not CONST.has_key(name):
+        if name not in CONST:
             error(_('Trying to access an undefined constant'))
             raise Exception
         return CONST[name]
 
     def set_const(self, name, value):
         """Save a constant"""
-        if CONST.has_key(name):
+        if name in CONST:
             error(_('Trying to redefine a constant'))
             raise Exception
         CONST[name] = value
@@ -93,21 +93,21 @@
     def __init__(self):
         #TODO: standardize callback system
 
-        self.__general_cb_map = {}  #callback called for general reasons (key = name)
-        self.__private_data = {}  #used for internal callbacks (key = id)
+        self.__general_cb_map = {}  # callback called for general reasons (key = name)
+        self.__private_data = {}  # used for internal callbacks (key = id)
         self.profiles = {}
         self.plugins = {}
-        self.menus = {} #used to know which new menus are wanted by plugins
+        self.menus = {}  # used to know which new menus are wanted by plugins
 
-        self.memory=Memory(self)
+        self.memory = Memory(self)
 
         local_dir = self.memory.getConfig('', 'local_dir')
         if not os.path.exists(local_dir):
             os.makedirs(local_dir)
 
-        self.trigger = TriggerManager() #trigger are used to change SàT behaviour
+        self.trigger = TriggerManager()  # trigger are used to change SàT behaviour
 
-        self.bridge=DBusBridge()
+        self.bridge = DBusBridge()
         self.bridge.register("getVersion", lambda: self.get_const('client_version'))
         self.bridge.register("getProfileName", self.memory.getProfileName)
         self.bridge.register("getProfilesList", self.memory.getProfilesList)
@@ -155,15 +155,14 @@
         info(_("Memory initialised"))
         self._import_plugins()
 
-
     def _import_plugins(self):
         """Import all plugins found in plugins directory"""
         import sat.plugins
         plugins_path = os.path.dirname(sat.plugins.__file__)
-        plug_lst = [os.path.splitext(plugin)[0] for plugin in map(os.path.basename,glob(os.path.join(plugins_path,"plugin*.py")))]
-        __plugins_to_import = {} #plugins we still have to import
+        plug_lst = [os.path.splitext(plugin)[0] for plugin in map(os.path.basename, glob(os.path.join(plugins_path, "plugin*.py")))]
+        __plugins_to_import = {}  # plugins we still have to import
         for plug in plug_lst:
-            plugin_path = 'sat.plugins.'+plug
+            plugin_path = 'sat.plugins.' + plug
             __import__(plugin_path)
             mod = sys.modules[plugin_path]
             plugin_info = mod.PLUGIN_INFO
@@ -176,58 +175,58 @@
     def _import_plugins_from_dict(self, plugins_to_import, import_name=None):
         """Recursively import and their dependencies in the right order
         @param plugins_to_import: dict where key=import_name and values= (plugin_path, module, plugin_info)"""
-        if self.plugins.has_key(import_name):
+        if import_name in self.plugins:
             debug('Plugin [%s] already imported, passing' % import_name)
             return
         if not import_name:
-            import_name,(plugin_path, mod, plugin_info) = plugins_to_import.popitem()
+            import_name, (plugin_path, mod, plugin_info) = plugins_to_import.popitem()
         else:
             if not import_name in plugins_to_import:
                 raise ImportError(_('Dependency plugin not found: [%s]') % import_name)
             plugin_path, mod, plugin_info = plugins_to_import.pop(import_name)
-        dependencies = plugin_info.setdefault("dependencies",[])
+        dependencies = plugin_info.setdefault("dependencies", [])
         for dependency in dependencies:
-            if not self.plugins.has_key(dependency):
+            if dependency not in self.plugins:
                 debug('Recursively import dependency of [%s]: [%s]' % (import_name, dependency))
                 self._import_plugins_from_dict(plugins_to_import, dependency)
-        info (_("importing plugin: %s"), plugin_info['name'])
+        info(_("importing plugin: %s"), plugin_info['name'])
         self.plugins[import_name] = getattr(mod, plugin_info['main'])(self)
-        if plugin_info.has_key('handler') and plugin_info['handler'] == 'yes':
+        if 'handler' in plugin_info and plugin_info['handler'] == 'yes':
             self.plugins[import_name].is_handler = True
         else:
             self.plugins[import_name].is_handler = False
         #TODO: test xmppclient presence and register handler parent
 
-
-    def connect(self, profile_key = '@DEFAULT@'):
+    def connect(self, profile_key='@DEFAULT@'):
         """Connect to jabber server"""
         self.asyncConnect(profile_key)
 
-    def asyncConnect(self, profile_key = '@DEFAULT@'):
+    def asyncConnect(self, profile_key='@DEFAULT@'):
         """Connect to jabber server with asynchronous reply
         @param profile_key: %(doc_profile)s
         """
 
         profile = self.memory.getProfileName(profile_key)
         if not profile:
-            error (_('Trying to connect a non-exsitant profile'))
+            error(_('Trying to connect a non-exsitant profile'))
             raise ProfileUnknownError(profile_key)
 
-        if (self.isConnected(profile)):
+        if self.isConnected(profile):
             info(_("already connected !"))
             return defer.succeed("None")
 
         def afterMemoryInit(ignore):
             """This part must be called when we have loaded individual parameters from memory"""
             try:
-                port = int(self.memory.getParamA("Port", "Connection", profile_key = profile))
+                port = int(self.memory.getParamA("Port", "Connection", profile_key=profile))
             except ValueError:
                 error(_("Can't parse port value, using default value"))
                 port = 5222
-            current = self.profiles[profile] = xmpp.SatXMPPClient(self, profile,
-                jid.JID(self.memory.getParamA("JabberID", "Connection", profile_key = profile), profile),
-                self.memory.getParamA("Password", "Connection", profile_key = profile),
-                self.memory.getParamA("Server", "Connection", profile_key = profile),
+            current = self.profiles[profile] = xmpp.SatXMPPClient(
+                self, profile,
+                jid.JID(self.memory.getParamA("JabberID", "Connection", profile_key=profile), profile),
+                self.memory.getParamA("Password", "Connection", profile_key=profile),
+                self.memory.getParamA("Server", "Connection", profile_key=profile),
                 port)
 
             current.messageProt = xmpp.SatMessageProtocol(self)
@@ -243,10 +242,10 @@
             current.fallBack.setHandlerParent(current)
 
             current.versionHandler = xmpp.SatVersionHandler(self.get_const('client_name'),
-                                                         self.get_const('client_version'))
+                                                            self.get_const('client_version'))
             current.versionHandler.setHandlerParent(current)
 
-            debug (_("setting plugins parents"))
+            debug(_("setting plugins parents"))
 
             for plugin in self.plugins.iteritems():
                 if plugin[1].is_handler:
@@ -258,7 +257,7 @@
             current.startService()
 
             d = current.getConnectionDeferred()
-            d.addCallback(lambda x: current.roster.got_roster) #we want to be sure that we got the roster
+            d.addCallback(lambda x: current.roster.got_roster)  # we want to be sure that we got the roster
             return d
 
         self.memory.startProfileSession(profile)
@@ -266,7 +265,7 @@
 
     def disconnect(self, profile_key):
         """disconnect from jabber server"""
-        if (not self.isConnected(profile_key)):
+        if not self.isConnected(profile_key):
             info(_("not connected !"))
             return
         profile = self.memory.getProfileName(profile_key)
@@ -282,8 +281,8 @@
         if not client:
             raise ProfileUnknownError(_('Asking contacts for a non-existant profile'))
         ret = []
-        for item in client.roster.getItems(): #we get all items for client's roster
-            #and convert them to expected format
+        for item in client.roster.getItems():  # we get all items for client's roster
+            # and convert them to expected format
             attr = client.roster.getAttributes(item)
             ret.append([item.jid.userhost(), attr, item.groups])
         return ret
@@ -338,12 +337,12 @@
             return None
         return self.profiles[profile]
 
-    def registerNewAccount(self, login, password, email, server, port = 5222, id = None, profile_key = '@DEFAULT@'):
+    def registerNewAccount(self, login, password, email, server, port=5222, id=None, profile_key='@DEFAULT@'):
         """Connect to a server and create a new account using in-band registration"""
         profile = self.memory.getProfileName(profile_key)
         assert(profile)
 
-        next_id = id or sat_next_id()  #the id is used to send server's answer
+        next_id = id or sat_next_id()  # the id is used to send server's answer
         serverRegistrer = xmlstream.XmlStreamFactory(xmpp.RegisteringAuthenticator(self, server, login, password, email, next_id, profile))
         connector = reactor.connectTCP(server, port, serverRegistrer)
         serverRegistrer.clientConnectionLost = lambda conn, reason: connector.disconnect()
@@ -356,24 +355,25 @@
         server = self.memory.getParamA("Server", "Connection", profile_key=profile)
 
         if not user or not password or not server:
-            info (_('No user or server given'))
+            info(_('No user or server given'))
             #TODO: a proper error message must be sent to frontend
-            self.actionResult(id, "ERROR", {'message':_("No user, password or server given, can't register new account.")}, profile)
+            self.actionResult(id, "ERROR", {'message': _("No user, password or server given, can't register new account.")}, profile)
             return
 
         confirm_id = sat_next_id()
-        self.__private_data[confirm_id]=(id,profile)
+        self.__private_data[confirm_id] = (id, profile)
 
-        self.askConfirmation(confirm_id, "YES/NO",
-            {"message":_("Are you sure to register new account [%(user)s] to server %(server)s ?") % {'user':user, 'server':server, 'profile':profile}},
+        self.askConfirmation(
+            confirm_id, "YES/NO",
+            {"message": _("Are you sure to register new account [%(user)s] to server %(server)s ?") % {'user': user, 'server': server, 'profile': profile}},
             self.regisConfirmCB, profile)
-        print ("===============+++++++++++ REGISTER NEW ACCOUNT++++++++++++++============")
-        print "id=",id
-        print "data=",data
+        print "===============+++++++++++ REGISTER NEW ACCOUNT++++++++++++++============"
+        print "id=", id
+        print "data=", data
 
     def regisConfirmCB(self, id, accepted, data, profile):
         print _("register Confirmation CB ! (%s)") % str(accepted)
-        action_id,profile = self.__private_data[id]
+        action_id, profile = self.__private_data[id]
         del self.__private_data[id]
         if accepted:
             user = jid.parse(self.memory.getParamA("JabberID", "Connection", profile_key=profile))[0]
@@ -398,13 +398,13 @@
         iq["to"] = target
         iq["from"] = self.profiles[profile].jid.full()
         query = iq.addElement(('jabber:iq:register', 'query'))
-        if action=='SUBMIT':
+        if action == 'SUBMIT':
             form = tupleList2dataForm(fields)
             query.addChild(form.toElement())
-        elif action=='CANCEL':
+        elif action == 'CANCEL':
             query.addElement('remove')
         else:
-            error (_("FIXME FIXME FIXME: Unmanaged action (%s) in submitForm") % action)
+            error(_("FIXME FIXME FIXME: Unmanaged action (%s) in submitForm") % action)
             raise NotImplementedError
 
         deferred = iq.send(target)
@@ -414,7 +414,7 @@
 
     def setParam(self, name, value, category, profile_key):
         """set wanted paramater and notice observers"""
-        info (_("setting param: %(name)s=%(value)s in category %(category)s") % {'name':name, 'value':value, 'category':category})
+        info(_("setting param: %(name)s=%(value)s in category %(category)s") % {'name': name, 'value': value, 'category': category})
         self.memory.setParam(name, value, category, profile_key)
 
     def isConnected(self, profile_key):
@@ -424,9 +424,9 @@
         """
         profile = self.memory.getProfileName(profile_key)
         if not profile:
-            error (_('asking connection status for a non-existant profile'))
+            error(_('asking connection status for a non-existant profile'))
             return
-        if not self.profiles.has_key(profile):
+        if profile not in self.profiles:
             return False
         return self.profiles[profile].isConnected()
 
@@ -439,22 +439,21 @@
         """
         profile = self.memory.getProfileName(profile_key)
         if not profile:
-            error (_('trying to launch action with a non-existant profile'))
-            raise Exception  #TODO: raise a proper exception
-        if type=="button":
+            error(_('trying to launch action with a non-existant profile'))
+            raise Exception  # TODO: raise a proper exception
+        if type == "button":
             try:
                 cb_name = data['callback_id']
             except KeyError:
-                error (_("Incomplete data"))
+                error(_("Incomplete data"))
                 return ""
             id = sat_next_id()
-            self.callGeneralCB(cb_name, id, data, profile = profile)
+            self.callGeneralCB(cb_name, id, data, profile=profile)
             return id
         else:
-            error (_("Unknown action type"))
+            error(_("Unknown action type"))
             return ""
 
-
     ## jabber methods ##
 
     def getWaitingConf(self, profile_key=None):
@@ -474,19 +473,19 @@
         assert(profile)
         client = self.profiles[profile]
         current_jid = client.jid
-        mess_data = { #we put data in a dict, so trigger methods can change them
-                      "to": jid.JID(to),
-                      "message": msg,
-                      "subject": subject,
-                      "type": mess_type
-                    }
+        mess_data = {  # we put data in a dict, so trigger methods can change them
+            "to": jid.JID(to),
+            "message": msg,
+            "subject": subject,
+            "type": mess_type
+        }
 
         if mess_data["type"] == "auto":
             # we try to guess the type
             if mess_data["subject"]:
                 mess_data["type"] = 'normal'
-            elif not mess_data["to"].resource: #if to JID has a resource, the type is not 'groupchat'
-                #we may have a groupchat message, we check if the we know this jid
+            elif not mess_data["to"].resource:  # if to JID has a resource, the type is not 'groupchat'
+                # we may have a groupchat message, we check if the we know this jid
                 try:
                     entity_type = self.memory.getEntityData(mess_data["to"], ['type'], profile)["type"]
                     #FIXME: should entity_type manage ressources ?
@@ -505,7 +504,7 @@
             return
 
         debug(_("Sending jabber message of type [%(type)s] to %(to)s...") % {"type": mess_data["type"], "to": to})
-        message = domish.Element((None,'message'))
+        message = domish.Element((None, 'message'))
         message["to"] = mess_data["to"].full()
         message["from"] = current_jid.full()
         message["type"] = mess_data["type"]
@@ -513,25 +512,23 @@
             message.addElement("subject", None, subject)
         message.addElement("body", None, mess_data["message"])
         client.xmlstream.send(message)
-        if mess_data["type"]!="groupchat":
-            self.memory.addToHistory(current_jid, jid.JID(to), unicode(mess_data["message"]), unicode(mess_data["type"]), profile=profile) #we don't add groupchat message to history, as we get them back
-                                                                                              #and they will be added then
-            self.bridge.newMessage(message['from'], unicode(mess_data["message"]), mess_type=mess_data["type"], to_jid=message['to'], extra={}, profile=profile) #We send back the message, so all clients are aware of it
+        if mess_data["type"] != "groupchat":
+            self.memory.addToHistory(current_jid, jid.JID(to), unicode(mess_data["message"]), unicode(mess_data["type"]), profile=profile)  # we don't add groupchat message to history, as we get them back
+                                                                                              # and they will be added then
+            self.bridge.newMessage(message['from'], unicode(mess_data["message"]), mess_type=mess_data["type"], to_jid=message['to'], extra={}, profile=profile)  # We send back the message, so all clients are aware of it
 
-
-    def setPresence(self, to="", show="", priority = 0, statuses={}, profile_key='@DEFAULT@'):
+    def setPresence(self, to="", show="", priority=0, statuses={}, profile_key='@DEFAULT@'):
         """Send our presence information"""
         profile = self.memory.getProfileName(profile_key)
         assert(profile)
         to_jid = jid.JID(to) if to else None
         self.profiles[profile].presence.available(to_jid, show, statuses, priority)
         #XXX: FIXME: temporary fix to work around openfire 3.7.0 bug (presence is not broadcasted to generating resource)
-        if statuses.has_key(''):
+        if '' in statuses:
             statuses['default'] = statuses['']
             del statuses['']
-        self.bridge.presenceUpdate(self.profiles[profile].jid.full(),  show,
-                int(priority), statuses, profile)
-
+        self.bridge.presenceUpdate(self.profiles[profile].jid.full(), show,
+                                   int(priority), statuses, profile)
 
     def subscription(self, subs_type, raw_jid, profile_key):
         """Called to manage subscription
@@ -541,22 +538,22 @@
         profile = self.memory.getProfileName(profile_key)
         assert(profile)
         to_jid = jid.JID(raw_jid)
-        debug (_('subsciption request [%(subs_type)s] for %(jid)s') % {'subs_type':subs_type, 'jid':to_jid.full()})
-        if subs_type=="subscribe":
+        debug(_('subsciption request [%(subs_type)s] for %(jid)s') % {'subs_type': subs_type, 'jid': to_jid.full()})
+        if subs_type == "subscribe":
             self.profiles[profile].presence.subscribe(to_jid)
-        elif subs_type=="subscribed":
+        elif subs_type == "subscribed":
             self.profiles[profile].presence.subscribed(to_jid)
-        elif subs_type=="unsubscribe":
+        elif subs_type == "unsubscribe":
             self.profiles[profile].presence.unsubscribe(to_jid)
-        elif subs_type=="unsubscribed":
+        elif subs_type == "unsubscribed":
             self.profiles[profile].presence.unsubscribed(to_jid)
 
     def addContact(self, to, profile_key):
         """Add a contact in roster list"""
         profile = self.memory.getProfileName(profile_key)
         assert(profile)
-        to_jid=jid.JID(to)
-        #self.profiles[profile].roster.addItem(to_jid) XXX: disabled (cf http://wokkel.ik.nu/ticket/56))
+        to_jid = jid.JID(to)
+        #self.profiles[profile].roster.addItem(to_jid)  #XXX: disabled (cf http://wokkel.ik.nu/ticket/56))
         self.profiles[profile].presence.subscribe(to_jid)
 
     def updateContact(self, to, name, groups, profile_key):
@@ -574,20 +571,19 @@
         """Remove contact from roster list"""
         profile = self.memory.getProfileName(profile_key)
         assert(profile)
-        to_jid=jid.JID(to)
+        to_jid = jid.JID(to)
         self.profiles[profile].roster.removeItem(to_jid)
         self.profiles[profile].presence.unsubscribe(to_jid)
 
-
     ## callbacks ##
 
     def serverDisco(self, disco, profile):
         """xep-0030 Discovery Protocol."""
         for feature in disco.features:
-            debug (_("Feature found: %s"),feature)
+            debug(_("Feature found: %s"), feature)
             self.memory.addServerFeature(feature, profile)
         for cat, type in disco.identities:
-            debug (_("Identity found: [%(category)s/%(type)s] %(identity)s") % {'category':cat, 'type':type, 'identity':disco.identities[(cat,type)]})
+            debug(_("Identity found: [%(category)s/%(type)s] %(identity)s") % {'category': cat, 'type': type, 'identity': disco.identities[(cat, type)]})
 
     def serverDiscoItems(self, disco_result, disco_client, profile, initialized):
         """xep-0030 Discovery Protocol.
@@ -598,23 +594,21 @@
 
         def _check_entity_cb(result, entity, profile):
             for category, type in result.identities:
-                debug (_('Identity added: (%(category)s,%(type)s) ==> %(entity)s [%(profile)s]') % {
-                         'category':category, 'type':type, 'entity':entity, 'profile':profile})
+                debug(_('Identity added: (%(category)s,%(type)s) ==> %(entity)s [%(profile)s]') % {
+                    'category': category, 'type': type, 'entity': entity, 'profile': profile})
                 self.memory.addServerIdentity(category, type, entity, profile)
 
         def _errback(result, entity, profile):
-            warning(_("Can't get information on identity [%(entity)s] for profile [%(profile)s]") % {'entity':entity, 'profile': profile})
+            warning(_("Can't get information on identity [%(entity)s] for profile [%(profile)s]") % {'entity': entity, 'profile': profile})
 
         defer_list = []
         for item in disco_result._items:
-            if item.entity.full().count('.') == 1: #XXX: workaround for a bug on jabberfr, tmp
+            if item.entity.full().count('.') == 1:  # XXX: workaround for a bug on jabberfr, tmp
                 warning(_('Using jabberfr workaround, be sure your domain has at least two levels (e.g. "example.tld", not "example" alone)'))
                 continue
             args = [item.entity, profile]
             defer_list.append(disco_client.requestInfo(item.entity).addCallbacks(_check_entity_cb, _errback, args, None, args))
         defer.DeferredList(defer_list).chainDeferred(initialized)
-
-
     ## Generic HMI ##
 
     def actionResult(self, action_id, action_type, data, profile):
@@ -636,8 +630,6 @@
             action_type = "DICT_DICT"
         self.bridge.actionResultExt(action_type, action_id, data, profile)
 
-
-
     def askConfirmation(self, conf_id, conf_type, data, cb, profile):
         """Add a confirmation callback
         @param conf_id: conf_id used to get answer
@@ -648,21 +640,20 @@
         client = self.getClient(profile)
         if not client:
             raise ProfileUnknownError(_("Asking confirmation a non-existant profile"))
-        if client._waiting_conf.has_key(conf_id):
-            error (_("Attempt to register two callbacks for the same confirmation"))
+        if conf_id in client._waiting_conf:
+            error(_("Attempt to register two callbacks for the same confirmation"))
         else:
             client._waiting_conf[conf_id] = (conf_type, data, cb)
             self.bridge.askConfirmation(conf_id, conf_type, data, profile)
 
-
     def confirmationAnswer(self, conf_id, accepted, data, profile):
         """Called by frontends to answer confirmation requests"""
         client = self.getClient(profile)
         if not client:
             raise ProfileUnknownError(_("Confirmation answer from a non-existant profile"))
-        debug (_("Received confirmation answer for conf_id [%(conf_id)s]: %(success)s") % {'conf_id': conf_id, 'success':_("accepted") if accepted else _("refused")})
-        if not client._waiting_conf.has_key(conf_id):
-            error (_("Received an unknown confirmation (%(id)s for %(profile)s)") % {'id': conf_id, 'profile': profile})
+        debug(_("Received confirmation answer for conf_id [%(conf_id)s]: %(success)s") % {'conf_id': conf_id, 'success': _("accepted") if accepted else _("refused")})
+        if conf_id not in client._waiting_conf:
+            error(_("Received an unknown confirmation (%(id)s for %(profile)s)") % {'id': conf_id, 'profile': profile})
         else:
             cb = client._waiting_conf[conf_id][-1]
             del client._waiting_conf[conf_id]
@@ -680,8 +671,8 @@
         client = self.getClient(profile)
         if not client:
             raise ProfileUnknownError
-        if not client._progress_cb_map.has_key(progress_id):
-            error (_("Trying to remove an unknow progress callback"))
+        if progress_id not in client._progress_cb_map:
+            error(_("Trying to remove an unknow progress callback"))
         else:
             del client._progress_cb_map[progress_id]
 
@@ -707,8 +698,8 @@
 
     def removeGeneralCB(self, name):
         """Remove a general callback"""
-        if not self.__general_cb_map.has_key(name):
-            error (_("Trying to remove an unknow general callback"))
+        if name not in self.__general_cb_map:
+            error(_("Trying to remove an unknow general callback"))
         else:
             del self.__general_cb_map[name]
 
@@ -722,15 +713,15 @@
 
     #Menus management
 
-    def importMenu(self, category, name, callback, help_string = "", type = "NORMAL"):
+    def importMenu(self, category, name, callback, help_string="", type="NORMAL"):
         """register a new menu for frontends
         @param category: category of the menu
         @param name: menu item entry
         @param callback: method to be called when menuitem is selected"""
-        if self.menus.has_key((category,name)):
-            error ("Want to register a menu which already existe")
+        if (category, name) in self.menus:
+            error("Want to register a menu which already existe")
             return
-        self.menus[(category,name,type)] = {'callback':callback, 'help_string':help_string, 'type':type}
+        self.menus[(category, name, type)] = {'callback': callback, 'help_string': help_string, 'type': type}
 
     def getMenus(self):
         """Return all menus registered"""
@@ -739,21 +730,21 @@
     def getMenuHelp(self, category, name, type="NORMAL"):
         """return the help string of the menu"""
         try:
-            return self.menus[(category,name,type)]['help_string']
+            return self.menus[(category, name, type)]['help_string']
         except KeyError:
-            error (_("Trying to access an unknown menu"))
+            error(_("Trying to access an unknown menu"))
             return ""
 
     def callMenu(self, category, name, type="NORMAL", profile_key='@DEFAULT@'):
         """return the id of the action"""
         profile = self.memory.getProfileName(profile_key)
         if not profile_key:
-            error (_('Non-exsitant profile'))
+            error(_('Non-exsitant profile'))
             return ""
-        if self.menus.has_key((category,name,type)):
+        if (category, name, type) in self.menus:
             id = self.get_next_id()
-            self.menus[(category,name,type)]['callback'](id, profile)
+            self.menus[(category, name, type)]['callback'](id, profile)
             return id
         else:
-            error (_("Trying to access an unknown menu (%(category)s/%(name)s/%(type)s)")%{'category':category, 'name':name,'type':type})
+            error(_("Trying to access an unknown menu (%(category)s/%(name)s/%(type)s)") % {'category': category, 'name': name, 'type': type})
             return ""
diff --git a/src/core/xmpp.py b/src/core/xmpp.py
--- a/src/core/xmpp.py
+++ b/src/core/xmpp.py
@@ -22,7 +22,7 @@
 from twisted.internet import task, defer
 from twisted.words.protocols.jabber import jid, xmlstream
 from wokkel import client, disco, xmppim, generic, compat, delay
-from logging import debug, info, error
+from logging import debug, info, warning, error
 from sat.core import exceptions
 from calendar import timegm
 
@@ -32,14 +32,13 @@
     def __init__(self, host_app, profile, user_jid, password, host=None, port=5222):
         client.XMPPClient.__init__(self, user_jid, password, host, port)
         self.factory.clientConnectionLost = self.connectionLost
-        self.__connected=False
+        self.__connected = False
         self.profile = profile
         self.host_app = host_app
         self.client_initialized = defer.Deferred()
         self.conn_deferred = defer.Deferred()
-        self._waiting_conf = {}  #callback called when a confirmation is received
-        self._progress_cb_map = {}  #callback called when a progress is requested (key = progress id)
-
+        self._waiting_conf = {}  # callback called when a confirmation is received
+        self._progress_cb_map = {}  # callback called when a progress is requested (key = progress id)
 
     def getConnectionDeferred(self):
         """Return a deferred which fire when the client is connected"""
@@ -49,16 +48,15 @@
         if not self.host_app.trigger.point("XML Initialized", xmlstream, self.profile):
             return
         client.XMPPClient._authd(self, xmlstream)
-        self.__connected=True
-        info (_("********** [%s] CONNECTED **********") % self.profile)
+        self.__connected = True
+        info(_("********** [%s] CONNECTED **********") % self.profile)
         self.streamInitialized()
-        self.host_app.bridge.connected(self.profile) #we send the signal to the clients
-
+        self.host_app.bridge.connected(self.profile)  # we send the signal to the clients
 
     def streamInitialized(self):
         """Called after _authd"""
-        debug (_("XML stream is initialized"))
-        self.keep_alife = task.LoopingCall(self.xmlstream.send, " ")  #Needed to avoid disconnection (specially with openfire)
+        debug(_("XML stream is initialized"))
+        self.keep_alife = task.LoopingCall(self.xmlstream.send, " ")  # Needed to avoid disconnection (specially with openfire)
         self.keep_alife.start(180)
 
         self.disco = SatDiscoProtocol(self)
@@ -73,18 +71,18 @@
 
         self.presence.available()
 
-        self.disco.requestInfo(jid.JID(self.jid.host)).addCallback(self.host_app.serverDisco, self.profile)  #FIXME: use these informations
+        self.disco.requestInfo(jid.JID(self.jid.host)).addCallback(self.host_app.serverDisco, self.profile)  # FIXME: use these informations
 
         self.disco.requestItems(jid.JID(self.jid.host)).addCallback(self.host_app.serverDiscoItems, self.disco, self.profile, self.client_initialized)
         self.conn_deferred.callback(None)
 
     def initializationFailed(self, reason):
-        print ("initializationFailed: %s" % reason)
+        print "initializationFailed: %s" % reason
         self.host_app.bridge.connectionError("AUTH_ERROR", self.profile)
         try:
             client.XMPPClient.initializationFailed(self, reason)
         except:
-            #we already send an error signal, no need to raise an exception
+            # we already send an error signal, no need to raise an exception
             pass
         self.conn_deferred.errback()
 
@@ -92,14 +90,14 @@
         return self.__connected
 
     def connectionLost(self, connector, unused_reason):
-        self.__connected=False
-        info (_("********** [%s] DISCONNECTED **********") % self.profile)
+        self.__connected = False
+        info(_("********** [%s] DISCONNECTED **********") % self.profile)
         try:
             self.keep_alife.stop()
         except AttributeError:
-            debug (_("No keep_alife"))
-        self.host_app.bridge.disconnected(self.profile) #we send the signal to the clients
-        self.host_app.purgeClient(self.profile) #and we remove references to this client
+            debug(_("No keep_alife"))
+        self.host_app.bridge.disconnected(self.profile)  # we send the signal to the clients
+        self.host_app.purgeClient(self.profile)  # and we remove references to this client
 
 
 class SatMessageProtocol(xmppim.MessageProtocol):
@@ -109,7 +107,7 @@
         self.host = host
 
     def onMessage(self, message):
-        debug (_(u"got message from: %s"), message["from"])
+        debug(_(u"got message from: %s"), message["from"])
         if not self.host.trigger.point("MessageReceived", message, profile=self.parent.profile):
             return
         for e in message.elements():
@@ -120,7 +118,7 @@
                     _delay = delay.Delay.fromElement(filter(lambda elm: elm.name == 'delay', message.elements())[0])
                     timestamp = timegm(_delay.stamp.utctimetuple())
                     extra = {"archive": str(timestamp)}
-                    if mess_type != 'groupchat': #XXX: we don't save delayed messages in history for groupchats
+                    if mess_type != 'groupchat':  # XXX: we don't save delayed messages in history for groupchats
                         #TODO: add delayed messages to history if they aren't already in it
                         self.host.memory.addToHistory(jid.JID(message["from"]), jid.JID(message["to"]), mess_body, mess_type, timestamp, profile=self.parent.profile)
                 except IndexError:
@@ -129,6 +127,7 @@
                 self.host.bridge.newMessage(message["from"], mess_body, mess_type, message['to'], extra, profile=self.parent.profile)
                 break
 
+
 class SatRosterProtocol(xmppim.RosterClientProtocol):
 
     def __init__(self, host):
@@ -136,8 +135,8 @@
         self.host = host
         self.got_roster = defer.Deferred()
         #XXX: the two following dicts keep a local copy of the roster
-        self._groups = {} #map from groups to bare jids: key=group value=set of bare jids
-        self._jids = {} #map from bare jids to RosterItem: key=jid value=RosterItem
+        self._groups = {}  # map from groups to bare jids: key=group value=set of bare jids
+        self._jids = {}  # map from bare jids to RosterItem: key=jid value=RosterItem
 
     def rosterCb(self, roster):
         for raw_jid, item in roster.iteritems():
@@ -193,17 +192,17 @@
         #TODO: send a signal to frontends
         if not item.subscriptionTo and not item.subscriptionFrom and not item.ask:
             #XXX: current behaviour: we don't want contact in our roster list
-            #if there is no presence subscription
-            #may change in the future
+            # if there is no presence subscription
+            # may change in the future
             self.removeItem(item.jid)
             return
-        info (_("new contact in roster list: %s"), item.jid.full())
+        info(_("new contact in roster list: %s"), item.jid.full())
         #self.host.memory.addContact(item.jid, item_attr, item.groups, self.parent.profile)
 
         bare_jid = item.jid.userhost()
         self._jids[bare_jid] = item
         for group in item.groups:
-            self._groups.setdefault(group,set()).add(bare_jid)
+            self._groups.setdefault(group, set()).add(bare_jid)
         self.host.bridge.newContact(item.jid.full(), self.getAttributes(item), item.groups, self.parent.profile)
 
     def onRosterRemove(self, entity):
@@ -211,11 +210,11 @@
         print _("removing %s from roster list") % entity.full()
         bare_jid = entity.userhost()
 
-        #we first remove item from local cache (self._groups and self._jids)
+        # we first remove item from local cache (self._groups and self._jids)
         try:
             item = self._jids.pop(bare_jid)
         except KeyError:
-            log.warning("Received a roster remove event for an item not in cache")
+            warning("Received a roster remove event for an item not in cache")
             return
         for group in item.groups:
             try:
@@ -224,10 +223,10 @@
                 if not jids_set:
                     del self._groups[group]
             except KeyError:
-                log.warning("there is not cache for the group [%(groups)s] of the removed roster item [%(jid)s]" %
-                            {"group": group, "jid": bare_jid})
+                warning("there is not cache for the group [%(groups)s] of the removed roster item [%(jid)s]" %
+                        {"group": group, "jid": bare_jid})
 
-        #then we send the bridge signal
+        # then we send the bridge signal
         self.host.bridge.contactDeleted(entity.userhost(), self.parent.profile)
 
     def getGroups(self):
@@ -256,7 +255,7 @@
         try:
             return self._groups[group]
         except KeyError:
-            return  exceptions.UnknownGroupError
+            return exceptions.UnknownGroupError
 
 
 class SatPresenceProtocol(xmppim.PresenceClientProtocol):
@@ -266,37 +265,38 @@
         self.host = host
 
     def availableReceived(self, entity, show=None, statuses=None, priority=0):
-        debug (_("presence update for [%(entity)s] (available, show=%(show)s statuses=%(statuses)s priority=%(priority)d)") % {'entity':entity, 'show':show, 'statuses':statuses, 'priority':priority})
+        debug(_("presence update for [%(entity)s] (available, show=%(show)s statuses=%(statuses)s priority=%(priority)d)") % {'entity': entity, 'show': show, 'statuses': statuses, 'priority': priority})
 
         if not statuses:
             statuses = {}
 
-        if statuses.has_key(None):   #we only want string keys
+        if None in statuses:  # we only want string keys
             statuses["default"] = statuses[None]
             del statuses[None]
 
         self.host.memory.setPresenceStatus(entity, show or "",
-                int(priority), statuses, self.parent.profile)
+                                           int(priority), statuses,
+                                           self.parent.profile)
 
-        #now it's time to notify frontends
-        self.host.bridge.presenceUpdate(entity.full(),  show or "",
-                int(priority), statuses, self.parent.profile)
+        # now it's time to notify frontends
+        self.host.bridge.presenceUpdate(entity.full(), show or "",
+                                        int(priority), statuses,
+                                        self.parent.profile)
 
     def unavailableReceived(self, entity, statuses=None):
-        debug (_("presence update for [%(entity)s] (unavailable, statuses=%(statuses)s)") % {'entity':entity, 'statuses':statuses})
+        debug(_("presence update for [%(entity)s] (unavailable, statuses=%(statuses)s)") % {'entity': entity, 'statuses': statuses})
 
         if not statuses:
             statuses = {}
 
-        if statuses.has_key(None):   #we only want string keys
+        if None in statuses:  # we only want string keys
             statuses["default"] = statuses[None]
             del statuses[None]
         self.host.memory.setPresenceStatus(entity, "unavailable", 0, statuses, self.parent.profile)
 
-        #now it's time to notify frontends
+        # now it's time to notify frontends
         self.host.bridge.presenceUpdate(entity.full(), "unavailable", 0, statuses, self.parent.profile)
 
-
     def available(self, entity=None, show=None, statuses=None, priority=0):
         if not statuses:
             statuses = {}
@@ -319,7 +319,7 @@
         xmppim.PresenceClientProtocol.subscribed(self, entity)
         self.host.memory.delWaitingSub(entity.userhost(), self.parent.profile)
         item = self.parent.roster.getItem(entity)
-        if not item or not item.subscriptionTo: #we automatically subscribe to 'to' presence
+        if not item or not item.subscriptionTo:  # we automatically subscribe to 'to' presence
             debug(_('sending automatic "from" subscription request'))
             self.subscribe(entity)
 
@@ -328,18 +328,18 @@
         self.host.memory.delWaitingSub(entity.userhost(), self.parent.profile)
 
     def subscribedReceived(self, entity):
-        debug (_("subscription approved for [%s]") % entity.userhost())
+        debug(_("subscription approved for [%s]") % entity.userhost())
         self.host.bridge.subscribe('subscribed', entity.userhost(), self.parent.profile)
 
     def unsubscribedReceived(self, entity):
-        debug (_("unsubscription confirmed for [%s]") % entity.userhost())
+        debug(_("unsubscription confirmed for [%s]") % entity.userhost())
         self.host.bridge.subscribe('unsubscribed', entity.userhost(), self.parent.profile)
 
     def subscribeReceived(self, entity):
-        debug (_("subscription request from [%s]") % entity.userhost())
+        debug(_("subscription request from [%s]") % entity.userhost())
         item = self.parent.roster.getItem(entity)
         if item and item.subscriptionTo:
-            #We automatically accept subscription if we are already subscribed to contact presence
+            # We automatically accept subscription if we are already subscribed to contact presence
             debug(_('sending automatic subscription acceptance'))
             self.subscribed(entity)
         else:
@@ -347,27 +347,30 @@
             self.host.bridge.subscribe('subscribe', entity.userhost(), self.parent.profile)
 
     def unsubscribeReceived(self, entity):
-        debug (_("unsubscription asked for [%s]") % entity.userhost())
+        debug(_("unsubscription asked for [%s]") % entity.userhost())
         item = self.parent.roster.getItem(entity)
-        if item and item.subscriptionFrom: #we automatically remove contact
+        if item and item.subscriptionFrom:  # we automatically remove contact
             debug(_('automatic contact deletion'))
             self.host.delContact(entity.userhost(), self.parent.profile)
         self.host.bridge.subscribe('unsubscribe', entity.userhost(), self.parent.profile)
 
+
 class SatDiscoProtocol(disco.DiscoClientProtocol):
     def __init__(self, host):
         disco.DiscoClientProtocol.__init__(self)
 
+
 class SatFallbackHandler(generic.FallbackHandler):
     def __init__(self, host):
         generic.FallbackHandler.__init__(self)
 
     def iqFallback(self, iq):
-        if iq.handled == True:
+        if iq.handled is True:
             return
-        debug (u"iqFallback: xml = [%s]" % (iq.toXml()))
+        debug(u"iqFallback: xml = [%s]" % (iq.toXml()))
         generic.FallbackHandler.iqFallback(self, iq)
 
+
 class RegisteringAuthenticator(xmlstream.ConnectAuthenticator):
 
     def __init__(self, host, jabber_host, user_login, user_pass, email, answer_id, profile):
@@ -379,7 +382,7 @@
         self.user_email = email
         self.answer_id = answer_id
         self.profile = profile
-        print _("Registration asked for"),user_login, user_pass, jabber_host
+        print _("Registration asked for"), user_login, user_pass, jabber_host
 
     def connectionMade(self):
         print "connectionMade"
@@ -400,25 +403,26 @@
         reg = iq.send(self.jabber_host).addCallbacks(self.registrationAnswer, self.registrationFailure)
 
     def registrationAnswer(self, answer):
-        debug (_("registration answer: %s") % answer.toXml())
+        debug(_("registration answer: %s") % answer.toXml())
         answer_type = "SUCCESS"
-        answer_data={"message":_("Registration successfull")}
+        answer_data = {"message": _("Registration successfull")}
         self.host.bridge.actionResult(answer_type, self.answer_id, answer_data, self.profile)
         self.xmlstream.sendFooter()
 
     def registrationFailure(self, failure):
-        info (_("Registration failure: %s") % str(failure.value))
+        info(_("Registration failure: %s") % str(failure.value))
         answer_type = "ERROR"
         answer_data = {}
         if failure.value.condition == 'conflict':
             answer_data['reason'] = 'conflict'
-            answer_data={"message":_("Username already exists, please choose an other one")}
+            answer_data = {"message": _("Username already exists, please choose an other one")}
         else:
             answer_data['reason'] = 'unknown'
-            answer_data={"message":_("Registration failed (%s)") % str(failure.value.condition)}
+            answer_data = {"message": _("Registration failed (%s)") % str(failure.value.condition)}
         self.host.bridge.actionResult(answer_type, self.answer_id, answer_data, self.profile)
         self.xmlstream.sendFooter()
 
+
 class SatVersionHandler(generic.VersionHandler):
 
     def getDiscoInfo(self, requestor, target, node):
@@ -428,4 +432,3 @@
         # disco features, and when the server (seen on ejabberd) generate its own hash for security check
         # it reject our features (resulting in e.g. no notification on PEP)
         return generic.VersionHandler.getDiscoInfo(self, requestor, target, None)
-
# HG changeset patch
# User Emmanuel Gil Peyrot <linkmauve at linkmauve.fr>
# Date 1358528135 -3600
# Node ID 47cd4fef85c41351b0322a5954437b4816b3c0d9
# Parent  d1b4805124a12e6887d3a9b58afd88690f1ebee3
Fix pep8 support in src/tools.

diff --git a/src/tools/games.py b/src/tools/games.py
--- a/src/tools/games.py
+++ b/src/tools/games.py
@@ -19,13 +19,11 @@
 along with this program.  If not, see <http://www.gnu.org/licenses/>.
 """
 
-from logging import debug, info, error
-
 """This library help manage general games (e.g. card games)"""
 
+SUITS_ORDER = ['pique', 'coeur', 'trefle', 'carreau', 'atout']  # I have switched the usual order 'trefle' and 'carreau' because card are more easy to see if suit colour change (black, red, black, red)
+VALUES_ORDER = [str(i) for i in xrange(1, 11)] + ["valet", "cavalier", "dame", "roi"]
 
-suits_order = ['pique', 'coeur', 'trefle', 'carreau', 'atout'] #I have switched the usual order 'trefle' and 'carreau' because card are more easy to see if suit colour change (black, red, black, red)
-values_order = map(str,range(1,11))+["valet","cavalier","dame","roi"]
 
 class TarotCard(object):
     """This class is used to represent a car logically"""
@@ -34,7 +32,7 @@
     def __init__(self, tuple_card):
         """@param tuple_card: tuple (suit, value)"""
         self.suit, self.value = tuple_card
-        self.bout = True if self.suit=="atout" and self.value in ["1","21","excuse"] else False
+        self.bout = self.suit == "atout" and self.value in ["1", "21", "excuse"]
         if self.bout or self.value == "roi":
             self.points = 4.5
         elif self.value == "dame":
@@ -47,7 +45,7 @@
             self.points = 0.5
 
     def get_tuple(self):
-        return (self.suit,self.value)
+        return (self.suit, self.value)
 
     @staticmethod
     def from_tuples(tuple_list):
@@ -57,11 +55,11 @@
         return result
 
     def __cmp__(self, other):
-        if other == None:
+        if other is None:
             return 1
         if self.suit != other.suit:
-            idx1 = suits_order.index(self.suit)
-            idx2 = suits_order.index(other.suit)
+            idx1 = SUITS_ORDER.index(self.suit)
+            idx2 = SUITS_ORDER.index(other.suit)
             return idx1.__cmp__(idx2)
         if self.suit == 'atout':
             if self.value == other.value == 'excuse':
@@ -71,9 +69,9 @@
             if other.value == 'excuse':
                 return 1
             return int(self.value).__cmp__(int(other.value))
-        #at this point we have the same suit which is not 'atout'
-        idx1 = values_order.index(self.value)
-        idx2 = values_order.index(other.value)
+        # at this point we have the same suit which is not 'atout'
+        idx1 = VALUES_ORDER.index(self.value)
+        idx2 = VALUES_ORDER.index(other.value)
         return idx1.__cmp__(idx2)
 
     def __str__(self):
diff --git a/src/tools/jid.py b/src/tools/jid.py
--- a/src/tools/jid.py
+++ b/src/tools/jid.py
@@ -20,7 +20,6 @@
 """
 
 
-
 class JID(unicode):
     """This class help manage JID (Node at Domaine/Resource)"""
 
@@ -31,19 +30,19 @@
 
     def __parse(self):
         """find node domaine and resource"""
-        node_end=self.find('@')
-        if node_end<0:
-            node_end=0
-        domain_end=self.find('/')
-        if domain_end<1:
-            domain_end=len(self)
-        self.node=self[:node_end]
-        self.domain=self[(node_end+1) if node_end else 0:domain_end]
-        self.resource=self[domain_end+1:]
+        node_end = self.find('@')
+        if node_end < 0:
+            node_end = 0
+        domain_end = self.find('/')
+        if domain_end < 1:
+            domain_end = len(self)
+        self.node = self[:node_end]
+        self.domain = self[(node_end + 1) if node_end else 0:domain_end]
+        self.resource = self[domain_end + 1:]
         if not node_end:
-            self.short=self
+            self.short = self
         else:
-            self.short=self.node+'@'+self.domain
+            self.short = self.node + '@' + self.domain
 
     def is_valid(self):
         """return True if the jid is xmpp compliant"""
diff --git a/src/tools/misc.py b/src/tools/misc.py
--- a/src/tools/misc.py
+++ b/src/tools/misc.py
@@ -19,34 +19,38 @@
 along with this program.  If not, see <http://www.gnu.org/licenses/>.
 """
 
-from logging import debug, info, error
+"""Misc usefull classes"""
 
-"""Misc usefull classes"""
 
 class TriggerException(Exception):
     pass
 
+
 class SkipOtherTriggers(Exception):
     """ Exception to raise if normal behaviour must be followed instead of
         followind triggers list """
     pass
 
+
 class TriggerManager(object):
-    """This class manage triggers: code which interact to change de behaviour of SàT"""
+    """This class manage triggers: code which interact to change de behaviour
+    of SàT"""
 
     def __init__(self):
-        self.__triggers={}
+        self.__triggers = {}
 
     def add(self, point_name, callback, priority=0):
         """Add a trigger to a point
         @param point_name: name of the point when the trigger should be run
         @param callback: method to call at the trigger point
-        @param priority: callback will be called in priority order, biggest first
+        @param priority: callback will be called in priority order, biggest
+        first
         """
-        if not self.__triggers.has_key(point_name):
-            self.__triggers[point_name]=[]
+        if point_name not in self.__triggers:
+            self.__triggers[point_name] = []
         self.__triggers[point_name].append((priority, callback))
-        self.__triggers[point_name].sort(key=lambda trigger_tuple: trigger_tuple[0], reverse=True)
+        self.__triggers[point_name].sort(key=lambda trigger_tuple:
+                                         trigger_tuple[0], reverse=True)
 
     def remove(self, point_name, callback):
         """Remove a trigger from a point
@@ -63,14 +67,13 @@
         All the trigger for that point will be run
         @param point_name: name of the trigger point
         @return: True if the action must be continued, False else"""
-        if not self.__triggers.has_key(point_name):
+        if point_name not in self.__triggers:
             return True
 
-        for priority,trigger in self.__triggers[point_name]:
+        for _, trigger in self.__triggers[point_name]:
             try:
                 if not trigger(*args, **kwargs):
                     return False
             except SkipOtherTriggers:
                 break
         return True
-
diff --git a/src/tools/xml_tools.py b/src/tools/xml_tools.py
--- a/src/tools/xml_tools.py
+++ b/src/tools/xml_tools.py
@@ -19,10 +19,9 @@
 along with this program.  If not, see <http://www.gnu.org/licenses/>.
 """
 
-from logging import debug, info, error
+from logging import error
 from xml.dom import minidom
 from wokkel import data_form
-import pdb
 from twisted.words.xish import domish
 
 """This library help manage XML used in SàT (parameters, registration, etc) """
@@ -36,9 +35,9 @@
     if form.instructions:
         form_ui.addText('\n'.join(form.instructions), 'instructions')
 
-    labels = filter(lambda field:field.label,form.fieldList)
+    labels = [field for field in form.fieldList if field.label]
     if labels:
-        #if there is no label, we don't need to use pairs
+        # if there is no label, we don't need to use pairs
         form_ui.changeLayout("pairs")
 
     for field in form.fieldList:
@@ -51,7 +50,7 @@
         elif field.fieldType == 'list-single':
             __field_type = "list"
         else:
-            error (u"FIXME FIXME FIXME: Type [%s] is not managed yet by SàT" % field.fieldType)
+            error(u"FIXME FIXME FIXME: Type [%s] is not managed yet by SàT" % field.fieldType)
             __field_type = "string"
 
         if labels:
@@ -60,9 +59,10 @@
             else:
                 form_ui.addEmpty()
 
-        elem = form_ui.addElement(__field_type, field.var, field.value, [option.value for option in field.options])
+        form_ui.addElement(__field_type, field.var, field.value, [option.value for option in field.options])
     return form_ui.toXml()
 
+
 def tupleList2dataForm(values):
     """convert a list of tuples (name,value) to a wokkel submit data form"""
     form = data_form.Form('submit')
@@ -72,6 +72,7 @@
 
     return form
 
+
 def paramsXml2xmlUI(xml):
     """Convert the xml for parameter to a SàT XML User Interface"""
     params_doc = minidom.parseString(xml.encode('utf-8'))
@@ -93,20 +94,18 @@
             if not name:
                 error(_('INTERNAL ERROR: params must have a name'))
                 assert(False)
-            type = param.getAttribute('type')
+            type_ = param.getAttribute('type')
             value = param.getAttribute('value') or None
             callback_id = param.getAttribute('callback_id') or None
-            if type == "button":
+            if type_ == "button":
                 param_ui.addEmpty()
             else:
                 param_ui.addLabel(label or name)
-            param_ui.addElement(name=name, type=type, value=value, callback_id=callback_id)
+            param_ui.addElement(name=name, type_=type_, value=value, callback_id=callback_id)
 
     return param_ui.toXml()
 
 
-
-
 class XMLUI(object):
     """This class is used to create a user interface (form/window/parameters/etc) using SàT XML"""
 
@@ -127,7 +126,7 @@
         if not panel_type in ['window', 'form', 'param']:
             error(_("Unknown panel type [%s]") % panel_type)
             assert(False)
-        self.type = panel_type
+        self.type_ = panel_type
         impl = minidom.getDOMImplementation()
 
         self.doc = impl.createDocument(None, "sat_xmlui", None)
@@ -135,8 +134,9 @@
         top_element.setAttribute("type", panel_type)
         if title:
             top_element.setAttribute("title", title)
-        self.parentTabsLayout = None #used only we have 'tabs' layout
-        self.currentCategory = None #used only we have 'tabs' layout
+        self.parentTabsLayout = None  # used only we have 'tabs' layout
+        self.currentCategory = None  # used only we have 'tabs' layout
+        self.currentLayout = None
         self.changeLayout(layout)
 
     def __del__(self):
@@ -148,17 +148,17 @@
         @parent: parent element or None
         """
         if not layout in ['vertical', 'horizontal', 'pairs', 'tabs']:
-            error (_("Unknown layout type [%s]") % layout)
-            assert (False)
+            error(_("Unknown layout type [%s]") % layout)
+            assert False
         layout_elt = self.doc.createElement('layout')
-        layout_elt.setAttribute('type',layout)
-        if parent != None:
+        layout_elt.setAttribute('type', layout)
+        if parent is not None:
             parent.appendChild(layout_elt)
         return layout_elt
 
-    def __createElem(self, type, name=None, parent = None):
+    def __createElem(self, type_, name=None, parent=None):
         """Create an element
-        @param type: one of
+        @param type_: one of
             - empty: empty element (usefull to skip something in a layout, e.g. skip first element in a PAIRS layout)
             - text: text to be displayed in an multi-line area, e.g. instructions
         @param name: name of the element or None
@@ -167,8 +167,8 @@
         elem = self.doc.createElement('elem')
         if name:
             elem.setAttribute('name', name)
-        elem.setAttribute('type', type)
-        if parent != None:
+        elem.setAttribute('type', type_)
+        if parent is not None:
             parent.appendChild(elem)
         return elem
 
@@ -178,10 +178,9 @@
         if layout == "tabs":
             self.parentTabsLayout = self.currentLayout
 
-
     def addEmpty(self, name=None):
         """Add a multi-lines text"""
-        elem = self.__createElem('empty', name, self.currentLayout)
+        self.__createElem('empty', name, self.currentLayout)
 
     def addText(self, text, name=None):
         """Add a multi-lines text"""
@@ -214,15 +213,15 @@
 
     def addBool(self, name=None, value="true"):
         """Add a string box"""
-        assert value in ["true","false"]
+        assert value in ["true", "false"]
         elem = self.__createElem('bool', name, self.currentLayout)
         elem.setAttribute('value', value)
 
     def addList(self, options, name=None, value=None, style=set()):
         """Add a list of choices"""
         styles = set(style)
-        assert (options)
-        assert (styles.issubset(['multi']))
+        assert options
+        assert styles.issubset(['multi'])
         elem = self.__createElem('list', name, self.currentLayout)
         self.addOptions(options, elem)
         if value:
@@ -244,31 +243,29 @@
             fback_el.setAttribute('name', field)
             elem.appendChild(fback_el)
 
-
-
-    def addElement(self, type, name = None, value = None, options = None, callback_id = None):
+    def addElement(self, type_, name=None, value=None, options=None, callback_id=None):
         """Convenience method to add element, the params correspond to the ones in addSomething methods"""
-        if type == 'empty':
+        if type_ == 'empty':
             self.addEmpty(name)
-        elif type == 'text':
-            assert(value!=None)
+        elif type_ == 'text':
+            assert value is not None
             self.addText(value, name)
-        elif type == 'label':
+        elif type_ == 'label':
             assert(value)
             self.addLabel(value)
-        elif type == 'string':
+        elif type_ == 'string':
             self.addString(name, value)
-        elif type == 'password':
+        elif type_ == 'password':
             self.addPassword(name, value)
-        elif type == 'textbox':
+        elif type_ == 'textbox':
             self.addTextBox(name, value)
-        elif type == 'bool':
+        elif type_ == 'bool':
             if not value:
                 value = "true"
             self.addBool(name, value)
-        elif type == 'list':
+        elif type_ == 'list':
             self.addList(options, name, value)
-        elif type == 'button':
+        elif type_ == 'button':
             assert(callback_id and value)
             self.addButton(callback_id, name, value)
 
@@ -303,26 +300,28 @@
         return self.doc.toxml()
 
 
-
 class ElementParser(object):
     """callable class to parse XML string into Element
     Found at http://stackoverflow.com/questions/2093400/how-to-create-twisted-words-xish-domish-element-entirely-from-raw-xml/2095942#2095942
     (c) Karl Anderson"""
 
-    def __call__(self, s):
+    def __call__(self, string):
         self.result = None
-        def onStart(el):
-            self.result = el
+
+        def onStart(elem):
+            self.result = elem
+
         def onEnd():
             pass
-        def onElement(el):
-            self.result.addChild(el)
+
+        def onElement(elem):
+            self.result.addChild(elem)
 
         parser = domish.elementStream()
         parser.DocumentStartEvent = onStart
         parser.ElementEvent = onElement
         parser.DocumentEndEvent = onEnd
         tmp = domish.Element((None, "s"))
-        tmp.addRawXml(s.replace('\n','').replace('\t',''))
+        tmp.addRawXml(string.replace('\n', '').replace('\t', ''))
         parser.parse(tmp.toXml().encode('utf-8'))
         return self.result.firstChildElement()
# HG changeset patch
# User Emmanuel Gil Peyrot <linkmauve at linkmauve.fr>
# Date 1358528135 -3600
# Node ID 79a71e08f2977d5cd22a2be0059cef2598d5ed88
# Parent  47cd4fef85c41351b0322a5954437b4816b3c0d9
Fix pep8 support in src/test.

diff --git a/src/test/helpers.py b/src/test/helpers.py
--- a/src/test/helpers.py
+++ b/src/test/helpers.py
@@ -26,9 +26,11 @@
 TEST_JID = JID(u"test at example.org/SàT")
 TEST_PROFILE = 'test_profile'
 
+
 class DifferentArgsException(Exception):
     pass
 
+
 class FakeSAT(object):
     """Class to simulate a SAT instance"""
 
@@ -75,6 +77,7 @@
     def delWaitingSub(self, contact_jid, profile_key):
         pass
 
+
 class FakeTriggerManager(object):
 
     def add(self, point_name, callback):
@@ -84,11 +87,13 @@
         """We always return true to continue the action"""
         return True
 
+
 class FakeParent(object):
     def __init__(self):
         self.profile = 'test_profile'
         self.jid = TEST_JID
 
+
 def _(text):
     return text
 
diff --git a/src/test/test_core_xmpp.py b/src/test/test_core_xmpp.py
--- a/src/test/test_core_xmpp.py
+++ b/src/test/test_core_xmpp.py
@@ -29,7 +29,6 @@
 from wokkel.xmppim import RosterItem
 
 
-
 class SatXMPPClientTest(unittest.TestCase):
 
     def setUp(self):
@@ -43,6 +42,7 @@
         self.assertEqual(self.client.host_app, self.host)
         self.assertTrue(isinstance(self.client.client_initialized, defer.Deferred))
 
+
 class SatMessageProtocolTest(unittest.TestCase):
 
     def setUp(self):
@@ -60,6 +60,7 @@
         self.host.bridge.expectCall("newMessage", "sender at example.net/house", "test", "chat", u"test at example.org/SàT", profile="test_profile")
         self.message.onMessage(stanza)
 
+
 class SatRosterProtocolTest(unittest.TestCase):
 
     def setUp(self):
@@ -74,9 +75,10 @@
         roster_item.subscriptionFrom = True
         roster_item.ask = False
         roster_item.groups = set([u"Test Group 1", u"Test Group 2", u"Test Group 3"])
-        self.host.bridge.expectCall("newContact", helpers.TEST_JID_STR, {'to':'True', 'from': 'True', 'ask': 'False', 'name': u'Test Man'}, set([u"Test Group 1", u"Test Group 2", u"Test Group 3"]), "test_profile")
+        self.host.bridge.expectCall("newContact", helpers.TEST_JID_STR, {'to': 'True', 'from': 'True', 'ask': 'False', 'name': u'Test Man'}, set([u"Test Group 1", u"Test Group 2", u"Test Group 3"]), "test_profile")
         self.roster.onRosterSet(roster_item)
 
+
 class SatPresenceProtocolTest(unittest.TestCase):
 
     def setUp(self):
@@ -85,8 +87,8 @@
         self.presence.parent = helpers.FakeParent()
 
     def test_availableReceived(self):
-        self.host.bridge.expectCall("presenceUpdate", helpers.TEST_JID_STR, "xa", 15, {'default': "test status", 'fr':'statut de test'}, helpers.TEST_PROFILE)
-        self.presence.availableReceived(helpers.TEST_JID, 'xa', {None: "test status", 'fr':'statut de test'}, 15)
+        self.host.bridge.expectCall("presenceUpdate", helpers.TEST_JID_STR, "xa", 15, {'default': "test status", 'fr': 'statut de test'}, helpers.TEST_PROFILE)
+        self.presence.availableReceived(helpers.TEST_JID, 'xa', {None: "test status", 'fr': 'statut de test'}, 15)
 
     def test_availableReceived_empty_statuses(self):
         self.host.bridge.expectCall("presenceUpdate", helpers.TEST_JID_STR, "xa", 15, {}, helpers.TEST_PROFILE)
@@ -111,4 +113,3 @@
     def test_unsubscribeReceived(self):
         self.host.bridge.expectCall("subscribe", "unsubscribe", helpers.TEST_JID.userhost(), helpers.TEST_PROFILE)
         self.presence.unsubscribeReceived(helpers.TEST_JID)
-
# HG changeset patch
# User Emmanuel Gil Peyrot <linkmauve at linkmauve.fr>
# Date 1358528135 -3600
# Node ID 3d0dc1ba2e0a08f75d7bd5def535566de28d8b87
# Parent  79a71e08f2977d5cd22a2be0059cef2598d5ed88
Fix pep8 support in src/memory.

diff --git a/src/memory/memory.py b/src/memory/memory.py
--- a/src/memory/memory.py
+++ b/src/memory/memory.py
@@ -33,8 +33,8 @@
 from sat.memory.persistent import PersistentDict
 from sat.core import exceptions
 
-SAVEFILE_PARAM_XML="/param" #xml parameters template
-SAVEFILE_DATABASE="/sat.db"
+SAVEFILE_PARAM_XML = "/param"  # xml parameters template
+SAVEFILE_DATABASE = "/sat.db"
 
 
 class Params(object):
@@ -61,18 +61,20 @@
         </category>
     </individual>
     </params>
-    """ % {'category_connection': _("Connection"),
-           'label_NewAccount': _("Register new account"),
-           'label_autoconnect': _('Connect on frontend startup'),
-           'label_autodisconnect': _('Disconnect on frontend closure'),
-           'category_misc': _("Misc")
-          }
+    """ % {
+        'category_connection': _("Connection"),
+        'label_NewAccount': _("Register new account"),
+        'label_autoconnect': _('Connect on frontend startup'),
+        'label_autodisconnect': _('Disconnect on frontend closure'),
+        'category_misc': _("Misc")
+    }
 
     def load_default_params(self):
         self.dom = minidom.parseString(Params.default_xml.encode('utf-8'))
 
     def _mergeParams(self, source_node, dest_node):
         """Look for every node in source_node and recursively copy them to dest if they don't exists"""
+
         def getNodesMap(children):
             ret = {}
             for child in children:
@@ -109,9 +111,9 @@
         @param profile: profile to load (*must exist*)
         @param cache: if not None, will be used to store the value, as a short time cache
         @return: deferred triggered once params are loaded"""
-        if cache == None:
+        if cache is None:
             self.params[profile] = {}
-        return self.storage.loadIndParams(self.params[profile] if cache==None else cache, profile)
+        return self.storage.loadIndParams(self.params[profile] if cache is None else cache, profile)
 
     def purgeProfile(self, profile):
         """Remove cache data of a profile
@@ -121,9 +123,9 @@
         except KeyError:
             error(_("Trying to purge cache of a profile not in memory: [%s]") % profile)
 
-    def save_xml(self, file):
+    def save_xml(self, filename):
         """Save parameters template to xml file"""
-        with open(file, 'wb') as xml_file:
+        with open(filename, 'wb') as xml_file:
             xml_file.write(self.dom.toxml('utf-8'))
 
     def __init__(self, host, storage):
@@ -141,7 +143,7 @@
         @param profile: profile of the profile"""
         #FIXME: must be asynchronous and call the callback once the profile actually exists
         if self.storage.hasProfile(profile):
-            info (_('The profile [%s] already exists') % (profile,))
+            info(_('The profile [%s] already exists') % (profile, ))
             return True
         if not self.host.trigger.point("ProfileCreation", profile):
             return False
@@ -157,13 +159,12 @@
                         - CANCELED: profile creation canceled
         """
         if self.storage.hasProfile(profile):
-            info (_('The profile name already exists'))
+            info(_('The profile name already exists'))
             return defer.fail("CONFLICT")
         if not self.host.trigger.point("ProfileCreation", profile):
             return defer.fail("CANCEL")
         return self.storage.createProfile(profile)
 
-
     def deleteProfile(self, profile):
         """Delete an existing profile
         @param profile: name of the profile"""
@@ -183,14 +184,14 @@
                             @ALL@ for all profiles
                             @DEFAULT@ for default profile
         @return: requested profile name or None if it doesn't exist"""
-        if profile_key=='@DEFAULT@':
+        if profile_key == '@DEFAULT@':
             default = self.host.memory.memory_data.get('Profile_default')
             if not default:
-                info(_('No default profile, returning first one')) #TODO: manage real default profile
+                info(_('No default profile, returning first one'))  # TODO: manage real default profile
                 default = self.host.memory.memory_data['Profile_default'] = self.storage.getProfilesList()[0]
-            return default #FIXME: temporary, must use real default value, and fallback to first one if it doesn't exists
+            return default  # FIXME: temporary, must use real default value, and fallback to first one if it doesn't exists
         if not self.storage.hasProfile(profile_key):
-            info (_('Trying to access an unknown profile'))
+            info(_('Trying to access an unknown profile'))
             return ""
         return profile_key
 
@@ -218,7 +219,7 @@
                 if child.nodeName == '#text':
                     continue
                 node = self.__get_unique_node(tgt_parent, child.nodeName, child.getAttribute("name"))
-                if not node: #The node is new
+                if not node:  # The node is new
                     tgt_parent.appendChild(child)
                 else:
                     import_node(node, child)
@@ -227,10 +228,10 @@
 
     def __default_ok(self, value, name, category):
         #FIXME: gof: will not work with individual parameters
-        self.setParam(name, value, category) #FIXME: better to set param xml value ???
+        self.setParam(name, value, category)  # FIXME: better to set param xml value ???
 
     def __default_ko(self, failure, name, category):
-        error (_("Can't determine default value for [%(category)s/%(name)s]: %(reason)s") % {'category':category, 'name':name, 'reason':str(failure.value)})
+        error(_("Can't determine default value for [%(category)s/%(name)s]: %(reason)s") % {'category': category, 'name': name, 'reason': str(failure.value)})
 
     def setDefault(self, name, category, callback, errback=None):
         """Set default value of parameter
@@ -241,9 +242,9 @@
         @param errback: must manage the error with args failure, name, category
         """
         #TODO: send signal param update if value changed
-        node =  self.__getParamNode(name, category, '@ALL@')
+        node = self.__getParamNode(name, category, '@ALL@')
         if not node:
-            error(_("Requested param [%(name)s] in category [%(category)s] doesn't exist !") % {'name':name, 'category':category})
+            error(_("Requested param [%(name)s] in category [%(category)s] doesn't exist !") % {'name': name, 'category': category})
             return
         if node[1].getAttribute('default_cb') == 'yes':
             del node[1].attributes['default_cb']
@@ -257,15 +258,15 @@
         @param attr: name of the attribute to get (e.g.: 'value' or 'type')
         @param value: user defined value"""
         if attr == 'value':
-            value_to_use = value if value!=None else node.getAttribute(attr) #we use value (user defined) if it exist, else we use node's default value
+            value_to_use = value if value is not None else node.getAttribute(attr)  # we use value (user defined) if it exist, else we use node's default value
             if node.getAttribute('type') == 'bool':
-                return value_to_use.lower() not in ('false','0')
+                return value_to_use.lower() not in ('false', '0')
             return value_to_use
         return node.getAttribute(attr)
 
     def __type_to_string(self, result):
         """ convert result to string, according to its type """
-        if isinstance(result,bool):
+        if isinstance(result, bool):
             return "true" if result else "false"
         return result
 
@@ -284,14 +285,14 @@
         #FIXME: looks really dirty and buggy, need to be reviewed/refactored
         node = self.__getParamNode(name, category)
         if not node:
-            error(_("Requested param [%(name)s] in category [%(category)s] doesn't exist !") % {'name':name, 'category':category})
+            error(_("Requested param [%(name)s] in category [%(category)s] doesn't exist !") % {'name': name, 'category': category})
             raise exceptions.NotFound
 
         if node[0] == 'general':
             value = self.__getParam(None, category, name, 'general')
             return self.__getAttr(node[1], attr, value)
 
-        assert(node[0] == 'individual')
+        assert node[0] == 'individual'
 
         profile = self.getProfileName(profile_key)
         if not profile:
@@ -319,14 +320,14 @@
            @param profile: owner of the param (@ALL@ for everyone)"""
         node = self.__getParamNode(name, category)
         if not node:
-            error(_("Requested param [%(name)s] in category [%(category)s] doesn't exist !") % {'name':name, 'category':category})
+            error(_("Requested param [%(name)s] in category [%(category)s] doesn't exist !") % {'name': name, 'category': category})
             return None
 
         if node[0] == 'general':
             value = self.__getParam(None, category, name, 'general')
             return defer.succeed(self.__getAttr(node[1], attr, value))
 
-        assert(node[0] == 'individual')
+        assert node[0] == 'individual'
 
         profile = self.getProfileName(profile_key)
         if not profile:
@@ -353,16 +354,16 @@
         @return: param value or None if it doesn't exist
         """
         if _type == 'general':
-            if self.params_gen.has_key((category, name)):
+            if (category, name) in self.params_gen:
                 return self.params_gen[(category, name)]
-            return None  #This general param has the default value
+            return None  # This general param has the default value
         assert (_type == 'individual')
-        if self.params.has_key(profile):
-            cache = self.params[profile] # if profile is in main cache, we use it,
-                                         # ignoring the temporary cache
-        elif cache == None: #else we use the temporary cache if it exists, or raise an exception
+        if profile in self.params:
+            cache = self.params[profile]  # if profile is in main cache, we use it,
+                                          # ignoring the temporary cache
+        elif cache is None:  # else we use the temporary cache if it exists, or raise an exception
             raise exceptions.ProfileNotInCacheError
-        if not cache.has_key((category, name)):
+        if (category, name) not in cache:
             return None
         return cache[(category, name)]
 
@@ -372,21 +373,22 @@
         @param profile: profile name (not key !)
         @return: a deferred that fire a minidom.Document of the profile xml (cf warning above)
         """
-        def constructProfile(ignore,profile_cache):
+
+        def constructProfile(ignore, profile_cache):
             prof_xml = minidom.parseString('<params/>')
             cache = {}
 
             for type_node in self.dom.documentElement.childNodes:
-                if type_node.nodeName == 'general' or type_node.nodeName == 'individual':  #we use all params, general and individual
+                if type_node.nodeName == 'general' or type_node.nodeName == 'individual':  # we use all params, general and individual
                     for cat_node in type_node.childNodes:
                         if cat_node.nodeName == 'category':
                             category = cat_node.getAttribute('name')
-                            if not cache.has_key(category):
-                                cache[category] = dest_cat = cat_node.cloneNode(True) #we make a copy for the new xml
+                            if category not in cache:
+                                cache[category] = dest_cat = cat_node.cloneNode(True)  # we make a copy for the new xml
                                 new_node = True
                             else:
                                 dest_cat = cache[category]
-                                new_node = False #It's not a new node, we will merge information
+                                new_node = False  # It's not a new node, we will merge information
                             params = cat_node.getElementsByTagName("param")
                             dest_params = {}
                             for node in dest_cat.childNodes:
@@ -402,14 +404,13 @@
                                     dest_cat.appendChild(dest_params[name])
 
                                 profile_value = self.__getParam(profile, category, name, type_node.nodeName, cache=profile_cache)
-                                if profile_value!=None:  #there is a value for this profile, we must change the default
+                                if profile_value is not None:  # there is a value for this profile, we must change the default
                                     dest_params[name].setAttribute('value', profile_value)
                             if new_node:
                                 prof_xml.documentElement.appendChild(dest_cat)
             return prof_xml
 
-
-        if self.params.has_key(profile):
+        if profile in self.params:
             d = defer.succeed(None)
             profile_cache = self.params[profile]
         else:
@@ -426,7 +427,7 @@
             error(_("Asking params for inexistant profile"))
             return ""
         d = self.getParams(profile)
-        return d.addCallback(lambda param_xml:paramsXml2xmlUI(param_xml))
+        return d.addCallback(lambda param_xml: paramsXml2xmlUI(param_xml))
 
     def getParams(self, profile_key):
         """Construct xml for asked profile
@@ -464,7 +465,7 @@
         d = self.__constructProfileXml(profile)
         return d.addCallback(returnCategoryXml)
 
-    def __getParamNode(self, name, category, _type="@ALL@"): #FIXME: is _type useful ?
+    def __getParamNode(self, name, category, _type="@ALL@"):  # FIXME: is _type useful ?
         """Return a node from the param_xml
         @param name: name of the node
         @param category: category of the node
@@ -475,8 +476,8 @@
         @return: a tuple with the node type and the the node, or None if not found"""
 
         for type_node in self.dom.documentElement.childNodes:
-            if ( ((_type == "@ALL@" or _type == "@GENERAL@") and type_node.nodeName == 'general')
-            or ( (_type == "@ALL@" or _type == "@INDIVIDUAL@") and type_node.nodeName == 'individual') ):
+            if (((_type == "@ALL@" or _type == "@GENERAL@") and type_node.nodeName == 'general')
+                    or ((_type == "@ALL@" or _type == "@INDIVIDUAL@") and type_node.nodeName == 'individual')):
                 for node in type_node.getElementsByTagName('category'):
                     if node.getAttribute("name") == category:
                         params = node.getElementsByTagName("param")
@@ -487,7 +488,7 @@
 
     def getParamsCategories(self):
         """return the categories availables"""
-        categories=[]
+        categories = []
         for cat in self.dom.getElementsByTagName("category"):
             name = cat.getAttribute("name")
             if name not in categories:
@@ -497,15 +498,15 @@
     def setParam(self, name, value, category, profile_key='@NONE@'):
         """Set a parameter, return None if the parameter is not in param xml"""
         #TODO: use different behaviour depending of the data type (e.g. password encrypted)
-        if profile_key!="@NONE@":
+        if profile_key != "@NONE@":
             profile = self.getProfileName(profile_key)
             if not profile:
                 error(_('Trying to set parameter for an unknown profile'))
-                return #TODO: throw an error
+                return  # TODO: throw an error
 
         node = self.__getParamNode(name, category, '@ALL@')
         if not node:
-            error(_('Requesting an unknown parameter (%(category)s/%(name)s)') % {'category':category, 'name':name})
+            error(_('Requesting an unknown parameter (%(category)s/%(name)s)') % {'category': category, 'name': name})
             return
 
         if node[0] == 'general':
@@ -520,35 +521,36 @@
         assert (profile_key != "@NONE@")
 
         _type = node[1].getAttribute("type")
-        if _type=="button":
-            print "clique",node.toxml()
+        if _type == "button":
+            print "clique", node.toxml()
         else:
-            if self.host.isConnected(profile): #key can not exists if profile is not connected
+            if self.host.isConnected(profile):  # key can not exists if profile is not connected
                 self.params[profile][(category, name)] = value
             self.host.bridge.paramUpdate(name, value, category, profile)
             self.storage.setIndParam(category, name, value, profile)
 
+
 class Memory(object):
     """This class manage all persistent informations"""
 
     def __init__(self, host):
-        info (_("Memory manager init"))
+        info(_("Memory manager init"))
         self.initialized = defer.Deferred()
         self.host = host
-        self.entitiesCache={} #XXX: keep presence/last resource/other data in cache
+        self.entitiesCache = {}  # XXX: keep presence/last resource/other data in cache
                               #     /!\ an entity is not necessarily in roster
-        self.subscriptions={}
-        self.server_features={} #used to store discovery's informations
-        self.server_identities={}
+        self.subscriptions = {}
+        self.server_features = {}  # used to store discovery's informations
+        self.server_identities = {}
         self.config = self.parseMainConf()
         host.set_const('savefile_database', SAVEFILE_DATABASE)
-        database_file = os.path.expanduser(self.getConfig('','local_dir')+
-                                        self.host.get_const('savefile_database'))
+        database_file = os.path.expanduser(self.getConfig('', 'local_dir') +
+                                           self.host.get_const('savefile_database'))
         self.storage = SqliteStorage(database_file)
         PersistentDict.storage = self.storage
-        self.params=Params(host, self.storage)
+        self.params = Params(host, self.storage)
         self.loadFiles()
-        d = self.storage.initialized.addCallback(lambda ignore:self.load())
+        d = self.storage.initialized.addCallback(lambda ignore: self.load())
         self.memory_data = PersistentDict("memory")
         d.addCallback(lambda ignore: self.memory_data.load())
         d.chainDeferred(self.initialized)
@@ -559,7 +561,7 @@
         try:
             _config.read(map(os.path.expanduser, ['/etc/sat.conf', '~/sat.conf', '~/.sat.conf', 'sat.conf', '.sat.conf']))
         except:
-            error (_("Can't read main config !"))
+            error(_("Can't read main config !"))
 
         return _config
 
@@ -569,7 +571,7 @@
         @param name: name of the option
         """
         if not section:
-            section='DEFAULT'
+            section = 'DEFAULT'
         try:
             _value = self.config.get(section, name)
         except (NoOptionError, NoSectionError):
@@ -577,11 +579,10 @@
 
         return os.path.expanduser(_value) if name.endswith('_path') or name.endswith('_dir') else _value
 
-
     def loadFiles(self):
         """Load parameters and all memory things from file/db"""
-        param_file_xml = os.path.expanduser(self.getConfig('','local_dir')+
-                                        self.host.get_const('savefile_param_xml'))
+        param_file_xml = os.path.expanduser(self.getConfig('', 'local_dir') +
+                                            self.host.get_const('savefile_param_xml'))
 
         #parameters template
         if os.path.exists(param_file_xml):
@@ -589,13 +590,12 @@
                 self.params.load_xml(param_file_xml)
                 debug(_("params template loaded"))
             except Exception as e:
-                error (_("Can't load params template: %s") % (e,))
+                error(_("Can't load params template: %s") % (e, ))
                 self.params.load_default_params()
         else:
-            info (_("No params template, using default template"))
+            info(_("No params template, using default template"))
             self.params.load_default_params()
 
-
     def load(self):
         """Load parameters and all memory things from db"""
         #parameters data
@@ -622,12 +622,11 @@
         except KeyError:
             error(_("Trying to purge roster status cache for a profile not in memory: [%s]") % profile)
 
-
     def save(self):
         """Save parameters and all memory things to file/db"""
         #TODO: need to encrypt files (at least passwords !) and set permissions
-        param_file_xml = os.path.expanduser(self.getConfig('','local_dir')+
-                                        self.host.get_const('savefile_param_xml'))
+        param_file_xml = os.path.expanduser(self.getConfig('', 'local_dir') +
+                                            self.host.get_const('savefile_param_xml'))
 
         self.params.save_xml(param_file_xml)
         debug(_("params saved"))
@@ -635,7 +634,6 @@
     def getProfilesList(self):
         return self.storage.getProfilesList()
 
-
     def getProfileName(self, profile_key):
         """Return name of profile from keyword
         @param profile_key: can be the profile name or a keywork (like @DEFAULT@)
@@ -660,18 +658,18 @@
         return self.params.deleteProfile(name)
 
     def addToHistory(self, from_jid, to_jid, message, _type='chat', timestamp=None, profile="@NONE@"):
-        assert(profile!="@NONE@")
+        assert profile != "@NONE@"
         return self.storage.addToHistory(from_jid, to_jid, message, _type, timestamp, profile)
 
     def getHistory(self, from_jid, to_jid, limit=0, between=True, profile="@NONE@"):
-        assert(profile != "@NONE@")
+        assert profile != "@NONE@"
         return self.storage.getHistory(jid.JID(from_jid), jid.JID(to_jid), limit, between, profile)
 
     def addServerFeature(self, feature, profile):
         """Add a feature discovered from server
         @param feature: string of the feature
         @param profile: which profile is using this server ?"""
-        if not self.server_features.has_key(profile):
+        if profile not in self.server_features:
             self.server_features[profile] = []
         self.server_features[profile].append(feature)
 
@@ -681,8 +679,8 @@
         @param profile: which profile is using this server ?"""
         if not profile in self.server_identities:
             self.server_identities[profile] = {}
-        if not self.server_identities[profile].has_key((category, _type)):
-            self.server_identities[profile][(category, _type)]=set()
+        if (category, _type) not in self.server_identities[profile]:
+            self.server_identities[profile][(category, _type)] = set()
         self.server_identities[profile][(category, _type)].add(entity)
 
     def getServerServiceEntities(self, category, _type, profile):
@@ -695,9 +693,9 @@
     def getServerServiceEntity(self, category, _type, profile):
         """Helper method to get first available entity for a service"""
         entities = self.getServerServiceEntities(category, _type, profile)
-        if entities == None:
-            warning(_("Entities (%(category)s/%(type)s) not available, maybe they haven't been asked to server yet ?") % {"category":category,
-                                                                                                                          "type":_type})
+        if entities is None:
+            warning(_("Entities (%(category)s/%(type)s) not available, maybe they haven't been asked to server yet ?") % {"category": category,
+                                                                                                                          "type": _type})
             return None
         else:
             return list(entities)[0] if entities else None
@@ -706,9 +704,9 @@
         """Tell if the server of the profile has the required feature"""
         profile = self.getProfileName(profile_key)
         if not profile:
-            error (_('Trying find server feature for a non-existant profile'))
+            error(_('Trying find server feature for a non-existant profile'))
             return
-        assert(self.server_features.has_key(profile))
+        assert profile in self.server_features
         return feature in self.server_features[profile]
 
     def getLastResource(self, contact, profile_key):
@@ -738,7 +736,7 @@
             if "presence" in self.entitiesCache[profile][entity]:
                 entities_presence[entity] = self.entitiesCache[profile][entity]["presence"]
 
-        debug ("Memory getPresenceStatus (%s)", entities_presence)
+        debug("Memory getPresenceStatus (%s)", entities_presence)
         return entities_presence
 
     def setPresenceStatus(self, entity_jid, show, priority, statuses, profile_key):
@@ -747,14 +745,14 @@
         if not profile:
             error(_('Trying to add presence status to a non-existant profile'))
             return
-        entity_data = self.entitiesCache[profile].setdefault(entity_jid.userhost(),{})
+        entity_data = self.entitiesCache[profile].setdefault(entity_jid.userhost(), {})
         resource = jid.parse(entity_jid.full())[2] or ''
         if resource:
             entity_data["last_resource"] = resource
         if not "last_resource" in entity_data:
             entity_data["last_resource"] = ''
 
-        entity_data.setdefault("presence",{})[resource] = (show, priority, statuses)
+        entity_data.setdefault("presence", {})[resource] = (show, priority, statuses)
 
     def updateEntityData(self, entity_jid, key, value, profile_key):
         """Set a misc data for an entity
@@ -768,9 +766,9 @@
             raise exceptions.UnknownProfileError(_('Trying to get entity data for a non-existant profile'))
         if not profile in self.entitiesCache:
             raise exceptions.ProfileNotInCacheError
-        entity_data = self.entitiesCache[profile].setdefault(entity_jid.userhost(),{})
+        entity_data = self.entitiesCache[profile].setdefault(entity_jid.userhost(), {})
         entity_data[key] = value
-        if isinstance(value,basestring):
+        if isinstance(value, basestring):
             self.host.bridge.entityDataUpdated(entity_jid.userhost(), key, value, profile)
 
     def getEntityData(self, entity_jid, keys_list, profile_key):
@@ -810,21 +808,19 @@
         except KeyError:
             pass
 
-
-
     def addWaitingSub(self, _type, entity_jid, profile_key):
         """Called when a subcription request is received"""
         profile = self.getProfileName(profile_key)
-        assert(profile)
-        if not self.subscriptions.has_key(profile):
+        assert profile
+        if profile not in self.subscriptions:
             self.subscriptions[profile] = {}
         self.subscriptions[profile][entity_jid] = _type
 
     def delWaitingSub(self, entity_jid, profile_key):
         """Called when a subcription request is finished"""
         profile = self.getProfileName(profile_key)
-        assert(profile)
-        if self.subscriptions.has_key(profile) and self.subscriptions[profile].has_key(entity_jid):
+        assert profile
+        if profile in self.subscriptions and entity_jid in self.subscriptions[profile]:
             del self.subscriptions[profile][entity_jid]
 
     def getWaitingSub(self, profile_key):
@@ -833,7 +829,7 @@
         if not profile:
             error(_('Asking waiting subscriptions for a non-existant profile'))
             return {}
-        if not self.subscriptions.has_key(profile):
+        if profile not in self.subscriptions:
             return {}
 
         return self.subscriptions[profile]
diff --git a/src/memory/persistent.py b/src/memory/persistent.py
--- a/src/memory/persistent.py
+++ b/src/memory/persistent.py
@@ -19,13 +19,15 @@
 along with this program.  If not, see <http://www.gnu.org/licenses/>.
 """
 
-from logging import debug, info, warning, error
+from logging import error
+
 
 class MemoryNotInitializedError(Exception):
     pass
 
+
 class PersistentDict(object):
-    """A dictionary which save persistently each value assigned
+    r"""A dictionary which save persistently each value assigned
     /!\ be careful, each assignment means a database write
     /!\ Memory must be initialised before loading/setting value with instances of this class"""
     storage = None
@@ -81,9 +83,6 @@
     def __nonzero__(self):
         return self._cache.__len__()
 
-    def __unicode__(self):
-        return self._cache.__unicode__()
-
     def __contains__(self, key):
         return self._cache.__contains__(key)
 
@@ -146,4 +145,3 @@
         if not self.profile:
             return self.storage.setGenPrivateBinary(self.namespace, name, self._cache[name])
         return self.storage.setIndPrivateBinary(self.namespace, name, self._cache[name], self.profile)
-
diff --git a/src/memory/sqlite.py b/src/memory/sqlite.py
--- a/src/memory/sqlite.py
+++ b/src/memory/sqlite.py
@@ -19,50 +19,49 @@
 along with this program.  If not, see <http://www.gnu.org/licenses/>.
 """
 
-
-from logging import debug, info, warning, error
+from logging import debug, info, error
 from twisted.enterprise import adbapi
 from twisted.internet import defer
+from time import time
 import os.path
-import time
 import cPickle as pickle
 
+
 class SqliteStorage(object):
     """This class manage storage with Sqlite database"""
 
-
     def __init__(self, db_filename):
         """Connect to the given database
         @param db_filename: full path to the Sqlite database"""
-        self.initialized = defer.Deferred() #triggered when memory is fully initialised and ready
-        init_defers = [] #list of deferred we have to wait to before initialisation is complete
-        self.profiles={} #we keep cache for the profiles (key: profile name, value: profile id)
+        self.initialized = defer.Deferred()  # triggered when memory is fully initialised and ready
+        init_defers = []  # list of deferred we have to wait to before initialisation is complete
+        self.profiles = {}  # we keep cache for the profiles (key: profile name, value: profile id)
 
         info(_("Connecting database"))
-        new_base = not os.path.exists(db_filename) #do we have to create the database ?
+        new_base = not os.path.exists(db_filename)  # do we have to create the database ?
         self.dbpool = adbapi.ConnectionPool("sqlite3", db_filename, check_same_thread=False)
         init_defers.append(self.dbpool.runOperation("PRAGMA foreign_keys = ON").addErrback(lambda x: error(_("Can't activate foreign keys"))))
         if new_base:
             info(_("The database is new, creating the tables"))
             database_creation = [
-            "CREATE TABLE profiles (id INTEGER PRIMARY KEY ASC, name TEXT, UNIQUE (name))",
-            "CREATE TABLE message_types (type TEXT PRIMARY KEY)",
-            "INSERT INTO message_types VALUES ('chat')",
-            "INSERT INTO message_types VALUES ('error')",
-            "INSERT INTO message_types VALUES ('groupchat')",
-            "INSERT INTO message_types VALUES ('headline')",
-            "INSERT INTO message_types VALUES ('normal')",
-            "CREATE TABLE history (id INTEGER PRIMARY KEY ASC, profile_id INTEGER, source TEXT, dest TEXT, source_res TEXT, dest_res TEXT, timestamp DATETIME, message TEXT, type TEXT, FOREIGN KEY(profile_id) REFERENCES profiles(id) ON DELETE CASCADE, FOREIGN KEY(type) REFERENCES message_types(type))",
-            "CREATE TABLE param_gen (category TEXT, name TEXT, value TEXT, PRIMARY KEY (category,name))",
-            "CREATE TABLE param_ind (category TEXT, name TEXT, profile_id INTEGER, value TEXT, PRIMARY KEY (category,name,profile_id), FOREIGN KEY(profile_id) REFERENCES profiles(id) ON DELETE CASCADE)",
-            "CREATE TABLE private_gen (namespace TEXT, key TEXT, value TEXT, PRIMARY KEY (namespace, key))",
-            "CREATE TABLE private_ind (namespace TEXT, key TEXT, profile_id INTEGER, value TEXT, PRIMARY KEY (namespace, key, profile_id), FOREIGN KEY(profile_id) REFERENCES profiles(id) ON DELETE CASCADE)",
-            "CREATE TABLE private_gen_bin (namespace TEXT, key TEXT, value BLOB, PRIMARY KEY (namespace, key))",
-            "CREATE TABLE private_ind_bin (namespace TEXT, key TEXT, profile_id INTEGER, value BLOB, PRIMARY KEY (namespace, key, profile_id), FOREIGN KEY(profile_id) REFERENCES profiles(id) ON DELETE CASCADE)",
+                "CREATE TABLE profiles (id INTEGER PRIMARY KEY ASC, name TEXT, UNIQUE (name))",
+                "CREATE TABLE message_types (type TEXT PRIMARY KEY)",
+                "INSERT INTO message_types VALUES ('chat')",
+                "INSERT INTO message_types VALUES ('error')",
+                "INSERT INTO message_types VALUES ('groupchat')",
+                "INSERT INTO message_types VALUES ('headline')",
+                "INSERT INTO message_types VALUES ('normal')",
+                "CREATE TABLE history (id INTEGER PRIMARY KEY ASC, profile_id INTEGER, source TEXT, dest TEXT, source_res TEXT, dest_res TEXT, timestamp DATETIME, message TEXT, type TEXT, FOREIGN KEY(profile_id) REFERENCES profiles(id) ON DELETE CASCADE, FOREIGN KEY(type) REFERENCES message_types(type))",
+                "CREATE TABLE param_gen (category TEXT, name TEXT, value TEXT, PRIMARY KEY (category,name))",
+                "CREATE TABLE param_ind (category TEXT, name TEXT, profile_id INTEGER, value TEXT, PRIMARY KEY (category,name,profile_id), FOREIGN KEY(profile_id) REFERENCES profiles(id) ON DELETE CASCADE)",
+                "CREATE TABLE private_gen (namespace TEXT, key TEXT, value TEXT, PRIMARY KEY (namespace, key))",
+                "CREATE TABLE private_ind (namespace TEXT, key TEXT, profile_id INTEGER, value TEXT, PRIMARY KEY (namespace, key, profile_id), FOREIGN KEY(profile_id) REFERENCES profiles(id) ON DELETE CASCADE)",
+                "CREATE TABLE private_gen_bin (namespace TEXT, key TEXT, value BLOB, PRIMARY KEY (namespace, key))",
+                "CREATE TABLE private_ind_bin (namespace TEXT, key TEXT, profile_id INTEGER, value BLOB, PRIMARY KEY (namespace, key, profile_id), FOREIGN KEY(profile_id) REFERENCES profiles(id) ON DELETE CASCADE)",
             ]
             for op in database_creation:
                 d = self.dbpool.runOperation(op)
-                d.addErrback(lambda x: error(_("Error while creating tables in database [QUERY: %s]") % op ))
+                d.addErrback(lambda x: error(_("Error while creating tables in database [QUERY: %s]") % op))
                 init_defers.append(d)
 
         def fillProfileCache(ignore):
@@ -76,8 +75,8 @@
         """Fill the profiles cache
         @param profiles_result: result of the sql profiles query"""
         for profile in profiles_result:
-            name, id = profile
-            self.profiles[name] = id
+            name, id_ = profile
+            self.profiles[name] = id_
 
     def getProfilesList(self):
         """"Return list of all registered profiles"""
@@ -86,20 +85,21 @@
     def hasProfile(self, profile_name):
         """return True if profile_name exists
         @param profile_name: name of the profile to check"""
-        return self.profiles.has_key(profile_name)
+        return profile_name in self.profiles
 
     def createProfile(self, name):
         """Create a new profile
         @param name: name of the profile
         @return: deferred triggered once profile is actually created"""
+
         def getProfileId(ignore):
-            return self.dbpool.runQuery("SELECT (id) FROM profiles WHERE name = ?", (name,))
+            return self.dbpool.runQuery("SELECT (id) FROM profiles WHERE name = ?", (name, ))
 
         def profile_created(profile_id):
             _id = profile_id[0][0]
-            self.profiles[name] = _id #we synchronise the cache
+            self.profiles[name] = _id  # we synchronise the cache
 
-        d = self.dbpool.runQuery("INSERT INTO profiles(name) VALUES (?)", (name,))
+        d = self.dbpool.runQuery("INSERT INTO profiles(name) VALUES (?)", (name, ))
         d.addCallback(getProfileId)
         d.addCallback(profile_created)
         return d
@@ -108,23 +108,21 @@
         """Delete profile
         @param name: name of the profile
         @return: deferred triggered once profile is actually deleted"""
-        def deletionError(failure):
-            error(_("Can't delete profile [%s]") % name)
-            return failure
+
         del self.profiles[name]
-        d = self.dbpool.runQuery("DELETE FROM profiles WHERE name = ?", (name,))
+        d = self.dbpool.runQuery("DELETE FROM profiles WHERE name = ?", (name, ))
         d.addCallback(lambda ignore: info(_("Profile [%s] deleted") % name))
         return d
 
-
     #Params
     def loadGenParams(self, params_gen):
         """Load general parameters
         @param params_gen: dictionary to fill
         @return: deferred"""
+
         def fillParams(result):
             for param in result:
-                category,name,value = param
+                category, name, value = param
                 params_gen[(category, name)] = value
         debug(_("loading general parameters from database"))
         return self.dbpool.runQuery("SELECT category,name,value FROM param_gen").addCallback(fillParams)
@@ -134,12 +132,13 @@
         @param params_ind: dictionary to fill
         @param profile: a profile which *must* exist
         @return: deferred"""
+
         def fillParams(result):
             for param in result:
-                category,name,value = param
+                category, name, value = param
                 params_ind[(category, name)] = value
         debug(_("loading individual parameters from database"))
-        d = self.dbpool.runQuery("SELECT category,name,value FROM param_ind WHERE profile_id=?", (self.profiles[profile],))
+        d = self.dbpool.runQuery("SELECT category,name,value FROM param_ind WHERE profile_id=?", (self.profiles[profile], ))
         d.addCallback(fillParams)
         return d
 
@@ -149,7 +148,7 @@
         @param name: name of the parameter
         @param profile: %(doc_profile)s
         @return: deferred"""
-        d = self.dbpool.runQuery("SELECT value FROM param_ind WHERE category=? AND name=? AND profile_id=?", (category,name,self.profiles[profile]))
+        d = self.dbpool.runQuery("SELECT value FROM param_ind WHERE category=? AND name=? AND profile_id=?", (category, name, self.profiles[profile]))
         d.addCallback(self.__getFirstResult)
         return d
 
@@ -160,7 +159,7 @@
         @param value: value to set
         @return: deferred"""
         d = self.dbpool.runQuery("REPLACE INTO param_gen(category,name,value) VALUES (?,?,?)", (category, name, value))
-        d.addErrback(lambda ignore: error(_("Can't set general parameter (%(category)s/%(name)s) in database" % {"category":category, "name":name})))
+        d.addErrback(lambda ignore: error(_("Can't set general parameter (%(category)s/%(name)s) in database" % {"category": category, "name": name})))
         return d
 
     def setIndParam(self, category, name, value, profile):
@@ -171,7 +170,7 @@
         @param profile: a profile which *must* exist
         @return: deferred"""
         d = self.dbpool.runQuery("REPLACE INTO param_ind(category,name,profile_id,value) VALUES (?,?,?,?)", (category, name, self.profiles[profile], value))
-        d.addErrback(lambda ignore: error(_("Can't set individual parameter (%(category)s/%(name)s) for [%(profile)s] in database" % {"category":category, "name":name, "profile":profile})))
+        d.addErrback(lambda ignore: error(_("Can't set individual parameter (%(category)s/%(name)s) for [%(profile)s] in database" % {"category": category, "name": name, "profile": profile})))
         return d
 
     #History
@@ -185,10 +184,10 @@
         """
         assert(profile)
         d = self.dbpool.runQuery("INSERT INTO history(source, source_res, dest, dest_res, timestamp, message, type, profile_id) VALUES (?,?,?,?,?,?,?,?)",
-                                (from_jid.userhost(), from_jid.resource, to_jid.userhost(), to_jid.resource, timestamp or time.time(),
-                                message, _type, self.profiles[profile]))
+                                 (from_jid.userhost(), from_jid.resource, to_jid.userhost(), to_jid.resource, timestamp or time(),
+                                  message, _type, self.profiles[profile]))
         d.addErrback(lambda ignore: error(_("Can't save following message in history: from [%(from_jid)s] to [%(to_jid)s] ==> [%(message)s]" %
-                                         {"from_jid":from_jid.full(), "to_jid":to_jid.full(), "message":message})))
+                                          {"from_jid": from_jid.full(), "to_jid": to_jid.full(), "message": message})))
         return d
 
     def getHistory(self, from_jid, to_jid, limit=0, between=True, profile=None):
@@ -198,35 +197,35 @@
         @param size: maximum number of messages to get, or 0 for unlimited
         """
         assert(profile)
+
         def sqliteToDict(query_result):
             query_result.reverse()
             result = []
             for row in query_result:
-                timestamp, source, source_res, dest, dest_res, message, _type= row
+                timestamp, source, source_res, dest, dest_res, message, _type = row
                 result.append((timestamp, "%s/%s" % (source, source_res) if source_res else source,
                                           "%s/%s" % (dest, dest_res) if dest_res else dest,
                                           message, _type))
             return result
 
-
         query_parts = ["SELECT timestamp, source, source_res, dest, dest_res, message, type FROM history WHERE profile_id=? AND"]
         values = [self.profiles[profile]]
 
-        def test_jid(_type,_jid):
+        def test_jid(_type, _jid):
             values.append(_jid.userhost())
             if _jid.resource:
                 values.append(_jid.resource)
                 return '(%s=? AND %s_res=?)' % (_type, _type)
-            return '%s=?' % (_type,)
+            return '%s=?' % (_type, )
 
         if between:
             query_parts.append("(%s OR %s) AND (%s or %s)" % (test_jid('source', from_jid),
-                                                               test_jid('source', to_jid),
-                                                               test_jid('dest', to_jid),
-                                                               test_jid('dest', from_jid)))
+                                                              test_jid('source', to_jid),
+                                                              test_jid('dest', to_jid),
+                                                              test_jid('dest', from_jid)))
         else:
-            query_parts.append("%s AND %s") % (test_jid('source', from_jid),
-                                               test_jid('dest', to_jid))
+            query_parts.append("%s AND %s" % (test_jid('source', from_jid),
+                                              test_jid('dest', to_jid)))
 
         query_parts.append("ORDER BY timestamp DESC")
 
@@ -243,12 +242,13 @@
         @param private_gen: dictionary to fill
         @param namespace: namespace of the values
         @return: deferred"""
+
         def fillPrivates(result):
             for private in result:
-                key,value = private
+                key, value = private
                 private_gen[key] = value
-        debug(_("loading general private values [namespace: %s] from database") % (namespace,))
-        d = self.dbpool.runQuery("SELECT key,value FROM private_gen WHERE namespace=?", (namespace,)).addCallback(fillPrivates)
+        debug(_("loading general private values [namespace: %s] from database") % (namespace, ))
+        d = self.dbpool.runQuery("SELECT key,value FROM private_gen WHERE namespace=?", (namespace, )).addCallback(fillPrivates)
         return d.addErrback(lambda x: debug(_("No data present in database for namespace %s") % namespace))
 
     def loadIndPrivates(self, private_ind, namespace, profile):
@@ -257,11 +257,12 @@
         @param namespace: namespace of the values
         @param profile: a profile which *must* exist
         @return: deferred"""
+
         def fillPrivates(result):
             for private in result:
-                key,value = private
+                key, value = private
                 private_ind[key] = value
-        debug(_("loading individual private values [namespace: %s] from database") % (namespace,))
+        debug(_("loading individual private values [namespace: %s] from database") % (namespace, ))
         d = self.dbpool.runQuery("SELECT key,value FROM private_ind WHERE namespace=? AND profile_id=?", (namespace, self.profiles[profile]))
         d.addCallback(fillPrivates)
         return d.addErrback(lambda x: debug(_("No data present in database for namespace %s") % namespace))
@@ -272,9 +273,9 @@
         @param key: key of the private value
         @param value: value to set
         @return: deferred"""
-        d = self.dbpool.runQuery("REPLACE INTO private_gen(namespace,key,value) VALUES (?,?,?)", (namespace,key,value))
+        d = self.dbpool.runQuery("REPLACE INTO private_gen(namespace,key,value) VALUES (?,?,?)", (namespace, key, value))
         d.addErrback(lambda ignore: error(_("Can't set general private value (%(key)s) [namespace:%(namespace)s] in database" %
-                     {"namespace":namespace, "key":key})))
+                     {"namespace": namespace, "key": key})))
         return d
 
     def setIndPrivate(self, namespace, key, value, profile):
@@ -286,7 +287,7 @@
         @return: deferred"""
         d = self.dbpool.runQuery("REPLACE INTO private_ind(namespace,key,profile_id,value) VALUES (?,?,?,?)", (namespace, key, self.profiles[profile], value))
         d.addErrback(lambda ignore: error(_("Can't set individual private value (%(key)s) [namespace: %(namespace)s] for [%(profile)s] in database" %
-                     {"namespace":namespace, "key":key, "profile":profile})))
+                     {"namespace": namespace, "key": key, "profile": profile})))
         return d
 
     def delGenPrivate(self, namespace, key):
@@ -294,9 +295,9 @@
         @param category: category of the privateeter
         @param key: key of the private value
         @return: deferred"""
-        d = self.dbpool.runQuery("DELETE FROM private_gen WHERE namespace=? AND key=?", (namespace,key))
+        d = self.dbpool.runQuery("DELETE FROM private_gen WHERE namespace=? AND key=?", (namespace, key))
         d.addErrback(lambda ignore: error(_("Can't delete general private value (%(key)s) [namespace:%(namespace)s] in database" %
-                     {"namespace":namespace, "key":key})))
+                     {"namespace": namespace, "key": key})))
         return d
 
     def delIndPrivate(self, namespace, key, profile):
@@ -307,21 +308,21 @@
         @return: deferred"""
         d = self.dbpool.runQuery("DELETE FROM private_ind WHERE namespace=? AND key=? AND profile=?)", (namespace, key, self.profiles[profile]))
         d.addErrback(lambda ignore: error(_("Can't delete individual private value (%(key)s) [namespace: %(namespace)s] for [%(profile)s] in database" %
-                     {"namespace":namespace, "key":key, "profile":profile})))
+                     {"namespace": namespace, "key": key, "profile": profile})))
         return d
 
-
     def loadGenPrivatesBinary(self, private_gen, namespace):
         """Load general private binary values
         @param private_gen: dictionary to fill
         @param namespace: namespace of the values
         @return: deferred"""
+
         def fillPrivates(result):
             for private in result:
-                key,value = private
+                key, value = private
                 private_gen[key] = pickle.loads(str(value))
-        debug(_("loading general private binary values [namespace: %s] from database") % (namespace,))
-        d = self.dbpool.runQuery("SELECT key,value FROM private_gen_bin WHERE namespace=?", (namespace,)).addCallback(fillPrivates)
+        debug(_("loading general private binary values [namespace: %s] from database") % (namespace, ))
+        d = self.dbpool.runQuery("SELECT key,value FROM private_gen_bin WHERE namespace=?", (namespace, )).addCallback(fillPrivates)
         return d.addErrback(lambda x: debug(_("No binary data present in database for namespace %s") % namespace))
 
     def loadIndPrivatesBinary(self, private_ind, namespace, profile):
@@ -330,11 +331,12 @@
         @param namespace: namespace of the values
         @param profile: a profile which *must* exist
         @return: deferred"""
+
         def fillPrivates(result):
             for private in result:
-                key,value = private
+                key, value = private
                 private_ind[key] = pickle.loads(str(value))
-        debug(_("loading individual private binary values [namespace: %s] from database") % (namespace,))
+        debug(_("loading individual private binary values [namespace: %s] from database") % (namespace, ))
         d = self.dbpool.runQuery("SELECT key,value FROM private_ind_bin WHERE namespace=? AND profile_id=?", (namespace, self.profiles[profile]))
         d.addCallback(fillPrivates)
         return d.addErrback(lambda x: debug(_("No binary data present in database for namespace %s") % namespace))
@@ -345,9 +347,9 @@
         @param key: key of the private value
         @param value: value to set
         @return: deferred"""
-        d = self.dbpool.runQuery("REPLACE INTO private_gen_bin(namespace,key,value) VALUES (?,?,?)", (namespace,key,pickle.dumps(value,0)))
+        d = self.dbpool.runQuery("REPLACE INTO private_gen_bin(namespace,key,value) VALUES (?,?,?)", (namespace, key, pickle.dumps(value, 0)))
         d.addErrback(lambda ignore: error(_("Can't set general private binary value (%(key)s) [namespace:%(namespace)s] in database" %
-                     {"namespace":namespace, "key":key})))
+                     {"namespace": namespace, "key": key})))
         return d
 
     def setIndPrivateBinary(self, namespace, key, value, profile):
@@ -357,9 +359,9 @@
         @param value: value to set
         @param profile: a profile which *must* exist
         @return: deferred"""
-        d = self.dbpool.runQuery("REPLACE INTO private_ind_bin(namespace,key,profile_id,value) VALUES (?,?,?,?)", (namespace, key, self.profiles[profile], pickle.dumps(value,0)))
+        d = self.dbpool.runQuery("REPLACE INTO private_ind_bin(namespace,key,profile_id,value) VALUES (?,?,?,?)", (namespace, key, self.profiles[profile], pickle.dumps(value, 0)))
         d.addErrback(lambda ignore: error(_("Can't set individual binary private value (%(key)s) [namespace: %(namespace)s] for [%(profile)s] in database" %
-                     {"namespace":namespace, "key":key, "profile":profile})))
+                     {"namespace": namespace, "key": key, "profile": profile})))
         return d
 
     def delGenPrivateBinary(self, namespace, key):
@@ -367,9 +369,9 @@
         @param category: category of the privateeter
         @param key: key of the private value
         @return: deferred"""
-        d = self.dbpool.runQuery("DELETE FROM private_gen_bin WHERE namespace=? AND key=?", (namespace,key))
+        d = self.dbpool.runQuery("DELETE FROM private_gen_bin WHERE namespace=? AND key=?", (namespace, key))
         d.addErrback(lambda ignore: error(_("Can't delete general private binary value (%(key)s) [namespace:%(namespace)s] in database" %
-                     {"namespace":namespace, "key":key})))
+                     {"namespace": namespace, "key": key})))
         return d
 
     def delIndPrivateBinary(self, namespace, key, profile):
@@ -380,7 +382,7 @@
         @return: deferred"""
         d = self.dbpool.runQuery("DELETE FROM private_ind_bin WHERE namespace=? AND key=? AND profile=?)", (namespace, key, self.profiles[profile]))
         d.addErrback(lambda ignore: error(_("Can't delete individual private binary value (%(key)s) [namespace: %(namespace)s] for [%(profile)s] in database" %
-                     {"namespace":namespace, "key":key, "profile":profile})))
+                     {"namespace": namespace, "key": key, "profile": profile})))
         return d
     ##Helper methods##
 
# HG changeset patch
# User Emmanuel Gil Peyrot <linkmauve at linkmauve.fr>
# Date 1358528135 -3600
# Node ID dd3179c7e02bc4fa112142a8825043d5a243cffd
# Parent  3d0dc1ba2e0a08f75d7bd5def535566de28d8b87
Fix pep8 support in src/plugins.

diff --git a/src/plugins/deprecated_misc_cs.py b/src/plugins/deprecated_misc_cs.py
--- a/src/plugins/deprecated_misc_cs.py
+++ b/src/plugins/deprecated_misc_cs.py
@@ -40,20 +40,20 @@
 from BeautifulSoup import BeautifulSoup
 import re
 
-
 PLUGIN_INFO = {
-"name": "CouchSurfing plugin",
-"import_name": "CS",
-"type": "Misc",
-"protocols": [],
-"dependencies": [],
-"main": "CS_Plugin",
-"handler": "no",
-"description": _(u"""This plugin allow to manage your CouchSurfing account throught your SàT frontend""")
+    "name": "CouchSurfing plugin",
+    "import_name": "CS",
+    "type": "Misc",
+    "protocols": [],
+    "dependencies": [],
+    "main": "CS_Plugin",
+    "handler": "no",
+    "description": _(u"""This plugin allow to manage your CouchSurfing account throught your SàT frontend""")
 }
 
 AGENT = 'Salut à Toi XMPP/CS Plugin'
 
+
 class CS_Plugin(object):
 
     params = """
@@ -73,16 +73,17 @@
         #parameters
         host.memory.importParams(CS_Plugin.params)
         #menu
-        host.importMenu(_("Plugin"), "CouchSurfing", self.menuSelected, help_string = _("Launch CoushSurfing management interface"))
-        self.data={} #TODO: delete cookies/data after a while
+        host.importMenu(_("Plugin"), "CouchSurfing", self.menuSelected, help_string=_("Launch CoushSurfing management interface"))
+        self.data = {}  # TODO: delete cookies/data after a while
         self.host.registerGeneralCB("plugin_CS_sendMessage", self.sendMessage)
         self.host.registerGeneralCB("plugin_CS_showUnreadMessages", self.showUnreadMessages)
 
     def profileConnected(self, profile):
         self.data[profile] = PersistentBinaryDict("plugin_CS", profile)
+
         def dataLoaded(ignore):
             if not self.data[profile]:
-                self.data[profile] = {'cookies':{}}
+                self.data[profile] = {'cookies': {}}
 
         self.data[profile].load().addCallback(dataLoaded)
 
@@ -92,7 +93,7 @@
     def erroCB(self, e, id):
         """Called when something is going wrong when contacting CS website"""
         #pdb.set_trace()
-        message_data={"reason": "connection error", "message":_(u"Impossible to contact CS website, please check your login/password, connection or try again later")}
+        message_data = {"reason": "connection error", "message": _(u"Impossible to contact CS website, please check your login/password, connection or try again later")}
         self.host.bridge.actionResult("ERROR", id, message_data)
 
     def menuSelected(self, id, profile):
@@ -100,24 +101,24 @@
         login = self.host.memory.getParamA("Login", "CouchSurfing", profile_key=profile)
         password = self.host.memory.getParamA("Password", "CouchSurfing", profile_key=profile)
         if not login or not password:
-            message_data={"reason": "uncomplete", "message":_(u"You have to fill your CouchSurfing login & password in parameters before using this interface")}
+            message_data = {"reason": "uncomplete", "message": _(u"You have to fill your CouchSurfing login & password in parameters before using this interface")}
             self.host.bridge.actionResult("ERROR", id, message_data)
             return
 
-        post_data = urllib.urlencode({'auth_login[un]':login,'auth_login[pw]':password,'auth_login[action]':'Login...'})
+        post_data = urllib.urlencode({'auth_login[un]': login, 'auth_login[pw]': password, 'auth_login[action]': 'Login...'})
 
         self.data[profile]['cookies'] = {}
 
-        d = getPage('http://www.couchsurfing.org/login.html', method='POST', postdata=post_data, headers={'Content-Type':'application/x-www-form-urlencoded'} , agent=AGENT, cookies=self.data[profile]['cookies'])
+        d = getPage('http://www.couchsurfing.org/login.html', method='POST', postdata=post_data, headers={'Content-Type': 'application/x-www-form-urlencoded'}, agent=AGENT, cookies=self.data[profile]['cookies'])
         d.addCallback(self.__connectionCB, id, profile)
         d.addErrback(self.erroCB, id)
 
         #self.host.bridge.actionResult("SUPPRESS", id, {})
 
+#pages parsing callbacks
 
-#pages parsing callbacks
     def savePage(self, name, html):
-        f = open ('/tmp/CS_'+name+'.html','w')
+        f = open('/tmp/CS_' + name + '.html', 'w')
         f.write(html)
         f.close()
         print "page [%s] sauvee" % name
@@ -127,27 +128,27 @@
         print 'Response received'
         #self.savePage('principale',html)
         soup = BeautifulSoup(html)
-        self.data[profile]['user_nick'] = soup.find('a','item_link',href='/home.html').contents[0]
+        self.data[profile]['user_nick'] = soup.find('a', 'item_link', href='/home.html').contents[0]
         self.data[profile]['user_name'] = soup.html.head.title.string.split(' - ')[1]
         #unread messages
         try:
-            self.data[profile]['unread_messages'] = int(soup.find(lambda tag: tag.name=='div' and ('class','item_bubble') in tag.attrs and tag.find('a', href="/messages.html?message_status=inbox")).find(text=True))
+            self.data[profile]['unread_messages'] = int(soup.find(lambda tag: tag.name == 'div' and ('class', 'item_bubble') in tag.attrs and tag.find('a', href="/messages.html?message_status=inbox")).find(text=True))
         except:
             self.data[profile]['unread_messages'] = 0
         #unread couchrequest messages
         try:
-            self.data[profile]['unread_CR_messages'] = int(soup.find(lambda tag: tag.name=='div' and ('class','item_bubble') in tag.attrs and tag.find('a', href="/couchmanager")).find(text=True))
+            self.data[profile]['unread_CR_messages'] = int(soup.find(lambda tag: tag.name == 'div' and ('class', 'item_bubble') in tag.attrs and tag.find('a', href="/couchmanager")).find(text=True))
         except:
             self.data[profile]['unread_CR_messages'] = 0
 
         #if we have already the list of friend, no need to make new requests
-        if not self.data[profile].has_key('friends'):
+        if 'friends' not in self.data[profile]:
             self.data[profile]['friends'] = {}
             d = getPage('http://www.couchsurfing.org/connections.html?type=myfriends&show=10000', agent=AGENT, cookies=self.data[profile]['cookies'])
             d.addCallback(self.__friendsPageCB, id=id, profile=profile)
             d.addErrback(self.erroCB, id)
         else:
-            self.host.bridge.actionResult("XMLUI", id, {"type":"window", "xml":self.__buildUI(self.data[profile])})
+            self.host.bridge.actionResult("XMLUI", id, {"type": "window", "xml": self.__buildUI(self.data[profile])})
 
     def __buildUI(self, data):
         """Build the XML UI of the plugin
@@ -158,11 +159,11 @@
         unread_CR_mess = data['unread_CR_messages']
         friends_list = data['friends'].keys()
         friends_list.sort()
-        interface = XMLUI('window','tabs', title='CouchSurfing management')
+        interface = XMLUI('window', 'tabs', title='CouchSurfing management')
         interface.addCategory(_("Messages"), "vertical")
-        interface.addText(_("G'day %(name)s, you have %(nb_message)i unread message%(plural_mess)s and %(unread_CR_mess)s unread couch request message%(plural_CR)s\nIf you want to send a message, select the recipient(s) in the list below") % {'name':user_name, 'nb_message':unread_mess, 'plural_mess':'s' if unread_mess>1 else '', 'unread_CR_mess': unread_CR_mess, 'plural_CR':'s' if unread_CR_mess>1 else ''})
+        interface.addText(_("G'day %(name)s, you have %(nb_message)i unread message%(plural_mess)s and %(unread_CR_mess)s unread couch request message%(plural_CR)s\nIf you want to send a message, select the recipient(s) in the list below") % {'name': user_name, 'nb_message': unread_mess, 'plural_mess': 's' if unread_mess > 1 else '', 'unread_CR_mess': unread_CR_mess, 'plural_CR': 's' if unread_CR_mess > 1 else ''})
         if unread_mess:
-            interface.addButton('plugin_CS_showUnreadMessages', 'showUnreadMessages', _('Show unread message%(plural)s in external web browser') % {'plural':'s' if unread_mess>1 else ''})
+            interface.addButton('plugin_CS_showUnreadMessages', 'showUnreadMessages', _('Show unread message%(plural)s in external web browser') % {'plural': 's' if unread_mess > 1 else ''})
         interface.addList(friends_list, 'friends', style=['multi'])
         interface.changeLayout('pairs')
         interface.addLabel(_("Subject"))
@@ -171,7 +172,7 @@
         interface.addLabel(_("Message"))
         interface.addText("(use %name% for contact name and %firstname% for guessed first name)")
         interface.addTextBox('message')
-        interface.addButton('plugin_CS_sendMessage', 'sendMessage', _('send'), fields_back=['friends','subject','message'])
+        interface.addButton('plugin_CS_sendMessage', 'sendMessage', _('send'), fields_back=['friends', 'subject', 'message'])
         #interface.addCategory(_("Events"), "vertical") #TODO: coming soon, hopefuly :)
         #interface.addCategory(_("Couch search"), "vertical")
         return interface.toXml()
@@ -181,28 +182,28 @@
 
     def __friendsPageCB(self, html, id, profile):
         """Called when the friends list page has been received"""
-        self.savePage('friends',html)
-        soup = BeautifulSoup(html.replace('"formtable width="400','"formtable" width="400"')) #CS html fix #TODO: report the bug to CS dev team
+        self.savePage('friends', html)
+        soup = BeautifulSoup(html.replace('"formtable width="400', '"formtable" width="400"'))  # CS html fix #TODO: report the bug to CS dev team
         friends = self.data[profile]['friends']
-        for _tr in soup.findAll('tr', {'class':re.compile("^msgRow*")}): #we parse the row with friends infos
-            _nobr = _tr.find('nobr')  #contain the friend name
+        for _tr in soup.findAll('tr', {'class': re.compile("^msgRow*")}):  # we parse the row with friends infos
+            _nobr = _tr.find('nobr')  # contain the friend name
             friend_name = unicode(_nobr.string)
-            friend_link = u'http://www.couchsurfing.org'+_nobr.parent['href']
+            friend_link = u'http://www.couchsurfing.org' + _nobr.parent['href']
             regex_href = re.compile(r'/connections\.html\?id=([^&]+)')
-            a_tag = _tr.find('a',href=regex_href)
+            a_tag = _tr.find('a', href=regex_href)
             friend_id = regex_href.search(unicode(a_tag)).groups()[0]
 
-            debug(_("CS friend found: %(friend_name)s (id: %(friend_id)s, link: %(friend_link)s)") % {'friend_name':friend_name, 'friend_id':friend_id, 'friend_link':friend_link})
-            friends[friend_name] = {'link':friend_link,'id':friend_id}
-        a = soup.find('td','barmiddle next').a  #is there several pages ?
+            debug(_("CS friend found: %(friend_name)s (id: %(friend_id)s, link: %(friend_link)s)") % {'friend_name': friend_name, 'friend_id': friend_id, 'friend_link': friend_link})
+            friends[friend_name] = {'link': friend_link, 'id': friend_id}
+        a = soup.find('td', 'barmiddle next').a  # is there several pages ?
         if a:
             #yes, we parse the next page
-            d = getPage('http://www.couchsurfing.org/'+str(a['href']), agent=AGENT, cookies=self.data[profile]['cookies'])
+            d = getPage('http://www.couchsurfing.org/' + str(a['href']), agent=AGENT, cookies=self.data[profile]['cookies'])
             d.addCallback(self.__friendsPageCB, id=id, profile=profile)
             d.addErrback(self.erroCB, id)
         else:
             #no, we show the result
-            self.host.bridge.actionResult("XMLUI", id, {"type":"window", "xml":self.__buildUI(self.data[profile])})
+            self.host.bridge.actionResult("XMLUI", id, {"type": "window", "xml": self.__buildUI(self.data[profile])})
 
     def __sendMessage(self, answer, subject, message, data, recipient_list, id, profile):
         """Send actually the message
@@ -224,18 +225,18 @@
                 friend_id = data['friends'][recipient]['id']
             except KeyError:
                 error('INTERNAL ERROR: unknown friend')
-                return  #send an error to the frontend
-            mess = message.replace('%name%',recipient).replace('%firstname%',recipient.split(' ')[0])
+                return  # send an error to the frontend
+            mess = message.replace('%name%', recipient).replace('%firstname%', recipient.split(' ')[0])
             info(_('Sending message to %s') % recipient)
-            debug(_("\nsubject: %(subject)s\nmessage: \n---\n%(message)s\n---\n\n") % {'subject':subject,'message':mess})
-            post_data = urllib.urlencode({'email[subject]':subject.encode('utf-8'),'email[body]':mess.encode('utf-8'),'email[id]':friend_id,'email[action]':'Send Message','email[replied_id]':'','email[couchsurf]':'','email[directions_to_add]':''})
-            d = getPage("http://www.couchsurfing.org/send_message.html", method='POST', postdata=post_data, headers={'Content-Type':'application/x-www-form-urlencoded'} , agent=AGENT, cookies=data['cookies'])
+            debug(_("\nsubject: %(subject)s\nmessage: \n---\n%(message)s\n---\n\n") % {'subject': subject, 'message': mess})
+            post_data = urllib.urlencode({'email[subject]': subject.encode('utf-8'), 'email[body]': mess.encode('utf-8'), 'email[id]': friend_id, 'email[action]': 'Send Message', 'email[replied_id]': '', 'email[couchsurf]': '', 'email[directions_to_add]': ''})
+            d = getPage("http://www.couchsurfing.org/send_message.html", method='POST', postdata=post_data, headers={'Content-Type': 'application/x-www-form-urlencoded'}, agent=AGENT, cookies=data['cookies'])
             d.addCallback(self.__sendMessage, subject, message, data, recipient_list, id, profile)
             d.addErrback(self.erroCB, id)
         else:
-            interface = XMLUI('window', title=_('Message sent')) #TODO: create particular actionResult for alerts ?
+            interface = XMLUI('window', title=_('Message sent'))  # TODO: create particular actionResult for alerts ?
             interface.addText(_('The message has been sent to every recipients'))
-            self.host.bridge.actionResult("XMLUI", id, {"type":"window", "xml":interface.toXml()})
+            self.host.bridge.actionResult("XMLUI", id, {"type": "window", "xml": interface.toXml()})
 
     def sendMessage(self, id, data, profile):
         """Called to send a message to a friend
@@ -247,26 +248,25 @@
                 - %firstname%: guessed first name of the friend (currently the first part of the name)
         """
         if not data['friends']:
-            message_data={"reason": "bad data", "message":_(u"There is not recipient selected for this message !")}
+            message_data = {"reason": "bad data", "message": _(u"There is not recipient selected for this message !")}
             self.host.bridge.actionResult("ERROR", id, message_data)
             return
         friends = data['friends'].split('\t')
         subject = data['subject']
         message = data['message']
-        info(_("sending message to %(friends)s with subject [%(subject)s]" % {'friends':friends, 'subject':subject}))
+        info(_("sending message to %(friends)s with subject [%(subject)s]" % {'friends': friends, 'subject': subject}))
         self.__sendMessage(None, subject, message, self.data[profile], friends, id, profile)
 
     def __showUnreadMessages2(self, html, id, profile):
         """Called when the inbox page has been received"""
         #FIXME: that's really too fragile, only works if the unread messages are in the first page, and it would be too resources consuming for the website to DL each time all pages. In addition, the show attribute doesn't work as expected.
         soup = BeautifulSoup(html)
-        for tag in soup.findAll(lambda tag: tag.name=='strong' and tag.a and tag.a['href'].startswith('messages.html?message_status=inbox')):
-            link = "http://www.couchsurfing.org/"+str(tag.a['href'])
-            webbrowser.open_new_tab(link) #TODO: the web browser need to already have CS cookies (i.e. already be opened & logged on CS, or be permanently loggued), a warning to the user should be sent/or a balloon-tip
+        for tag in soup.findAll(lambda tag: tag.name == 'strong' and tag.a and tag.a['href'].startswith('messages.html?message_status=inbox')):
+            link = "http://www.couchsurfing.org/" + str(tag.a['href'])
+            webbrowser.open_new_tab(link)  # TODO: the web browser need to already have CS cookies (i.e. already be opened & logged on CS, or be permanently loggued), a warning to the user should be sent/or a balloon-tip
 
     def showUnreadMessages(self, id, data, profile):
         """Called when user want to see all unread messages in the external browser"""
         d = getPage("http://www.couchsurfing.org/messages.html?message_status=inbox&show=10000", agent=AGENT, cookies=self.data[profile]['cookies'])
         d.addCallback(self.__showUnreadMessages2, id, profile)
         d.addErrback(self.erroCB, id)
-
diff --git a/src/plugins/plugin_exp_parrot.py b/src/plugins/plugin_exp_parrot.py
--- a/src/plugins/plugin_exp_parrot.py
+++ b/src/plugins/plugin_exp_parrot.py
@@ -22,21 +22,21 @@
 from logging import debug, info, warning, error
 from twisted.words.protocols.jabber import jid
 
-
 from sat.core.exceptions import UnknownEntityError
 from sat.tools.misc import SkipOtherTriggers
 
 PLUGIN_INFO = {
-"name": "Parrot Plugin",
-"import_name": "EXP-PARROT",
-"type": "EXP",
-"protocols": [],
-"dependencies": ["XEP-0045"],
-"main": "Exp_Parrot",
-"handler": "no",
-"description": _("""Implementation of parrot mode (repeat messages between 2 entities)""")
+    "name": "Parrot Plugin",
+    "import_name": "EXP-PARROT",
+    "type": "EXP",
+    "protocols": [],
+    "dependencies": ["XEP-0045"],
+    "main": "Exp_Parrot",
+    "handler": "no",
+    "description": _("""Implementation of parrot mode (repeat messages between 2 entities)""")
 }
 
+
 class Exp_Parrot(object):
     """Parrot mode plugin: repeat messages from one entity or MUC room to another one"""
     #XXX: This plugin can be potentially dangerous if we don't trust entities linked
@@ -123,5 +123,3 @@
             del client.parrot_links[source_jid.userhostJID()]
         except (AttributeError, KeyError):
             pass
-
-
diff --git a/src/plugins/plugin_exp_pipe.py b/src/plugins/plugin_exp_pipe.py
--- a/src/plugins/plugin_exp_pipe.py
+++ b/src/plugins/plugin_exp_pipe.py
@@ -23,7 +23,7 @@
 from twisted.words.xish import domish
 from twisted.words.protocols.jabber import jid
 from twisted.words.protocols.jabber import error as jab_error
-import os, os.path
+import os
 from twisted.internet import reactor
 from sat.core.exceptions import ProfileNotInCacheError
 
@@ -34,16 +34,17 @@
 PROFILE = "http://jabber.org/protocol/si/profile/" + PROFILE_NAME
 
 PLUGIN_INFO = {
-"name": "Pipe Plugin",
-"import_name": "EXP-PIPE",
-"type": "EXP",
-"protocols": ["EXP-PIPE"],
-"dependencies": ["XEP-0020", "XEP-0095", "XEP-0065", "XEP-0047"],
-"main": "Exp_Pipe",
-"handler": "no",
-"description": _("""Implementation of SI Pipe Transfer""")
+    "name": "Pipe Plugin",
+    "import_name": "EXP-PIPE",
+    "type": "EXP",
+    "protocols": ["EXP-PIPE"],
+    "dependencies": ["XEP-0020", "XEP-0095", "XEP-0065", "XEP-0047"],
+    "main": "Exp_Pipe",
+    "handler": "no",
+    "description": _("""Implementation of SI Pipe Transfer""")
 }
 
+
 class Exp_Pipe(object):
     """This is a modified version of XEP-0096 to work with named pipes instead of files"""
 
@@ -51,13 +52,13 @@
         info(_("Plugin Pipe initialization"))
         self.host = host
         self.managed_stream_m = [self.host.plugins["XEP-0065"].NAMESPACE,
-                                 self.host.plugins["XEP-0047"].NAMESPACE] #Stream methods managed
+                                 self.host.plugins["XEP-0047"].NAMESPACE]  # Stream methods managed
         self.host.plugins["XEP-0095"].registerSIProfile(PROFILE_NAME, self.transferRequest)
         host.bridge.addMethod("pipeOut", ".plugin", in_sign='ssa{ss}s', out_sign='s', method=self.pipeOut)
 
     def profileConnected(self, profile):
         client = self.host.getClient(profile)
-        client._pipe_waiting_for_approval = {} #key = id, value = [transfer data, IdelayedCall Reactor timeout,
+        client._pipe_waiting_for_approval = {}  # key = id, value = [transfer data, IdelayedCall Reactor timeout,
                                         # current stream method, [failed stream methods], profile]
 
     def _kill_id(self, approval_id, profile):
@@ -78,7 +79,7 @@
         @param si_mime_type: Mime type of the pipe (or default "application/octet-stream" if unknown)
         @param si_el: domish.Element of the request
         @param profile: %(doc_profile)s"""
-        info (_("EXP-PIPE file transfer requested"))
+        info(_("EXP-PIPE file transfer requested"))
         debug(si_el.toXml())
         client = self.host.getClient(profile)
         if not client:
@@ -95,7 +96,7 @@
             feature_el = feature_elts[0]
             form = data_form.Form.fromElement(feature_el.firstChildElement())
             try:
-                stream_method = self.host.plugins["XEP-0020"].negociate(feature_el, 'stream-method',self.managed_stream_m)
+                stream_method = self.host.plugins["XEP-0020"].negociate(feature_el, 'stream-method', self.managed_stream_m)
             except KeyError:
                 warning(_("No stream method found"))
                 self.host.plugins["XEP-0095"].sendBadRequestError(iq_id, from_jid, profile)
@@ -110,12 +111,11 @@
             return
 
         #if we are here, the transfer can start, we just need user's agreement
-        data={ "id": iq_id, "from":from_jid }
+        data = {"id": iq_id, "from": from_jid}
         client._pipe_waiting_for_approval[si_id] = [data, reactor.callLater(300, self._kill_id, si_id), stream_method, [], profile]
 
         self.host.askConfirmation(si_id, "PIPE_TRANSFER", data, self.confirmationCB, profile)
 
-
     def confirmationCB(self, sid, accepted, frontend_data, profile):
         """Called on confirmation answer
         @param sid: file transfer session id
@@ -146,13 +146,13 @@
                 return
 
             #we can send the iq result
-            feature_elt = self.host.plugins["XEP-0020"].chooseOption({'stream-method':stream_method})
+            feature_elt = self.host.plugins["XEP-0020"].chooseOption({'stream-method': stream_method})
             misc_elts = []
             misc_elts.append(domish.Element((PROFILE, "file")))
             self.host.plugins["XEP-0095"].acceptStream(data["id"], data['from'], feature_elt, misc_elts, profile)
         else:
-            debug (_("Transfer [%s] refused"), sid)
-            self.host.plugins["XEP-0095"].sendRejectedError (data["id"], data['from'], profile=profile)
+            debug(_("Transfer [%s] refused"), sid)
+            self.host.plugins["XEP-0095"].sendRejectedError(data["id"], data['from'], profile=profile)
             del(client._pipe_waiting_for_approval[sid])
 
     def _transferSucceeded(self, sid, file_obj, stream_method, profile):
@@ -173,8 +173,8 @@
         if not client:
             raise ProfileNotInCacheError
         data, timeout, stream_method, failed_methods, profile = client._pipe_waiting_for_approval[sid]
-        warning(_('Transfer %(id)s failed with stream method %(s_method)s') % { 'id': sid,
-                                                                                 's_method': stream_method })
+        warning(_('Transfer %(id)s failed with stream method %(s_method)s') % {'id': sid,
+                                                                               's_method': stream_method})
         filepath = file_obj.name
         file_obj.close()
         #TODO: session remenber (within a time limit) when a stream method fail, and avoid that stream method with full jid for the rest of the session
@@ -211,15 +211,15 @@
             return
 
         if stream_method == self.host.plugins["XEP-0065"].NAMESPACE:
-           #fd = os.open(filepath, os.O_RDONLY | os.O_NONBLOCK) #XXX: non blocking openingl cause issues with XEP-0065's FileSender
-           #file_obj = os.fdopen(fd, 'r')
-           file_obj = open(filepath, 'r') #XXX: we have to be sure that filepath is well opened, as reading can block it
-           self.host.plugins["XEP-0065"].startStream(file_obj, jid.JID(IQ['from']), sid, None, self.sendSuccessCb, self.sendFailureCb, None, profile)
+            #fd = os.open(filepath, os.O_RDONLY | os.O_NONBLOCK) #XXX: non blocking openingl cause issues with XEP-0065's FileSender
+            #file_obj = os.fdopen(fd, 'r')
+            file_obj = open(filepath, 'r')  # XXX: we have to be sure that filepath is well opened, as reading can block it
+            self.host.plugins["XEP-0065"].startStream(file_obj, jid.JID(IQ['from']), sid, None, self.sendSuccessCb, self.sendFailureCb, None, profile)
         elif stream_method == self.host.plugins["XEP-0047"].NAMESPACE:
-           #fd = os.open(filepath, os.O_RDONLY | os.O_NONBLOCK) #XXX: non blocking openingl cause issues with XEP-0065's FileSender
-           #file_obj = os.fdopen(fd, 'r')
-           file_obj = open(filepath, 'r') #XXX: we have to be sure that filepath is well opened, as reading can block it
-           self.host.plugins["XEP-0047"].startStream(file_obj, jid.JID(IQ['from']), sid, None, self.sendSuccessCb, self.sendFailureCb, None, profile)
+            #fd = os.open(filepath, os.O_RDONLY | os.O_NONBLOCK) #XXX: non blocking openingl cause issues with XEP-0065's FileSender
+            #file_obj = os.fdopen(fd, 'r')
+            file_obj = open(filepath, 'r')  # XXX: we have to be sure that filepath is well opened, as reading can block it
+            self.host.plugins["XEP-0047"].startStream(file_obj, jid.JID(IQ['from']), sid, None, self.sendSuccessCb, self.sendFailureCb, None, profile)
         else:
             warning(_("Invalid stream method received"))
 
@@ -242,7 +242,7 @@
         pipe_elt = domish.Element((PROFILE, 'pipe'))
         pipe_transfer_elts.append(pipe_elt)
 
-        sid, offer = self.host.plugins["XEP-0095"].proposeStream(jid.JID(to_jid), PROFILE, feature_elt, pipe_transfer_elts, profile_key = profile)
+        sid, offer = self.host.plugins["XEP-0095"].proposeStream(jid.JID(to_jid), PROFILE, feature_elt, pipe_transfer_elts, profile_key=profile)
         offer.addCallback(self.pipeCb, filepath, sid, profile)
         return sid
 
@@ -252,5 +252,4 @@
 
     def sendFailureCb(self, sid, file_obj, stream_method, reason, profile):
         file_obj.close()
-        warning(_('Transfer %(id)s failed with stream method %(s_method)s %(profile)s') % { 'id': sid, "s_method": stream_method, "profile": profile })
-
+        warning(_('Transfer %(id)s failed with stream method %(s_method)s %(profile)s') % {'id': sid, "s_method": stream_method, "profile": profile})
diff --git a/src/plugins/plugin_misc_account.py b/src/plugins/plugin_misc_account.py
--- a/src/plugins/plugin_misc_account.py
+++ b/src/plugins/plugin_misc_account.py
@@ -28,14 +28,14 @@
 from twisted.mail.smtp import sendmail
 
 PLUGIN_INFO = {
-"name": "Account Plugin",
-"import_name": "MISC-ACCOUNT",
-"type": "MISC",
-"protocols": [],
-"dependencies": [],
-"main": "MiscAccount",
-"handler": "no",
-"description": _(u"""SàT account creation""")
+    "name": "Account Plugin",
+    "import_name": "MISC-ACCOUNT",
+    "type": "MISC",
+    "protocols": [],
+    "dependencies": [],
+    "main": "MiscAccount",
+    "handler": "no",
+    "description": _(u"""SàT account creation""")
 }
 
 #You need do adapt the following consts to your server
@@ -45,24 +45,24 @@
 _NEW_ACCOUNT_SERVER = "localhost"
 _NEW_ACCOUNT_DOMAIN = "example.net"
 _NEW_ACCOUNT_RESOURCE = "libervia"
-_PROSODY_PATH = None #prosody path (where prosodyctl will be executed from), or None to automaticaly find it
+_PROSODY_PATH = None  # prosody path (where prosodyctl will be executed from), or None to automaticaly find it
 _PROSODYCTL = "prosodyctl"
 
 RESERVED = ['libervia']
 
+
 class ProsodyRegisterProtocol(protocol.ProcessProtocol):
     """ Try to register an account with prosody """
 
-    def __init__(self, password, deferred = None):
+    def __init__(self, password, deferred=None):
         self.password = password
         self.deferred = deferred
         self.data = ''
 
     def connectionMade(self):
-        self.transport.write("%s\n%s" % ((self.password.encode('utf-8'),)*2))
+        self.transport.write("%s\n%s" % ((self.password.encode('utf-8'), ) * 2))
         self.transport.closeStdin()
 
-
     def outReceived(self, data):
         self.data += data
 
@@ -87,14 +87,14 @@
     def __init__(self, host):
         info(_(u"Plugin Account initialization"))
         self.host = host
-        host.bridge.addMethod("registerSatAccount", ".plugin", in_sign='sss', out_sign='', method=self._registerAccount, async = True)
+        host.bridge.addMethod("registerSatAccount", ".plugin", in_sign='sss', out_sign='', method=self._registerAccount, async=True)
         if not self._prosody_path:
             paths = which(_PROSODYCTL)
             if not paths:
-                error(_("Can't find %s") % (_PROSODYCTL,))
+                error(_("Can't find %s") % (_PROSODYCTL, ))
             else:
                 self._prosody_path = dirname(paths[0])
-                info(_('Prosody path found: %s') % (self._prosody_path,))
+                info(_('Prosody path found: %s') % (self._prosody_path, ))
 
     def _registerAccount(self, email, password, profile):
 
@@ -128,7 +128,7 @@
         #     and just change the password if the account already exists
         d = defer.Deferred()
         prosody_reg = ProsodyRegisterProtocol(password, d)
-        prosody_exe = join (self._prosody_path, _PROSODYCTL)
+        prosody_exe = join(self._prosody_path, _PROSODYCTL)
         reactor.spawnProcess(prosody_reg, prosody_exe, [prosody_exe, 'adduser', "%s@%s" % (profile, _NEW_ACCOUNT_DOMAIN)], path=self._prosody_path)
 
         d.addCallback(self._accountCreated, profile, email, password)
@@ -145,7 +145,7 @@
 
         def email_ko(ignore):
             #TODO: return error code to user
-            error ("Failed to send email to %s" % email)
+            error("Failed to send email to %s" % email)
 
         body = (u"""Welcome to Libervia, a Salut à Toi project part
 
@@ -165,7 +165,7 @@
 Any feedback welcome
 
 Cheers
-Goffi""" % { 'login': login, 'password': password, 'jid':"%s@%s" % (login, _NEW_ACCOUNT_DOMAIN) }).encode('utf-8')
+Goffi""" % {'login': login, 'password': password, 'jid': "%s@%s" % (login, _NEW_ACCOUNT_DOMAIN)}).encode('utf-8')
         msg = MIMEText(body, 'plain', 'UTF-8')
         msg['Subject'] = 'Libervia account created'
         msg['From'] = _email_from
@@ -173,10 +173,9 @@
 
         d = sendmail(_email_host, _email_from, email, msg.as_string())
         d.addCallbacks(email_ok, email_ko)
-
         #email to the administrator
 
-        body = (u"""New account created: %(login)s [%(email)s]""" % { 'login': login, 'email': email }).encode('utf-8')
+        body = (u"""New account created: %(login)s [%(email)s]""" % {'login': login, 'email': email}).encode('utf-8')
         msg = MIMEText(body, 'plain', 'UTF-8')
         msg['Subject'] = 'Libervia new account created'
         msg['From'] = _email_from
diff --git a/src/plugins/plugin_misc_groupblog.py b/src/plugins/plugin_misc_groupblog.py
--- a/src/plugins/plugin_misc_groupblog.py
+++ b/src/plugins/plugin_misc_groupblog.py
@@ -36,7 +36,7 @@
 NS_GROUPBLOG = 'http://goffi.org/protocol/groupblog'
 NS_NODE_PREFIX = 'urn:xmpp:groupblog:'
 #NS_PUBSUB_EXP = 'http://goffi.org/protocol/pubsub' #for non official features
-NS_PUBSUB_EXP = NS_PUBSUB #XXX: we can't use custom namespace as Wokkel's PubSubService use official NS
+NS_PUBSUB_EXP = NS_PUBSUB  # XXX: we can't use custom namespace as Wokkel's PubSubService use official NS
 NS_PUBSUB_ITEM_ACCESS = NS_PUBSUB_EXP + "#item-access"
 NS_PUBSUB_CREATOR_JID_CHECK = NS_PUBSUB_EXP + "#creator-jid-check"
 NS_PUBSUB_ITEM_CONFIG = NS_PUBSUB_EXP + "#item-config"
@@ -51,28 +51,33 @@
 TYPE_COLLECTION = 'collection'
 
 PLUGIN_INFO = {
-"name": "Group blogging throught collections",
-"import_name": "groupblog",
-"type": "MISC",
-"protocols": [],
-"dependencies": ["XEP-0277"],
-"main": "GroupBlog",
-"handler": "yes",
-"description": _("""Implementation of microblogging with roster access""")
+    "name": "Group blogging throught collections",
+    "import_name": "groupblog",
+    "type": "MISC",
+    "protocols": [],
+    "dependencies": ["XEP-0277"],
+    "main": "GroupBlog",
+    "handler": "yes",
+    "description": _("""Implementation of microblogging with roster access""")
 }
 
+
 class NoCompatiblePubSubServerFound(Exception):
     pass
 
+
 class BadAccessTypeError(Exception):
     pass
 
+
 class BadAccessListError(Exception):
     pass
 
+
 class UnknownType(Exception):
     pass
 
+
 class GroupBlog(object):
     """This class use a SàT PubSub Service to manage access on microblog"""
 
@@ -81,29 +86,28 @@
         self.host = host
 
         host.bridge.addMethod("sendGroupBlog", ".plugin", in_sign='sasss', out_sign='',
-                               method=self.sendGroupBlog)
+                              method=self.sendGroupBlog)
 
         host.bridge.addMethod("getLastGroupBlogs", ".plugin",
                               in_sign='sis', out_sign='aa{ss}',
                               method=self.getLastGroupBlogs,
-                              async = True)
+                              async=True)
 
         host.bridge.addMethod("getMassiveLastGroupBlogs", ".plugin",
                               in_sign='sasis', out_sign='a{saa{ss}}',
                               method=self.getMassiveLastGroupBlogs,
-                              async = True)
+                              async=True)
 
         host.bridge.addMethod("subscribeGroupBlog", ".plugin", in_sign='ss', out_sign='',
-                               method=self.subscribeGroupBlog,
-                               async = True)
+                              method=self.subscribeGroupBlog,
+                              async=True)
 
         host.bridge.addMethod("massiveSubscribeGroupBlogs", ".plugin", in_sign='sass', out_sign='',
-                               method=self.massiveSubscribeGroupBlogs,
-                               async = True)
+                              method=self.massiveSubscribeGroupBlogs,
+                              async=True)
 
         host.trigger.add("PubSubItemsReceived", self.pubSubItemsReceivedTrigger)
 
-
     def getHandler(self, profile):
         return GroupBlog_handler()
 
@@ -121,10 +125,10 @@
         if not client:
             error(_('No client for this profile key: %s') % profile_key)
             raise Exception("Unknown profile")
-        yield client.client_initialized #we want to be sure that the client is initialized
+        yield client.client_initialized  # we want to be sure that the client is initialized
 
         #we first check that we have a item-access pubsub server
-        if not hasattr(client,"item_access_pubsub"):
+        if not hasattr(client, "item_access_pubsub"):
             debug(_('Looking for item-access power pubsub server'))
             #we don't have any pubsub server featuring item access yet
             client.item_access_pubsub = None
@@ -137,7 +141,7 @@
                     client.item_access_pubsub = entity
             client._item_access_pubsub_pending.callback(None)
 
-        if hasattr(client,"_item_access_pubsub_pending"):
+        if hasattr(client, "_item_access_pubsub_pending"):
             #XXX: we need to wait for item access pubsub service check
             yield client._item_access_pubsub_pending
             del client._item_access_pubsub_pending
@@ -157,8 +161,8 @@
             #FIXME: basic origin check, must be improved
             #TODO: automatic security test
             if (not (origin_host)
-                or len(event_host) < len(origin_host)
-                or event_host[-len(origin_host):] != origin_host):
+                    or len(event_host) < len(origin_host)
+                    or event_host[-len(origin_host):] != origin_host):
                 warning("Host incoherence between %s and %s (hack attempt ?)" % (unicode(event.sender),
                                                                                  unicode(publisher)))
                 return
@@ -169,7 +173,6 @@
             return False
         return True
 
-
     def _parseAccessData(self, microblog_data, item):
         form_elts = filter(lambda elt: elt.name == "x", item.children)
         for form_elt in form_elts:
@@ -192,15 +195,12 @@
         self._parseAccessData(microblog_data, item)
         return microblog_data
 
-
     def getNodeName(self, publisher):
         """Retrieve the name of publisher's node
         @param publisher: publisher's jid
         @return: node's name (string)"""
         return NS_NODE_PREFIX + publisher.userhost()
 
-
-
     def _publishMblog(self, service, client, access_type, access_list, message):
         """Actually publish the message on the group blog
         @param service: jid of the item-access pubsub service
@@ -209,7 +209,7 @@
         @param access_list: set of entities (empty list for all, groups or jids) allowed to see the item
         @param message: message to publish
         """
-        mblog_item = self.host.plugins["XEP-0277"].data2entry({'content':message}, client.profile)
+        mblog_item = self.host.plugins["XEP-0277"].data2entry({'content': message}, client.profile)
         form = data_form.Form('submit', formNamespace=NS_PUBSUB_ITEM_CONFIG)
         if access_type == "PUBLIC":
             if access_list:
@@ -243,6 +243,7 @@
         @profile_key: %(doc_profile)s
         """
         print "sendGroupBlog"
+
         def initialised(result):
             profile, client = result
             if access_type == "PUBLIC":
@@ -250,7 +251,7 @@
                     raise Exception("Publishers list must be empty when getting microblogs for all contacts")
                 self._publishMblog(client.item_access_pubsub, client, "PUBLIC", [], message)
             elif access_type == "GROUP":
-                _groups = set(access_list).intersection(client.roster.getGroups()) #We only keep group which actually exist
+                _groups = set(access_list).intersection(client.roster.getGroups())  # We only keep group which actually exist
                 if not _groups:
                     raise BadAccessListError("No valid group")
                 self._publishMblog(client.item_access_pubsub, client, "GROUP", _groups, message)
@@ -262,8 +263,6 @@
 
         self.initialise(profile_key).addCallback(initialised)
 
-
-
     def getLastGroupBlogs(self, pub_jid, max_items=10, profile_key='@DEFAULT@'):
         """Get the last published microblogs
         @param pub_jid: jid of the publisher
@@ -277,7 +276,7 @@
             d = self.host.plugins["XEP-0060"].getItems(client.item_access_pubsub, self.getNodeName(jid.JID(pub_jid)),
                                                        max_items=max_items, profile_key=profile_key)
             d.addCallback(lambda items: map(self.item2gbdata, items))
-            d.addErrback(lambda ignore: {}) #TODO: more complete error management (log !)
+            d.addErrback(lambda ignore: {})  # TODO: more complete error management (log !)
             return d
 
         #TODO: we need to use the server corresponding the the host of the jid
@@ -290,6 +289,7 @@
         @param max_items: how many microblogs we want to get
         @param profile_key: profile key
         """
+
         def sendResult(result):
             """send result of DeferredList (list of microblogs to the calling method"""
 
@@ -329,11 +329,10 @@
 
             return dlist
 
-
         #TODO: custom exception
         if publishers_type not in ["GROUP", "JID", "ALL"]:
             raise Exception("Bad call, unknown publishers_type")
-        if publishers_type=="ALL" and publishers:
+        if publishers_type == "ALL" and publishers:
             raise Exception("Publishers list must be empty when getting microblogs for all contacts")
         return self.initialise(profile_key).addCallback(initialised)
         #TODO: we need to use the server corresponding the the host of the jid
@@ -348,13 +347,13 @@
         #TODO: we need to use the server corresponding the the host of the jid
         return self.initialise(profile_key).addCallback(initialised)
 
-
     def massiveSubscribeGroupBlogs(self, publishers_type, publishers, profile_key='@DEFAULT@'):
         """Subscribe microblogs for a list of groups or jids
         @param publishers_type: type of the list of publishers (one of "GROUP" or "JID" or "ALL")
         @param publishers: list of publishers, according to "publishers_type" (list of groups or list of jids)
         @param profile_key: profile key
         """
+
         def initialised(result):
             profile, client = result
 
@@ -378,17 +377,15 @@
             dlist = defer.DeferredList(mblogs)
             return dlist
 
-
         #TODO: custom exception
         if publishers_type not in ["GROUP", "JID", "ALL"]:
             raise Exception("Bad call, unknown publishers_type")
-        if publishers_type=="ALL" and publishers:
+        if publishers_type == "ALL" and publishers:
             raise Exception("Publishers list must be empty when getting microblogs for all contacts")
         return self.initialise(profile_key).addCallback(initialised)
         #TODO: we need to use the server corresponding the the host of the jid
 
 
-
 class GroupBlog_handler(XMPPHandler):
     implements(iwokkel.IDisco)
 
@@ -397,4 +394,3 @@
 
     def getDiscoItems(self, requestor, target, nodeIdentifier=''):
         return []
-
diff --git a/src/plugins/plugin_misc_imap.py b/src/plugins/plugin_misc_imap.py
--- a/src/plugins/plugin_misc_imap.py
+++ b/src/plugins/plugin_misc_imap.py
@@ -21,33 +21,32 @@
 
 from logging import debug, info, error
 import warnings
-from twisted.internet import protocol,defer
+from twisted.internet import protocol, defer
 from twisted.words.protocols.jabber import error as jab_error
-from twisted.cred import portal,checkers,credentials
+from twisted.cred import portal, checkers, credentials
 from twisted.cred import error as cred_error
 from twisted.mail import imap4
 from twisted.python import failure
 from email.parser import Parser
 import email.message
-import os,os.path
+import os
 from cStringIO import StringIO
 from twisted.internet import reactor
 import pdb
 
-
 from zope.interface import implements
 
+PLUGIN_INFO = {
+    "name": "IMAP server Plugin",
+    "import_name": "IMAP",
+    "type": "Misc",
+    "protocols": [],
+    "dependencies": ["Maildir"],
+    "main": "IMAP_server",
+    "handler": "no",
+    "description": _("""Create an Imap server that you can use to read your "normal" type messages""")
+}
 
-PLUGIN_INFO = {
-"name": "IMAP server Plugin",
-"import_name": "IMAP",
-"type": "Misc",
-"protocols": [],
-"dependencies": ["Maildir"],
-"main": "IMAP_server",
-"handler": "no",
-"description": _("""Create an Imap server that you can use to read your "normal" type messages""")
-}
 
 class IMAP_server(object):
     #TODO: connect profile on mailbox request, once password is accepted
@@ -75,15 +74,16 @@
         self.server_factory = ImapServerFactory(self.host)
         reactor.listenTCP(port, self.server_factory)
 
+
 class Message(object):
     implements(imap4.IMessage)
 
     def __init__(self, uid, flags, mess_fp):
         debug('Message Init')
-        self.uid=uid
-        self.flags=flags
-        self.mess_fp=mess_fp
-        self.message=Parser().parse(mess_fp)
+        self.uid = uid
+        self.flags = flags
+        self.mess_fp = mess_fp
+        self.message = Parser().parse(mess_fp)
 
     def getUID(self):
         """Retrieve the unique identifier associated with this message.
@@ -105,7 +105,6 @@
         debug('getInternalDate')
         return self.message['Date']
 
-
     def getHeaders(self, negate, *names):
         """Retrieve a group of message headers.
         @param names: The names of the headers to retrieve or omit.
@@ -114,12 +113,12 @@
         @return: A mapping of header field names to header field values
         """
         debug('getHeaders %s - %s' % (negate, names))
-        final_dict={}
-        to_check=[name.lower() for name in names]
+        final_dict = {}
+        to_check = [name.lower() for name in names]
         for header in self.message.keys():
             if (negate and not header.lower() in to_check) or \
-              (not negate and header.lower() in to_check):
-                final_dict[header]=self.message[header]
+                    (not negate and header.lower() in to_check):
+                final_dict[header] = self.message[header]
         return final_dict
 
     def getBodyFile(self):
@@ -132,17 +131,16 @@
         """Retrieve the total size, in octets, of this message.
         """
         debug('getSize')
-        self.mess_fp.seek(0,os.SEEK_END)
+        self.mess_fp.seek(0, os.SEEK_END)
         return self.mess_fp.tell()
 
-
     def isMultipart(self):
         """Indicate whether this message has subparts.
         """
         debug('isMultipart')
         return False
 
-    def getSubPart(self,part):
+    def getSubPart(self, part):
         """Retrieve a MIME sub-message
         @param part: The number of the part to retrieve, indexed from 0.
         @return: The specified sub-part.
@@ -154,39 +152,39 @@
 class SatMailbox(object):
     implements(imap4.IMailbox)
 
-    def __init__(self,host,name,profile):
+    def __init__(self, host, name, profile):
         self.host = host
-        self.listeners=set()
-        debug ('Mailbox init (%s)', name)
-        if name!="INBOX":
+        self.listeners = set()
+        debug('Mailbox init (%s)', name)
+        if name != "INBOX":
             raise imap4.MailboxException("Only INBOX is managed for the moment")
-        self.mailbox=self.host.plugins["Maildir"].accessMessageBox(name,self.newMessage, profile)
+        self.mailbox = self.host.plugins["Maildir"].accessMessageBox(name, self.newMessage, profile)
 
     def newMessage(self):
         """Called when a new message is in the mailbox"""
-        debug ("newMessage signal received")
-        nb_messages=self.getMessageCount()
+        debug("newMessage signal received")
+        nb_messages = self.getMessageCount()
         for listener in self.listeners:
-            listener.newMessages(nb_messages,None)
+            listener.newMessages(nb_messages, None)
 
     def getUIDValidity(self):
         """Return the unique validity identifier for this mailbox.
         """
-        debug ('getUIDValidity')
+        debug('getUIDValidity')
         return 0
 
     def getUIDNext(self):
         """Return the likely UID for the next message added to this mailbox.
         """
-        debug ('getUIDNext')
+        debug('getUIDNext')
         return self.mailbox.getNextUid()
 
-    def getUID(self,message):
+    def getUID(self, message):
         """Return the UID of a message in the mailbox
         @param message: The message sequence number
         @return: The UID of the message.
         """
-        debug ('getUID (%i)' % message)
+        debug('getUID (%i)' % message)
         #return self.mailbox.getUid(message-1) #XXX: it seems that this method get uid and not message sequence number
         return message
 
@@ -208,7 +206,7 @@
         """Return the number of messages with the 'Unseen' flag.
         """
         debug('getUnseenCount')
-        return self.getMessageCount()-len(self.mailbox.getMessageIdsWithFlag('\\SEEN'))
+        return self.getMessageCount() - len(self.mailbox.getMessageIdsWithFlag('\\SEEN'))
 
     def isWriteable(self):
         """Get the read/write status of the mailbox.
@@ -222,7 +220,6 @@
         """
         debug('destroy')
 
-
     def requestStatus(self, names):
         """Return status information about this mailbox.
         @param names: The status names to return information regarding.
@@ -262,7 +259,7 @@
         else:
             raise imap4.MailboxException('Trying to remove an unknown listener')
 
-    def addMessage(self, message, flags = (), date = None):
+    def addMessage(self, message, flags=(), date=None):
         """Add the given message to this mailbox.
         @param message: The RFC822 formatted message
         @param flags: The flags to associate with this message
@@ -288,24 +285,24 @@
         about
         @param uid: If true, the IDs specified in the query are UIDs;
         """
-        debug('fetch (%s, %s)'%(messages,uid))
+        debug('fetch (%s, %s)' % (messages, uid))
         if uid:
             messages.last = self.mailbox.getMaxUid()
             messages.getnext = self.mailbox.getNextExistingUid
             for mess_uid in messages:
-                if mess_uid == None:
-                    debug ('stopping iteration')
+                if mess_uid is None:
+                    debug('stopping iteration')
                     raise StopIteration
                 try:
-                    yield (mess_uid,Message(mess_uid,self.mailbox.getFlagsUid(mess_uid), self.mailbox.getMessageUid(mess_uid)))
+                    yield (mess_uid, Message(mess_uid, self.mailbox.getFlagsUid(mess_uid), self.mailbox.getMessageUid(mess_uid)))
                 except IndexError:
                     continue
         else:
             messages.last = self.getMessageCount()
             for mess_idx in messages:
-                if mess_idx>self.getMessageCount():
+                if mess_idx > self.getMessageCount():
                     raise StopIteration
-                yield (mess_idx,Message(mess_idx,self.mailbox.getFlags(mess_idx),self.mailbox.getMessage(mess_idx-1)))
+                yield (mess_idx, Message(mess_idx, self.mailbox.getFlags(mess_idx), self.mailbox.getMessage(mess_idx - 1)))
 
     def store(self, messages, flags, mode, uid):
         """Set the flags of one or more messages.
@@ -324,19 +321,19 @@
         """
         debug('store')
 
-        flags=[flag.upper() for flag in flags]
+        flags = [flag.upper() for flag in flags]
 
-        def updateFlags(getF,setF):
+        def updateFlags(getF, setF):
             ret = {}
             for mess_id in messages:
-                if (uid and mess_id == None) or (not uid and mess_id>self.getMessageCount()):
+                if (uid and mess_id is None) or (not uid and mess_id > self.getMessageCount()):
                     break
-                _flags=set(getF(mess_id) if mode else [])
-                if mode==-1:
+                _flags = set(getF(mess_id) if mode else [])
+                if mode == -1:
                     _flags.difference_update(set(flags))
                 else:
                     _flags.update(set(flags))
-                new_flags=list(_flags)
+                new_flags = list(_flags)
                 setF(mess_id, new_flags)
                 ret[mess_id] = tuple(new_flags)
             return ret
@@ -344,15 +341,15 @@
         if uid:
             messages.last = self.mailbox.getMaxUid()
             messages.getnext = self.mailbox.getNextExistingUid
-            ret = updateFlags(self.mailbox.getFlagsUid,self.mailbox.setFlagsUid)
+            ret = updateFlags(self.mailbox.getFlagsUid, self.mailbox.setFlagsUid)
             for listener in self.listeners:
                 listener.flagsChanged(ret)
             return ret
 
         else:
             messages.last = self.getMessageCount()
-            ret = updateFlags(self.mailbox.getFlags,self.mailbox.setFlags)
-            newFlags={}
+            ret = updateFlags(self.mailbox.getFlags, self.mailbox.setFlags)
+            newFlags = {}
             for idx in ret:
                 #we have to convert idx to uid for the listeners
                 newFlags[self.mailbox.getUid(idx)] = ret[idx]
@@ -366,7 +363,7 @@
         @return: A list of the flags that can be set on messages in this mailbox.
         """
         debug('getFlags')
-        return ['\\SEEN','\\ANSWERED','\\FLAGGED','\\DELETED','\\DRAFT'] #TODO: add '\\RECENT'
+        return ['\\SEEN', '\\ANSWERED', '\\FLAGGED', '\\DELETED', '\\DRAFT']  # TODO: add '\\RECENT'
 
     def getHierarchicalDelimiter(self):
         """Get the character which delimits namespaces for in this mailbox.
@@ -374,33 +371,35 @@
         debug('getHierarchicalDelimiter')
         return '.'
 
+
 class ImapSatAccount(imap4.MemoryAccount):
     #implements(imap4.IAccount)
 
     def __init__(self, host, profile):
         debug("ImapAccount init")
-        self.host=host
-        self.profile=profile
-        imap4.MemoryAccount.__init__(self,profile)
-        self.addMailbox("Inbox") #We only manage Inbox for the moment
-        debug ('INBOX added')
+        self.host = host
+        self.profile = profile
+        imap4.MemoryAccount.__init__(self, profile)
+        self.addMailbox("Inbox")  # We only manage Inbox for the moment
+        debug('INBOX added')
 
     def _emptyMailbox(self, name, id):
-        return SatMailbox(self.host,name,self.profile)
+        return SatMailbox(self.host, name, self.profile)
 
 
 class ImapRealm(object):
     implements(portal.IRealm)
 
-    def __init__(self,host):
+    def __init__(self, host):
         self.host = host
 
     def requestAvatar(self, avatarID, mind, *interfaces):
         debug('requestAvatar')
-        profile=avatarID.decode('utf-8')
+        profile = avatarID.decode('utf-8')
         if imap4.IAccount not in interfaces:
             raise NotImplementedError
-        return imap4.IAccount, ImapSatAccount(self.host,profile), lambda:None
+        return imap4.IAccount, ImapSatAccount(self.host, profile), lambda: None
+
 
 class SatProfileCredentialChecker(object):
     """
@@ -412,7 +411,6 @@
     credentialInterfaces = (credentials.IUsernamePassword,
                             credentials.IUsernameHashedPassword)
 
-
     def __init__(self, host):
         self.host = host
 
@@ -431,20 +429,21 @@
         d.addCallback(self._cbPasswordMatch, credentials.username)
         return d
 
+
 class ImapServerFactory(protocol.ServerFactory):
     protocol = imap4.IMAP4Server
 
     def __init__(self, host):
-        self.host=host
+        self.host = host
 
     def startedConnecting(self, connector):
-        debug (_("IMAP server connection started"))
+        debug(_("IMAP server connection started"))
 
     def clientConnectionLost(self, connector, reason):
-        debug (_("IMAP server connection lost (reason: %s)"), reason)
+        debug(_("IMAP server connection lost (reason: %s)"), reason)
 
     def buildProtocol(self, addr):
-        debug ("Building protocol")
+        debug("Building protocol")
         prot = protocol.ServerFactory.buildProtocol(self, addr)
         prot.portal = portal.Portal(ImapRealm(self.host))
         prot.portal.registerChecker(SatProfileCredentialChecker(self.host))
diff --git a/src/plugins/plugin_misc_maildir.py b/src/plugins/plugin_misc_maildir.py
--- a/src/plugins/plugin_misc_maildir.py
+++ b/src/plugins/plugin_misc_maildir.py
@@ -21,54 +21,54 @@
 
 from logging import debug, info, error
 import warnings
-warnings.filterwarnings('ignore','the MimeWriter',DeprecationWarning,'twisted' ) #FIXME: to be removed, see http://twistedmatrix.com/trac/ticket/4038
+warnings.filterwarnings('ignore', 'the MimeWriter', DeprecationWarning, 'twisted')  # FIXME: to be removed, see http://twistedmatrix.com/trac/ticket/4038
 from twisted.internet import protocol
 from twisted.words.protocols.jabber import error as jab_error
-from twisted.cred import portal,checkers
-from twisted.mail import imap4,maildir
+from twisted.cred import portal, checkers
+from twisted.mail import imap4, maildir
 from email.parser import Parser
 import email.message
 from email.charset import Charset
-import os,os.path
+import os
 from cStringIO import StringIO
 from twisted.internet import reactor
 import pdb
 from sat.core.exceptions import ProfileUnknownError
 from sat.memory.persistent import PersistentBinaryDict
 
-
 from zope.interface import implements
 
-
 PLUGIN_INFO = {
-"name": "Maildir Plugin",
-"import_name": "Maildir",
-"type": "Misc",
-"protocols": [],
-"dependencies": [],
-"main": "MaildirBox",
-"handler": "no",
-"description": _("""Intercept "normal" type messages, and put them in a Maildir type box""")
+    "name": "Maildir Plugin",
+    "import_name": "Maildir",
+    "type": "Misc",
+    "protocols": [],
+    "dependencies": [],
+    "main": "MaildirBox",
+    "handler": "no",
+    "description": _("""Intercept "normal" type messages, and put them in a Maildir type box""")
 }
 
 MAILDIR_PATH = "Maildir"
 
+
 class MaildirError(Exception):
     pass
 
+
 class MaildirBox(object):
 
     def __init__(self, host):
         info(_("Plugin Maildir initialization"))
         self.host = host
 
-        self.__observed={}
-        self.data={} #list of profile spectific data. key = profile, value = PersistentBinaryDict where key=mailbox name,
+        self.__observed = {}
+        self.data = {}  # list of profile spectific data. key = profile, value = PersistentBinaryDict where key=mailbox name,
                      # and value is a dictionnary with the following value
                      #    - cur_idx: value of the current unique integer increment (UID)
                      #    - message_id (as returned by MaildirMailbox): a tuple of (UID, [flag1, flag2, ...])
-        pList=host.memory.getProfilesList #shorter :)
-        self.__mailboxes={} #key: profile, value: {boxname: MailboxUser instance}
+        pList = host.memory.getProfilesList  # shorter :)
+        self.__mailboxes = {}  # key: profile, value: {boxname: MailboxUser instance}
 
         #the triggers
         host.trigger.add("MessageReceived", self.messageReceivedTrigger)
@@ -76,11 +76,12 @@
     def profileConnected(self, profile):
         """Called on profile connection, create profile data"""
         self.data[profile] = PersistentBinaryDict("plugin_maildir", profile)
-        self.__mailboxes[profile]={}
+        self.__mailboxes[profile] = {}
+
         def dataLoaded(ignore):
             if not self.data[profile]:
                 #the mailbox is new, we initiate the data
-                self.data[profile]["INBOX"] = {"cur_idx":0}
+                self.data[profile]["INBOX"] = {"cur_idx": 0}
         self.data[profile].load().addCallback(dataLoaded)
 
     def profileDisconnected(self, profile):
@@ -108,8 +109,8 @@
         profile = self.host.memory.getProfileName(profile_key)
         if not profile:
             raise ProfileUnknownError(profile_key)
-        if not self.__mailboxes[profile].has_key(boxname):
-            self.__mailboxes[profile][boxname]=MailboxUser(self, boxname, observer, profile=profile)
+        if boxname not in self.__mailboxes[profile]:
+            self.__mailboxes[profile][boxname] = MailboxUser(self, boxname, observer, profile=profile)
         else:
             if observer:
                 self.addObserver(observer, profile, boxname)
@@ -118,33 +119,33 @@
     def _getProfilePath(self, profile):
         """Return a unique path for profile's mailbox
         The path must be unique, usable as a dir name, and bijectional"""
-        return profile.replace('/','_').replace('..','_') #FIXME: this is too naive to work well, must be improved
+        return profile.replace('/', '_').replace('..', '_')  # FIXME: this is too naive to work well, must be improved
 
     def _removeBoxAccess(self, boxname, mailboxUser, profile):
         """Remove a reference to a box
         @param name: name of the box
         @param mailboxUser: MailboxUser instance"""
-        if not self.__mailboxes.has_key(boxname):
-            err_msg=_("Trying to remove an mailboxUser not referenced")
+        if boxname not in self.__mailboxes:
+            err_msg = _("Trying to remove an mailboxUser not referenced")
             error(_("INTERNAL ERROR: ") + err_msg)
             raise MaildirError(err_msg)
-        assert self.__mailboxes[profile][boxname]==mailboxUser
+        assert self.__mailboxes[profile][boxname] == mailboxUser
         del __mailboxes[profile][boxname]
 
     def _checkBoxReference(self, boxname, profile):
         """Check if there is a reference on a box, and return it
         @param boxname: name of the box to check
         @return: MailboxUser instance or None"""
-        if self.__mailboxes.has_key(profile):
-            if self.__mailboxes[profile].has_key(boxname):
+        if profile in self.__mailboxes:
+            if boxname in self.__mailboxes[profile]:
                 return self.__mailboxes[profile][boxname]
 
     def __getBoxData(self, boxname, profile):
         """Return the date of a box"""
         try:
-            return self.data[profile][boxname] #the boxname MUST exist in the data
+            return self.data[profile][boxname]  # the boxname MUST exist in the data
         except KeyError:
-            err_msg=_("Boxname doesn't exist in internal data")
+            err_msg = _("Boxname doesn't exist in internal data")
             error(_("INTERNAL ERROR: ") + err_msg)
             raise MaildirError(err_msg)
 
@@ -155,11 +156,11 @@
         @param message_id: unique id of the message as given by MaildirMailbox
         @return: Integer UID"""
         box_data = self.__getBoxData(boxname, profile)
-        if box_data.has_key(message_id):
+        if message_id in box_data:
             ret = box_data[message_id][0]
         else:
-            box_data['cur_idx']+=1
-            box_data[message_id]=[box_data['cur_idx'],[]]
+            box_data['cur_idx'] += 1
+            box_data[message_id] = [box_data['cur_idx'], []]
             ret = box_data[message_id]
             self.data[profile].force(boxname)
         return ret
@@ -170,7 +171,7 @@
         @param boxname: name of the box where the message is
         @return: Integer UID"""
         box_data = self.__getBoxData(boxname, profile)
-        return box_data['cur_idx']+1
+        return box_data['cur_idx'] + 1
 
     def getNextExistingUid(self, boxname, uid, profile):
         """Give the next uid of existing message
@@ -178,10 +179,10 @@
         @param uid: uid to start from
         @return: uid or None if the is no more message"""
         box_data = self.__getBoxData(boxname, profile)
-        idx=uid+1
-        while self.getIdFromUid(boxname, idx, profile) == None: #TODO: this is highly inefficient because getIdfromUid is inefficient, fix this
-            idx+=1
-            if idx>box_data['cur_idx']:
+        idx = uid + 1
+        while self.getIdFromUid(boxname, idx, profile) is None:  # TODO: this is highly inefficient because getIdfromUid is inefficient, fix this
+            idx += 1
+            if idx > box_data['cur_idx']:
                 return None
         return idx
 
@@ -198,7 +199,7 @@
         @param message_uid: unique integer identifier
         @return: unique id of the message as given by MaildirMailbox or None if not found"""
         box_data = self.__getBoxData(boxname, profile)
-        for message_id in box_data.keys(): #TODO: this is highly inefficient on big mailbox, must be replaced in the future
+        for message_id in box_data.keys():  # TODO: this is highly inefficient on big mailbox, must be replaced in the future
             if message_id == 'cur_idx':
                 continue
             if box_data[message_id][0] == message_uid:
@@ -211,7 +212,7 @@
         @param message_idx: message id as given by MaildirMailbox
         @return: list of strings"""
         box_data = self.__getBoxData(boxname, profile)
-        if not box_data.has_key(mess_id):
+        if mess_id not in box_data:
             raise MailboxException("Trying to get flags from an unexisting message")
         return box_data[mess_id][1]
 
@@ -222,11 +223,11 @@
         @param flags: list of strings
         """
         box_data = self.__getBoxData(boxname, profile)
-        assert(type(flags)==list)
-        flags=[flag.upper() for flag in flags] #we store every flag UPPERCASE
-        if not box_data.has_key(mess_id):
+        assert(type(flags) == list)
+        flags = [flag.upper() for flag in flags]  # we store every flag UPPERCASE
+        if mess_id not in box_data:
             raise MailboxException("Trying to set flags for an unexisting message")
-        box_data[mess_id][1]=flags
+        box_data[mess_id][1] = flags
         self.data[profile].force(boxname)
 
     def getMessageIdsWithFlag(self, boxname, flag, profile):
@@ -235,11 +236,11 @@
         @param flag: flag to check
         @return: list of id (as given by MaildirMailbox)"""
         box_data = self.__getBoxData(boxname, profile)
-        assert(isinstance(flag,basestring))
-        flag=flag.upper()
+        assert(isinstance(flag, basestring))
+        flag = flag.upper()
         result = []
         for key in box_data:
-            if key=='cur_idx':
+            if key == 'cur_idx':
                 continue
             if flag in box_data[key][1]:
                 result.append(key)
@@ -250,8 +251,8 @@
         @param boxname: name of the box where the message is
         """
         box_data = self.__getBoxData(boxname, profile)
-        for mess_id in self.getMessageIdsWithFlag(boxname,"\\Deleted", profile):
-           del(box_data[mess_id])
+        for mess_id in self.getMessageIdsWithFlag(boxname, "\\Deleted", profile):
+            del(box_data[mess_id])
         self.data[profile].force(boxname)
 
     def cleanTable(self, boxname, existant_id, profile):
@@ -259,9 +260,9 @@
         @param boxname: name of the box to clean
         @param existant_id: list of id which actually exist"""
         box_data = self.__getBoxData(boxname, profile)
-        to_remove=[]
+        to_remove = []
         for key in box_data:
-            if key not in existant_id and key!="cur_idx":
+            if key not in existant_id and key != "cur_idx":
                 to_remove.append(key)
         for key in to_remove:
             del box_data[key]
@@ -271,34 +272,34 @@
         @param callback: method to call when the the box is updated
         @param boxname: name of the box to observe
         @param signal: which signal is observed by the caller"""
-        if not self.__observed.has_key((profile,boxname)):
-            self.__observed[(profile,boxname)]={}
-        if not self.__observed[(profile,boxname)].has_key(signal):
-            self.__observed[(profile,boxname)][signal]=set()
-        self.__observed[(profile,boxname)][signal].add(callback)
+        if (profile, boxname) not in self.__observed:
+            self.__observed[(profile, boxname)] = {}
+        if signal not in self.__observed[(profile, boxname)]:
+            self.__observed[(profile, boxname)][signal] = set()
+        self.__observed[(profile, boxname)][signal].add(callback)
 
     def removeObserver(self, callback, profile, boxname, signal="NEW_MESSAGE"):
         """Remove an observer of maildir box changes
         @param callback: method to remove from obervers
         @param boxname: name of the box which was observed
         @param signal: which signal was observed by the caller"""
-        if not self.__observed.has_key((profile,boxname)):
-            err_msg=_("Trying to remove an observer for an inexistant mailbox")
+        if (profile, boxname) not in self.__observed:
+            err_msg = _("Trying to remove an observer for an inexistant mailbox")
             error(_("INTERNAL ERROR: ") + err_msg)
             raise MaildirError(err_msg)
-        if not self.__observed[(profile,boxname)].has_key(signal):
-            err_msg=_("Trying to remove an inexistant observer, no observer for this signal")
+        if signal not in self.__observed[(profile, boxname)]:
+            err_msg = _("Trying to remove an inexistant observer, no observer for this signal")
             error(_("INTERNAL ERROR: ") + err_msg)
             raise MaildirError(err_msg)
-        if not callback in self.__observed[(profile,boxname)][signal]:
-            err_msg=_("Trying to remove an inexistant observer")
+        if not callback in self.__observed[(profile, boxname)][signal]:
+            err_msg = _("Trying to remove an inexistant observer")
             error(_("INTERNAL ERROR: ") + err_msg)
             raise MaildirError(err_msg)
-        self.__observed[(profile,boxname)][signal].remove(callback)
+        self.__observed[(profile, boxname)][signal].remove(callback)
 
     def emitSignal(self, profile, boxname, signal_name):
         """Emit the signal to observer"""
-        debug('emitSignal %s %s %s' %(profile, boxname, signal_name))
+        debug('emitSignal %s %s %s' % (profile, boxname, signal_name))
         try:
             for observer_cb in self.__observed[(profile, boxname)][signal_name]:
                 observer_cb()
@@ -325,7 +326,7 @@
             if e.name == "body":
                 mail.set_payload(e.children[0].encode('utf-8'))
             elif e.name == "subject":
-                mail['Subject'] =  e.children[0].encode('utf-8')
+                mail['Subject'] = e.children[0].encode('utf-8')
         return mail.as_string()
 
     def __init__(self, _maildir, name, observer=None, profile="@NONE@"):
@@ -334,36 +335,35 @@
            @param profile: real profile (ie not a profile_key)
            THIS OBJECT MUST NOT BE USED DIRECTLY: use MaildirBox.accessMessageBox instead"""
         if _maildir._checkBoxReference(name, profile):
-            error ("INTERNAL ERROR: MailboxUser MUST NOT be instancied directly")
+            error("INTERNAL ERROR: MailboxUser MUST NOT be instancied directly")
             raise MailboxException('double MailboxUser instanciation')
-        if name!="INBOX":
+        if name != "INBOX":
             raise NotImplementedError
-        self.name=name
-        self.profile=profile
-        self.maildir=_maildir
+        self.name = name
+        self.profile = profile
+        self.maildir = _maildir
         profile_path = self.maildir._getProfilePath(profile)
-        full_profile_path = os.path.join(self.maildir.host.memory.getConfig('','local_dir'), profile_path)
+        full_profile_path = os.path.join(self.maildir.host.memory.getConfig('', 'local_dir'), profile_path)
         if not os.path.exists(full_profile_path):
-            os.makedirs(full_profile_path,0700)
+            os.makedirs(full_profile_path, 0700)
         mailbox_path = os.path.join(full_profile_path, MAILDIR_PATH)
-        self.mailbox_path=mailbox_path
+        self.mailbox_path = mailbox_path
         self.mailbox = maildir.MaildirMailbox(mailbox_path)
-        self.observer=observer
+        self.observer = observer
         self.__uid_table_update()
 
         if observer:
-            debug("adding observer for %s (%s)" % (name,profile))
+            debug("adding observer for %s (%s)" % (name, profile))
             self.maildir.addObserver(observer, profile, name, "NEW_MESSAGE")
 
     def __uid_table_update(self):
-        existant_id=[]
-        for mess_idx in range (self.getMessageCount()):
+        existant_id = []
+        for mess_idx in range(self.getMessageCount()):
             #we update the uid table
             existant_id.append(self.getId(mess_idx))
             self.getUid(mess_idx)
         self.maildir.cleanTable(self.name, existant_id, profile=self.profile)
 
-
     def __del__(self):
         if observer:
             debug("removing observer for %s" % self.name)
@@ -377,8 +377,8 @@
 
     def emitSignal(self, ignore, signal):
         """Emit the signal to the observers"""
-        if signal=="NEW_MESSAGE":
-            self.getUid(self.getMessageCount()-1) #XXX: we make an uid for the last message added
+        if signal == "NEW_MESSAGE":
+            self.getUid(self.getMessageCount() - 1)  # XXX: we make an uid for the last message added
         self.maildir.emitSignal(self.profile, self.name, signal)
 
     def getId(self, mess_idx):
@@ -388,8 +388,8 @@
 
     def getUid(self, mess_idx):
         """Return a unique interger id for the message, always ascending"""
-        mess_id=self.getId(mess_idx)
-        return self.maildir.getUid(self.name,mess_id, profile=self.profile)
+        mess_id = self.getId(mess_idx)
+        return self.maildir.getUid(self.name, mess_id, profile=self.profile)
 
     def getNextUid(self):
         return self.maildir.getNextUid(self.name, profile=self.profile)
@@ -413,7 +413,7 @@
         """Return the message index from the uid
         @param mess_uid: message unique identifier
         @return: message index, as managed by MaildirMailbox"""
-        for mess_idx in range (self.getMessageCount()):
+        for mess_idx in range(self.getMessageCount()):
             if self.getUid(mess_idx) == mess_uid:
                 return mess_idx
         raise IndexError
@@ -422,7 +422,7 @@
         """Return the message index from the unique index
         @param mess_id: message unique index as given by MaildirMailbox
         @return: message sequence index"""
-        for mess_idx in range (self.getMessageCount()):
+        for mess_idx in range(self.getMessageCount()):
             if self.mailbox.getUidl(mess_idx) == mess_id:
                 return mess_idx
         raise IndexError
@@ -448,7 +448,7 @@
         """Return the flags of the message
         @param mess_uid: message unique identifier
         @return: list of strings"""
-        id = self.maildir.getIdFromUid(self.name,mess_uid, profile=self.profile)
+        id = self.maildir.getIdFromUid(self.name, mess_uid, profile=self.profile)
         return self.maildir.getFlags(self.name, id, profile=self.profile)
 
     def setFlags(self, mess_idx, flags):
@@ -464,14 +464,14 @@
         @param mess_uid: message unique identifier
         @param flags: list of strings
         """
-        id = self.maildir.getIdFromUid(self.name,mess_uid, profile=self.profile)
+        id = self.maildir.getIdFromUid(self.name, mess_uid, profile=self.profile)
         return self.maildir.setFlags(self.name, id, flags, profile=self.profile)
 
     def getMessageIdsWithFlag(self, flag):
         """Return ids of messages where a flag is set
         @param flag: flag to check
         @return: list of id (as given by MaildirMailbox)"""
-        return self.maildir.getMessageIdsWithFlag(self.name,flag, profile=self.profile)
+        return self.maildir.getMessageIdsWithFlag(self.name, flag, profile=self.profile)
 
     def removeDeleted(self):
         """Actually delete message flagged "\\Deleted"
@@ -480,11 +480,10 @@
         for mess_id in self.getMessageIdsWithFlag("\\Deleted"):
             print ("Deleting %s" % mess_id)
             self.mailbox.deleteMessage(self.getIdxFromId(mess_id))
-        self.mailbox = maildir.MaildirMailbox(self.mailbox_path) #We need to reparse the dir to have coherent indexing
+        self.mailbox = maildir.MaildirMailbox(self.mailbox_path)  # We need to reparse the dir to have coherent indexing
         self.maildir.purgeDeleted(self.name, profile=self.profile)
 
     def emptyTrash(self):
         """Delete everything in the .Trash dir"""
         import shutils
         pdb.set_trace()
-
diff --git a/src/plugins/plugin_misc_quiz.py b/src/plugins/plugin_misc_quiz.py
--- a/src/plugins/plugin_misc_quiz.py
+++ b/src/plugins/plugin_misc_quiz.py
@@ -46,14 +46,14 @@
 QG_REQUEST = MESSAGE + '/' + QG_TAG + '[@xmlns="' + NS_QG + '"]'
 
 PLUGIN_INFO = {
-"name": "Quiz game plugin",
-"import_name": "Quiz",
-"type": "Game",
-"protocols": [],
-"dependencies": ["XEP-0045", "XEP-0249"],
-"main": "Quiz",
-"handler": "yes",
-"description": _("""Implementation of Quiz game""")
+    "name": "Quiz game plugin",
+    "import_name": "Quiz",
+    "type": "Game",
+    "protocols": [],
+    "dependencies": ["XEP-0045", "XEP-0249"],
+    "main": "Quiz",
+    "handler": "yes",
+    "description": _("""Implementation of Quiz game""")
 }
 
 
@@ -62,66 +62,66 @@
     def __init__(self, host):
         info(_("Plugin Quiz initialization"))
         self.host = host
-        self.games={}
-        self.waiting_inv = {} #Invitation waiting for people to join to launch a game
-        host.bridge.addMethod("quizGameLaunch", ".plugin", in_sign='ass', out_sign='', method=self.quizGameLaunch) #args: players, profile
-        host.bridge.addMethod("quizGameCreate", ".plugin", in_sign='sass', out_sign='', method=self.quizGameCreate) #args: room_jid, players, profile
-        host.bridge.addMethod("quizGameReady", ".plugin", in_sign='sss', out_sign='', method=self.newPlayerReady) #args: player, referee, profile
+        self.games = {}
+        self.waiting_inv = {}  # Invitation waiting for people to join to launch a game
+        host.bridge.addMethod("quizGameLaunch", ".plugin", in_sign='ass', out_sign='', method=self.quizGameLaunch)  # args: players, profile
+        host.bridge.addMethod("quizGameCreate", ".plugin", in_sign='sass', out_sign='', method=self.quizGameCreate)  # args: room_jid, players, profile
+        host.bridge.addMethod("quizGameReady", ".plugin", in_sign='sss', out_sign='', method=self.newPlayerReady)  # args: player, referee, profile
         host.bridge.addMethod("quizGameAnswer", ".plugin", in_sign='ssss', out_sign='', method=self.playerAnswer)
-        host.bridge.addSignal("quizGameStarted", ".plugin", signature='ssass') #args: room_jid, referee, players, profile
+        host.bridge.addSignal("quizGameStarted", ".plugin", signature='ssass')  # args: room_jid, referee, players, profile
         host.bridge.addSignal("quizGameNew", ".plugin",
                               signature='sa{ss}s',
-                              doc = { 'summary': 'Start a new game',
-                                      'param_0': "room_jid: jid of game's room",
-                                      'param_1': "game_data: data of the game",
-                                      'param_2': '%(doc_profile)s'})
+                              doc={'summary': 'Start a new game',
+                                   'param_0': "room_jid: jid of game's room",
+                                   'param_1': "game_data: data of the game",
+                                   'param_2': '%(doc_profile)s'})
         host.bridge.addSignal("quizGameQuestion", ".plugin",
-                              signature = 'sssis',
-                              doc = { 'summary': "Send the current question",
-                                      'param_0': "room_jid: jid of game's room",
-                                      'param_1': "question_id: question id",
-                                      'param_2': "question: question to ask",
-                                      'param_3': "timer: timer",
-                                      'param_4': '%(doc_profile)s'})
+                              signature='sssis',
+                              doc={'summary': "Send the current question",
+                                   'param_0': "room_jid: jid of game's room",
+                                   'param_1': "question_id: question id",
+                                   'param_2': "question: question to ask",
+                                   'param_3': "timer: timer",
+                                   'param_4': '%(doc_profile)s'})
         host.bridge.addSignal("quizGamePlayerBuzzed", ".plugin",
-                              signature = 'ssbs',
-                              doc = { 'summary': "A player just pressed the buzzer",
-                                      'param_0': "room_jid: jid of game's room",
-                                      'param_1': "player: player who pushed the buzzer",
-                                      'param_2': "pause: should the game be paused ?",
-                                      'param_3': '%(doc_profile)s'})
+                              signature='ssbs',
+                              doc={'summary': "A player just pressed the buzzer",
+                                   'param_0': "room_jid: jid of game's room",
+                                   'param_1': "player: player who pushed the buzzer",
+                                   'param_2': "pause: should the game be paused ?",
+                                   'param_3': '%(doc_profile)s'})
         host.bridge.addSignal("quizGamePlayerSays", ".plugin",
-                              signature = 'sssis',
-                              doc = { 'summary': "A player just pressed the buzzer",
-                                      'param_0': "room_jid: jid of game's room",
-                                      'param_1': "player: player who pushed the buzzer",
-                                      'param_2': "text: what the player say",
-                                      'param_3': "delay: how long, in seconds, the text must appear",
-                                      'param_4': '%(doc_profile)s'})
+                              signature='sssis',
+                              doc={'summary': "A player just pressed the buzzer",
+                                   'param_0': "room_jid: jid of game's room",
+                                   'param_1': "player: player who pushed the buzzer",
+                                   'param_2': "text: what the player say",
+                                   'param_3': "delay: how long, in seconds, the text must appear",
+                                   'param_4': '%(doc_profile)s'})
         host.bridge.addSignal("quizGameAnswerResult", ".plugin",
-                              signature = 'ssba{si}s',
-                              doc = { 'summary': "Result of the just given answer",
-                                      'param_0': "room_jid: jid of game's room",
-                                      'param_1': "player: player who gave the answer",
-                                      'param_2': "good_answer: True if the answer is right",
-                                      'param_3': "score: dict of score with player as key",
-                                      'param_4': '%(doc_profile)s'})
+                              signature='ssba{si}s',
+                              doc={'summary': "Result of the just given answer",
+                                   'param_0': "room_jid: jid of game's room",
+                                   'param_1': "player: player who gave the answer",
+                                   'param_2': "good_answer: True if the answer is right",
+                                   'param_3': "score: dict of score with player as key",
+                                   'param_4': '%(doc_profile)s'})
         host.bridge.addSignal("quizGameTimerExpired", ".plugin",
-                              signature = 'ss',
-                              doc = { 'summary': "Nobody answered the question in time",
-                                      'param_0': "room_jid: jid of game's room",
-                                      'param_1': '%(doc_profile)s'})
+                              signature='ss',
+                              doc={'summary': "Nobody answered the question in time",
+                                   'param_0': "room_jid: jid of game's room",
+                                   'param_1': '%(doc_profile)s'})
         host.bridge.addSignal("quizGameTimerRestarted", ".plugin",
-                              signature = 'sis',
-                              doc = { 'summary': "Nobody answered the question in time",
-                                      'param_0': "room_jid: jid of game's room",
-                                      'param_1': "time_left: time left before timer expiration",
-                                      'param_2': '%(doc_profile)s'})
+                              signature='sis',
+                              doc={'summary': "Nobody answered the question in time",
+                                   'param_0': "room_jid: jid of game's room",
+                                   'param_1': "time_left: time left before timer expiration",
+                                   'param_2': '%(doc_profile)s'})
         host.trigger.add("MUC user joined", self.userJoinedTrigger)
 
     def createGameElt(self, to_jid, type="normal"):
         type = "normal" if to_jid.resource else "groupchat"
-        elt = domish.Element((None,'message'))
+        elt = domish.Element((None, 'message'))
         elt["to"] = to_jid.full()
         elt["type"] = type
         elt.addElement((NS_QG, QG_TAG))
@@ -129,9 +129,9 @@
 
     def __game_data_to_xml(self, game_data):
         """Convert a game data dict to domish element"""
-        game_data_elt = domish.Element((None,'game_data'))
+        game_data_elt = domish.Element((None, 'game_data'))
         for data in game_data:
-            data_elt = domish.Element((None,data))
+            data_elt = domish.Element((None, data))
             data_elt.addContent(game_data[data])
             game_data_elt.addChild(data_elt)
         return game_data_elt
@@ -162,12 +162,12 @@
         for player in game_data['players']:
             score[player] = players_data[player]['score']
 
-        answer_result_elt = domish.Element((None,'answer_result'))
+        answer_result_elt = domish.Element((None, 'answer_result'))
         answer_result_elt['player'] = player_answering
         answer_result_elt['good_answer'] = str(good_answer)
 
         for player in score:
-            score_elt = domish.Element((None,"score"))
+            score_elt = domish.Element((None, "score"))
             score_elt['player'] = player
             score_elt['score'] = str(score[player])
             answer_result_elt.addChild(score_elt)
@@ -176,19 +176,19 @@
 
     def __create_started_elt(self, players):
         """Create a game_started domish element"""
-        started_elt = domish.Element((None,'started'))
+        started_elt = domish.Element((None, 'started'))
         idx = 0
         for player in players:
-            player_elt = domish.Element((None,'player'))
+            player_elt = domish.Element((None, 'player'))
             player_elt.addContent(player)
             player_elt['index'] = str(idx)
-            idx+=1
+            idx += 1
             started_elt.addChild(player_elt)
         return started_elt
 
     def __ask_question(self, question_id, question, timer):
         """Create a element for asking a question"""
-        question_elt = domish.Element((None,'question'))
+        question_elt = domish.Element((None, 'question'))
         question_elt['id'] = question_id
         question_elt['timer'] = str(timer)
         question_elt.addContent(question)
@@ -197,14 +197,13 @@
     def __start_play(self, room_jid, game_data, profile):
         """Start the game (tell to the first player after dealer to play"""
         game_data['stage'] = "play"
-        next_player_idx = game_data['current_player'] = (game_data['init_player'] + 1) % len(game_data['players']) #the player after the dealer start
+        next_player_idx = game_data['current_player'] = (game_data['init_player'] + 1) % len(game_data['players'])  # the player after the dealer start
         game_data['first_player'] = next_player = game_data['players'][next_player_idx]
-        to_jid = jid.JID(room_jid.userhost()+"/"+next_player)
+        to_jid = jid.JID(room_jid.userhost() + "/" + next_player)
         mess = self.createGameElt(to_jid)
         yourturn_elt = mess.firstChildElement().addElement('your_turn')
         self.host.profiles[profile].xmlstream.send(mess)
 
-
     def userJoinedTrigger(self, room, user, profile):
         """This trigger is used to check if we are waiting people in this room,
         and to create a game if everybody is here"""
@@ -229,8 +228,8 @@
         def quizRoomJoined(room):
             _room = room.occupantJID.userhostJID()
             for player in players:
-                self.host.plugins["XEP-0249"].invite(jid.JID(player), room.occupantJID.userhostJID(), {"game":"Quiz"}, profile)
-            self.waiting_inv[_room] = (time(), players) #TODO: remove invitation waiting for too long, using the time data
+                self.host.plugins["XEP-0249"].invite(jid.JID(player), room.occupantJID.userhostJID(), {"game": "Quiz"}, profile)
+            self.waiting_inv[_room] = (time(), players)  # TODO: remove invitation waiting for too long, using the time data
 
         def after_init(ignore):
             room_name = "sat_quiz_%s" % self.host.plugins["XEP-0045"].getUniqueName(profile_key)
@@ -262,28 +261,28 @@
         @param room_jid_param: jid of the room
         @param players: list of players nick (nick must exist in the room)
         @param profile_key: %(doc_profile_key)s"""
-        debug (_("Creating Quiz game"))
+        debug(_("Creating Quiz game"))
         room_jid = jid.JID(room_jid_param)
         profile = self.host.memory.getProfileName(profile_key)
         if not profile:
-            error (_("profile %s is unknown") % profile_key)
+            error(_("profile %s is unknown") % profile_key)
             return
-        if self.games.has_key(room_jid):
-            warning (_("Quiz game already started in room %s") % room_jid.userhost())
+        if room_jid in self.games:
+            warning(_("Quiz game already started in room %s") % room_jid.userhost())
         else:
             room_nick = self.host.plugins["XEP-0045"].getRoomNick(room_jid.userhost(), profile)
             if not room_nick:
-                error ('Internal error')
+                error('Internal error')
                 return
             referee = room_jid.userhost() + '/' + room_nick
             status = {}
             players_data = {}
             for player in players:
-                players_data[player] = {'score':0}
+                players_data[player] = {'score': 0}
                 status[player] = "init"
-            self.games[room_jid.userhost()] = {'referee':referee, 'players':players, 'status':status, 'players_data':players_data, 'stage': None}
+            self.games[room_jid.userhost()] = {'referee': referee, 'players': players, 'status': status, 'players_data': players_data, 'stage': None}
             for player in players:
-                mess = self.createGameElt(jid.JID(room_jid.userhost()+'/'+player))
+                mess = self.createGameElt(jid.JID(room_jid.userhost() + '/' + player))
                 mess.firstChildElement().addChild(self.__create_started_elt(players))
                 self.host.profiles[profile].xmlstream.send(mess)
 
@@ -291,9 +290,9 @@
         """Must be called when player is ready to start a new game"""
         profile = self.host.memory.getProfileName(profile_key)
         if not profile:
-            error (_("profile %s is unknown") % profile_key)
+            error(_("profile %s is unknown") % profile_key)
             return
-        debug ('new player ready: %s' % profile)
+        debug('new player ready: %s' % profile)
         mess = self.createGameElt(jid.JID(referee))
         ready_elt = mess.firstChildElement().addElement('player_ready')
         ready_elt['player'] = player
@@ -303,9 +302,9 @@
         """Called when a player give an answer"""
         profile = self.host.memory.getProfileName(profile_key)
         if not profile:
-            error (_("profile %s is unknown") % profile_key)
+            error(_("profile %s is unknown") % profile_key)
             return
-        debug ('new player answer (%(profile)s): %(answer)s' % {'profile':profile, 'answer':answer})
+        debug('new player answer (%(profile)s): %(answer)s' % {'profile': profile, 'answer': answer})
         mess = self.createGameElt(jid.JID(referee))
         answer_elt = mess.firstChildElement().addElement('player_answer')
         answer_elt['player'] = player
@@ -333,7 +332,7 @@
     def restartTimer(self, room_jid, profile):
         """Restart a timer with the saved time"""
         game_data = self.games[room_jid.userhost()]
-        assert(game_data['time_left'] != None)
+        assert game_data['time_left'] is not None
         mess = self.createGameElt(room_jid)
         restarted_elt = mess.firstChildElement().addElement('timer_restarted')
         restarted_elt["time_left"] = str(game_data['time_left'])
@@ -359,7 +358,7 @@
         """Check if the answer given is right"""
         game_data = self.games[room_jid.userhost()]
         players_data = game_data['players_data']
-        good_answer =  game_data['question_id'] == "1" and answer=="42"
+        good_answer = game_data['question_id'] == "1" and answer == "42"
         players_data[player]['score'] += 1 if good_answer else -1
         players_data[player]['score'] = min(9, max(0, players_data[player]['score']))
 
@@ -374,7 +373,7 @@
 
     def newGame(self, room_jid, profile):
         """Launch a new round"""
-        debug (_('new Quiz game'))
+        debug(_('new Quiz game'))
         game_data = self.games[room_jid.userhost()]
         players = game_data['players']
         players_data = game_data['players_data']
@@ -401,30 +400,30 @@
 
         for elt in game_elt.elements():
 
-            if elt.name == 'started': #new game created
+            if elt.name == 'started':  # new game created
                 players = []
                 for player in elt.elements():
                     players.append(unicode(player))
                 self.host.bridge.quizGameStarted(room_jid.userhost(), from_jid.full(), players, profile)
 
-            elif elt.name == 'player_ready': #ready to play
+            elif elt.name == 'player_ready':  # ready to play
                 player = elt['player']
                 status = self.games[room_jid.userhost()]['status']
                 nb_players = len(self.games[room_jid.userhost()]['players'])
                 status[player] = 'ready'
-                debug (_('Player %(player)s is ready to start [status: %(status)s]') % {'player':player, 'status':status})
-                if status.values().count('ready') == nb_players: #everybody is ready, we can start the game
+                debug(_('Player %(player)s is ready to start [status: %(status)s]') % {'player': player, 'status': status})
+                if status.values().count('ready') == nb_players:  # everybody is ready, we can start the game
                     self.newGame(room_jid, profile)
 
             elif elt.name == 'game_data':
                 self.host.bridge.quizGameNew(room_jid.userhost(), self.__xml_to_game_data(elt), profile)
 
-            elif elt.name == 'question': #A question is asked
-                self.host.bridge.quizGameQuestion(room_jid.userhost(), elt["id"], unicode(elt), int(elt["timer"]), profile )
+            elif elt.name == 'question':  # A question is asked
+                self.host.bridge.quizGameQuestion(room_jid.userhost(), elt["id"], unicode(elt), int(elt["timer"]), profile)
 
             elif elt.name == 'player_answer':
                 player = elt['player']
-                pause = game_data['stage'] == 'question' #we pause the game only if we are have a question at the moment
+                pause = game_data['stage'] == 'question'  # we pause the game only if we are have a question at the moment
                 #we first send a buzzer message
                 mess = self.createGameElt(room_jid)
                 buzzer_elt = mess.firstChildElement().addElement('player_buzzed')
@@ -460,10 +459,11 @@
                 self.host.bridge.quizGameTimerRestarted(room_jid.userhost(), int(elt['time_left']), profile)
 
             else:
-                error (_('Unmanaged game element: %s') % elt.name)
+                error(_('Unmanaged game element: %s') % elt.name)
 
     def getHandler(self, profile):
-            return QuizGameHandler(self)
+        return QuizGameHandler(self)
+
 
 class QuizGameHandler (XMPPHandler):
     implements(iwokkel.IDisco)
@@ -473,11 +473,10 @@
         self.host = plugin_parent.host
 
     def connectionInitialized(self):
-        self.xmlstream.addObserver(QG_REQUEST, self.plugin_parent.quiz_game_cmd, profile = self.parent.profile)
+        self.xmlstream.addObserver(QG_REQUEST, self.plugin_parent.quiz_game_cmd, profile=self.parent.profile)
 
     def getDiscoInfo(self, requestor, target, nodeIdentifier=''):
         return [disco.DiscoFeature(NS_QG)]
 
     def getDiscoItems(self, requestor, target, nodeIdentifier=''):
         return []
-
diff --git a/src/plugins/plugin_misc_radiocol.py b/src/plugins/plugin_misc_radiocol.py
--- a/src/plugins/plugin_misc_radiocol.py
+++ b/src/plugins/plugin_misc_radiocol.py
@@ -43,14 +43,14 @@
 RADIOC_REQUEST = MESSAGE + '/' + RADIOC_TAG + '[@xmlns="' + NC_RADIOCOL + '"]'
 
 PLUGIN_INFO = {
-"name": "Radio collective plugin",
-"import_name": "Radiocol",
-"type": "Exp",
-"protocols": [],
-"dependencies": ["XEP-0045", "XEP-0249"],
-"main": "Radiocol",
-"handler": "yes",
-"description": _("""Implementation of radio collective""")
+    "name": "Radio collective plugin",
+    "import_name": "Radiocol",
+    "type": "Exp",
+    "protocols": [],
+    "dependencies": ["XEP-0045", "XEP-0249"],
+    "main": "Radiocol",
+    "handler": "yes",
+    "description": _("""Implementation of radio collective""")
 }
 
 QUEUE_LIMIT = 2
@@ -61,21 +61,21 @@
     def __init__(self, host):
         info(_("Radio collective initialization"))
         self.host = host
-        self.radios={}
+        self.radios = {}
         host.bridge.addMethod("radiocolLaunch", ".plugin", in_sign='ass', out_sign='', method=self.radiocolLaunch)
         host.bridge.addMethod("radiocolCreate", ".plugin", in_sign='ss', out_sign='', method=self.radiocolCreate)
         host.bridge.addMethod("radiocolSongAdded", ".plugin", in_sign='sss', out_sign='', method=self.radiocolSongAdded)
-        host.bridge.addSignal("radiocolStarted", ".plugin", signature='sss') #room_jid, referee, profile
-        host.bridge.addSignal("radiocolSongRejected", ".plugin", signature='sss') #room_jid, reason, profile
-        host.bridge.addSignal("radiocolPreload", ".plugin", signature='ssssss') #room_jid, filename, title, artist, album, profile
-        host.bridge.addSignal("radiocolPlay", ".plugin", signature='sss') #room_jid, filename, profile
-        host.bridge.addSignal("radiocolNoUpload", ".plugin", signature='ss') #room_jid, profile
-        host.bridge.addSignal("radiocolUploadOk", ".plugin", signature='ss') #room_jid, profile
+        host.bridge.addSignal("radiocolStarted", ".plugin", signature='sss')  # room_jid, referee, profile
+        host.bridge.addSignal("radiocolSongRejected", ".plugin", signature='sss')  # room_jid, reason, profile
+        host.bridge.addSignal("radiocolPreload", ".plugin", signature='ssssss')  # room_jid, filename, title, artist, album, profile
+        host.bridge.addSignal("radiocolPlay", ".plugin", signature='sss')  # room_jid, filename, profile
+        host.bridge.addSignal("radiocolNoUpload", ".plugin", signature='ss')  # room_jid, profile
+        host.bridge.addSignal("radiocolUploadOk", ".plugin", signature='ss')  # room_jid, profile
         host.trigger.add("MUC user joined", self.userJoinedTrigger)
 
     def createRadiocolElt(self, to_jid, type="normal"):
         type = "normal" if to_jid.resource else "groupchat"
-        elt = domish.Element((None,'message'))
+        elt = domish.Element((None, 'message'))
         elt["to"] = to_jid.full()
         elt["type"] = type
         elt.addElement((NC_RADIOCOL, RADIOC_TAG))
@@ -83,26 +83,25 @@
 
     def __create_started_elt(self):
         """Create a game_started domish element"""
-        started_elt = domish.Element((None,'started'))
+        started_elt = domish.Element((None, 'started'))
         return started_elt
 
     def __create_preload_elt(self, sender, filename, title, artist, album):
-        preload_elt = domish.Element((None,'preload'))
+        preload_elt = domish.Element((None, 'preload'))
         preload_elt['sender'] = sender
-        preload_elt['filename'] = filename #XXX: the frontend should know the temporary directory where file is put
+        preload_elt['filename'] = filename  # XXX: the frontend should know the temporary directory where file is put
         preload_elt['title'] = title
         preload_elt['artist'] = artist
         preload_elt['album'] = album
         return preload_elt
 
-
     def userJoinedTrigger(self, room, user, profile):
         """This trigger is used to check if we are waiting people in this room,
         and to create a game if everybody is here"""
         room_jid = room.occupantJID.userhost()
-        if self.radios.has_key(room_jid) and self.radios[room_jid]["referee"] == room.occupantJID.full():
+        if room_jid in self.radios and self.radios[room_jid]["referee"] == room.occupantJID.full():
             #we are in a radiocol room, let's start the party !
-            mess = self.createRadiocolElt(jid.JID(room_jid+'/'+user.nick))
+            mess = self.createRadiocolElt(jid.JID(room_jid + '/' + user.nick))
             mess.firstChildElement().addChild(self.__create_started_elt())
             self.host.profiles[profile].xmlstream.send(mess)
         return True
@@ -121,7 +120,7 @@
             _room_jid = room.occupantJID.userhostJID()
             self.radiocolCreate(_room_jid.userhost(), profile_key=profile)
             for occupant in occupants:
-                self.host.plugins["XEP-0249"].invite(jid.JID(occupant), room.occupantJID.userhostJID(), {"game":"Radiocol"}, profile)
+                self.host.plugins["XEP-0249"].invite(jid.JID(occupant), room.occupantJID.userhostJID(), {"game": "Radiocol"}, profile)
 
         def after_init(ignore):
             room_name = "sat_radiocol_%s" % self.host.plugins["XEP-0045"].getUniqueName(profile_key)
@@ -153,21 +152,21 @@
         """Create a new game
         @param room_jid_param: jid of the room
         @param profile_key: %(doc_profile_key)s"""
-        debug (_("Creating Radiocol"))
+        debug(_("Creating Radiocol"))
         room_jid = jid.JID(room_jid_param)
         profile = self.host.memory.getProfileName(profile_key)
         if not profile:
-            error (_("profile %s is unknown") % profile_key)
+            error(_("profile %s is unknown") % profile_key)
             return
-        if self.radios.has_key(room_jid):
-            warning (_("Radiocol already started in room %s") % room_jid.userhost())
+        if room_jid in self.radios:
+            warning(_("Radiocol already started in room %s") % room_jid.userhost())
         else:
             room_nick = self.host.plugins["XEP-0045"].getRoomNick(room_jid.userhost(), profile)
             if not room_nick:
-                error ('Internal error')
+                error('Internal error')
                 return
             referee = room_jid.userhost() + '/' + room_nick
-            self.radios[room_jid.userhost()] = {'referee':referee, 'queue':[], 'upload':True, 'playing': False, 'occupants_data':{}, 'to_delete':{}}
+            self.radios[room_jid.userhost()] = {'referee': referee, 'queue': [], 'upload': True, 'playing': False, 'occupants_data': {}, 'to_delete': {}}
             mess = self.createRadiocolElt(jid.JID(room_jid.userhost()))
             mess.firstChildElement().addChild(self.__create_started_elt())
             self.host.profiles[profile].xmlstream.send(mess)
@@ -189,8 +188,8 @@
             song = OggVorbis(song_path)
         except OggVorbisHeaderError:
             #this file is not ogg vorbis, we reject it
-            unlink(song_path) # FIXME: same host trick (see note above)
-            self.host.bridge.radiocolSongRejected(jid.JID(referee).userhost(), \
+            unlink(song_path)  # FIXME: same host trick (see note above)
+            self.host.bridge.radiocolSongRejected(jid.JID(referee).userhost(),
                                                   "Uploaded file is not Ogg Vorbis song, only Ogg Vorbis songs are acceptable", profile)
             """mess = self.createRadiocolElt(jid.JID(referee))
             reject_elt = mess.firstChildElement().addElement(('','song_rejected'))
@@ -204,7 +203,7 @@
         album = song.get("album", ["Unknown"])[0]
         length = song.info.length
         mess = self.createRadiocolElt(jid.JID(referee))
-        added_elt = mess.firstChildElement().addElement(('','song_added'))
+        added_elt = mess.firstChildElement().addElement(('', 'song_added'))
         added_elt['filename'] = filename = os.path.basename(song_path)
         added_elt['title'] = title
         added_elt['artist'] = artist
@@ -212,8 +211,8 @@
         added_elt['length'] = str(length)
         self.host.profiles[profile].xmlstream.send(mess)
 
-        radio_data = self.radios[jid.JID(referee).userhost()] #FIXME: referee comes from Libervia's client side, it's unsecure
-        radio_data['to_delete'][filename] = song_path #FIXME: works only because of the same host trick, see the note under the docstring
+        radio_data = self.radios[jid.JID(referee).userhost()]  # FIXME: referee comes from Libervia's client side, it's unsecure
+        radio_data['to_delete'][filename] = song_path  # FIXME: works only because of the same host trick, see the note under the docstring
 
     def playNext(self, room_jid, profile):
         """"Play next sont in queue if exists, and put a timer
@@ -231,14 +230,14 @@
 
         filename, length = queue.pop(0)
         mess = self.createRadiocolElt(room_jid)
-        play_elt = mess.firstChildElement().addElement(('','play'))
+        play_elt = mess.firstChildElement().addElement(('', 'play'))
         play_elt['filename'] = filename
         self.host.profiles[profile].xmlstream.send(mess)
 
         if not radio_data['upload'] and len(queue) < QUEUE_LIMIT:
             #upload is blocked and we now have resources to get more, we reactivate it
             mess = self.createRadiocolElt(room_jid)
-            no_upload_elt = mess.firstChildElement().addElement(('','upload_ok'))
+            no_upload_elt = mess.firstChildElement().addElement(('', 'upload_ok'))
             self.host.profiles[profile].xmlstream.send(mess)
             radio_data['upload'] = True
 
@@ -250,8 +249,7 @@
             return
 
         #we wait more than the song length to delete the file, to manage poorly reactive networks/clients
-        reactor.callLater(length + 90, unlink, file_to_delete) #FIXME: same host trick (see above)
-
+        reactor.callLater(length + 90, unlink, file_to_delete)  # FIXME: same host trick (see above)
 
     def radiocol_game_cmd(self, mess_elt, profile):
         #FIXME: we should check sender (is it referee ?) here before accepting commands
@@ -264,26 +262,26 @@
 
         for elt in radio_elt.elements():
 
-            if elt.name == 'started': #new game created
+            if elt.name == 'started':  # new game created
                 self.host.bridge.radiocolStarted(room_jid.userhost(), from_jid.full(), profile)
-            elif elt.name == 'preload': #a song is in queue and must be preloaded
+            elif elt.name == 'preload':  # a song is in queue and must be preloaded
                 self.host.bridge.radiocolPreload(room_jid.userhost(), elt['filename'], elt['title'], elt['artist'], elt['album'], profile)
             elif elt.name == 'play':
                 self.host.bridge.radiocolPlay(room_jid.userhost(), elt['filename'], profile)
-            elif elt.name == 'song_rejected': #a song has been refused
+            elif elt.name == 'song_rejected':  # a song has been refused
                 self.host.bridge.radiocolSongRejected(room_jid.userhost(), elt['reason'], profile)
             elif elt.name == 'no_upload':
                 self.host.bridge.radiocolNoUpload(room_jid.userhost(), profile)
             elif elt.name == 'upload_ok':
                 self.host.bridge.radiocolUploadOk(room_jid.userhost(), profile)
-            elif elt.name == 'song_added': #a song has been added
+            elif elt.name == 'song_added':  # a song has been added
                 #FIXME: we are KISS for the proof of concept: every song is added, to a limit of 3 in queue.
                 #       Need to manage some sort of rules to allow peoples to send songs
 
                 if len(queue) >= QUEUE_LIMIT:
                     #there are already too many songs in queue, we reject this one
                     mess = self.createRadiocolElt(room_jid)
-                    reject_elt = mess.firstChildElement().addElement(('','song_rejected'))
+                    reject_elt = mess.firstChildElement().addElement(('', 'song_rejected'))
                     reject_elt['sender'] = from_jid.resource
                     reject_elt['reason'] = "Too many songs in queue"
                     #FIXME: add an error code
@@ -296,12 +294,11 @@
                 if len(queue) >= QUEUE_LIMIT:
                     #We are at the limit, we refuse new upload until next play
                     mess = self.createRadiocolElt(room_jid)
-                    no_upload_elt = mess.firstChildElement().addElement(('','no_upload'))
+                    no_upload_elt = mess.firstChildElement().addElement(('', 'no_upload'))
                     #FIXME: add an error code
                     self.host.profiles[profile].xmlstream.send(mess)
                     radio_data['upload'] = False
 
-
                 mess = self.createRadiocolElt(room_jid)
                 preload_elt = self.__create_preload_elt(from_jid.resource,
                                                         elt['filename'],
@@ -316,10 +313,11 @@
                     radio_data['playing'] = True
                     self.playNext(room_jid, profile)
             else:
-                error (_('Unmanaged game element: %s') % elt.name)
+                error(_('Unmanaged game element: %s') % elt.name)
 
     def getHandler(self, profile):
-            return RadiocolHandler(self)
+        return RadiocolHandler(self)
+
 
 class RadiocolHandler (XMPPHandler):
     implements(iwokkel.IDisco)
@@ -329,11 +327,10 @@
         self.host = plugin_parent.host
 
     def connectionInitialized(self):
-        self.xmlstream.addObserver(RADIOC_REQUEST, self.plugin_parent.radiocol_game_cmd, profile = self.parent.profile)
+        self.xmlstream.addObserver(RADIOC_REQUEST, self.plugin_parent.radiocol_game_cmd, profile=self.parent.profile)
 
     def getDiscoInfo(self, requestor, target, nodeIdentifier=''):
         return [disco.DiscoFeature(NC_RADIOCOL)]
 
     def getDiscoItems(self, requestor, target, nodeIdentifier=''):
         return []
-
diff --git a/src/plugins/plugin_misc_smtp.py b/src/plugins/plugin_misc_smtp.py
--- a/src/plugins/plugin_misc_smtp.py
+++ b/src/plugins/plugin_misc_smtp.py
@@ -21,33 +21,32 @@
 
 from logging import debug, info, error
 import warnings
-from twisted.internet import protocol,defer
+from twisted.internet import protocol, defer
 from twisted.words.protocols.jabber import error as jab_error
-from twisted.cred import portal,checkers,credentials
+from twisted.cred import portal, checkers, credentials
 from twisted.cred import error as cred_error
 from twisted.mail import smtp
 from twisted.python import failure
 from email.parser import Parser
 from email.utils import parseaddr
 from twisted.mail.imap4 import LOGINCredentials, PLAINCredentials
-import os,os.path
+import os
 from twisted.internet import reactor
 import sys
 
-
 from zope.interface import implements
 
+PLUGIN_INFO = {
+    "name": "SMTP server Plugin",
+    "import_name": "SMTP",
+    "type": "Misc",
+    "protocols": [],
+    "dependencies": ["Maildir"],
+    "main": "SMTP_server",
+    "handler": "no",
+    "description": _("""Create a SMTP server that you can use to send your "normal" type messages""")
+}
 
-PLUGIN_INFO = {
-"name": "SMTP server Plugin",
-"import_name": "SMTP",
-"type": "Misc",
-"protocols": [],
-"dependencies": ["Maildir"],
-"main": "SMTP_server",
-"handler": "no",
-"description": _("""Create a SMTP server that you can use to send your "normal" type messages""")
-}
 
 class SMTP_server(object):
 
@@ -74,13 +73,14 @@
         self.server_factory = SmtpServerFactory(self.host)
         reactor.listenTCP(port, self.server_factory)
 
+
 class SatSmtpMessage(object):
     implements(smtp.IMessage)
 
     def __init__(self, host, profile):
-        self.host=host
-        self.profile=profile
-        self.message=[]
+        self.host = host
+        self.profile = profile
+        self.message = []
 
     def lineReceived(self, line):
         """handle another line"""
@@ -90,25 +90,26 @@
         """handle end of message"""
         mail = Parser().parsestr("\n".join(self.message))
         try:
-            self.host.sendMessage(parseaddr(mail['to'].decode('utf-8','replace'))[1], mail.get_payload().decode('utf-8','replace'), #TODO: manage other charsets
-                                  subject=mail['subject'].decode('utf-8','replace'), mess_type='normal', profile_key=self.profile)
+            self.host.sendMessage(parseaddr(mail['to'].decode('utf-8', 'replace'))[1], mail.get_payload().decode('utf-8', 'replace'),  # TODO: manage other charsets
+                                  subject=mail['subject'].decode('utf-8', 'replace'), mess_type='normal', profile_key=self.profile)
         except:
             exc_type, exc_value, exc_traceback = sys.exc_info()
-            error(_("Can't send message: %s") % exc_value) #The email is invalid or incorreclty parsed
+            error(_("Can't send message: %s") % exc_value)  # The email is invalid or incorreclty parsed
             return defer.fail()
-        self.message=None
+        self.message = None
         return defer.succeed(None)
 
     def connectionLost(self):
         """handle message truncated"""
         raise smtp.SMTPError
 
+
 class SatSmtpDelivery(object):
     implements(smtp.IMessageDelivery)
 
     def __init__(self, host, profile):
-        self.host=host
-        self.profile=profile
+        self.host = host
+        self.profile = profile
 
     def receivedHeader(self, helo, origin, recipients):
         """
@@ -144,18 +145,20 @@
         """
         return origin
 
+
 class SmtpRealm(object):
     implements(portal.IRealm)
 
-    def __init__(self,host):
+    def __init__(self, host):
         self.host = host
 
     def requestAvatar(self, avatarID, mind, *interfaces):
         debug('requestAvatar')
-        profile=avatarID.decode('utf-8')
+        profile = avatarID.decode('utf-8')
         if smtp.IMessageDelivery not in interfaces:
             raise NotImplementedError
-        return smtp.IMessageDelivery, SatSmtpDelivery(self.host,profile), lambda:None
+        return smtp.IMessageDelivery, SatSmtpDelivery(self.host, profile), lambda: None
+
 
 class SatProfileCredentialChecker(object):
     """
@@ -167,7 +170,6 @@
     credentialInterfaces = (credentials.IUsernamePassword,
                             credentials.IUsernameHashedPassword)
 
-
     def __init__(self, host):
         self.host = host
 
@@ -182,26 +184,26 @@
         if not credentials.username in profiles:
             return defer.fail(cred_error.UnauthorizedLogin())
         password = self.host.memory.getParamA("Password", "Connection", profile_key=credentials.username)
-        return defer.maybeDeferred(
-            credentials.checkPassword,
-            password).addCallback(
-            self._cbPasswordMatch, credentials.username)
+        return defer.maybeDeferred(credentials.checkPassword,
+                                   password).addCallback(self._cbPasswordMatch,
+                                                         credentials.username)
+
 
 class SmtpServerFactory(smtp.SMTPFactory):
 
     def __init__(self, host):
         self.protocol = smtp.ESMTP
-        self.host=host
+        self.host = host
         _portal = portal.Portal(SmtpRealm(self.host))
         _portal.registerChecker(SatProfileCredentialChecker(self.host))
         smtp.SMTPFactory.__init__(self, _portal)
 
     def startedConnecting(self, connector):
-        debug (_("SMTP server connection started"))
+        debug(_("SMTP server connection started"))
         smtp.SMTPFactory.startedConnecting(self, connector)
 
     def clientConnectionLost(self, connector, reason):
-        debug (_("SMTP server connection lost (reason: %s)"), reason)
+        debug(_("SMTP server connection lost (reason: %s)"), reason)
         smtp.SMTPFactory.clientConnectionLost(self, connector, reason)
 
     def buildProtocol(self, addr):
@@ -209,4 +211,3 @@
         # add the challengers from imap4, more secure and complicated challengers are available
         p.challengers = {"LOGIN": LOGINCredentials, "PLAIN": PLAINCredentials}
         return p
-
diff --git a/src/plugins/plugin_misc_tarot.py b/src/plugins/plugin_misc_tarot.py
--- a/src/plugins/plugin_misc_tarot.py
+++ b/src/plugins/plugin_misc_tarot.py
@@ -43,14 +43,14 @@
 CG_REQUEST = MESSAGE + '/' + CG_TAG + '[@xmlns="' + NS_CG + '"]'
 
 PLUGIN_INFO = {
-"name": "Tarot cards plugin",
-"import_name": "Tarot",
-"type": "Misc",
-"protocols": [],
-"dependencies": ["XEP-0045", "XEP-0249"],
-"main": "Tarot",
-"handler": "yes",
-"description": _("""Implementation of Tarot card game""")
+    "name": "Tarot cards plugin",
+    "import_name": "Tarot",
+    "type": "Misc",
+    "protocols": [],
+    "dependencies": ["XEP-0045", "XEP-0249"],
+    "main": "Tarot",
+    "handler": "yes",
+    "description": _("""Implementation of Tarot card game""")
 }
 
 
@@ -59,33 +59,33 @@
     def __init__(self, host):
         info(_("Plugin Tarot initialization"))
         self.host = host
-        self.games={}
-        self.waiting_inv = {} #Invitation waiting for people to join to launch a game
+        self.games = {}
+        self.waiting_inv = {}  # Invitation waiting for people to join to launch a game
         self.contrats = [_('Passe'), _('Petite'), _('Garde'), _('Garde Sans'), _('Garde Contre')]
-        host.bridge.addMethod("tarotGameLaunch", ".plugin", in_sign='ass', out_sign='', method=self.launchGame) #args: room_jid, players, profile
-        host.bridge.addMethod("tarotGameCreate", ".plugin", in_sign='sass', out_sign='', method=self.createGame) #args: room_jid, players, profile
-        host.bridge.addMethod("tarotGameReady", ".plugin", in_sign='sss', out_sign='', method=self.newPlayerReady) #args: player, referee, profile
-        host.bridge.addMethod("tarotGameContratChoosed", ".plugin", in_sign='ssss', out_sign='', method=self.contratChoosed) #args: player, referee, contrat, profile
-        host.bridge.addMethod("tarotGamePlayCards", ".plugin", in_sign='ssa(ss)s', out_sign='', method=self.play_cards) #args: player, referee, cards, profile
-        host.bridge.addSignal("tarotGameStarted", ".plugin", signature='ssass') #args: room_jid, referee, players, profile
-        host.bridge.addSignal("tarotGameNew", ".plugin", signature='sa(ss)s') #args: room_jid, hand, profile
-        host.bridge.addSignal("tarotGameChooseContrat", ".plugin", signature='sss') #args: room_jid, xml_data, profile
-        host.bridge.addSignal("tarotGameShowCards", ".plugin", signature='ssa(ss)a{ss}s') #args: room_jid, type ["chien", "poignée",...], cards, data[dict], profile
-        host.bridge.addSignal("tarotGameCardsPlayed", ".plugin", signature='ssa(ss)s') #args: room_jid, player, type ["chien", "poignée",...], cards, data[dict], profile
-        host.bridge.addSignal("tarotGameYourTurn", ".plugin", signature='ss') #args: room_jid, profile
-        host.bridge.addSignal("tarotGameScore", ".plugin", signature='ssasass') #args: room_jid, xml_data, winners (list of nicks), loosers (list of nicks), profile
-        host.bridge.addSignal("tarotGameInvalidCards", ".plugin", signature='ssa(ss)a(ss)s') #args: room_jid, game phase, played_cards, invalid_cards, profile
+        host.bridge.addMethod("tarotGameLaunch", ".plugin", in_sign='ass', out_sign='', method=self.launchGame)  # args: room_jid, players, profile
+        host.bridge.addMethod("tarotGameCreate", ".plugin", in_sign='sass', out_sign='', method=self.createGame)  # args: room_jid, players, profile
+        host.bridge.addMethod("tarotGameReady", ".plugin", in_sign='sss', out_sign='', method=self.newPlayerReady)  # args: player, referee, profile
+        host.bridge.addMethod("tarotGameContratChoosed", ".plugin", in_sign='ssss', out_sign='', method=self.contratChoosed)  # args: player, referee, contrat, profile
+        host.bridge.addMethod("tarotGamePlayCards", ".plugin", in_sign='ssa(ss)s', out_sign='', method=self.play_cards)  # args: player, referee, cards, profile
+        host.bridge.addSignal("tarotGameStarted", ".plugin", signature='ssass')  # args: room_jid, referee, players, profile
+        host.bridge.addSignal("tarotGameNew", ".plugin", signature='sa(ss)s')  # args: room_jid, hand, profile
+        host.bridge.addSignal("tarotGameChooseContrat", ".plugin", signature='sss')  # args: room_jid, xml_data, profile
+        host.bridge.addSignal("tarotGameShowCards", ".plugin", signature='ssa(ss)a{ss}s')  # args: room_jid, type ["chien", "poignée",...], cards, data[dict], profile
+        host.bridge.addSignal("tarotGameCardsPlayed", ".plugin", signature='ssa(ss)s')  # args: room_jid, player, type ["chien", "poignée",...], cards, data[dict], profile
+        host.bridge.addSignal("tarotGameYourTurn", ".plugin", signature='ss')  # args: room_jid, profile
+        host.bridge.addSignal("tarotGameScore", ".plugin", signature='ssasass')  # args: room_jid, xml_data, winners (list of nicks), loosers (list of nicks), profile
+        host.bridge.addSignal("tarotGameInvalidCards", ".plugin", signature='ssa(ss)a(ss)s')  # args: room_jid, game phase, played_cards, invalid_cards, profile
         host.trigger.add("MUC user joined", self.userJoinedTrigger)
         self.deck_ordered = []
-        for value in ['excuse']+map(str,range(1,22)):
-            self.deck_ordered.append(TarotCard(("atout",value)))
+        for value in ['excuse'] + map(str, range(1, 22)):
+            self.deck_ordered.append(TarotCard(("atout", value)))
         for suit in ["pique", "coeur", "carreau", "trefle"]:
-            for value in map(str,range(1,11))+["valet","cavalier","dame","roi"]:
+            for value in map(str, range(1, 11)) + ["valet", "cavalier", "dame", "roi"]:
                 self.deck_ordered.append(TarotCard((suit, value)))
 
     def createGameElt(self, to_jid, type="normal"):
         type = "normal" if to_jid.resource else "groupchat"
-        elt = domish.Element((None,'message'))
+        elt = domish.Element((None, 'message'))
         elt["to"] = to_jid.full()
         elt["type"] = type
         elt.addElement((NS_CG, CG_TAG))
@@ -93,9 +93,9 @@
 
     def __card_list_to_xml(self, cards_list, elt_name):
         """Convert a card list to domish element"""
-        cards_list_elt = domish.Element((None,elt_name))
+        cards_list_elt = domish.Element((None, elt_name))
         for card in cards_list:
-            card_elt = domish.Element((None,'card'))
+            card_elt = domish.Element((None, 'card'))
             card_elt['suit'] = card.suit
             card_elt['value'] = card.value
             cards_list_elt.addChild(card_elt)
@@ -108,22 +108,21 @@
             cards_list.append((card['suit'], card['value']))
         return cards_list
 
-
     def __create_started_elt(self, players):
         """Create a game_started domish element"""
-        started_elt = domish.Element((None,'started'))
+        started_elt = domish.Element((None, 'started'))
         idx = 0
         for player in players:
-            player_elt = domish.Element((None,'player'))
+            player_elt = domish.Element((None, 'player'))
             player_elt.addContent(player)
             player_elt['index'] = str(idx)
-            idx+=1
+            idx += 1
             started_elt.addChild(player_elt)
         return started_elt
 
     def __ask_contrat(self):
         """Create a element for asking contrat"""
-        contrat_elt = domish.Element((None,'contrat'))
+        contrat_elt = domish.Element((None, 'contrat'))
         form = data_form.Form('form', title=_('contrat selection'))
         field = data_form.Field('list-single', 'contrat', options=map(data_form.Option, self.contrats), required=True)
         form.addField(field)
@@ -136,18 +135,18 @@
         @param winners: list of unicode nicks of winners
         @param loosers: list of unicode nicks of loosers"""
 
-        score_elt = domish.Element((None,'score'))
+        score_elt = domish.Element((None, 'score'))
         form = data_form.Form('form', title=_('scores'))
         for line in scores.split('\n'):
-            field = data_form.Field('fixed', value = line)
+            field = data_form.Field('fixed', value=line)
             form.addField(field)
         score_elt.addChild(form.toElement())
         for winner in winners:
-            winner_elt = domish.Element((None,'winner'))
+            winner_elt = domish.Element((None, 'winner'))
             winner_elt.addContent(winner)
             score_elt.addChild(winner_elt)
         for looser in loosers:
-            looser_elt = domish.Element((None,'looser'))
+            looser_elt = domish.Element((None, 'looser'))
             looser_elt.addContent(looser)
             score_elt.addChild(looser_elt)
         return score_elt
@@ -156,7 +155,7 @@
         """Create a element for invalid_cards error
         @param list_cards: list of Card
         @param game_phase: phase of the game ['ecart', 'play']"""
-        error_elt = domish.Element((None,'error'))
+        error_elt = domish.Element((None, 'error'))
         played_elt = self.__card_list_to_xml(played_cards, 'played')
         invalid_elt = self.__card_list_to_xml(invalid_cards, 'invalid')
         error_elt['type'] = 'invalid_cards'
@@ -165,7 +164,7 @@
         error_elt.addChild(invalid_elt)
         return error_elt
 
-    def __next_player(self, game_data, next_pl = None):
+    def __next_player(self, game_data, next_pl=None):
         """Increment player number & return player name
         @param next_pl: if given, then next_player is forced to this one
         """
@@ -189,7 +188,7 @@
             card = players_data[player]['played']
             if card.value == "excuse":
                 continue
-            if suit_asked == None:
+            if suit_asked is None:
                 suit_asked = card.suit
             if (card.suit == suit_asked or card.suit == "atout") and card > strongest:
                 strongest = card
@@ -204,7 +203,7 @@
         @param winner: nick of the trick winner"""
         #TODO: manage the case where excuse is played on the last trick (and lost)
         players_data = game_data['players_data']
-        excuse = TarotCard(("atout","excuse"))
+        excuse = TarotCard(("atout", "excuse"))
 
         #we first check if the Excuse was already played
         #and if somebody is waiting for a card
@@ -218,7 +217,7 @@
                             pl_waiting = players_data[player]['wait_for_low']
                             played.remove(card)
                             players_data[pl_waiting]['levees'].append(card)
-                            debug (_('Player %(excuse_owner)s give %(card_waited)s to %(player_waiting)s for Excuse compensation') % {"excuse_owner":player, "card_waited": card, "player_waiting":pl_waiting})
+                            debug(_('Player %(excuse_owner)s give %(card_waited)s to %(player_waiting)s for Excuse compensation') % {"excuse_owner": player, "card_waited": card, "player_waiting": pl_waiting})
                             return
                 return
 
@@ -226,14 +225,14 @@
             #the Excuse is not on the table, nothing to do
             return
 
-        excuse_player = None #Who has played the Excuse ?
+        excuse_player = None  # Who has played the Excuse ?
         for player in game_data['players']:
             if players_data[player]['played'] == excuse:
                 excuse_player = player
                 break
 
         if excuse_player == winner:
-            return #the excuse player win the trick, nothing to do
+            return  # the excuse player win the trick, nothing to do
 
         #first we remove the excuse from played cards
         played.remove(excuse)
@@ -244,18 +243,17 @@
         low_card = None
         #We look backward in cards won by the Excuse owner to
         #find a low value card
-        for card_idx in range(len(owner_levees)-1, -1, -1):
+        for card_idx in range(len(owner_levees) - 1, -1, -1):
             if owner_levees[card_idx].points == 0.5:
                 low_card = owner_levees[card_idx]
                 del owner_levees[card_idx]
                 players_data[winner]['levees'].append(low_card)
-                debug (_('Player %(excuse_owner)s give %(card_waited)s to %(player_waiting)s for Excuse compensation') % {"excuse_owner":excuse_player, "card_waited": low_card, "player_waiting":winner})
+                debug(_('Player %(excuse_owner)s give %(card_waited)s to %(player_waiting)s for Excuse compensation') % {"excuse_owner": excuse_player, "card_waited": low_card, "player_waiting": winner})
                 break
-        if not low_card: #The player has no low card yet
+        if not low_card:  # The player has no low card yet
             #TODO: manage case when player never win a trick with low card
             players_data[excuse_player]['wait_for_low'] = winner
-            debug(_("%(excuse_owner)s keep the Excuse but has not card to give, %(winner)s is waiting for one") % {'excuse_owner':excuse_player, 'winner':winner})
-
+            debug(_("%(excuse_owner)s keep the Excuse but has not card to give, %(winner)s is waiting for one") % {'excuse_owner': excuse_player, 'winner': winner})
 
     def __draw_game(self, game_data):
         """The game is draw, no score change
@@ -263,14 +261,13 @@
         @return: tuple with (string victory message, list of winners, list of loosers)"""
         players_data = game_data['players_data']
         scores_str = _('Draw game')
-        scores_str+='\n'
+        scores_str += '\n'
         for player in game_data['players']:
-            scores_str+=_("\n--\n%(player)s:\nscore for this game ==> %(score_game)i\ntotal score ==> %(total_score)i") % {'player':player, 'score_game':0, 'total_score': players_data[player]['score']}
+            scores_str += _("\n--\n%(player)s:\nscore for this game ==> %(score_game)i\ntotal score ==> %(total_score)i") % {'player': player, 'score_game': 0, 'total_score': players_data[player]['score']}
         debug(scores_str)
 
         return (scores_str, [], [])
 
-
     def __calculate_scores(self, game_data):
         """The game is finished, time to know who won :)
         @param game_data: data of the game
@@ -282,7 +279,7 @@
         bouts = []
         for card in levees:
             if card.bout:
-                nb_bouts +=1
+                nb_bouts += 1
                 bouts.append(card.value)
             score += card.points
 
@@ -292,10 +289,10 @@
         defenseurs.remove(game_data['attaquant'])
         for defenseur in defenseurs:
             for card in players_data[defenseur]['levees']:
-                check_score+=card.points
+                check_score += card.points
         if game_data['contrat'] == "Garde Contre":
             for card in game_data['chien']:
-                check_score+=card.points
+                check_score += card.points
         assert (score + check_score == 91)
 
         point_limit = None
@@ -329,16 +326,16 @@
             #TODO: adjust this for 3 and 5 players variants
             #TODO: manage bonuses (petit au bout, poignée, chelem)
             player_score[player] = points_defenseur if player != game_data['attaquant'] else points_defenseur * -3
-            players_data[player]['score'] += player_score[player] #we add score of this game to the global score
+            players_data[player]['score'] += player_score[player]  # we add score of this game to the global score
             if player_score[player] > 0:
                 winners.append(player)
             else:
                 loosers.append(player)
 
-        scores_str = _('The attacker (%(attaquant)s) makes %(points)i and needs to make %(point_limit)i (%(nb_bouts)s oulder%(plural)s%(separator)s%(bouts)s): he %(victory)s') % {'attaquant':game_data['attaquant'], 'points':score, 'point_limit':point_limit, 'nb_bouts': nb_bouts, 'plural': 's' if nb_bouts>1 else '', 'separator':': ' if nb_bouts != 0 else '', 'bouts':','.join(map(str,bouts)), 'victory': 'win' if victory else 'loose'}
-        scores_str+='\n'
+        scores_str = _('The attacker (%(attaquant)s) makes %(points)i and needs to make %(point_limit)i (%(nb_bouts)s oulder%(plural)s%(separator)s%(bouts)s): he %(victory)s') % {'attaquant': game_data['attaquant'], 'points': score, 'point_limit': point_limit, 'nb_bouts': nb_bouts, 'plural': 's' if nb_bouts > 1 else '', 'separator': ': ' if nb_bouts != 0 else '', 'bouts': ','.join(map(str, bouts)), 'victory': 'win' if victory else 'loose'}
+        scores_str += '\n'
         for player in game_data['players']:
-            scores_str+=_("\n--\n%(player)s:\nscore for this game ==> %(score_game)i\ntotal score ==> %(total_score)i") % {'player':player, 'score_game':player_score[player], 'total_score': players_data[player]['score']}
+            scores_str += _("\n--\n%(player)s:\nscore for this game ==> %(score_game)i\ntotal score ==> %(total_score)i") % {'player': player, 'score_game': player_score[player], 'total_score': players_data[player]['score']}
         debug(scores_str)
 
         return (scores_str, winners, loosers)
@@ -351,7 +348,7 @@
         forbidden_cards = []
         if game_data['stage'] == 'ecart':
             for card in cards:
-                if card.bout or card.value=="roi":
+                if card.bout or card.value == "roi":
                     forbidden_cards.append(card)
                 #TODO: manage case where atouts (trumps) are in the dog
         elif game_data['stage'] == 'play':
@@ -373,7 +370,7 @@
                 if played_card.suit == "atout" and played_card > biggest_atout:
                     biggest_atout = played_card
                 idx = (idx + 1) % len(players)
-            has_suit = False #True if there is one card of the asked suit in the hand of the player
+            has_suit = False  # True if there is one card of the asked suit in the hand of the player
             has_atout = False
             biggest_hand_atout = None
 
@@ -399,18 +396,16 @@
             error(_('Internal error: unmanaged game stage'))
         return forbidden_cards
 
-
     def __start_play(self, room_jid, game_data, profile):
         """Start the game (tell to the first player after dealer to play"""
         game_data['stage'] = "play"
-        next_player_idx = game_data['current_player'] = (game_data['init_player'] + 1) % len(game_data['players']) #the player after the dealer start
+        next_player_idx = game_data['current_player'] = (game_data['init_player'] + 1) % len(game_data['players'])  # the player after the dealer start
         game_data['first_player'] = next_player = game_data['players'][next_player_idx]
-        to_jid = jid.JID(room_jid.userhost()+"/"+next_player) #FIXME: gof:
+        to_jid = jid.JID(room_jid.userhost() + "/" + next_player)  # FIXME: gof:
         mess = self.createGameElt(to_jid)
         yourturn_elt = mess.firstChildElement().addElement('your_turn')
         self.host.profiles[profile].xmlstream.send(mess)
 
-
     def userJoinedTrigger(self, room, user, profile):
         """This trigger is used to check if we are waiting people in this room,
         and to create a game if everybody is here"""
@@ -435,8 +430,8 @@
         def tarotRoomJoined(room):
             _room = room.occupantJID.userhostJID()
             for player in players:
-                self.host.plugins["XEP-0249"].invite(jid.JID(player), room.occupantJID.userhostJID(), {"game":"Tarot"}, profile)
-            self.waiting_inv[_room] = (time(), players) #TODO: remove invitation waiting for too long, using the time data
+                self.host.plugins["XEP-0249"].invite(jid.JID(player), room.occupantJID.userhostJID(), {"game": "Tarot"}, profile)
+            self.waiting_inv[_room] = (time(), players)  # TODO: remove invitation waiting for too long, using the time data
 
         def after_init(ignore):
             room_name = "sat_tarot_%s" % self.host.plugins["XEP-0045"].getUniqueName(profile_key)
@@ -464,36 +459,33 @@
             return
         client.client_initialized.addCallback(after_init)
 
-
-
-
     def createGame(self, room_jid_param, players, profile_key='@NONE@'):
         """Create a new game
         @param room_jid_param: jid of the room
         @param players: list of players nick (nick must exist in the room)
         @param profile_key: %(doc_profile_key)s"""
-        debug (_("Creating Tarot game"))
+        debug(_("Creating Tarot game"))
         room_jid = jid.JID(room_jid_param)
         profile = self.host.memory.getProfileName(profile_key)
         if not profile:
-            error (_("profile %s is unknown") % profile_key)
+            error(_("profile %s is unknown") % profile_key)
             return
-        if self.games.has_key(room_jid):
-            warning (_("Tarot game already started in room %s") % room_jid.userhost())
+        if room_jid in self.games:
+            warning(_("Tarot game already started in room %s") % room_jid.userhost())
         else:
             room_nick = self.host.plugins["XEP-0045"].getRoomNick(room_jid.userhost(), profile)
             if not room_nick:
-                error ('Internal error')
+                error('Internal error')
                 return
             referee = room_jid.userhost() + '/' + room_nick
             status = {}
             players_data = {}
             for player in players:
-                players_data[player] = {'score':0}
+                players_data[player] = {'score': 0}
                 status[player] = "init"
-            self.games[room_jid.userhost()] = {'referee':referee, 'players':players, 'status':status, 'players_data':players_data, 'hand_size':18, 'init_player':0, 'current_player': None, 'contrat': None, 'stage': None}
+            self.games[room_jid.userhost()] = {'referee': referee, 'players': players, 'status': status, 'players_data': players_data, 'hand_size': 18, 'init_player': 0, 'current_player': None, 'contrat': None, 'stage': None}
             for player in players:
-                mess = self.createGameElt(jid.JID(room_jid.userhost()+'/'+player))
+                mess = self.createGameElt(jid.JID(room_jid.userhost() + '/' + player))
                 mess.firstChildElement().addChild(self.__create_started_elt(players))
                 self.host.profiles[profile].xmlstream.send(mess)
 
@@ -501,9 +493,9 @@
         """Must be called when player is ready to start a new game"""
         profile = self.host.memory.getProfileName(profile_key)
         if not profile:
-            error (_("profile %s is unknown") % profile_key)
+            error(_("profile %s is unknown") % profile_key)
             return
-        debug ('new player ready: %s' % profile)
+        debug('new player ready: %s' % profile)
         mess = self.createGameElt(jid.JID(referee))
         ready_elt = mess.firstChildElement().addElement('player_ready')
         ready_elt['player'] = player
@@ -518,11 +510,11 @@
         """
         profile = self.host.memory.getProfileName(profile_key)
         if not profile:
-            error (_("profile %s is unknown") % profile_key)
+            error(_("profile %s is unknown") % profile_key)
             return
-        debug (_('contrat [%(contrat)s] choosed by %(profile)s') % {'contrat':contrat, 'profile':profile})
+        debug(_('contrat [%(contrat)s] choosed by %(profile)s') % {'contrat': contrat, 'profile': profile})
         mess = self.createGameElt(jid.JID(referee))
-        contrat_elt = mess.firstChildElement().addElement(('','contrat_choosed'), content=contrat)
+        contrat_elt = mess.firstChildElement().addElement(('', 'contrat_choosed'), content=contrat)
         contrat_elt['player'] = player
         self.host.profiles[profile].xmlstream.send(mess)
 
@@ -535,9 +527,9 @@
         """
         profile = self.host.memory.getProfileName(profile_key)
         if not profile:
-            error (_("profile %s is unknown") % profile_key)
+            error(_("profile %s is unknown") % profile_key)
             return
-        debug (_('Cards played by %(profile)s: [%(cards)s]') % {'profile':profile,'cards':cards})
+        debug(_('Cards played by %(profile)s: [%(cards)s]') % {'profile': profile, 'cards': cards})
         mess = self.createGameElt(jid.JID(referee))
         playcard_elt = mess.firstChildElement().addChild(self.__card_list_to_xml(TarotCard.from_tuples(cards), 'cards_played'))
         playcard_elt['player'] = player
@@ -545,7 +537,7 @@
 
     def newGame(self, room_jid, profile):
         """Launch a new round"""
-        debug (_('new Tarot game'))
+        debug(_('new Tarot game'))
         deck = self.deck_ordered[:]
         random.shuffle(deck)
         game_data = self.games[room_jid.userhost()]
@@ -553,7 +545,7 @@
         players_data = game_data['players_data']
         current_player = game_data['current_player']
         game_data['stage'] = "init"
-        game_data['first_player'] = None #first player for the current trick
+        game_data['first_player'] = None  # first player for the current trick
         game_data['contrat'] = None
         hand = game_data['hand'] = {}
         hand_size = game_data['hand_size']
@@ -565,23 +557,22 @@
         del(deck[:])
 
         for player in players:
-            to_jid = jid.JID(room_jid.userhost()+"/"+player) #FIXME: gof:
+            to_jid = jid.JID(room_jid.userhost() + "/" + player)  # FIXME: gof:
             mess = self.createGameElt(to_jid)
             mess.firstChildElement().addChild(self.__card_list_to_xml(hand[player], 'hand'))
             self.host.profiles[profile].xmlstream.send(mess)
             players_data[player]['contrat'] = None
-            players_data[player]['levees'] = [] #cards won
-            players_data[player]['played'] = None #card on the table
-            players_data[player]['wait_for_low'] = None #Used when a player wait for a low card because of excuse
+            players_data[player]['levees'] = []  # cards won
+            players_data[player]['played'] = None  # card on the table
+            players_data[player]['wait_for_low'] = None  # Used when a player wait for a low card because of excuse
 
-        pl_idx = game_data['current_player'] = (game_data['init_player'] + 1) % len(players) #the player after the dealer start
+        pl_idx = game_data['current_player'] = (game_data['init_player'] + 1) % len(players)  # the player after the dealer start
         player = players[pl_idx]
-        to_jid = jid.JID(room_jid.userhost()+"/"+player) #FIXME: gof:
+        to_jid = jid.JID(room_jid.userhost() + "/" + player)  # FIXME: gof:
         mess = self.createGameElt(to_jid)
         mess.firstChildElement().addChild(self.__ask_contrat())
         self.host.profiles[profile].xmlstream.send(mess)
 
-
     def card_game_cmd(self, mess_elt, profile):
         from_jid = jid.JID(mess_elt['from'])
         room_jid = jid.JID(from_jid.userhost())
@@ -591,25 +582,25 @@
 
         for elt in game_elt.elements():
 
-            if elt.name == 'started': #new game created
+            if elt.name == 'started':  # new game created
                 players = []
                 for player in elt.elements():
                     players.append(unicode(player))
                 self.host.bridge.tarotGameStarted(room_jid.userhost(), from_jid.full(), players, profile)
 
-            elif elt.name == 'player_ready': #ready to play
+            elif elt.name == 'player_ready':  # ready to play
                 player = elt['player']
                 status = self.games[room_jid.userhost()]['status']
                 nb_players = len(self.games[room_jid.userhost()]['players'])
                 status[player] = 'ready'
-                debug (_('Player %(player)s is ready to start [status: %(status)s]') % {'player':player, 'status':status})
-                if status.values().count('ready') == nb_players: #everybody is ready, we can start the game
+                debug(_('Player %(player)s is ready to start [status: %(status)s]') % {'player': player, 'status': status})
+                if status.values().count('ready') == nb_players:  # everybody is ready, we can start the game
                     self.newGame(room_jid, profile)
 
-            elif elt.name == 'hand': #a new hand has been received
+            elif elt.name == 'hand':  # a new hand has been received
                 self.host.bridge.tarotGameNew(room_jid.userhost(), self.__xml_to_list(elt), profile)
 
-            elif elt.name == 'contrat': #it's time to choose contrat
+            elif elt.name == 'contrat':  # it's time to choose contrat
                 form = data_form.Form.fromElement(elt.firstChildElement())
                 xml_data = dataForm2xml(form)
                 self.host.bridge.tarotGameChooseContrat(room_jid.userhost(), xml_data, profile)
@@ -623,7 +614,7 @@
                 if contrats.count(None):
                     #not everybody has choosed his contrat, it's next one turn
                     player = self.__next_player(game_data)
-                    to_jid = jid.JID(room_jid.userhost()+"/"+player) #FIXME: gof:
+                    to_jid = jid.JID(room_jid.userhost() + "/" + player)  # FIXME: gof:
                     mess = self.createGameElt(to_jid)
                     mess.firstChildElement().addChild(self.__ask_contrat())
                     self.host.profiles[profile].xmlstream.send(mess)
@@ -642,11 +633,11 @@
                         mess = self.createGameElt(to_jid)
                         mess.firstChildElement().addChild(self.__give_scores(*self.__draw_game(game_data)))
                         self.host.profiles[profile].xmlstream.send(mess)
-                        game_data['init_player'] = (game_data['init_player'] + 1) % len(game_data['players']) #we change the dealer
+                        game_data['init_player'] = (game_data['init_player'] + 1) % len(game_data['players'])  # we change the dealer
                         for player in game_data['players']:
                             game_data['status'][player] = "init"
                         return
-                    debug (_("%(player)s win the bid with %(contrat)s") % {'player':best_contrat[0],'contrat':best_contrat[1]})
+                    debug(_("%(player)s win the bid with %(contrat)s") % {'player': best_contrat[0], 'contrat': best_contrat[1]})
                     game_data['contrat'] = best_contrat[1]
 
                     if game_data['contrat'] == "Garde Sans" or game_data['contrat'] == "Garde Contre":
@@ -654,7 +645,7 @@
                         game_data['attaquant'] = best_contrat[0]
                     else:
                         #Time to show the chien to everybody
-                        to_jid = jid.JID(room_jid.userhost()) #FIXME: gof:
+                        to_jid = jid.JID(room_jid.userhost())  # FIXME: gof:
                         mess = self.createGameElt(to_jid)
                         chien_elt = mess.firstChildElement().addChild(self.__card_list_to_xml(game_data['chien'], 'chien'))
                         chien_elt['attaquant'] = best_contrat[0]
@@ -668,10 +659,9 @@
                         players_data[best_contrat[0]]['levees'].extend(game_data['chien'])
                         del game_data['chien'][:]
 
-
-            elif elt.name == 'chien': #we have received the chien
-                debug (_("tarot: chien received"))
-                data = {"attaquant":elt['attaquant']}
+            elif elt.name == 'chien':  # we have received the chien
+                debug(_("tarot: chien received"))
+                data = {"attaquant": elt['attaquant']}
                 game_data['stage'] = "ecart"
                 game_data['attaquant'] = elt['attaquant']
                 self.host.bridge.tarotGameShowCards(room_jid.userhost(), "chien", self.__xml_to_list(elt), data, profile)
@@ -679,18 +669,18 @@
             elif elt.name == 'cards_played':
                 if game_data['stage'] == "ecart":
                     #TODO: show atouts (trumps) if player put some in écart
-                    assert (game_data['attaquant'] == elt['player']) #TODO: throw an xml error here
+                    assert (game_data['attaquant'] == elt['player'])  # TODO: throw an xml error here
                     list_cards = TarotCard.from_tuples(self.__xml_to_list(elt))
                     #we now check validity of card
                     invalid_cards = self.__invalid_cards(game_data, list_cards)
                     if invalid_cards:
-                        mess = self.createGameElt(jid.JID(room_jid.userhost()+'/'+elt['player']))
+                        mess = self.createGameElt(jid.JID(room_jid.userhost() + '/' + elt['player']))
                         mess.firstChildElement().addChild(self.__invalid_cards_elt(list_cards, invalid_cards, game_data['stage']))
                         self.host.profiles[profile].xmlstream.send(mess)
                         return
 
                     #FIXME: gof: manage Garde Sans & Garde Contre cases
-                    players_data[elt['player']]['levees'].extend(list_cards) #we add the chien to attaquant's levées
+                    players_data[elt['player']]['levees'].extend(list_cards)  # we add the chien to attaquant's levées
                     for card in list_cards:
                         game_data['hand'][elt['player']].remove(card)
 
@@ -706,7 +696,7 @@
                         #we first check validity of card
                         invalid_cards = self.__invalid_cards(game_data, cards)
                         if invalid_cards:
-                            mess = self.createGameElt(jid.JID(room_jid.userhost()+'/'+current_player))
+                            mess = self.createGameElt(jid.JID(room_jid.userhost() + '/' + current_player))
                             mess.firstChildElement().addChild(self.__invalid_cards_elt(cards, invalid_cards, game_data['stage']))
                             self.host.profiles[profile].xmlstream.send(mess)
                             return
@@ -725,7 +715,7 @@
                         if all(played):
                             #everybody has played
                             winner = self.__winner(game_data)
-                            debug (_('The winner of this trick is %s') % winner)
+                            debug(_('The winner of this trick is %s') % winner)
                             #the winner win the trick
                             self.__excuse_hack(game_data, played, winner)
                             players_data[elt['player']]['levees'].extend(played)
@@ -738,7 +728,7 @@
                                 mess = self.createGameElt(to_jid)
                                 chien_elt = mess.firstChildElement().addChild(self.__give_scores(*self.__calculate_scores(game_data)))
                                 self.host.profiles[profile].xmlstream.send(mess)
-                                game_data['init_player'] = (game_data['init_player'] + 1) % len(game_data['players']) #we change the dealer
+                                game_data['init_player'] = (game_data['init_player'] + 1) % len(game_data['players'])  # we change the dealer
                                 for player in game_data['players']:
                                     game_data['status'][player] = "init"
                                 return
@@ -748,7 +738,7 @@
                             next_player = self.__next_player(game_data)
 
                         #finally, we tell to the next player to play
-                        to_jid = jid.JID(room_jid.userhost()+"/"+next_player)
+                        to_jid = jid.JID(room_jid.userhost() + "/" + next_player)
                         mess = self.createGameElt(to_jid)
                         yourturn_elt = mess.firstChildElement().addElement('your_turn')
                         self.host.profiles[profile].xmlstream.send(mess)
@@ -757,7 +747,7 @@
                 self.host.bridge.tarotGameYourTurn(room_jid.userhost(), profile)
 
             elif elt.name == 'score':
-                form_elt = elt.elements(name='x',uri='jabber:x:data').next()
+                form_elt = elt.elements(name='x', uri='jabber:x:data').next()
                 winners = []
                 loosers = []
                 for winner in elt.elements(name='winner', uri=NS_CG):
@@ -769,16 +759,17 @@
                 self.host.bridge.tarotGameScore(room_jid.userhost(), xml_data, winners, loosers, profile)
             elif elt.name == 'error':
                 if elt['type'] == 'invalid_cards':
-                    played_cards = self.__xml_to_list(elt.elements(name='played',uri=NS_CG).next())
-                    invalid_cards = self.__xml_to_list(elt.elements(name='invalid',uri=NS_CG).next())
+                    played_cards = self.__xml_to_list(elt.elements(name='played', uri=NS_CG).next())
+                    invalid_cards = self.__xml_to_list(elt.elements(name='invalid', uri=NS_CG).next())
                     self.host.bridge.tarotGameInvalidCards(room_jid.userhost(), elt['phase'], played_cards, invalid_cards, profile)
                 else:
-                    error (_('Unmanaged error type: %s') % elt['type'])
+                    error(_('Unmanaged error type: %s') % elt['type'])
             else:
-                error (_('Unmanaged card game element: %s') % elt.name)
+                error(_('Unmanaged card game element: %s') % elt.name)
 
     def getHandler(self, profile):
-            return CardGameHandler(self)
+        return CardGameHandler(self)
+
 
 class CardGameHandler (XMPPHandler):
     implements(iwokkel.IDisco)
@@ -788,11 +779,10 @@
         self.host = plugin_parent.host
 
     def connectionInitialized(self):
-        self.xmlstream.addObserver(CG_REQUEST, self.plugin_parent.card_game_cmd, profile = self.parent.profile)
+        self.xmlstream.addObserver(CG_REQUEST, self.plugin_parent.card_game_cmd, profile=self.parent.profile)
 
     def getDiscoInfo(self, requestor, target, nodeIdentifier=''):
         return [disco.DiscoFeature(NS_CG)]
 
     def getDiscoItems(self, requestor, target, nodeIdentifier=''):
         return []
-
diff --git a/src/plugins/plugin_misc_text_commands.py b/src/plugins/plugin_misc_text_commands.py
--- a/src/plugins/plugin_misc_text_commands.py
+++ b/src/plugins/plugin_misc_text_commands.py
@@ -23,16 +23,17 @@
 from logging import debug, info, warning, error
 
 PLUGIN_INFO = {
-"name": "Text commands",
-"import_name": "text-commands",
-"type": "Misc",
-"protocols": [],
-"dependencies": ["XEP-0045", "EXP-PARROT"],
-"main": "TextCommands",
-"handler": "no",
-"description": _("""IRC like text commands""")
+    "name": "Text commands",
+    "import_name": "text-commands",
+    "type": "Misc",
+    "protocols": [],
+    "dependencies": ["XEP-0045", "EXP-PARROT"],
+    "main": "TextCommands",
+    "handler": "no",
+    "description": _("""IRC like text commands""")
 }
 
+
 class TextCommands(object):
     #FIXME: doc strings for commands have to be translatable
     #       plugins need a dynamic translation system (translation
@@ -52,13 +53,13 @@
                 if command.isalpha():
                     # looks like an actual command, we try to call the corresponding method
                     try:
-                        mess_data["unparsed"] = msg[1+len(command):] #part not yet parsed of the message
-                        return getattr(self,"cmd_%s" % command)(mess_data,profile)
+                        mess_data["unparsed"] = msg[1 + len(command):]  # part not yet parsed of the message
+                        return getattr(self, "cmd_%s" % command)(mess_data, profile)
                     except AttributeError:
                         pass
-            elif msg[0] == '\\': #we have escape char
+            elif msg[0] == '\\':  # we have escape char
                 try:
-                    if msg[1] in ('/','\\'): # we have '\/' or '\\', we escape to '/' or '\'
+                    if msg[1] in ('/', '\\'):  # we have '\/' or '\\', we escape to '/' or '\'
                         mess_data["message"] = msg[1:]
                 except IndexError:
                     pass
@@ -72,9 +73,9 @@
         """
         nb_arobas = arg.count('@')
         if nb_arobas == 1:
-            if arg[-1] !='@':
+            if arg[-1] != '@':
                 return jid.JID(arg)
-            return jid.JID(arg+service_jid)
+            return jid.JID(arg + service_jid)
         return jid.JID(u"%s@%s" % (arg, service_jid))
 
     def _feedBack(self, message, mess_data, profile):
@@ -99,7 +100,7 @@
         nick = mess_data["unparsed"].strip()
         room = mess_data["to"]
 
-        self.host.plugins["XEP-0045"].nick(room,nick,profile)
+        self.host.plugins["XEP-0045"].nick(room, nick, profile)
 
         return False
 
@@ -134,7 +135,7 @@
         else:
             room = mess_data["to"]
 
-        self.host.plugins["XEP-0045"].leave(room,profile)
+        self.host.plugins["XEP-0045"].leave(room, profile)
 
         return False
 
@@ -183,7 +184,7 @@
         self.host.plugins["EXP-PARROT"].addParrot(link_left_jid, link_right_jid, profile)
         self.host.plugins["EXP-PARROT"].addParrot(link_right_jid, link_left_jid, profile)
 
-        self._feedBack("Parrot mode activated for %s" % (unicode(link_left_jid),), mess_data, profile)
+        self._feedBack("Parrot mode activated for %s" % (unicode(link_left_jid), ), mess_data, profile)
 
         return False
 
@@ -210,7 +211,7 @@
 
     def cmd_help(self, mess_data, profile):
         """show help on available commands"""
-        commands=filter(lambda method: method.startswith('cmd_'), dir(self))
+        commands = filter(lambda method: method.startswith('cmd_'), dir(self))
         longuest = max([len(command) for command in commands])
         help_cmds = []
 
@@ -223,7 +224,5 @@
             spaces = (longuest - len(command)) * ' '
             help_cmds.append("    /%s: %s %s" % (command[4:], spaces, help_str))
 
-        help_mess = _(u"Text commands available:\n%s") % (u'\n'.join(help_cmds),)
+        help_mess = _(u"Text commands available:\n%s") % (u'\n'.join(help_cmds), )
         self._feedBack(help_mess, mess_data, profile)
-
-
diff --git a/src/plugins/plugin_misc_xmllog.py b/src/plugins/plugin_misc_xmllog.py
--- a/src/plugins/plugin_misc_xmllog.py
+++ b/src/plugins/plugin_misc_xmllog.py
@@ -24,24 +24,25 @@
 from twisted.words.xish import domish
 
 PLUGIN_INFO = {
-"name": "Raw XML log Plugin",
-"import_name": "XmlLog",
-"type": "Misc",
-"protocols": [],
-"dependencies": [],
-"main": "XmlLog",
-"handler": "no",
-"description": _("""Send raw XML logs to bridge""")
+    "name": "Raw XML log Plugin",
+    "import_name": "XmlLog",
+    "type": "Misc",
+    "protocols": [],
+    "dependencies": [],
+    "main": "XmlLog",
+    "handler": "no",
+    "description": _("""Send raw XML logs to bridge""")
 }
 
+
 class LoggingXmlStream(XmlStream):
     """This class send the raw XML to the Bridge, for logging purpose"""
 
     def send(self, obj):
-        if isinstance(obj,basestring):
-            log=unicode(obj)
+        if isinstance(obj, basestring):
+            log = unicode(obj)
         elif isinstance(obj, domish.Element):
-            log=obj.toXml()
+            log = obj.toXml()
         else:
             error(_('INTERNAL ERROR: Unmanaged XML type'))
         self._host.bridge.xmlLog("OUT", log, self._profile)
@@ -72,7 +73,7 @@
         host.memory.importParams(self.params)
 
         #bridge
-        host.bridge.addSignal("xmlLog", ".plugin", signature='sss') #args: direction("IN" or "OUT"), xml_data, profile
+        host.bridge.addSignal("xmlLog", ".plugin", signature='sss')  # args: direction("IN" or "OUT"), xml_data, profile
 
         do_log = self.host.memory.getParamA("Xml log", "Debug")
         if do_log:
diff --git a/src/plugins/plugin_xep_0020.py b/src/plugins/plugin_xep_0020.py
--- a/src/plugins/plugin_xep_0020.py
+++ b/src/plugins/plugin_xep_0020.py
@@ -35,15 +35,16 @@
 NS_FEATURE_NEG = 'http://jabber.org/protocol/feature-neg'
 
 PLUGIN_INFO = {
-"name": "XEP 0020 Plugin",
-"import_name": "XEP-0020",
-"type": "XEP",
-"protocols": ["XEP-0020"],
-"main": "XEP_0020",
-"handler": "yes",
-"description": _("""Implementation of Feature Negotiation""")
+    "name": "XEP 0020 Plugin",
+    "import_name": "XEP-0020",
+    "type": "XEP",
+    "protocols": ["XEP-0020"],
+    "main": "XEP_0020",
+    "handler": "yes",
+    "description": _("""Implementation of Feature Negotiation""")
 }
 
+
 class XEP_0020(object):
 
     def __init__(self, host):
@@ -67,7 +68,7 @@
         for field in form.fields:
             values = form.fields[field].values
             result[field] = values[0] if values else None
-            if len(values)>1:
+            if len(values) > 1:
                 warning(_("More than one value choosed for %s, keeping the first one") % field)
         return result
 
@@ -92,7 +93,7 @@
         feature_elt.addChild(x_form.toElement())
         return feature_elt
 
-    def proposeFeatures(self, options_dict, namespace = None):
+    def proposeFeatures(self, options_dict, namespace=None):
         """Build a feature element with options to propose
         @param options_dict: dict with feature as key and list of acceptable options as value
         @param namespace: feature namespace"""
@@ -104,6 +105,7 @@
         feature_elt.addChild(x_form.toElement())
         return feature_elt
 
+
 class XEP_0020_handler(XMPPHandler):
     implements(iwokkel.IDisco)
 
@@ -112,4 +114,3 @@
 
     def getDiscoItems(self, requestor, target, nodeIdentifier=''):
         return []
-
diff --git a/src/plugins/plugin_xep_0045.py b/src/plugins/plugin_xep_0045.py
--- a/src/plugins/plugin_xep_0045.py
+++ b/src/plugins/plugin_xep_0045.py
@@ -36,53 +36,55 @@
     from wokkel.subprotocols import XMPPHandler
 
 PLUGIN_INFO = {
-"name": "XEP 0045 Plugin",
-"import_name": "XEP-0045",
-"type": "XEP",
-"protocols": ["XEP-0045"],
-"dependencies": [],
-"main": "XEP_0045",
-"handler": "yes",
-"description": _("""Implementation of Multi-User Chat""")
+    "name": "XEP 0045 Plugin",
+    "import_name": "XEP-0045",
+    "type": "XEP",
+    "protocols": ["XEP-0045"],
+    "dependencies": [],
+    "main": "XEP_0045",
+    "handler": "yes",
+    "description": _("""Implementation of Multi-User Chat""")
 }
 
+
 class UnknownRoom(Exception):
     pass
 
+
 class XEP_0045(object):
 
     def __init__(self, host):
         info(_("Plugin XEP_0045 initialization"))
         self.host = host
-        self.clients={}
+        self.clients = {}
         host.bridge.addMethod("joinMUC", ".plugin", in_sign='ssa{ss}s', out_sign='', method=self._join)
         host.bridge.addMethod("mucNick", ".plugin", in_sign='sss', out_sign='', method=self.mucNick)
         host.bridge.addMethod("mucLeave", ".plugin", in_sign='ss', out_sign='', method=self.leave)
         host.bridge.addMethod("getRoomsJoined", ".plugin", in_sign='s', out_sign='a(sass)', method=self.getRoomsJoined)
         host.bridge.addMethod("getRoomsSubjects", ".plugin", in_sign='s', out_sign='a(ss)', method=self.getRoomsSubjects)
         host.bridge.addMethod("getUniqueRoomName", ".plugin", in_sign='s', out_sign='s', method=self.getUniqueName)
-        host.bridge.addSignal("roomJoined", ".plugin", signature='sasss') #args: room_jid, room_nicks, user_nick, profile
-        host.bridge.addSignal("roomLeft", ".plugin", signature='ss') #args: room_jid, profile
-        host.bridge.addSignal("roomUserJoined", ".plugin", signature='ssa{ss}s') #args: room_jid, user_nick, user_data, profile
-        host.bridge.addSignal("roomUserLeft", ".plugin", signature='ssa{ss}s') #args: room_jid, user_nick, user_data, profile
-        host.bridge.addSignal("roomUserChangedNick", ".plugin", signature='ssss') #args: room_jid, old_nick, new_nick, profile
-        host.bridge.addSignal("roomNewSubject", ".plugin", signature='sss') #args: room_jid, subject, profile
-
+        host.bridge.addSignal("roomJoined", ".plugin", signature='sasss')  # args: room_jid, room_nicks, user_nick, profile
+        host.bridge.addSignal("roomLeft", ".plugin", signature='ss')  # args: room_jid, profile
+        host.bridge.addSignal("roomUserJoined", ".plugin", signature='ssa{ss}s')  # args: room_jid, user_nick, user_data, profile
+        host.bridge.addSignal("roomUserLeft", ".plugin", signature='ssa{ss}s')  # args: room_jid, user_nick, user_data, profile
+        host.bridge.addSignal("roomUserChangedNick", ".plugin", signature='ssss')  # args: room_jid, old_nick, new_nick, profile
+        host.bridge.addSignal("roomNewSubject", ".plugin", signature='sss')  # args: room_jid, subject, profile
 
     def __check_profile(self, profile):
         """check if profile is used and connected
         if profile known but disconnected, remove it from known profiles
         @param profile: profile to check
         @return: True if the profile is known and connected, else False"""
-        if not profile or not self.clients.has_key(profile) or not self.host.isConnected(profile):
-            error (_('Unknown or disconnected profile (%s)') % profile)
-            if self.clients.has_key(profile):
+        if not profile or profile not in self.clients or not self.host.isConnected(profile):
+            error(_('Unknown or disconnected profile (%s)') % profile)
+            if profile in self.clients:
                 del self.clients[profile]
             return False
         return True
 
     def __room_joined(self, room, profile):
         """Called when the user is in the requested room"""
+
         def _sendBridgeSignal(ignore=None):
             self.host.bridge.roomJoined(room.roomJID.userhost(), [user.nick for user in room.roster.values()], room.nick, profile)
 
@@ -99,16 +101,15 @@
             _sendBridgeSignal()
         return room
 
-
     def __err_joining_room(self, failure, room_jid, nick, history_options, password, profile):
         """Called when something is going wrong when joining the room"""
         if failure.value.condition == 'conflict':
             # we have a nickname conflict, we try again with "_" suffixed to current nickname
             nick += '_'
-            return self.clients[profile].join(room_jid, nick, history_options, password).addCallbacks(self.__room_joined, self.__err_joining_room, callbackKeywords={'profile':profile}, errbackArgs=[room_jid, nick, history_options, password, profile])
+            return self.clients[profile].join(room_jid, nick, history_options, password).addCallbacks(self.__room_joined, self.__err_joining_room, callbackKeywords={'profile': profile}, errbackArgs=[room_jid, nick, history_options, password, profile])
 
         mess = _("Error when joining the room")
-        error (mess)
+        error(mess)
         self.host.bridge.newAlert(mess, _("Group chat error"), "ERROR", profile)
         raise failure
 
@@ -128,7 +129,7 @@
         @profile_key: profile
         @return: nick or empty string in case of error"""
         profile = self.host.memory.getProfileName(profile_key)
-        if not self.__check_profile(profile) or not self.clients[profile].joined_rooms.has_key(room_jid_s):
+        if not self.__check_profile(profile) or room_jid_s not in self.clients[profile].joined_rooms:
             return ''
         return self.clients[profile].joined_rooms[room_jid_s].nick
 
@@ -137,7 +138,7 @@
         profile = self.host.memory.getProfileName(profile)
         if not self.__check_profile(profile):
             raise exceptions.UnknownProfileError("Unknown or disconnected profile")
-        if not self.clients[profile].joined_rooms.has_key(room_jid.userhost()):
+        if room_jid.userhost() not in self.clients[profile].joined_rooms:
             raise UnknownRoom("This room has not been joined")
         return self.clients[profile].joined_rooms[room_jid.userhost()].inRoster(nick)
 
@@ -155,7 +156,7 @@
         return uuid.uuid1()
 
     def join(self, room_jid, nick, options, profile_key='@DEFAULT@'):
-        def _errDeferred(exc_obj = Exception, txt='Error while joining room'):
+        def _errDeferred(exc_obj=Exception, txt='Error while joining room'):
             d = defer.Deferred()
             d.errback(exc_obj(txt))
             return d
@@ -163,15 +164,15 @@
         profile = self.host.memory.getProfileName(profile_key)
         if not self.__check_profile(profile):
             return _errDeferred()
-        if self.clients[profile].joined_rooms.has_key(room_jid.userhost()):
-            warning(_('%(profile)s is already in room %(room_jid)s') % {'profile':profile, 'room_jid':room_jid.userhost()})
+        if room_jid.userhost() in self.clients[profile].joined_rooms:
+            warning(_('%(profile)s is already in room %(room_jid)s') % {'profile': profile, 'room_jid': room_jid.userhost()})
             return _errDeferred()
-        info (_("[%(profile)s] is joining room %(room)s with nick %(nick)s") % {'profile':profile,'room':room_jid.userhost(), 'nick':nick})
+        info(_("[%(profile)s] is joining room %(room)s with nick %(nick)s") % {'profile': profile, 'room': room_jid.userhost(), 'nick': nick})
 
-        history_options = options["history"] == "True" if options.has_key("history") else None
-        password = options["password"] if options.has_key("password") else None
+        history_options = options["history"] == "True" if "history" in options else None
+        password = options["password"] if "password" in options else None
 
-        return self.clients[profile].join(room_jid, nick, history_options, password).addCallbacks(self.__room_joined, self.__err_joining_room, callbackKeywords={'profile':profile}, errbackArgs=[room_jid, nick, history_options, password, profile])
+        return self.clients[profile].join(room_jid, nick, history_options, password).addCallbacks(self.__room_joined, self.__err_joining_room, callbackKeywords={'profile': profile}, errbackArgs=[room_jid, nick, history_options, password, profile])
 
     def _join(self, room_jid_s, nick, options={}, profile_key='@DEFAULT@'):
         """join method used by bridge: use the _join method, but doesn't return any deferred"""
@@ -186,13 +187,13 @@
             self.host.bridge.newAlert(mess, _("Group chat error"), "ERROR", profile)
             return
         d = self.join(room_jid, nick, options, profile)
-        d.addErrback(lambda x: warning(_('Error while joining room'))) #TODO: error management + signal in bridge
+        d.addErrback(lambda x: warning(_('Error while joining room')))  # TODO: error management + signal in bridge
 
     def nick(self, room_jid, nick, profile_key):
         profile = self.host.memory.getProfileName(profile_key)
         if not self.__check_profile(profile):
             raise exceptions.UnknownProfileError("Unknown or disconnected profile")
-        if not self.clients[profile].joined_rooms.has_key(room_jid.userhost()):
+        if room_jid.userhost() not in self.clients[profile].joined_rooms:
             raise UnknownRoom("This room has not been joined")
         return self.clients[profile].nick(room_jid, nick)
 
@@ -200,7 +201,7 @@
         profile = self.host.memory.getProfileName(profile_key)
         if not self.__check_profile(profile):
             raise exceptions.UnknownProfileError("Unknown or disconnected profile")
-        if not self.clients[profile].joined_rooms.has_key(room_jid.userhost()):
+        if room_jid.userhost() not in self.clients[profile].joined_rooms:
             raise UnknownRoom("This room has not been joined")
         return self.clients[profile].leave(room_jid)
 
@@ -208,7 +209,7 @@
         profile = self.host.memory.getProfileName(profile_key)
         if not self.__check_profile(profile):
             raise exceptions.UnknownProfileError("Unknown or disconnected profile")
-        if not self.clients[profile].joined_rooms.has_key(room_jid.userhost()):
+        if room_jid.userhost() not in self.clients[profile].joined_rooms:
             raise UnknownRoom("This room has not been joined")
         return self.clients[profile].subject(room_jid, subject)
 
@@ -232,9 +233,9 @@
         self.plugin_parent = plugin_parent
         self.host = plugin_parent.host
         muc.MUCClient.__init__(self)
-        self.joined_rooms = {} #FIXME: seem to do the same thing as MUCClient's _rooms attribute, must be removed
+        self.joined_rooms = {}  # FIXME: seem to do the same thing as MUCClient's _rooms attribute, must be removed
         self.rec_subjects = {}
-        self.__changing_nicks = set() # used to keep trace of who is changing nick,
+        self.__changing_nicks = set()  # used to keep trace of who is changing nick,
                                       # and to discard userJoinedRoom signal in this case
         print "init SatMUCClient OK"
 
@@ -271,35 +272,35 @@
         if user.nick in self.__changing_nicks:
             self.__changing_nicks.remove(user.nick)
         else:
-            debug (_("user %(nick)s has joined room (%(room_id)s)") % {'nick':user.nick, 'room_id':room.occupantJID.userhost()})
+            debug(_("user %(nick)s has joined room (%(room_id)s)") % {'nick': user.nick, 'room_id': room.occupantJID.userhost()})
             if not self.host.trigger.point("MUC user joined", room, user, self.parent.profile):
                 return
-            user_data={'entity':user.entity.full() if user.entity else  '', 'affiliation':user.affiliation, 'role':user.role}
+            user_data = {'entity': user.entity.full() if user.entity else '', 'affiliation': user.affiliation, 'role': user.role}
             self.host.bridge.roomUserJoined(room.roomJID.userhost(), user.nick, user_data, self.parent.profile)
 
     def userLeftRoom(self, room, user):
         if user.nick == room.nick:
             # we left the room
             room_jid_s = room.roomJID.userhost()
-            info (_("Room [%(room)s] left (%(profile)s))") % { "room": room_jid_s,
-                                                               "profile": self.parent.profile })
+            info(_("Room [%(room)s] left (%(profile)s))") % {"room": room_jid_s,
+                                                             "profile": self.parent.profile})
             self.host.memory.delEntityCache(room.roomJID, self.parent.profile)
             del self.plugin_parent.clients[self.parent.profile].joined_rooms[room_jid_s]
             self.host.bridge.roomLeft(room.roomJID.userhost(), self.parent.profile)
         else:
-            debug (_("user %(nick)s left room (%(room_id)s)") % {'nick':user.nick, 'room_id':room.occupantJID.userhost()})
-            user_data={'entity':user.entity.full() if user.entity else  '', 'affiliation':user.affiliation, 'role':user.role}
+            debug(_("user %(nick)s left room (%(room_id)s)") % {'nick': user.nick, 'room_id': room.occupantJID.userhost()})
+            user_data = {'entity': user.entity.full() if user.entity else '', 'affiliation': user.affiliation, 'role': user.role}
             self.host.bridge.roomUserLeft(room.roomJID.userhost(), user.nick, user_data, self.parent.profile)
 
     def userChangedNick(self, room, user, new_nick):
-            self.host.bridge.roomUserChangedNick(room.roomJID.userhost(), user.nick, new_nick, self.parent.profile)
+        self.host.bridge.roomUserChangedNick(room.roomJID.userhost(), user.nick, new_nick, self.parent.profile)
 
     def userUpdatedStatus(self, room, user, show, status):
         print("FIXME: MUC status not managed yet")
         #FIXME:
 
     def receivedSubject(self, room, user, subject):
-        debug (_("New subject for room (%(room_id)s): %(subject)s") % {'room_id':room.roomJID.full(),'subject':subject})
+        debug(_("New subject for room (%(room_id)s): %(subject)s") % {'room_id': room.roomJID.full(), 'subject': subject})
         self.rec_subjects[room.roomJID.userhost()] = (room.roomJID.userhost(), subject)
         self.host.bridge.roomNewSubject(room.roomJID.userhost(), subject, self.parent.profile)
 
@@ -311,4 +312,3 @@
 
     #def getDiscoItems(self, requestor, target, nodeIdentifier=''):
         #return []
-
diff --git a/src/plugins/plugin_xep_0047.py b/src/plugins/plugin_xep_0047.py
--- a/src/plugins/plugin_xep_0047.py
+++ b/src/plugins/plugin_xep_0047.py
@@ -44,19 +44,20 @@
 IBB_CLOSE = IQ_SET + '/close[@xmlns="' + NS_IBB + '" and @sid="%s"]'
 IBB_IQ_DATA = IQ_SET + '/data[@xmlns="' + NS_IBB + '" and @sid="%s"]'
 IBB_MESSAGE_DATA = MESSAGE + '/data[@xmlns="' + NS_IBB + '" and @sid="%s"]'
-TIMEOUT = 60 #timeout for workflow
+TIMEOUT = 60  # timeout for workflow
 BLOCK_SIZE = 4096
 
 PLUGIN_INFO = {
-"name": "In-Band Bytestream Plugin",
-"import_name": "XEP-0047",
-"type": "XEP",
-"protocols": ["XEP-0047"],
-"main": "XEP_0047",
-"handler": "yes",
-"description": _("""Implementation of In-Band Bytestreams""")
+    "name": "In-Band Bytestream Plugin",
+    "import_name": "XEP-0047",
+    "type": "XEP",
+    "protocols": ["XEP-0047"],
+    "main": "XEP_0047",
+    "handler": "yes",
+    "description": _("""Implementation of In-Band Bytestreams""")
 }
 
+
 class XEP_0047(object):
     NAMESPACE = NS_IBB
 
@@ -71,7 +72,7 @@
         client = self.host.getClient(profile)
         if not client:
             raise ProfileNotInCacheError
-        client.xep_0047_current_stream = {} #key: stream_id, value: data(dict)
+        client.xep_0047_current_stream = {}  # key: stream_id, value: data(dict)
 
     def _timeOut(self, sid, profile):
         """Delecte current_stream id, called after timeout
@@ -87,14 +88,14 @@
         if not client:
             warning(_("Client no more in cache"))
             return
-        if not client.xep_0047_current_stream.has_key(sid):
+        if sid not in client.xep_0047_current_stream:
             warning(_("kill id called on a non existant id"))
             return
-        if client.xep_0047_current_stream[sid].has_key("observer_cb"):
+        if "observer_cb" in client.xep_0047_current_stream[sid]:
             client.xmlstream.removeObserver(client.xep_0047_current_stream[sid]["event_data"], client.xep_0047_current_stream[sid]["observer_cb"])
         if client.xep_0047_current_stream[sid]['timer'].active():
             client.xep_0047_current_stream[sid]['timer'].cancel()
-        if client.xep_0047_current_stream[sid].has_key("size"):
+        if "size" in client.xep_0047_current_stream[sid]:
             self.host.removeProgressCB(sid, profile)
 
         file_obj = client.xep_0047_current_stream[sid]['file_obj']
@@ -145,7 +146,7 @@
 
     def streamOpening(self, IQ, profile):
         debug(_("IBB stream opening"))
-        IQ.handled=True
+        IQ.handled = True
         client = self.host.getClient(profile)
         if not client:
             raise ProfileNotInCacheError
@@ -153,7 +154,7 @@
         block_size = open_elt.getAttribute('block-size')
         sid = open_elt.getAttribute('sid')
         stanza = open_elt.getAttribute('stanza', 'iq')
-        if not sid or not block_size or int(block_size)>65535:
+        if not sid or not block_size or int(block_size) > 65535:
             warning(_("malformed IBB transfer: %s" % IQ['id']))
             self.sendNotAcceptableError(IQ['id'], IQ['from'], client.xmlstream)
             return
@@ -173,12 +174,12 @@
         client.xep_0047_current_stream[sid]["timer"].reset(TIMEOUT)
 
         #we save the xmlstream, events and observer data to allow observer removal
-        client.xep_0047_current_stream[sid]["event_data"] = event_data = (IBB_MESSAGE_DATA if stanza=='message' else IBB_IQ_DATA) % sid
-        client.xep_0047_current_stream[sid]["observer_cb"] = observer_cb = self.messageData if stanza=='message' else self.iqData
+        client.xep_0047_current_stream[sid]["event_data"] = event_data = (IBB_MESSAGE_DATA if stanza == 'message' else IBB_IQ_DATA) % sid
+        client.xep_0047_current_stream[sid]["observer_cb"] = observer_cb = self.messageData if stanza == 'message' else self.iqData
         event_close = IBB_CLOSE % sid
         #we now set the stream observer to look after data packet
-        client.xmlstream.addObserver(event_data, observer_cb, profile = profile)
-        client.xmlstream.addOnetimeObserver(event_close, self.streamClosing, profile = profile)
+        client.xmlstream.addObserver(event_data, observer_cb, profile=profile)
+        client.xmlstream.addOnetimeObserver(event_close, self.streamClosing, profile=profile)
         #finally, we send the accept stanza
         result = domish.Element((None, 'iq'))
         result['type'] = 'result'
@@ -187,7 +188,7 @@
         client.xmlstream.send(result)
 
     def streamClosing(self, IQ, profile):
-        IQ.handled=True
+        IQ.handled = True
         client = self.host.getClient(profile)
         if not client:
             raise ProfileNotInCacheError
@@ -202,7 +203,7 @@
         self._killId(sid, success=True, profile=profile)
 
     def iqData(self, IQ, profile):
-        IQ.handled=True
+        IQ.handled = True
         client = self.host.getClient(profile)
         if not client:
             raise ProfileNotInCacheError
@@ -219,7 +220,7 @@
 
     def messageData(self, message_elt, profile):
         data_elt = message_elt.firstChildElement()
-        sid = message_elt.getAttribute('id','')
+        sid = message_elt.getAttribute('id', '')
         self._manageDataElt(message_elt, 'message', sid, jid.JID(message_elt['from']), profile)
 
     def _manageDataElt(self, data_elt, stanza, sid, stanza_from_jid, profile):
@@ -239,14 +240,14 @@
 
         if stanza_from_jid != from_jid:
             warning(_("sended jid inconsistency (man in the middle attack attempt ?)"))
-            if stanza=='iq':
+            if stanza == 'iq':
                 self.sendNotAcceptableError(sid, from_jid, client.xmlstream)
             return False
 
-        client.xep_0047_current_stream[sid]["seq"]+=1
-        if int(data_elt.getAttribute("seq",-1)) != client.xep_0047_current_stream[sid]["seq"]:
+        client.xep_0047_current_stream[sid]["seq"] += 1
+        if int(data_elt.getAttribute("seq", -1)) != client.xep_0047_current_stream[sid]["seq"]:
             warning(_("Sequence error"))
-            if stanza=='iq':
+            if stanza == 'iq':
                 self.sendNotAcceptableError(data_elt["id"], from_jid, client.xmlstream)
             return False
 
@@ -259,7 +260,7 @@
         except TypeError:
             #The base64 data is invalid
             warning(_("Invalid base64 data"))
-            if stanza=='iq':
+            if stanza == 'iq':
                 self.sendNotAcceptableError(data_elt["id"], from_jid, client.xmlstream)
             return False
         return True
@@ -275,10 +276,10 @@
         result['to'] = to_jid
         error_el = result.addElement('error')
         error_el['type'] = 'cancel'
-        error_el.addElement(('urn:ietf:params:xml:ns:xmpp-stanzas','not-acceptable'))
+        error_el.addElement(('urn:ietf:params:xml:ns:xmpp-stanzas', 'not-acceptable'))
         xmlstream.send(result)
 
-    def startStream(self, file_obj, to_jid, sid, length, successCb, failureCb, size = None, profile=None):
+    def startStream(self, file_obj, to_jid, sid, length, successCb, failureCb, size=None, profile=None):
         """Launch the stream workflow
         @param file_obj: file_obj to send
         @param to_jid: JID of the recipient
@@ -290,7 +291,7 @@
         client = self.host.getClient(profile)
         if not client:
             raise ProfileNotInCacheError
-        if length != None:
+        if length is not None:
             error(_('stream length not managed yet'))
             return
         data = client.xep_0047_current_stream[sid] = {}
@@ -303,10 +304,10 @@
         if size:
             data["size"] = size
             self.host.registerProgressCB(sid, self.getProgress, profile)
-        iq_elt = jabber_client.IQ(client.xmlstream,'set')
+        iq_elt = jabber_client.IQ(client.xmlstream, 'set')
         iq_elt['from'] = client.jid.full()
         iq_elt['to'] = to_jid.full()
-        open_elt = iq_elt.addElement('open',NS_IBB)
+        open_elt = iq_elt.addElement('open', NS_IBB)
         open_elt['block-size'] = str(BLOCK_SIZE)
         open_elt['sid'] = sid
         open_elt['stanza'] = 'iq'
@@ -329,18 +330,18 @@
 
         buffer = data["file_obj"].read(data["block_size"])
         if buffer:
-            next_iq_elt = jabber_client.IQ(client.xmlstream,'set')
+            next_iq_elt = jabber_client.IQ(client.xmlstream, 'set')
             next_iq_elt['to'] = data["to"].full()
             data_elt = next_iq_elt.addElement('data', NS_IBB)
             data_elt['seq'] = str(seq)
             data_elt['sid'] = sid
             data_elt.addContent(base64.b64encode(buffer))
-            next_iq_elt.addCallback(self.iqResult, sid, seq+1, length, profile)
+            next_iq_elt.addCallback(self.iqResult, sid, seq + 1, length, profile)
             next_iq_elt.send()
         else:
             self.terminateStream(sid, profile=profile)
 
-    def terminateStream(self, sid, failure_reason = None, profile=None):
+    def terminateStream(self, sid, failure_reason=None, profile=None):
         """Terminate the stream session
         @param to_jid: recipient
         @param sid: Session id
@@ -353,9 +354,9 @@
         if not client:
             raise ProfileNotInCacheError
         data = client.xep_0047_current_stream[sid]
-        iq_elt = jabber_client.IQ(client.xmlstream,'set')
+        iq_elt = jabber_client.IQ(client.xmlstream, 'set')
         iq_elt['to'] = data["to"].full()
-        close_elt = iq_elt.addElement('close',NS_IBB)
+        close_elt = iq_elt.addElement('close', NS_IBB)
         close_elt['sid'] = sid
         iq_elt.send()
         self.host.removeProgressCB(sid, profile)
@@ -364,14 +365,15 @@
         else:
             self._killId(sid, True, profile=profile)
 
+
 class XEP_0047_handler(XMPPHandler):
     implements(iwokkel.IDisco)
 
-    def __init__(self,parent):
+    def __init__(self, parent):
         self.plugin_parent = parent
 
     def connectionInitialized(self):
-        self.xmlstream.addObserver(IBB_OPEN, self.plugin_parent.streamOpening, profile = self.parent.profile)
+        self.xmlstream.addObserver(IBB_OPEN, self.plugin_parent.streamOpening, profile=self.parent.profile)
 
     def getDiscoInfo(self, requestor, target, nodeIdentifier=''):
         return [disco.DiscoFeature(NS_IBB)]
diff --git a/src/plugins/plugin_xep_0054.py b/src/plugins/plugin_xep_0054.py
--- a/src/plugins/plugin_xep_0054.py
+++ b/src/plugins/plugin_xep_0054.py
@@ -31,7 +31,7 @@
 
 from wokkel import disco, iwokkel
 
-from base64 import b64decode,b64encode
+from base64 import b64decode, b64encode
 from hashlib import sha1
 from sat.core import exceptions
 from sat.memory.persistent import PersistentDict
@@ -47,23 +47,24 @@
 
 IQ_GET = '/iq[@type="get"]'
 NS_VCARD = 'vcard-temp'
-VCARD_REQUEST = IQ_GET + '/vCard[@xmlns="' + NS_VCARD + '"]'  #TODO: manage requests
+VCARD_REQUEST = IQ_GET + '/vCard[@xmlns="' + NS_VCARD + '"]'  # TODO: manage requests
 
 PRESENCE = '/presence'
 NS_VCARD_UPDATE = 'vcard-temp:x:update'
-VCARD_UPDATE = PRESENCE + '/x[@xmlns="' +  NS_VCARD_UPDATE + '"]'
+VCARD_UPDATE = PRESENCE + '/x[@xmlns="' + NS_VCARD_UPDATE + '"]'
 
 PLUGIN_INFO = {
-"name": "XEP 0054 Plugin",
-"import_name": "XEP-0054",
-"type": "XEP",
-"protocols": ["XEP-0054", "XEP-0153"],
-"dependencies": [],
-"main": "XEP_0054",
-"handler": "yes",
-"description": _("""Implementation of vcard-temp""")
+    "name": "XEP 0054 Plugin",
+    "import_name": "XEP-0054",
+    "type": "XEP",
+    "protocols": ["XEP-0054", "XEP-0153"],
+    "dependencies": [],
+    "main": "XEP_0054",
+    "handler": "yes",
+    "description": _("""Implementation of vcard-temp""")
 }
 
+
 class XEP_0054(object):
     #TODO: - check that nickname is ok
     #      - refactor the code/better use of Wokkel
@@ -76,10 +77,10 @@
         if not os.path.exists(self.avatar_path):
             os.makedirs(self.avatar_path)
         self.avatars_cache = PersistentDict(NS_VCARD)
-        self.avatars_cache.load() #FIXME: resulting deferred must be correctly managed
+        self.avatars_cache.load()  # FIXME: resulting deferred must be correctly managed
         host.bridge.addMethod("getCard", ".plugin", in_sign='ss', out_sign='s', method=self.getCard)
         host.bridge.addMethod("getAvatarFile", ".plugin", in_sign='s', out_sign='s', method=self.getAvatarFile)
-        host.bridge.addMethod("setAvatar", ".plugin", in_sign='ss', out_sign='', method=self.setAvatar, async = True)
+        host.bridge.addMethod("setAvatar", ".plugin", in_sign='ss', out_sign='', method=self.setAvatar, async=True)
         host.trigger.add("presence_available", self.presenceTrigger)
 
     def getHandler(self, profile):
@@ -144,9 +145,9 @@
                 debug(_('Decoding binary'))
                 decoded = b64decode(str(elem))
                 image_hash = sha1(decoded).hexdigest()
-                filename = self.avatar_path+'/'+image_hash
+                filename = self.avatar_path + '/' + image_hash
                 if not os.path.exists(filename):
-                    with open(filename,'wb') as file:
+                    with open(filename, 'wb') as file:
                         file.write(decoded)
                     debug(_("file saved to %s") % image_hash)
                 else:
@@ -156,7 +157,7 @@
     @inlineCallbacks
     def vCard2Dict(self, vcard, target, profile):
         """Convert a VCard to a dict, and save binaries"""
-        debug (_("parsing vcard"))
+        debug(_("parsing vcard"))
         dictionary = {}
 
         for elem in vcard.elements():
@@ -173,18 +174,18 @@
                 dictionary['birthday'] = unicode(elem)
             elif elem.name == 'PHOTO':
                 dictionary["avatar"] = yield threads.deferToThread(self.save_photo, elem)
-                if not dictionary["avatar"]:  #can happen in case of e.g. empty photo elem
+                if not dictionary["avatar"]:  # can happen in case of e.g. empty photo elem
                     del dictionary['avatar']
                 else:
                     self.update_cache(target, 'avatar', dictionary['avatar'], profile)
             else:
-                info (_('FIXME: [%s] VCard tag is not managed yet') % elem.name)
+                info(_('FIXME: [%s] VCard tag is not managed yet') % elem.name)
 
         returnValue(dictionary)
 
     def vcard_ok(self, answer, profile):
         """Called after the first get IQ"""
-        debug (_("VCard found"))
+        debug(_("VCard found"))
 
         if answer.firstChildElement().name == "vCard":
             _jid, steam = self.host.getJidNStream(profile)
@@ -195,13 +196,13 @@
             d = self.vCard2Dict(answer.firstChildElement(), from_jid, profile)
             d.addCallback(lambda data: self.host.bridge.actionResult("RESULT", answer['id'], data, profile))
         else:
-            error (_("FIXME: vCard not found as first child element"))
-            self.host.bridge.actionResult("SUPPRESS", answer['id'], {}, profile) #FIXME: maybe an error message would be better
+            error(_("FIXME: vCard not found as first child element"))
+            self.host.bridge.actionResult("SUPPRESS", answer['id'], {}, profile)  # FIXME: maybe an error message would be better
 
     def vcard_err(self, failure, profile):
         """Called when something is wrong with registration"""
-        error (_("Can't find VCard of %s") % failure.value.stanza['from'])
-        self.host.bridge.actionResult("SUPPRESS", failure.value.stanza['id'], {}, profile) #FIXME: maybe an error message would be better
+        error(_("Can't find VCard of %s") % failure.value.stanza['from'])
+        self.host.bridge.actionResult("SUPPRESS", failure.value.stanza['id'], {}, profile)  # FIXME: maybe an error message would be better
 
     def getCard(self, target_s, profile_key='@DEFAULT@'):
         """Ask server for VCard
@@ -209,13 +210,13 @@
         @result: id to retrieve the profile"""
         current_jid, xmlstream = self.host.getJidNStream(profile_key)
         if not xmlstream:
-            error (_('Asking vcard for a non-existant or not connected profile'))
+            error(_('Asking vcard for a non-existant or not connected profile'))
             return ""
         profile = self.host.memory.getProfileName(profile_key)
         to_jid = jid.JID(target_s)
         debug(_("Asking for %s's VCard") % to_jid.userhost())
-        reg_request=IQ(xmlstream,'get')
-        reg_request["from"]=current_jid.full()
+        reg_request = IQ(xmlstream, 'get')
+        reg_request["from"] = current_jid.full()
         reg_request["to"] = to_jid.userhost()
         reg_request.addElement('vCard', NS_VCARD)
         reg_request.send(to_jid.userhost()).addCallbacks(self.vcard_ok, self.vcard_err, callbackArgs=[profile], errbackArgs=[profile])
@@ -226,9 +227,9 @@
         @param hash: SHA1 hash
         @return full_path
         """
-        filename = self.avatar_path+'/'+avatar_hash
+        filename = self.avatar_path + '/' + avatar_hash
         if not os.path.exists(filename):
-            error (_("Asking for an uncached avatar [%s]") % avatar_hash)
+            error(_("Asking for an uncached avatar [%s]") % avatar_hash)
             return ""
         return filename
 
@@ -259,13 +260,13 @@
         if not client:
             raise exceptions.NotConnectedProfileError(_('Trying to set avatar for a non-existant or not connected profile'))
 
-        vcard_set = IQ(client.xmlstream,'set')
+        vcard_set = IQ(client.xmlstream, 'set')
         d = threads.deferToThread(self._buildSetAvatar, vcard_set, filepath)
 
         def elementBuilt(result):
             """Called once the image is at the right size/format, and the vcard set element is build"""
             set_avatar_elt, img_hash = result
-            self.avatars_cache[client.jid.userhost()] = img_hash # we need to update the hash, so we can send a new presence
+            self.avatars_cache[client.jid.userhost()] = img_hash  # we need to update the hash, so we can send a new presence
                                                                  # element with the right hash
             return set_avatar_elt.send().addCallback(lambda ignore: client.presence.available())
 
@@ -296,7 +297,7 @@
         """
         from_jid = jid.JID(presence['from'])
         #FIXME: wokkel's data_form should be used here
-        x_elem = filter (lambda x:x.name == "x", presence.elements())[0] #We only want the "x" element
+        x_elem = filter(lambda x: x.name == "x", presence.elements())[0]  # We only want the "x" element
         for elem in x_elem.elements():
             if elem.name == 'photo':
                 _hash = str(elem)
diff --git a/src/plugins/plugin_xep_0060.py b/src/plugins/plugin_xep_0060.py
--- a/src/plugins/plugin_xep_0060.py
+++ b/src/plugins/plugin_xep_0060.py
@@ -30,23 +30,24 @@
 from zope.interface import implements
 
 PLUGIN_INFO = {
-"name": "Publish-Subscribe",
-"import_name": "XEP-0060",
-"type": "XEP",
-"protocols": ["XEP-0060"],
-"dependencies": [],
-"main": "XEP_0060",
-"handler": "yes",
-"description": _("""Implementation of PubSub Protocol""")
+    "name": "Publish-Subscribe",
+    "import_name": "XEP-0060",
+    "type": "XEP",
+    "protocols": ["XEP-0060"],
+    "dependencies": [],
+    "main": "XEP_0060",
+    "handler": "yes",
+    "description": _("""Implementation of PubSub Protocol""")
 }
 
+
 class XEP_0060(object):
 
     def __init__(self, host):
         info(_("PubSub plugin initialization"))
         self.host = host
-        self.managedNodes=[]
-        self.clients={}
+        self.managedNodes = []
+        self.clients = {}
         """host.bridge.addMethod("getItems", ".plugin", in_sign='ssa{ss}s', out_sign='as', method=self.getItems,
                               async = True,
                               doc = { 'summary':'retrieve items',
@@ -78,8 +79,8 @@
         profile = self.host.memory.getProfileName(profile_key)
         if not profile:
             err_mess = _('Trying to %(action)s with an unknown profile key [%(profile_key)s]') % {
-                         'action':action,
-                         'profile_key':profile_key}
+                'action': action,
+                'profile_key': profile_key}
             error(err_mess)
             raise Exception(err_mess)
         try:
@@ -91,31 +92,31 @@
         return profile, client
 
     def publish(self, service, nodeIdentifier, items=None, profile_key='@DEFAULT@'):
-        profile,client = self.__getClientNProfile(profile_key, 'publish item')
+        profile, client = self.__getClientNProfile(profile_key, 'publish item')
         return client.publish(service, nodeIdentifier, items, client.parent.jid)
 
     def getItems(self, service, node, max_items=None, sub_id=None, profile_key='@DEFAULT@'):
-        profile,client = self.__getClientNProfile(profile_key, 'get items')
+        profile, client = self.__getClientNProfile(profile_key, 'get items')
         return client.items(service, node, max_items, sub_id, client.parent.jid)
 
     def getOptions(self, service, nodeIdentifier, subscriber, subscriptionIdentifier=None, profile_key='@DEFAULT@'):
-        profile,client = self.__getClientNProfile(profile_key, 'get options')
+        profile, client = self.__getClientNProfile(profile_key, 'get options')
         return client.getOptions(service, nodeIdentifier, subscriber, subscriptionIdentifier)
 
     def setOptions(self, service, nodeIdentifier, subscriber, options, subscriptionIdentifier=None, profile_key='@DEFAULT@'):
-        profile,client = self.__getClientNProfile(profile_key, 'set options')
+        profile, client = self.__getClientNProfile(profile_key, 'set options')
         return client.setOptions(service, nodeIdentifier, subscriber, options, subscriptionIdentifier)
 
     def createNode(self, service, nodeIdentifier, options, profile_key='@DEFAULT@'):
-        profile,client = self.__getClientNProfile(profile_key, 'create node')
+        profile, client = self.__getClientNProfile(profile_key, 'create node')
         return client.createNode(service, nodeIdentifier, options)
 
     def deleteNode(self, service, nodeIdentifier, profile_key='@DEFAULT@'):
-        profile,client = self.__getClientNProfile(profile_key, 'delete node')
+        profile, client = self.__getClientNProfile(profile_key, 'delete node')
         return client.deleteNode(service, nodeIdentifier)
 
-    def subscribe(self, service, nodeIdentifier, sub_jid = None, options=None, profile_key='@DEFAULT@'):
-        profile,client = self.__getClientNProfile(profile_key, 'subscribe node')
+    def subscribe(self, service, nodeIdentifier, sub_jid=None, options=None, profile_key='@DEFAULT@'):
+        profile, client = self.__getClientNProfile(profile_key, 'subscribe node')
         return client.subscribe(service, nodeIdentifier, sub_jid or client.parent.jid.userhostJID(), options=options)
 
 
@@ -123,7 +124,7 @@
     implements(disco.IDisco)
 
     def __init__(self, host, parent_plugin):
-        self.host=host
+        self.host = host
         self.parent_plugin = parent_plugin
         pubsub.PubSubClient.__init__(self)
 
@@ -152,4 +153,3 @@
 
     def getDiscoItems(self, requestor, target, nodeIdentifier=''):
         return []
-
diff --git a/src/plugins/plugin_xep_0065.py b/src/plugins/plugin_xep_0065.py
--- a/src/plugins/plugin_xep_0065.py
+++ b/src/plugins/plugin_xep_0065.py
@@ -78,30 +78,28 @@
 IQ_SET = '/iq[@type="set"]'
 NS_BS = 'http://jabber.org/protocol/bytestreams'
 BS_REQUEST = IQ_SET + '/query[@xmlns="' + NS_BS + '"]'
-TIMEOUT = 60 #timeout for workflow
-
-
+TIMEOUT = 60  # timeout for workflow
 
 PLUGIN_INFO = {
-"name": "XEP 0065 Plugin",
-"import_name": "XEP-0065",
-"type": "XEP",
-"protocols": ["XEP-0065"],
-"main": "XEP_0065",
-"handler": "yes",
-"description": _("""Implementation of SOCKS5 Bytestreams""")
+    "name": "XEP 0065 Plugin",
+    "import_name": "XEP-0065",
+    "type": "XEP",
+    "protocols": ["XEP-0065"],
+    "main": "XEP_0065",
+    "handler": "yes",
+    "description": _("""Implementation of SOCKS5 Bytestreams""")
 }
 
 STATE_INITIAL = 0
-STATE_AUTH    = 1
+STATE_AUTH = 1
 STATE_REQUEST = 2
-STATE_READY   = 3
+STATE_READY = 3
 STATE_AUTH_USERPASS = 4
 STATE_TARGET_INITIAL = 5
-STATE_TARGET_AUTH    = 6
+STATE_TARGET_AUTH = 6
 STATE_TARGET_REQUEST = 7
-STATE_TARGET_READY   = 8
-STATE_LAST    = 9
+STATE_TARGET_READY = 8
+STATE_LAST = 9
 
 STATE_CONNECT_PENDING = STATE_LAST + 1
 
@@ -139,15 +137,14 @@
     return hashlib.sha1((sid + from_jid.full() + to_jid.full()).encode('utf-8')).hexdigest()
 
 
-
 class SOCKSv5(protocol.Protocol, FileSender):
     def __init__(self):
         debug(_("Protocol init"))
         self.state = STATE_INITIAL
         self.buf = ""
-        self.supportedAuthMechs = [ AUTHMECH_ANON ]
-        self.supportedAddrs = [ ADDR_DOMAINNAME ]
-        self.enabledCommands = [ CMD_CONNECT ]
+        self.supportedAuthMechs = [AUTHMECH_ANON]
+        self.supportedAddrs = [ADDR_DOMAINNAME]
+        self.enabledCommands = [CMD_CONNECT]
         self.peersock = None
         self.addressType = 0
         self.requestType = 0
@@ -162,7 +159,7 @@
         try:
             # Parse out data
             ver, nmethod = struct.unpack('!BB', self.buf[:2])
-            methods = struct.unpack('%dB' % nmethod, self.buf[2:nmethod+2])
+            methods = struct.unpack('%dB' % nmethod, self.buf[2:nmethod + 2])
 
             # Ensure version is correct
             if ver != 5:
@@ -171,7 +168,7 @@
                 return
 
             # Trim off front of the buffer
-            self.buf = self.buf[nmethod+2:]
+            self.buf = self.buf[nmethod + 2:]
 
             # Check for supported auth mechs
             for m in self.supportedAuthMechs:
@@ -320,7 +317,7 @@
         debug("connectRequested")
 
         # Check that this session is expected
-        if not self.factory.hash_sid_map.has_key(addr):
+        if addr not in self.factory.hash_sid_map:
             #no: we refuse it
             self.sendErrorReply(REPLY_CONN_REFUSED)
             return
@@ -374,14 +371,13 @@
         if self.state == STATE_TARGET_AUTH:
             ver, method = struct.unpack('!BB', buf)
             self.buf = self.buf[2:]
-            if ver!=SOCKS5_VER or method!=AUTHMECH_ANON:
+            if ver != SOCKS5_VER or method != AUTHMECH_ANON:
                 self.transport.loseConnection()
             else:
                 self._makeRequest()
         if self.state == STATE_TARGET_REQUEST:
             self._parseRequestReply()
 
-
     def clientConnectionLost(self, reason):
         debug("clientConnectionLost")
         self.transport.loseConnection()
@@ -390,7 +386,7 @@
         debug("connectionLost")
         if self.state != STATE_CONNECT_PENDING:
             self.transport.unregisterProducer()
-            if self.peersock != None:
+            if self.peersock is not None:
                 self.peersock.peersock = None
                 self.peersock.transport.unregisterProducer()
                 self.peersock = None
@@ -405,10 +401,11 @@
         self.finishedCb = finishedCb
 
     def startedConnecting(self, connector):
-        debug (_("Socks 5 server connection started"))
+        debug(_("Socks 5 server connection started"))
 
     def clientConnectionLost(self, connector, reason):
-        debug (_("Socks 5 server connection lost (reason: %s)"), reason)
+        debug(_("Socks 5 server connection lost (reason: %s)"), reason)
+
 
 class Socks5ClientFactory(protocol.ClientFactory):
     protocol = SOCKSv5
@@ -432,11 +429,11 @@
         self.profile = profile
 
     def startedConnecting(self, connector):
-        debug (_("Socks 5 client connection started"))
+        debug(_("Socks 5 client connection started"))
 
     def clientConnectionLost(self, connector, reason):
-        debug (_("Socks 5 client connection lost (reason: %s)"), reason)
-        self.finishedCb(self.sid, reason.type == jab_error.ConnectionDone, self.profile) #TODO: really check if the state is actually successful
+        debug(_("Socks 5 client connection lost (reason: %s)"), reason)
+        self.finishedCb(self.sid, reason.type == jab_error.ConnectionDone, self.profile)  # TODO: really check if the state is actually successful
 
 
 class XEP_0065(object):
@@ -465,7 +462,7 @@
         info(_("Plugin XEP_0065 initialization"))
 
         #session data
-        self.hash_sid_map = {}  #key: hash of the transfer session, value: (session id, profile)
+        self.hash_sid_map = {}  # key: hash of the transfer session, value: (session id, profile)
 
         self.host = host
         debug(_("registering"))
@@ -486,7 +483,7 @@
         client = self.host.getClient(profile)
         if not client:
             raise ProfileNotInCacheError
-        client.xep_0065_current_stream = {} #key: stream_id, value: data(dict)
+        client.xep_0065_current_stream = {}  # key: stream_id, value: data(dict)
 
     def getExternalIP(self):
         """Return IP visible from outside, by asking to a website"""
@@ -518,15 +515,15 @@
         if not client:
             warning(_("Client no more in cache"))
             return
-        if not client.xep_0065_current_stream.has_key(sid):
+        if sid not in client.xep_0065_current_stream:
             warning(_("kill id called on a non existant id"))
             return
-        if client.xep_0065_current_stream[sid].has_key("observer_cb"):
+        if "observer_cb" in client.xep_0065_current_stream[sid]:
             xmlstream = client.xep_0065_current_stream[sid]["xmlstream"]
             xmlstream.removeObserver(client.xep_0065_current_stream[sid]["event_data"], client.xep_0065_current_stream[sid]["observer_cb"])
         if client.xep_0065_current_stream[sid]['timer'].active():
             client.xep_0065_current_stream[sid]['timer'].cancel()
-        if client.xep_0065_current_stream[sid].has_key("size"):
+        if "size" in client.xep_0065_current_stream[sid]:
             self.host.removeProgressCB(sid, profile)
 
         file_obj = client.xep_0065_current_stream[sid]['file_obj']
@@ -544,7 +541,7 @@
         else:
             failure_cb(sid, file_obj, NS_BS, failure_reason, profile)
 
-    def startStream(self, file_obj, to_jid, sid, length, successCb, failureCb, size = None, profile=None):
+    def startStream(self, file_obj, to_jid, sid, length, successCb, failureCb, size=None, profile=None):
         """Launch the stream workflow
         @param file_obj: file_obj to send
         @param to_jid: JID of the recipient
@@ -559,7 +556,7 @@
             error(_("Unknown profile, this should not happen"))
             raise ProfileNotInCacheError
 
-        if length != None:
+        if length is not None:
             error(_('stream length not managed yet'))
             return
 
@@ -579,7 +576,7 @@
         if size:
             data["size"] = size
             self.host.registerProgressCB(sid, self.getProgress, profile)
-        iq_elt = jabber_client.IQ(xmlstream,'set')
+        iq_elt = jabber_client.IQ(xmlstream, 'set')
         iq_elt["from"] = profile_jid.full()
         iq_elt["to"] = to_jid.full()
         query_elt = iq_elt.addElement('query', NS_BS)
@@ -638,7 +635,7 @@
             factory = Socks5ClientFactory(client.xep_0065_current_stream, sid, None, self.activateProxyStream, lambda sid, success, profile: self._killId(sid, success, profile=profile), True, profile)
             reactor.connectTCP(proxy_host, int(proxy_port), factory)
         else:
-            data["start_transfer_cb"](file_obj) #We now activate the stream
+            data["start_transfer_cb"](file_obj)  # We now activate the stream
 
     def activateProxyStream(self, sid, iq_id, start_transfer_cb, profile):
         debug(_("activating stream"))
@@ -648,7 +645,7 @@
         data = client.xep_0065_current_stream[sid]
         profile_jid, xmlstream = self.host.getJidNStream(profile)
 
-        iq_elt = client.IQ(xmlstream,'set')
+        iq_elt = client.IQ(xmlstream, 'set')
         iq_elt["from"] = profile_jid.full()
         iq_elt["to"] = self.host.memory.getParamA("Proxy", "File Transfer", profile_key=profile)
         query_elt = iq_elt.addElement('query', NS_BS)
@@ -687,7 +684,6 @@
         data["success_cb"] = success_cb
         data["failure_cb"] = failure_cb
 
-
     def streamQuery(self, iq_elt, profile):
         """Get file using byte stream"""
         debug(_("BS stream query"))
@@ -717,7 +713,7 @@
             self.sendBadRequestError(iq_elt['id'], iq_elt['from'], xmlstream)
             return
 
-        streamhost_elt = streamhost_elts[0] #TODO: manage several streamhost elements case
+        streamhost_elt = streamhost_elts[0]  # TODO: manage several streamhost elements case
         sh_host = streamhost_elt.getAttribute("host")
         sh_port = streamhost_elt.getAttribute("port")
         sh_jid = streamhost_elt.getAttribute("jid")
@@ -728,7 +724,7 @@
 
         client.xep_0065_current_stream[sid]["streamhost"] = (sh_host, sh_port, sh_jid)
 
-        info (_("Stream proposed: host=[%(host)s] port=[%(port)s]") % {'host':sh_host, 'port':sh_port})
+        info(_("Stream proposed: host=[%(host)s] port=[%(port)s]") % {'host': sh_host, 'port': sh_port})
         factory = Socks5ClientFactory(client.xep_0065_current_stream, sid, iq_elt["id"], self.activateStream, lambda sid, success, profile: self._killId(sid, success, profile=profile), profile=profile)
         reactor.connectTCP(sh_host, int(sh_port), factory)
 
@@ -760,7 +756,7 @@
         result['to'] = to_jid
         error_el = result.addElement('error')
         error_el['type'] = 'modify'
-        error_el.addElement(('urn:ietf:params:xml:ns:xmpp-stanzas','not-acceptable'))
+        error_el.addElement(('urn:ietf:params:xml:ns:xmpp-stanzas', 'not-acceptable'))
         xmlstream.send(result)
 
     def sendBadRequestError(self, iq_id, to_jid, xmlstream):
@@ -774,9 +770,10 @@
         result['to'] = to_jid
         error_el = result.addElement('error')
         error_el['type'] = 'cancel'
-        error_el.addElement(('urn:ietf:params:xml:ns:xmpp-stanzas','bad-request'))
+        error_el.addElement(('urn:ietf:params:xml:ns:xmpp-stanzas', 'bad-request'))
         xmlstream.send(result)
 
+
 class XEP_0065_handler(XMPPHandler):
     implements(iwokkel.IDisco)
 
@@ -801,10 +798,9 @@
         if len(streamhost_elts) != 1:
             warning(_("Multiple streamhost elements in proxy not managed, keeping only the first one"))
         streamhost_elt = streamhost_elts[0]
-        proxy = self.host.memory.setParam("Proxy", streamhost_elt.getAttribute("jid",""), "File Transfer", self.parent.profile)
-        proxy = self.host.memory.setParam("Proxy host", streamhost_elt.getAttribute("host",""), "File Transfer", self.parent.profile)
-        proxy = self.host.memory.setParam("Proxy port", streamhost_elt.getAttribute("port",""), "File Transfer", self.parent.profile)
-
+        proxy = self.host.memory.setParam("Proxy", streamhost_elt.getAttribute("jid", ""), "File Transfer", self.parent.profile)
+        proxy = self.host.memory.setParam("Proxy host", streamhost_elt.getAttribute("host", ""), "File Transfer", self.parent.profile)
+        proxy = self.host.memory.setParam("Proxy port", streamhost_elt.getAttribute("port", ""), "File Transfer", self.parent.profile)
 
     def connectionInitialized(self):
         def after_init(ignore):
@@ -812,20 +808,17 @@
             if not proxy_ent:
                 debug(_("No proxy found on this server"))
                 return
-            iq_elt = jabber_client.IQ(self.parent.xmlstream,'get')
+            iq_elt = jabber_client.IQ(self.parent.xmlstream, 'get')
             iq_elt["to"] = proxy_ent.full()
             query_elt = iq_elt.addElement('query', NS_BS)
             iq_elt.addCallback(self._proxyDataResult)
             iq_elt.send()
 
-
-        self.xmlstream.addObserver(BS_REQUEST, self.plugin_parent.streamQuery, profile = self.parent.profile)
-        proxy = self.host.memory.getParamA("Proxy", "File Transfer", profile_key = self.parent.profile)
+        self.xmlstream.addObserver(BS_REQUEST, self.plugin_parent.streamQuery, profile=self.parent.profile)
+        proxy = self.host.memory.getParamA("Proxy", "File Transfer", profile_key=self.parent.profile)
         if not proxy:
             self.parent.client_initialized.addCallback(after_init)
 
-
-
     def getDiscoInfo(self, requestor, target, nodeIdentifier=''):
         return [disco.DiscoFeature(NS_BS)]
 
diff --git a/src/plugins/plugin_xep_0077.py b/src/plugins/plugin_xep_0077.py
--- a/src/plugins/plugin_xep_0077.py
+++ b/src/plugins/plugin_xep_0077.py
@@ -29,21 +29,22 @@
 NS_REG = 'jabber:iq:register'
 
 PLUGIN_INFO = {
-"name": "XEP 0077 Plugin",
-"import_name": "XEP-0077",
-"type": "XEP",
-"protocols": ["XEP-0077"],
-"dependencies": [],
-"main": "XEP_0077",
-"description": _("""Implementation of in-band registration""")
+    "name": "XEP 0077 Plugin",
+    "import_name": "XEP-0077",
+    "type": "XEP",
+    "protocols": ["XEP-0077"],
+    "dependencies": [],
+    "main": "XEP_0077",
+    "description": _("""Implementation of in-band registration""")
 }
 
+
 class XEP_0077(object):
 
     def __init__(self, host):
         info(_("Plugin XEP_0077 initialization"))
         self.host = host
-        self.triggers = {}  #used by other protocol (e.g. XEP-0100) to finish registration. key = target_jid
+        self.triggers = {}  # used by other protocol (e.g. XEP-0100) to finish registration. key = target_jid
         host.bridge.addMethod("in_band_register", ".plugin", in_sign='ss', out_sign='s', method=self.in_band_register)
         host.bridge.addMethod("in_band_submit", ".plugin", in_sign='ssa(ss)s', out_sign='s', method=self.in_band_submit)
 
@@ -54,65 +55,65 @@
     def reg_ok(self, answer, profile):
         """Called after the first get IQ"""
         try:
-            x_elem = filter (lambda x:x.name == "x", answer.firstChildElement().elements())[0] #We only want the "x" element (data form)
+            x_elem = filter(lambda x: x.name == "x", answer.firstChildElement().elements())[0]  # We only want the "x" element (data form)
         except IndexError:
             info(_("No data form found"))
             #TODO: manage registration without data form
-            answer_data={"reason": "unmanaged", "message":_("This gateway can't be managed by SàT, sorry :(")}
+            answer_data = {"reason": "unmanaged", "message": _("This gateway can't be managed by SàT, sorry :(")}
             answer_type = "ERROR"
             self.host.bridge.actionResult(answer_type, answer['id'], answer_data, profile)
             return
 
         form = data_form.Form.fromElement(x_elem)
         xml_data = dataForm2xml(form)
-        self.host.bridge.actionResult("XMLUI", answer['id'], {"target":answer["from"], "type":"registration", "xml":xml_data}, profile)
+        self.host.bridge.actionResult("XMLUI", answer['id'], {"target": answer["from"], "type": "registration", "xml": xml_data}, profile)
 
     def reg_err(self, failure, profile):
         """Called when something is wrong with registration"""
-        info (_("Registration failure: %s") % str(failure.value))
+        info(_("Registration failure: %s") % str(failure.value))
         answer_data = {}
         answer_data['reason'] = 'unknown'
-        answer_data={"message":"%s [code: %s]" % (failure.value.condition, unicode(failure.value))}
+        answer_data = {"message": "%s [code: %s]" % (failure.value.condition, unicode(failure.value))}
         answer_type = "ERROR"
         self.host.bridge.actionResult(answer_type, failure.value.stanza['id'], answer_data, profile)
 
     def unregistrationAnswer(self, answer, profile):
-        debug (_("registration answer: %s") % answer.toXml())
+        debug(_("registration answer: %s") % answer.toXml())
         answer_type = "SUCCESS"
-        answer_data={"message":_("Your are now unregistred")}
+        answer_data = {"message": _("Your are now unregistred")}
         self.host.bridge.actionResult(answer_type, answer['id'], answer_data, profile)
 
     def unregistrationFailure(self, failure, profile):
-        info (_("Unregistration failure: %s") % str(failure.value))
+        info(_("Unregistration failure: %s") % str(failure.value))
         answer_type = "ERROR"
         answer_data = {}
         answer_data['reason'] = 'unknown'
-        answer_data={"message":_("Unregistration failed: %s") % failure.value.condition}
+        answer_data = {"message": _("Unregistration failed: %s") % failure.value.condition}
         self.host.bridge.actionResult(answer_type, failure.value.stanza['id'], answer_data, profile)
 
     def registrationAnswer(self, answer, profile):
-        debug (_("registration answer: %s") % answer.toXml())
+        debug(_("registration answer: %s") % answer.toXml())
         answer_type = "SUCCESS"
-        answer_data={"message":_("Registration successfull")}
+        answer_data = {"message": _("Registration successfull")}
         self.host.bridge.actionResult(answer_type, answer['id'], answer_data, profile)
-        if self.triggers.has_key(answer["from"]):
-            callback,profile = self.triggers[answer["from"]]
+        if answer["from"] in self.triggers:
+            callback, profile = self.triggers[answer["from"]]
             callback(answer["from"], profile)
             del self.triggers[answer["from"]]
 
     def registrationFailure(self, failure, profile):
-        info (_("Registration failure: %s") % str(failure.value))
+        info(_("Registration failure: %s") % str(failure.value))
         print failure.value.stanza.toXml()
         answer_type = "ERROR"
         answer_data = {}
         if failure.value.condition == 'conflict':
             answer_data['reason'] = 'conflict'
-            answer_data={"message":_("Username already exists, please choose an other one")}
+            answer_data = {"message": _("Username already exists, please choose an other one")}
         else:
             answer_data['reason'] = 'unknown'
-            answer_data={"message":_("Registration failed")}
+            answer_data = {"message": _("Registration failed")}
         self.host.bridge.actionResult(answer_type, failure.value.stanza['id'], answer_data, profile)
-        if failure.value.stanza["from"] in self.triggers.has_key:
+        if failure.value.stanza["from"] in self.triggers:
             del self.triggers[failure.value.stanza["from"]]
 
     def in_band_submit(self, action, target, fields, profile):
@@ -128,12 +129,12 @@
         """register to a target JID"""
         client = self.host.getClient(profile_key)
         if not client:
-            error (_('Asking for an non-existant or not connected profile'))
+            error(_('Asking for an non-existant or not connected profile'))
             return ""
         to_jid = jid.JID(target)
         debug(_("Asking registration for [%s]") % to_jid.full())
-        reg_request=IQ(client.xmlstream,'get')
-        reg_request["from"]=client.jid.full()
+        reg_request = IQ(client.xmlstream, 'get')
+        reg_request["from"] = client.jid.full()
         reg_request["to"] = to_jid.full()
         reg_request.addElement('query', NS_REG)
         reg_request.send(to_jid.full()).addCallbacks(self.reg_ok, self.reg_err, callbackArgs=[client.profile], errbackArgs=[client.profile])
diff --git a/src/plugins/plugin_xep_0095.py b/src/plugins/plugin_xep_0095.py
--- a/src/plugins/plugin_xep_0095.py
+++ b/src/plugins/plugin_xep_0095.py
@@ -43,21 +43,22 @@
 SI_PROFILE_HEADER = "http://jabber.org/protocol/si/profile/"
 
 PLUGIN_INFO = {
-"name": "XEP 0095 Plugin",
-"import_name": "XEP-0095",
-"type": "XEP",
-"protocols": ["XEP-0095"],
-"main": "XEP_0095",
-"handler": "yes",
-"description": _("""Implementation of Stream Initiation""")
+    "name": "XEP 0095 Plugin",
+    "import_name": "XEP-0095",
+    "type": "XEP",
+    "protocols": ["XEP-0095"],
+    "main": "XEP_0095",
+    "handler": "yes",
+    "description": _("""Implementation of Stream Initiation""")
 }
 
+
 class XEP_0095(object):
 
     def __init__(self, host):
         info(_("Plugin XEP_0095 initialization"))
         self.host = host
-        self.si_profiles = {} #key: SI profile, value: callback
+        self.si_profiles = {}  # key: SI profile, value: callback
 
     def getHandler(self, profile):
         return XEP_0095_handler(self)
@@ -66,33 +67,33 @@
         """Add a callback for a SI Profile
         param si_profile: SI profile name (e.g. file-transfer)
         param callback: method to call when the profile name is asked"""
-        self.si_profiles[si_profile] =  callback
+        self.si_profiles[si_profile] = callback
 
     def streamInit(self, iq_el, profile):
         """This method is called on stream initiation (XEP-0095 #3.2)
         @param iq_el: IQ element
         @param profile: %(doc_profile)s"""
-        info (_("XEP-0095 Stream initiation"))
-        iq_el.handled=True
+        info(_("XEP-0095 Stream initiation"))
+        iq_el.handled = True
         si_el = iq_el.firstChildElement()
         si_id = si_el.getAttribute('id')
         si_mime_type = iq_el.getAttribute('mime-type', 'application/octet-stream')
         si_profile = si_el.getAttribute('profile')
-        si_profile_key =  si_profile[len(SI_PROFILE_HEADER):] if si_profile.startswith(SI_PROFILE_HEADER) else si_profile
-        if self.si_profiles.has_key(si_profile_key):
+        si_profile_key = si_profile[len(SI_PROFILE_HEADER):] if si_profile.startswith(SI_PROFILE_HEADER) else si_profile
+        if si_profile_key in self.si_profiles:
             #We know this SI profile, we call the callback
             self.si_profiles[si_profile_key](iq_el['id'], iq_el['from'], si_id, si_mime_type, si_el, profile)
         else:
             #We don't know this profile, we send an error
             self.sendBadProfileError(iq_el['id'], iq_el['from'], profile)
 
-    def sendRejectedError(self, iq_id, to_jid, reason = 'Offer Declined', profile='@NONE@'):
+    def sendRejectedError(self, iq_id, to_jid, reason='Offer Declined', profile='@NONE@'):
         """Helper method to send when the stream is rejected
         @param iq_id: IQ id
         @param to_jid: recipient
         @param reason: human readable reason (string)
         @param profile: %(doc_profile)s"""
-        self.sendError(iq_id, to_jid, 403, 'cancel', {'text':reason}, profile=profile)
+        self.sendError(iq_id, to_jid, 403, 'cancel', {'text': reason}, profile=profile)
 
     def sendBadProfileError(self, iq_id, to_jid, profile):
         """Helper method to send when we don't know the SI profile
@@ -113,7 +114,7 @@
         @param iq_id: IQ id
         @param to_jid: recipient
         @param profile: %(doc_profile)s"""
-        self.sendError(iq_id, to_jid, 500, 'cancel', {'custom':'failed'}, profile=profile) #as there is no error code for failed transfer, we use 500 (undefined-condition)
+        self.sendError(iq_id, to_jid, 500, 'cancel', {'custom': 'failed'}, profile=profile)  # as there is no error code for failed transfer, we use 500 (undefined-condition)
 
     def sendError(self, iq_id, to_jid, err_code, err_type='cancel', data={}, profile='@NONE@'):
         """Send IQ error as a result
@@ -131,21 +132,21 @@
         result['id'] = iq_id
         result['to'] = to_jid
         error_el = result.addElement('error')
-        error_el['err_code'] =  str(err_code)
+        error_el['err_code'] = str(err_code)
         error_el['type'] = err_type
-        if err_code==400 and err_type=='cancel':
-            error_el.addElement(('urn:ietf:params:xml:ns:xmpp-stanzas','bad-request'))
-            error_el.addElement((NS_SI,'no-valid-streams'))
-        elif err_code==400 and err_type=='modify':
-            error_el.addElement(('urn:ietf:params:xml:ns:xmpp-stanzas','bad-request'))
-            error_el.addElement((NS_SI,'bad-profile'))
-        elif err_code==403 and err_type=='cancel':
-            error_el.addElement(('urn:ietf:params:xml:ns:xmpp-stanzas','forbidden'))
-            if data.has_key('text'):
-                error_el.addElement(('urn:ietf:params:xml:ns:xmpp-stanzas','text'), content=data['text'])
-        elif err_code==500 and err_type=='cancel':
-            condition_el = error_el.addElement((NS_SI,'undefined-condition'))
-            if data.has_key('custom') and data['custom']=='failed':
+        if err_code == 400 and err_type == 'cancel':
+            error_el.addElement(('urn:ietf:params:xml:ns:xmpp-stanzas', 'bad-request'))
+            error_el.addElement((NS_SI, 'no-valid-streams'))
+        elif err_code == 400 and err_type == 'modify':
+            error_el.addElement(('urn:ietf:params:xml:ns:xmpp-stanzas', 'bad-request'))
+            error_el.addElement((NS_SI, 'bad-profile'))
+        elif err_code == 403 and err_type == 'cancel':
+            error_el.addElement(('urn:ietf:params:xml:ns:xmpp-stanzas', 'forbidden'))
+            if 'text' in data:
+                error_el.addElement(('urn:ietf:params:xml:ns:xmpp-stanzas', 'text'), content=data['text'])
+        elif err_code == 500 and err_type == 'cancel':
+            condition_el = error_el.addElement((NS_SI, 'undefined-condition'))
+            if 'custom' in data and data['custom'] == 'failed':
                 condition_el.addContent('Stream failed')
 
         _client.xmlstream.send(result)
@@ -158,7 +159,7 @@
         @param profile: %(doc_profile)s"""
         _client = self.host.getClient(profile)
         assert(_client)
-        info (_("sending stream initiation accept answer"))
+        info(_("sending stream initiation accept answer"))
         result = domish.Element((None, 'iq'))
         result['type'] = 'result'
         result['id'] = iq_id
@@ -180,16 +181,16 @@
         @return: session id, offer"""
         current_jid, xmlstream = self.host.getJidNStream(profile_key)
         if not xmlstream:
-            error (_('Asking for an non-existant or not connected profile'))
+            error(_('Asking for an non-existant or not connected profile'))
             return ""
 
-        offer = client.IQ(xmlstream,'set')
+        offer = client.IQ(xmlstream, 'set')
         sid = str(uuid.uuid4())
-        debug (_("Stream Session ID: %s") % offer["id"])
+        debug(_("Stream Session ID: %s") % offer["id"])
 
         offer["from"] = current_jid.full()
         offer["to"] = to_jid.full()
-        si=offer.addElement('si',NS_SI)
+        si = offer.addElement('si', NS_SI)
         si['id'] = sid
         si["mime-type"] = mime_type
         si["profile"] = si_profile
@@ -209,11 +210,10 @@
         self.host = plugin_parent.host
 
     def connectionInitialized(self):
-        self.xmlstream.addObserver(SI_REQUEST, self.plugin_parent.streamInit, profile = self.parent.profile)
+        self.xmlstream.addObserver(SI_REQUEST, self.plugin_parent.streamInit, profile=self.parent.profile)
 
     def getDiscoInfo(self, requestor, target, nodeIdentifier=''):
         return [disco.DiscoFeature(NS_SI)] + [disco.DiscoFeature("http://jabber.org/protocol/si/profile/%s" % profile_name) for profile_name in self.plugin_parent.si_profiles]
 
     def getDiscoItems(self, requestor, target, nodeIdentifier=''):
         return []
-
diff --git a/src/plugins/plugin_xep_0096.py b/src/plugins/plugin_xep_0096.py
--- a/src/plugins/plugin_xep_0096.py
+++ b/src/plugins/plugin_xep_0096.py
@@ -23,11 +23,10 @@
 from twisted.words.xish import domish
 from twisted.words.protocols.jabber import jid
 from twisted.words.protocols.jabber import error as jab_error
-import os, os.path
+import os
 from twisted.internet import reactor
 from sat.core.exceptions import ProfileNotInCacheError
 
-
 from wokkel import data_form
 
 IQ_SET = '/iq[@type="set"]'
@@ -35,29 +34,30 @@
 PROFILE = "http://jabber.org/protocol/si/profile/" + PROFILE_NAME
 
 PLUGIN_INFO = {
-"name": "XEP 0096 Plugin",
-"import_name": "XEP-0096",
-"type": "XEP",
-"protocols": ["XEP-0096"],
-"dependencies": ["XEP-0020", "XEP-0095", "XEP-0065", "XEP-0047"],
-"main": "XEP_0096",
-"handler": "no",
-"description": _("""Implementation of SI File Transfer""")
+    "name": "XEP 0096 Plugin",
+    "import_name": "XEP-0096",
+    "type": "XEP",
+    "protocols": ["XEP-0096"],
+    "dependencies": ["XEP-0020", "XEP-0095", "XEP-0065", "XEP-0047"],
+    "main": "XEP_0096",
+    "handler": "no",
+    "description": _("""Implementation of SI File Transfer""")
 }
 
+
 class XEP_0096(object):
 
     def __init__(self, host):
         info(_("Plugin XEP_0096 initialization"))
         self.host = host
         self.managed_stream_m = [self.host.plugins["XEP-0065"].NAMESPACE,
-                                 self.host.plugins["XEP-0047"].NAMESPACE] #Stream methods managed
+                                 self.host.plugins["XEP-0047"].NAMESPACE]  # Stream methods managed
         self.host.plugins["XEP-0095"].registerSIProfile(PROFILE_NAME, self.transferRequest)
         host.bridge.addMethod("sendFile", ".plugin", in_sign='ssa{ss}s', out_sign='s', method=self.sendFile)
 
     def profileConnected(self, profile):
         client = self.host.getClient(profile)
-        client._xep_0096_waiting_for_approval = {} #key = id, value = [transfer data, IdelayedCall Reactor timeout,
+        client._xep_0096_waiting_for_approval = {}  # key = id, value = [transfer data, IdelayedCall Reactor timeout,
                                         # current stream method, [failed stream methods], profile]
 
     def _kill_id(self, approval_id, profile):
@@ -78,7 +78,7 @@
         @param si_mime_type: Mime type of the file (or default "application/octet-stream" if unknown)
         @param si_el: domish.Element of the request
         @param profile: %(doc_profile)s"""
-        info (_("XEP-0096 file transfer requested"))
+        info(_("XEP-0096 file transfer requested"))
         debug(si_el.toXml())
         client = self.host.getClient(profile)
         if not client:
@@ -98,7 +98,7 @@
             file_size = file_el["size"]
             file_date = file_el.getAttribute("date", "")
             file_hash = file_el.getAttribute("hash", "")
-            info (_("File proposed: name=[%(name)s] size=%(size)s") % {'name':filename, 'size':file_size})
+            info(_("File proposed: name=[%(name)s] size=%(size)s") % {'name': filename, 'size': file_size})
             for file_child_el in file_el.elements():
                 if file_child_el.name == "desc":
                     file_desc = unicode(file_child_el)
@@ -113,7 +113,7 @@
             feature_el = feature_elts[0]
             form = data_form.Form.fromElement(feature_el.firstChildElement())
             try:
-                stream_method = self.host.plugins["XEP-0020"].negociate(feature_el, 'stream-method',self.managed_stream_m)
+                stream_method = self.host.plugins["XEP-0020"].negociate(feature_el, 'stream-method', self.managed_stream_m)
             except KeyError:
                 warning(_("No stream method found"))
                 self.host.plugins["XEP-0095"].sendBadRequestError(iq_id, from_jid, profile)
@@ -128,13 +128,12 @@
             return
 
         #if we are here, the transfer can start, we just need user's agreement
-        data={ "filename":filename, "id": iq_id, "from":from_jid, "size":file_size, "date":file_date, "hash":file_hash, "desc":file_desc, "can_range": str(can_range) }
+        data = {"filename": filename, "id": iq_id, "from": from_jid, "size": file_size, "date": file_date, "hash": file_hash, "desc": file_desc, "can_range": str(can_range)}
         client._xep_0096_waiting_for_approval[si_id] = [data, reactor.callLater(300, self._kill_id, si_id, profile), stream_method, []]
 
         self.host.askConfirmation(si_id, "FILE_TRANSFER", data, self.confirmationCB, profile)
 
-
-    def _getFileObject(self, dest_path, can_range = False):
+    def _getFileObject(self, dest_path, can_range=False):
         """Open file, put file pointer to the end if the file if needed
         @param dest_path: path of the destination file
         @param can_range: True if the file pointer can be moved
@@ -175,7 +174,7 @@
                 return
 
             #we can send the iq result
-            feature_elt = self.host.plugins["XEP-0020"].chooseOption({'stream-method':stream_method})
+            feature_elt = self.host.plugins["XEP-0020"].chooseOption({'stream-method': stream_method})
             misc_elts = []
             misc_elts.append(domish.Element((PROFILE, "file")))
             if can_range:
@@ -185,8 +184,8 @@
                 misc_elts.append(range_elt)
             self.host.plugins["XEP-0095"].acceptStream(data["id"], data['from'], feature_elt, misc_elts, profile)
         else:
-            debug (_("Transfer [%s] refused"), sid)
-            self.host.plugins["XEP-0095"].sendRejectedError (data["id"], data['from'], profile=profile)
+            debug(_("Transfer [%s] refused"), sid)
+            self.host.plugins["XEP-0095"].sendRejectedError(data["id"], data['from'], profile=profile)
             del(client._xep_0096_waiting_for_approval[sid])
 
     def _transferSucceeded(self, sid, file_obj, stream_method, profile):
@@ -207,9 +206,10 @@
         if not client:
             raise ProfileNotInCacheError
         data, timeout, stream_method, failed_methods = client._xep_0096_waiting_for_approval[sid]
-        warning(_('Transfer %(id)s failed with stream method %(s_method)s: %(reason)s') % { 'id': sid,
-                                                                                 's_method': stream_method,
-                                                                                 'reason': reason})
+        warning(_('Transfer %(id)s failed with stream method %(s_method)s: %(reason)s') % {
+            'id': sid,
+            's_method': stream_method,
+            'reason': reason})
         filepath = file_obj.name
         file_obj.close()
         os.remove(filepath)
@@ -255,15 +255,15 @@
             range_length = range_elt.getAttribute("length")
 
         if stream_method == self.host.plugins["XEP-0065"].NAMESPACE:
-           file_obj = open(filepath, 'r')
-           if range_offset:
-               file_obj.seek(range_offset)
-           self.host.plugins["XEP-0065"].startStream(file_obj, jid.JID(IQ['from']), sid, range_length, self.sendSuccessCb, self.sendFailureCb, size, profile)
+            file_obj = open(filepath, 'r')
+            if range_offset:
+                file_obj.seek(range_offset)
+            self.host.plugins["XEP-0065"].startStream(file_obj, jid.JID(IQ['from']), sid, range_length, self.sendSuccessCb, self.sendFailureCb, size, profile)
         elif stream_method == self.host.plugins["XEP-0047"].NAMESPACE:
-           file_obj = open(filepath, 'r')
-           if range_offset:
-               file_obj.seek(range_offset)
-           self.host.plugins["XEP-0047"].startStream(file_obj, jid.JID(IQ['from']), sid, range_length, self.sendSuccessCb, self.sendFailureCb, size, profile)
+            file_obj = open(filepath, 'r')
+            if range_offset:
+                file_obj.seek(range_offset)
+            self.host.plugins["XEP-0047"].startStream(file_obj, jid.JID(IQ['from']), sid, range_length, self.sendSuccessCb, self.sendFailureCb, size, profile)
         else:
             warning(_("Invalid stream method received"))
 
@@ -286,13 +286,13 @@
 
         statinfo = os.stat(filepath)
         file_elt = domish.Element((PROFILE, 'file'))
-        file_elt['name']=os.path.basename(filepath)
-        size = file_elt['size']=str(statinfo.st_size)
+        file_elt['name'] = os.path.basename(filepath)
+        size = file_elt['size'] = str(statinfo.st_size)
         file_transfer_elts.append(file_elt)
 
-        file_transfer_elts.append(domish.Element((None,'range')))
+        file_transfer_elts.append(domish.Element((None, 'range')))
 
-        sid, offer = self.host.plugins["XEP-0095"].proposeStream(jid.JID(to_jid), PROFILE, feature_elt, file_transfer_elts, profile_key = profile)
+        sid, offer = self.host.plugins["XEP-0095"].proposeStream(jid.JID(to_jid), PROFILE, feature_elt, file_transfer_elts, profile_key=profile)
         offer.addCallback(self.fileCb, filepath, sid, size, profile)
         return sid
 
@@ -302,4 +302,4 @@
 
     def sendFailureCb(self, sid, file_obj, stream_method, reason, profile):
         file_obj.close()
-        warning(_('Transfer %(id)s failed with stream method %(s_method)s: %(reason)s [%(profile)s') % { 'id': sid, "s_method": stream_method, 'reason': reason, 'profile': profile })
+        warning(_('Transfer %(id)s failed with stream method %(s_method)s: %(reason)s [%(profile)s') % {'id': sid, "s_method": stream_method, 'reason': reason, 'profile': profile})
diff --git a/src/plugins/plugin_xep_0100.py b/src/plugins/plugin_xep_0100.py
--- a/src/plugins/plugin_xep_0100.py
+++ b/src/plugins/plugin_xep_0100.py
@@ -25,86 +25,85 @@
 import twisted.internet.error
 
 PLUGIN_INFO = {
-"name": "Gateways Plugin",
-"import_name": "XEP-0100",
-"type": "XEP",
-"protocols": ["XEP-0100"],
-"dependencies": ["XEP-0077"],
-"main": "XEP_0100",
-"description": _("""Implementation of Gateways protocol""")
+    "name": "Gateways Plugin",
+    "import_name": "XEP-0100",
+    "type": "XEP",
+    "protocols": ["XEP-0100"],
+    "dependencies": ["XEP-0077"],
+    "main": "XEP_0100",
+    "description": _("""Implementation of Gateways protocol""")
 }
 
+
 class XEP_0100(object):
 
     def __init__(self, host):
         info(_("Gateways plugin initialization"))
         self.host = host
-        self.__gateways = {}  #dict used to construct the answer to findGateways. Key = target jid
+        self.__gateways = {}  # dict used to construct the answer to findGateways. Key = target jid
         host.bridge.addMethod("findGateways", ".plugin", in_sign='ss', out_sign='s', method=self.findGateways)
         host.bridge.addMethod("gatewayRegister", ".plugin", in_sign='ssa(ss)s', out_sign='s', method=self.gatewayRegister)
 
     def __inc_handled_items(self, request_id, profile):
-        self.__gateways[request_id]['__handled_items']+=1
+        self.__gateways[request_id]['__handled_items'] += 1
 
         if self.__gateways[request_id]['__total_items'] == self.__gateways[request_id]['__handled_items']:
-            debug (_("All items checked for id [%s]") % str(request_id))
+            debug(_("All items checked for id [%s]") % str(request_id))
 
             del self.__gateways[request_id]['__total_items']
             del self.__gateways[request_id]['__handled_items']
-            self.host.actionResultExt(request_id,"DICT_DICT",self.__gateways[request_id], profile)
+            self.host.actionResultExt(request_id, "DICT_DICT", self.__gateways[request_id], profile)
 
     def discoInfo(self, disco, entity, request_id, profile):
         """Find disco infos about entity, to check if it is a gateway"""
 
         for identity in disco.identities:
             if identity[0] == 'gateway':
-                print (_("Found gateway (%(jid)s): %(identity)s") % {'jid':entity.full(), 'identity':disco.identities[identity]})
+                print (_("Found gateway (%(jid)s): %(identity)s") % {'jid': entity.full(), 'identity': disco.identities[identity]})
                 self.__gateways[request_id][entity.full()] = {
-                    'name':disco.identities[identity],
-                    'type':identity[1]
+                    'name': disco.identities[identity],
+                    'type': identity[1]
                 }
 
         self.__inc_handled_items(request_id, profile)
 
     def discoInfoErr(self, failure, entity, request_id, profile):
         """Something is going wrong with disco"""
-        failure.trap(jab_error.StanzaError,twisted.internet.error.ConnectionLost)
-        error(_("Error when discovering [%(jid)s]: %(error)s") % {'jid':entity.full(), 'error':failure.getErrorMessage()})
+        failure.trap(jab_error.StanzaError, twisted.internet.error.ConnectionLost)
+        error(_("Error when discovering [%(jid)s]: %(error)s") % {'jid': entity.full(), 'error': failure.getErrorMessage()})
         self.__inc_handled_items(request_id, profile)
 
-
     def discoItems(self, disco, request_id, target, client):
         """Look for items with disco protocol, and ask infos for each one"""
         #FIXME: target is used as we can't find the original iq node (parent is None)
         #       an other way would avoid this useless parameter (is there a way with wokkel ?)
         if len(disco._items) == 0:
-            debug (_("No gateway found"))
-            self.host.actionResultExt(request_id,"DICT_DICT",{})
+            debug(_("No gateway found"))
+            self.host.actionResultExt(request_id, "DICT_DICT", {})
             return
 
-        self.__gateways[request_id] = {'__total_items':len(disco._items), '__handled_items':0, '__private__':{'target':target.full()}}
+        self.__gateways[request_id] = {'__total_items': len(disco._items), '__handled_items': 0, '__private__': {'target': target.full()}}
         for item in disco._items:
             #TODO: need to set a timeout for theses requests
-            debug (_("item found: %s"), item.name)
+            debug(_("item found: %s"), item.name)
             client.disco.requestInfo(item.entity).addCallback(self.discoInfo, entity=item.entity, request_id=request_id, profile=client.profile).addErrback(self.discoInfoErr, entity=item.entity, request_id=request_id, profile=client.profile)
 
     def discoItemsErr(self, failure, request_id, target, client):
         """Something is going wrong with disco"""
-        error(_("Error when discovering [%(target)s]: %(condition)s") % {'target':target.full(), 'condition':unicode(failure.value)})
-        message_data={"reason": "connection error", "message":_(u"Error while trying to discover %(target)s gateways: %(error_mess)s") % {'target':target.full(), 'error_mess':unicode(failure.value)}}
+        error(_("Error when discovering [%(target)s]: %(condition)s") % {'target': target.full(), 'condition': unicode(failure.value)})
+        message_data = {"reason": "connection error", "message": _(u"Error while trying to discover %(target)s gateways: %(error_mess)s") % {'target': target.full(), 'error_mess': unicode(failure.value)}}
         self.host.bridge.actionResult("ERROR", request_id, message_data)
 
-
     def registrationSuccessful(self, target, profile):
         """Called when in_band registration is ok, we must now follow the rest of procedure"""
-        debug (_("Registration successful, doing the rest"))
+        debug(_("Registration successful, doing the rest"))
         self.host.addContact(target, profile)
         self.host.setPresence(target, profile)
 
     def gatewayRegister(self, action, target, fields, profile_key='@DEFAULT@'):
         """Register gateway using in-band registration, then log-in to gateway"""
         profile = self.host.memory.getProfileName(profile_key)
-        assert(profile) #FIXME: return an error here
+        assert(profile)  # FIXME: return an error here
         if action == 'SUBMIT':
             self.host.plugins["XEP-0077"].addTrigger(target, self.registrationSuccessful, profile)
         return self.host.plugins["XEP-0077"].in_band_submit(action, target, fields, profile)
@@ -117,7 +116,7 @@
         client = self.host.getClient(profile_key)
         assert(client)
         to_jid = jid.JID(target)
-        debug (_("find gateways (target = %(target)s, profile = %(profile)s)") % {'target':to_jid.full(), 'profile':profile})
+        debug(_("find gateways (target = %(target)s, profile = %(profile)s)") % {'target': to_jid.full(), 'profile': profile})
         request_id = self.host.get_next_id()
-        client.disco.requestItems(to_jid).addCallback(self.discoItems, request_id=request_id, target = to_jid, client = client).addErrback(self.discoItemsErr, request_id=request_id, target = to_jid, client = client)
+        client.disco.requestItems(to_jid).addCallback(self.discoItems, request_id=request_id, target=to_jid, client=client).addErrback(self.discoItemsErr, request_id=request_id, target=to_jid, client=client)
         return request_id
diff --git a/src/plugins/plugin_xep_0115.py b/src/plugins/plugin_xep_0115.py
--- a/src/plugins/plugin_xep_0115.py
+++ b/src/plugins/plugin_xep_0115.py
@@ -42,22 +42,24 @@
 
 PRESENCE = '/presence'
 NS_ENTITY_CAPABILITY = 'http://jabber.org/protocol/caps'
-CAPABILITY_UPDATE = PRESENCE + '/c[@xmlns="' +  NS_ENTITY_CAPABILITY + '"]'
+CAPABILITY_UPDATE = PRESENCE + '/c[@xmlns="' + NS_ENTITY_CAPABILITY + '"]'
 
 PLUGIN_INFO = {
-"name": "XEP 0115 Plugin",
-"import_name": "XEP-0115",
-"type": "XEP",
-"protocols": ["XEP-0115"],
-"dependencies": [],
-"main": "XEP_0115",
-"handler": "yes",
-"description": _("""Implementation of entity capabilities""")
+    "name": "XEP 0115 Plugin",
+    "import_name": "XEP-0115",
+    "type": "XEP",
+    "protocols": ["XEP-0115"],
+    "dependencies": [],
+    "main": "XEP_0115",
+    "handler": "yes",
+    "description": _("""Implementation of entity capabilities""")
 }
 
+
 class HashGenerationError(Exception):
     pass
 
+
 class ByteIdentity(object):
     """This class manage identity as bytes (needed for i;octet sort),
     it is used for the hash generation"""
@@ -74,16 +76,16 @@
 
 
 class XEP_0115(object):
-    cap_hash = None #capabilities hash is class variable as it is common to all profiles
+    cap_hash = None  # capabilities hash is class variable as it is common to all profiles
     #TODO: this code is really dirty, need to clean it and try to move it to Wokkel
 
     def __init__(self, host):
         info(_("Plugin XEP_0115 initialization"))
         self.host = host
         host.trigger.add("Disco Handled", self.checkHash)
-        self.hash_cache = PersistentBinaryDict(NS_ENTITY_CAPABILITY) #key = hash or jid, value = features
+        self.hash_cache = PersistentBinaryDict(NS_ENTITY_CAPABILITY)  # key = hash or jid, value = features
         self.hash_cache.load()
-        self.jid_hash = {} #jid to hash mapping, map to a discoInfo features if the hash method is unknown
+        self.jid_hash = {}  # jid to hash mapping, map to a discoInfo features if the hash method is unknown
 
     def checkHash(self, profile):
         if not XEP_0115.cap_hash:
@@ -97,16 +99,17 @@
 
     def presenceHack(self, profile):
         """modify SatPresenceProtocol to add capabilities data"""
-        client=self.host.getClient(profile)
+        client = self.host.getClient(profile)
         presenceInst = client.presence
-        c_elt = domish.Element((NS_ENTITY_CAPABILITY,'c'))
-        c_elt['hash']='sha-1'
-        c_elt['node']='http://wiki.goffi.org/wiki/Salut_%C3%A0_Toi'
-        c_elt['ver']=XEP_0115.cap_hash
+        c_elt = domish.Element((NS_ENTITY_CAPABILITY, 'c'))
+        c_elt['hash'] = 'sha-1'
+        c_elt['node'] = 'http://wiki.goffi.org/wiki/Salut_%C3%A0_Toi'
+        c_elt['ver'] = XEP_0115.cap_hash
         presenceInst._c_elt = c_elt
         if "_legacy_send" in dir(presenceInst):
             debug('capabilities already added to presence instance')
             return
+
         def hacked_send(self, obj):
             obj.addChild(self._c_elt)
             self._legacy_send(obj)
@@ -114,31 +117,30 @@
         presenceInst._legacy_send = presenceInst.send
         presenceInst.send = new_send
 
-
     def generateHash(self, profile_key="@DEFAULT@"):
         """This method generate a sha1 hash as explained in xep-0115 #5.1
         it then store it in XEP_0115.cap_hash"""
         profile = self.host.memory.getProfileName(profile_key)
         if not profile:
-            error ('Requesting hash for an inexistant profile')
+            error('Requesting hash for an inexistant profile')
             raise HashGenerationError
 
         client = self.host.getClient(profile_key)
         if not client:
-            error ('Requesting hash for an inexistant client')
+            error('Requesting hash for an inexistant client')
             raise HashGenerationError
 
         def generateHash_2(services, profile):
-            _s=[]
-            byte_identities = [ByteIdentity(identity) for identity in filter(lambda x:isinstance(x,disco.DiscoIdentity),services)] #FIXME: lang must be managed here
-            byte_identities.sort(key=lambda i:i.lang)
-            byte_identities.sort(key=lambda i:i.idType)
-            byte_identities.sort(key=lambda i:i.category)
+            _s = []
+            byte_identities = [ByteIdentity(identity) for identity in filter(lambda x: isinstance(x, disco.DiscoIdentity), services)]  # FIXME: lang must be managed here
+            byte_identities.sort(key=lambda i: i.lang)
+            byte_identities.sort(key=lambda i: i.idType)
+            byte_identities.sort(key=lambda i: i.category)
             for identity in byte_identities:
                 _s.append(str(identity))
                 _s.append('<')
-            byte_features = [feature.encode('utf-8') for feature in filter(lambda x:isinstance(x,disco.DiscoFeature),services)]
-            byte_features.sort() #XXX: the default sort has the same behaviour as the requested RFC 4790 i;octet sort
+            byte_features = [feature.encode('utf-8') for feature in filter(lambda x: isinstance(x, disco.DiscoFeature), services)]
+            byte_features.sort()  # XXX: the default sort has the same behaviour as the requested RFC 4790 i;octet sort
             for feature in byte_features:
                 _s.append(feature)
                 _s.append('<')
@@ -149,6 +151,7 @@
 
         services = client.discoHandler.info(client.jid, client.jid, '').addCallback(generateHash_2, profile)
 
+
 class XEP_0115_handler(XMPPHandler):
     implements(iwokkel.IDisco)
 
@@ -176,7 +179,6 @@
             #No key, that means unknown hash method
             self.plugin_parent.jid_hash[from_jid] = discoResult.features
 
-
     def update(self, presence):
         """
         Manage the capabilities of the entity
@@ -184,11 +186,11 @@
         and get the capibilities if necessary
         """
         from_jid = jid.JID(presence['from'])
-        c_elem = filter (lambda x:x.name == "c", presence.elements())[0] #We only want the "c" element
+        c_elem = filter(lambda x: x.name == "c", presence.elements())[0]  # We only want the "c" element
         try:
-            ver=c_elem['ver']
-            hash=c_elem['hash']
-            node=c_elem['node']
+            ver = c_elem['ver']
+            hash = c_elem['hash']
+            node = c_elem['node']
         except KeyError:
             warning('Received invalid capabilities tag')
             return
@@ -197,9 +199,8 @@
                 #we know that hash, we just link it with the jid
                 self.plugin_parent.jid_hash[from_jid] = ver
             else:
-                if hash!='sha-1':
+                if hash != 'sha-1':
                     #unknown hash method
                     warning('Unknown hash for entity capabilities: [%s]' % hash)
-                self.parent.disco.requestInfo(from_jid).addCallback(self._updateCache, from_jid, ver if hash=='sha-1' else None )
+                self.parent.disco.requestInfo(from_jid).addCallback(self._updateCache, from_jid, ver if hash == 'sha-1' else None)
         #TODO: me must manage the full algorithm described at XEP-0115 #5.4 part 3
-
diff --git a/src/plugins/plugin_xep_0163.py b/src/plugins/plugin_xep_0163.py
--- a/src/plugins/plugin_xep_0163.py
+++ b/src/plugins/plugin_xep_0163.py
@@ -26,32 +26,33 @@
 import twisted.internet.error
 from twisted.words.xish import domish
 
-from wokkel import disco,pubsub
+from wokkel import disco, pubsub
 from wokkel.formats import Mood
 
 NS_USER_MOOD = 'http://jabber.org/protocol/mood'
 
 PLUGIN_INFO = {
-"name": "Personal Eventing Protocol Plugin",
-"import_name": "XEP-0163",
-"type": "XEP",
-"protocols": ["XEP-0163", "XEP-0107"],
-"dependencies": ["XEP-0060"],
-"main": "XEP_0163",
-"handler": "no",
-"description": _("""Implementation of Personal Eventing Protocol""")
+    "name": "Personal Eventing Protocol Plugin",
+    "import_name": "XEP-0163",
+    "type": "XEP",
+    "protocols": ["XEP-0163", "XEP-0107"],
+    "dependencies": ["XEP-0060"],
+    "main": "XEP_0163",
+    "handler": "no",
+    "description": _("""Implementation of Personal Eventing Protocol""")
 }
 
+
 class XEP_0163(object):
 
     def __init__(self, host):
         info(_("PEP plugin initialization"))
         self.host = host
-        self.pep_events=set()
-        self.pep_out_cb={}
+        self.pep_events = set()
+        self.pep_out_cb = {}
         host.trigger.add("PubSub Disco Info", self.disoInfoTrigger)
-        host.bridge.addSignal("personalEvent", ".plugin", signature='ssa{ss}s') #args: from (jid), type(MOOD, TUNE, etc), data, profile
-        host.bridge.addMethod("sendPersonalEvent", ".plugin", in_sign='sa{ss}s', out_sign='i', method=self.sendPersonalEvent) #args: type(MOOD, TUNE, etc), data, profile_key; return 0 or error_code
+        host.bridge.addSignal("personalEvent", ".plugin", signature='ssa{ss}s')  # args: from (jid), type(MOOD, TUNE, etc), data, profile
+        host.bridge.addMethod("sendPersonalEvent", ".plugin", in_sign='sa{ss}s', out_sign='i', method=self.sendPersonalEvent)  # args: type(MOOD, TUNE, etc), data, profile_key; return 0 or error_code
         self.addPEPEvent("MOOD", NS_USER_MOOD, self.userMoodCB, self.sendMood)
 
     def disoInfoTrigger(self, disco_info, profile):
@@ -62,7 +63,7 @@
         disco_info.extend(map(disco.DiscoFeature, self.pep_events))
         return True
 
-    def addPEPEvent(self, event_type, name, in_callback, out_callback = None, notify = True):
+    def addPEPEvent(self, event_type, name, in_callback, out_callback=None, notify=True):
         """Add a Personal Eventing Protocol event manager
         @param event_type: type of the event (always uppercase), can be MOOD, TUNE, etc
         @param name: namespace of the node (e.g. http://jabber.org/protocol/mood for User Mood)
@@ -73,7 +74,7 @@
             self.pep_out_cb[event_type] = out_callback
         self.pep_events.add(name)
         if notify:
-            self.pep_events.add(name+"+notify")
+            self.pep_events.add(name + "+notify")
         self.host.plugins["XEP-0060"].addManagedNode(name, in_callback)
 
     def sendPEPEvent(self, namespace, data, profile):
@@ -83,7 +84,7 @@
         @param profile: profile which send the data"""
 
         item = pubsub.Item(payload=data)
-        self.host.plugins["XEP-0060"].publish(None, namespace, [item], profile_key = profile)
+        self.host.plugins["XEP-0060"].publish(None, namespace, [item], profile_key=profile)
 
     def sendPersonalEvent(self, event_type, data, profile_key='@DEFAULT@'):
         """Send personal event after checking the data is alright
@@ -96,7 +97,7 @@
             error(_('Trying to send personal event with an unknown profile key [%s]') % profile_key)
             return 1
         if not event_type in self.pep_out_cb.keys():
-            error (_('Trying to send personal event for an unknown type'))
+            error(_('Trying to send personal event for an unknown type'))
             return 2
         return self.pep_out_cb[event_type](data, profile)
 
@@ -105,7 +106,7 @@
             debug(_("No item found"))
             return
         try:
-            mood_elem = filter(lambda x:x.name == "mood", itemsEvent.items[0].children)[0]
+            mood_elem = filter(lambda x: x.name == "mood", itemsEvent.items[0].children)[0]
         except KeyError:
             error(_("Can't find mood element in mood event"))
             return
@@ -113,7 +114,7 @@
         if not _mood:
             debug(_("No mood found"))
             return
-        self.host.bridge.personalEvent(itemsEvent.sender.full(), "MOOD", {"mood":_mood.value or "", "text":_mood.text or ""}, profile)
+        self.host.bridge.personalEvent(itemsEvent.sender.full(), "MOOD", {"mood": _mood.value or "", "text": _mood.text or ""}, profile)
 
     def sendMood(self, data, profile):
         """Send XEP-0107's User Mood
@@ -121,7 +122,7 @@
         @param profile: profile which send the mood"""
         try:
             value = data['mood'].lower()
-            text = data['text'] if data.has_key('text') else ''
+            text = data['text'] if 'text' in data else ''
         except KeyError:
             error(_("Mood data must contain at least 'mood' key"))
             return 3
@@ -129,6 +130,7 @@
         self.sendPEPEvent(NS_USER_MOOD, _mood, profile)
         return 0
 
+
 class UserMood(Mood, domish.Element):
     """Improved wokkel Mood which is also a domish.Element"""
 
@@ -138,4 +140,3 @@
         self.addElement(value)
         if text:
             self.addElement('text', content=text)
-
diff --git a/src/plugins/plugin_xep_0249.py b/src/plugins/plugin_xep_0249.py
--- a/src/plugins/plugin_xep_0249.py
+++ b/src/plugins/plugin_xep_0249.py
@@ -34,21 +34,22 @@
 except ImportError:
     from wokkel.subprotocols import XMPPHandler
 
-MESSAGE= '/message'
+MESSAGE = '/message'
 NS_DIRECT_MUC_INVITATION = 'jabber:x:conference'
 DIRECT_MUC_INVITATION_REQUEST = MESSAGE + '/x[@xmlns="' + NS_DIRECT_MUC_INVITATION + '"]'
 
 PLUGIN_INFO = {
-"name": "XEP 0249 Plugin",
-"import_name": "XEP-0249",
-"type": "XEP",
-"protocols": ["XEP-0249"],
-"dependencies": ["XEP-0045"],
-"main": "XEP_0249",
-"handler": "yes",
-"description": _("""Implementation of Direct MUC Invitations""")
+    "name": "XEP 0249 Plugin",
+    "import_name": "XEP-0249",
+    "type": "XEP",
+    "protocols": ["XEP-0249"],
+    "dependencies": ["XEP-0045"],
+    "main": "XEP_0249",
+    "handler": "yes",
+    "description": _("""Implementation of Direct MUC Invitations""")
 }
 
+
 class XEP_0249(object):
 
     def __init__(self, host):
@@ -71,15 +72,15 @@
         if not profile:
             error(_("Profile doesn't exists !"))
             return
-        message = domish.Element((None,'message'))
+        message = domish.Element((None, 'message'))
         message["to"] = target.full()
-        x_elt = message.addElement('x',NS_DIRECT_MUC_INVITATION)
+        x_elt = message.addElement('x', NS_DIRECT_MUC_INVITATION)
         x_elt['jid'] = room.userhost()
         for opt in options:
             x_elt[opt] = options[opt]
         self.host.profiles[profile].xmlstream.send(message)
 
-    def _invite(self, target, service, roomId, options = {}, profile_key='@DEFAULT@'):
+    def _invite(self, target, service, roomId, options={}, profile_key='@DEFAULT@'):
         """
         Invite an user to a room
         @param target: jid of the user to invite
@@ -90,14 +91,13 @@
         #TODO: check parameters validity
         self.invite(jid.JID(target), jid.JID("%s@%s" % (roomId, service)), options, profile_key)
 
-
     def onInvitation(self, message, profile):
         """
         called when an invitation is received
         @param message: message element
         @profile: %(doc_profile)s
         """
-        info(_('Invitation received for room %(room)s [%(profile)s]') % {'room':'','profile':profile})
+        info(_('Invitation received for room %(room)s [%(profile)s]') % {'room': '', 'profile': profile})
         try:
             room = jid.JID(message.firstChildElement()['jid'])
         except:
@@ -116,7 +116,7 @@
         self.host = plugin_parent.host
 
     def connectionInitialized(self):
-        self.xmlstream.addObserver(DIRECT_MUC_INVITATION_REQUEST, self.plugin_parent.onInvitation, profile = self.parent.profile)
+        self.xmlstream.addObserver(DIRECT_MUC_INVITATION_REQUEST, self.plugin_parent.onInvitation, profile=self.parent.profile)
 
     def getDiscoInfo(self, requestor, target, nodeIdentifier=''):
         return [disco.DiscoFeature(NS_DIRECT_MUC_INVITATION)]
diff --git a/src/plugins/plugin_xep_0277.py b/src/plugins/plugin_xep_0277.py
--- a/src/plugins/plugin_xep_0277.py
+++ b/src/plugins/plugin_xep_0277.py
@@ -27,7 +27,7 @@
 from twisted.words.xish import domish
 from sat.tools.xml_tools import ElementParser
 
-from wokkel import disco,pubsub
+from wokkel import disco, pubsub
 from feed.atom import Entry, Author
 import uuid
 from time import time
@@ -40,19 +40,21 @@
 OPT_SEND_ITEM_SUBSCRIBE = 'pubsub#send_item_subscribe'
 
 PLUGIN_INFO = {
-"name": "Microblogging over XMPP Plugin",
-"import_name": "XEP-0277",
-"type": "XEP",
-"protocols": [],
-"dependencies": ["XEP-0163","XEP-0060"],
-"main": "XEP_0277",
-"handler": "no",
-"description": _("""Implementation of microblogging Protocol""")
+    "name": "Microblogging over XMPP Plugin",
+    "import_name": "XEP-0277",
+    "type": "XEP",
+    "protocols": [],
+    "dependencies": ["XEP-0163", "XEP-0060"],
+    "main": "XEP_0277",
+    "handler": "no",
+    "description": _("""Implementation of microblogging Protocol""")
 }
 
+
 class NodeAccessChangeException(Exception):
     pass
 
+
 class XEP_0277(object):
 
     def __init__(self, host):
@@ -62,30 +64,28 @@
         host.bridge.addMethod("getLastMicroblogs", ".plugin",
                               in_sign='sis', out_sign='aa{ss}',
                               method=self.getLastMicroblogs,
-                              async = True,
-                              doc = { 'summary':'retrieve items',
-                                      'param_0':'jid: publisher of wanted microblog',
-                                      'param_1':'max_items: see XEP-0060 #6.5.7',
-                                      'param_2':'%(doc_profile)s',
-                                      'return':'list of microblog data (dict)'
-                                    })
+                              async=True,
+                              doc={'summary': 'retrieve items',
+                                   'param_0': 'jid: publisher of wanted microblog',
+                                   'param_1': 'max_items: see XEP-0060 #6.5.7',
+                                   'param_2': '%(doc_profile)s',
+                                   'return': 'list of microblog data (dict)'})
         host.bridge.addMethod("setMicroblogAccess", ".plugin", in_sign='ss', out_sign='',
-                               method=self.setMicroblogAccess,
-                               async = True,
-                               doc = {
-                                     })
+                              method=self.setMicroblogAccess,
+                              async=True,
+                              doc={})
 
     def item2mbdata(self, item):
         """Convert an XML Item to microblog data used in bridge API
         @param item: domish.Element of microblog item
         @return: microblog data (dictionary)"""
         try:
-            entry_elt = filter (lambda x:x.name == "entry", item.children)[0]
+            entry_elt = filter(lambda x: x.name == "entry", item.children)[0]
         except KeyError:
             warning(_('No entry element in microblog item'))
             return
         _entry = Entry().import_xml(entry_elt.toXml().encode('utf-8'))
-        microblog_data={}
+        microblog_data = {}
         try:
             microblog_data['content'] = _entry.title.text
             if len(_entry.authors):
@@ -100,7 +100,7 @@
         if not 'author' in microblog_data:
             from xe import NestElement
             try:
-                author=NestElement('author')
+                author = NestElement('author')
                 author.import_xml(str(_entry))
                 microblog_data['author'] = author.nick.text
             except:
@@ -123,8 +123,8 @@
         #FIXME: need to escape html
         _entry.title = unicode(content).encode('utf-8')
         _entry.author = Author()
-        _entry.author.name = data.get('author',self.host.getJidNStream(profile)[0].userhost()).encode('utf-8')
-        _entry.updated = float(data.get('timestamp',time()))
+        _entry.author.name = data.get('author', self.host.getJidNStream(profile)[0].userhost()).encode('utf-8')
+        _entry.updated = float(data.get('timestamp', time()))
         _entry.id = str(_uuid)
         _entry_elt = ElementParser()(str(_entry).decode('utf-8'))
         item = pubsub.Item(payload=_entry_elt)
@@ -135,7 +135,7 @@
         """Send XEP-0277's microblog data
         @param data: must include content
         @param profile: profile which send the mood"""
-        if not data.has_key('content'):
+        if 'content' not in data:
             error(_("Microblog data must contain at least 'content' key"))
             return 3
         content = data['content']
@@ -143,7 +143,7 @@
             error(_("Microblog data's content value must not be empty"))
             return 3
         item = self.data2entry(data, profile)
-        self.host.plugins["XEP-0060"].publish(None, NS_MICROBLOG, [item], profile_key = profile)
+        self.host.plugins["XEP-0060"].publish(None, NS_MICROBLOG, [item], profile_key=profile)
         return 0
 
     def getLastMicroblogs(self, pub_jid, max_items=10, profile_key='@DEFAULT@'):
@@ -168,7 +168,7 @@
         if not _jid:
             error(_("Can't find profile's jid"))
             return
-        _options = {OPT_ACCESS_MODEL:access, OPT_PERSIST_ITEMS:1, OPT_MAX_ITEMS:-1, OPT_DELIVER_PAYLOADS:1, OPT_SEND_ITEM_SUBSCRIBE: 1}
+        _options = {OPT_ACCESS_MODEL: access, OPT_PERSIST_ITEMS: 1, OPT_MAX_ITEMS: -1, OPT_DELIVER_PAYLOADS: 1, OPT_SEND_ITEM_SUBSCRIBE: 1}
 
         def cb(result):
             #Node is created with right permission
@@ -182,7 +182,7 @@
         def err_cb(s_error):
             #If the node already exists, the condition is "conflict",
             #else we have an unmanaged error
-            if s_error.value.condition=='conflict':
+            if s_error.value.condition == 'conflict':
                 #d = self.host.plugins["XEP-0060"].deleteNode(_jid.userhostJID(), NS_MICROBLOG, profile_key=profile_key)
                 #d.addCallback(lambda x: create_node().addCallback(cb).addErrback(fatal_err))
                 change_node_options().addCallback(cb).addErrback(fatal_err)
@@ -196,6 +196,3 @@
             return self.host.plugins["XEP-0060"].setOptions(_jid.userhostJID(), NS_MICROBLOG, _jid.userhostJID(), _options, profile_key=profile_key)
 
         create_node().addCallback(cb).addErrback(err_cb)
-
-
-
# HG changeset patch
# User Emmanuel Gil Peyrot <linkmauve at linkmauve.fr>
# Date 1358528135 -3600
# Node ID 9668802b04b69942f958d7fa02547bf69889d762
# Parent  dd3179c7e02bc4fa112142a8825043d5a243cffd
Fix pep8 support in src/bridge.

diff --git a/src/bridge/DBus.py b/src/bridge/DBus.py
--- a/src/bridge/DBus.py
+++ b/src/bridge/DBus.py
@@ -19,7 +19,6 @@
 along with this program.  If not, see <http://www.gnu.org/licenses/>.
 """
 
-
 from bridge import Bridge
 import dbus
 import dbus.service
@@ -28,42 +27,49 @@
 from logging import debug, info, error
 from twisted.internet.defer import Deferred
 
-const_INT_PREFIX = "org.goffi.SAT"  #Interface prefix
-const_ERROR_PREFIX = const_INT_PREFIX+".error"
+const_INT_PREFIX = "org.goffi.SAT"  # Interface prefix
+const_ERROR_PREFIX = const_INT_PREFIX + ".error"
 const_OBJ_PATH = '/org/goffi/SAT/bridge'
 const_CORE_SUFFIX = ".core"
 const_PLUGIN_SUFFIX = ".plugin"
 
+
 class ParseError(Exception):
     pass
 
+
 class MethodNotRegistered(dbus.DBusException):
     _dbus_error_name = const_ERROR_PREFIX + ".MethodNotRegistered"
 
+
 class InternalError(dbus.DBusException):
     _dbus_error_name = const_ERROR_PREFIX + ".InternalError"
 
+
 class AsyncNotDeferred(dbus.DBusException):
     _dbus_error_name = const_ERROR_PREFIX + ".AsyncNotDeferred"
 
+
 class DeferredNotAsync(dbus.DBusException):
     _dbus_error_name = const_ERROR_PREFIX + ".DeferredNotAsync"
 
+
 class GenericException(dbus.DBusException):
     def __init__(self, twisted_error):
-        super(GenericException,self).__init__()
+        super(GenericException, self).__init__()
         mess = twisted_error.getErrorMessage()
-        self._dbus_error_name = const_ERROR_PREFIX+"."+ (mess or str(twisted_error.__class__))
+        self._dbus_error_name = const_ERROR_PREFIX + "." + (mess or str(twisted_error.__class__))
+
 
 class DbusObject(dbus.service.Object):
 
     def __init__(self, bus, path):
         dbus.service.Object.__init__(self, bus, path)
         debug("Init DbusObject...")
-        self.cb={}
+        self.cb = {}
 
     def register(self, name, cb):
-        self.cb[name]=cb
+        self.cb[name] = cb
 
     def _callback(self, name, *args, **kwargs):
         """call the callback if it exists, raise an exception else
@@ -86,17 +92,16 @@
             if not isinstance(result, Deferred):
                 error("Asynchronous method [%s] does not return a Deferred." % name)
                 raise AsyncNotDeferred
-            result.addCallback(lambda result: callback() if result==None else callback(result))
-            result.addErrback(lambda err:errback(GenericException(err)))
+            result.addCallback(lambda result: callback() if result == None else callback(result))
+            result.addErrback(lambda err: errback(GenericException(err)))
         else:
             if isinstance(result, Deferred):
                 error("Synchronous method [%s] return a Deferred." % name)
                 raise DeferredNotAsync
             return result
-
     ### signals ###
 
-    @dbus.service.signal(const_INT_PREFIX+const_PLUGIN_SUFFIX,
+    @dbus.service.signal(const_INT_PREFIX + const_PLUGIN_SUFFIX,
                          signature='')
     def dummySignal(self):
         #FIXME: workaround for addSignal (doesn't work if one method doensn't
@@ -174,7 +179,6 @@
     def subscribe(self, sub_type, entity_jid, profile):
         pass
 
-
     ### methods ###
 
     @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
@@ -411,41 +415,40 @@
     def updateContact(self, entity_jid, name, groups, profile_key="@DEFAULT@"):
         return self._callback("updateContact", unicode(entity_jid), unicode(name), groups, unicode(profile_key))
 
-
     def __attributes(self, in_sign):
         """Return arguments to user given a in_sign
         @param in_sign: in_sign in the short form (using s,a,i,b etc)
         @return: list of arguments that correspond to a in_sign (e.g.: "sss" return "arg1, arg2, arg3")"""
-        i=0
-        idx=0
-        attr=[]
-        while i<len(in_sign):
-            if in_sign[i] not in ['b','y','n','i','x','q','u','t','d','s','a']:
+        i = 0
+        idx = 0
+        attr = []
+        while i < len(in_sign):
+            if in_sign[i] not in ['b', 'y', 'n', 'i', 'x', 'q', 'u', 't', 'd', 's', 'a']:
                 raise ParseError("Unmanaged attribute type [%c]" % in_sign[i])
 
             attr.append("arg_%i" % idx)
-            idx+=1
+            idx += 1
 
             if in_sign[i] == 'a':
-                i+=1
-                if in_sign[i]!='{' and in_sign[i]!='(': #FIXME: must manage tuples out of arrays
-                    i+=1
-                    continue #we have a simple type for the array
+                i += 1
+                if in_sign[i] != '{' and in_sign[i] != '(':  # FIXME: must manage tuples out of arrays
+                    i += 1
+                    continue  # we have a simple type for the array
                 opening_car = in_sign[i]
-                assert(opening_car in ['{','('])
+                assert(opening_car in ['{', '('])
                 closing_car = '}' if opening_car == '{' else ')'
                 opening_count = 1
-                while (True): #we have a dict or a list of tuples
-                    i+=1
-                    if i>=len(in_sign):
+                while (True):  # we have a dict or a list of tuples
+                    i += 1
+                    if i >= len(in_sign):
                         raise ParseError("missing }")
                     if in_sign[i] == opening_car:
-                        opening_count+=1
+                        opening_count += 1
                     if in_sign[i] == closing_car:
-                        opening_count-=1
+                        opening_count -= 1
                         if opening_count == 0:
                             break
-            i+=1
+            i += 1
         return attr
 
     def addMethod(self, name, int_suffix, in_sign, out_sign, method, async=False):
@@ -460,30 +463,30 @@
             del(_arguments[0])
 
         #first arguments are for the _callback method
-        arguments_callback = ', '.join([repr(name)] + ((_arguments + ['callback=callback','errback=errback']) if async else _arguments))
+        arguments_callback = ', '.join([repr(name)] + ((_arguments + ['callback=callback', 'errback=errback']) if async else _arguments))
 
         if async:
-            _arguments.extend(['callback','errback'])
+            _arguments.extend(['callback', 'errback'])
             _defaults.extend([None, None])
 
 
         #now we create a second list with default values
-        for i in range(1, len(_defaults)+1):
+        for i in range(1, len(_defaults) + 1):
             _arguments[-i] = "%s = %s" % (_arguments[-i], repr(_defaults[-i]))
 
-        arguments_defaults =  ', '.join(_arguments)
+        arguments_defaults = ', '.join(_arguments)
 
-        code = compile ('def %(name)s (self,%(arguments_defaults)s): return self._callback(%(arguments_callback)s)' %
-                        {'name':name, 'arguments_defaults':arguments_defaults, 'arguments_callback':arguments_callback}, '<DBus bridge>','exec')
-        exec (code) #FIXME: to the same thing in a cleaner way, without compile/exec
+        code = compile('def %(name)s (self,%(arguments_defaults)s): return self._callback(%(arguments_callback)s)' %
+                        {'name': name, 'arguments_defaults': arguments_defaults, 'arguments_callback': arguments_callback}, '<DBus bridge>', 'exec')
+        exec (code)  # FIXME: to the same thing in a cleaner way, without compile/exec
         method = locals()[name]
         async_callbacks = ('callback', 'errback') if async else None
         setattr(DbusObject, name, dbus.service.method(
-            const_INT_PREFIX+int_suffix, in_signature=in_sign, out_signature=out_sign,
+            const_INT_PREFIX + int_suffix, in_signature=in_sign, out_signature=out_sign,
             async_callbacks=async_callbacks)(method))
         function = getattr(self, name)
         func_table = self._dbus_class_table[self.__class__.__module__ + '.' + self.__class__.__name__][function._dbus_interface]
-        func_table[function.__name__] = function #Needed for introspection
+        func_table[function.__name__] = function  # Needed for introspection
 
     def addSignal(self, name, int_suffix, signature, doc={}):
         """Dynamically add a signal to Dbus Bridge"""
@@ -491,20 +494,21 @@
         #TODO: use doc parameter to name attributes
 
         #code = compile ('def '+name+' (self,'+attributes+'): debug ("'+name+' signal")', '<DBus bridge>','exec') #XXX: the debug is too annoying with xmllog
-        code = compile ('def '+name+' (self,'+attributes+'): pass', '<DBus bridge>','exec')
+        code = compile('def ' + name + ' (self,' + attributes + '): pass', '<DBus bridge>', 'exec')
         exec (code)
         signal = locals()[name]
         setattr(DbusObject, name, dbus.service.signal(
-            const_INT_PREFIX+int_suffix, signature=signature)(signal))
+            const_INT_PREFIX + int_suffix, signature=signature)(signal))
         function = getattr(self, name)
         func_table = self._dbus_class_table[self.__class__.__module__ + '.' + self.__class__.__name__][function._dbus_interface]
-        func_table[function.__name__] = function #Needed for introspection
+        func_table[function.__name__] = function  # Needed for introspection
+
 
 class DBusBridge(Bridge):
     def __init__(self):
         dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
         Bridge.__init__(self)
-        info ("Init DBus...")
+        info("Init DBus...")
         self.session_bus = dbus.SessionBus()
         self.dbus_name = dbus.service.BusName(const_INT_PREFIX, self.session_bus)
         self.dbus_bridge = DbusObject(self.session_bus, const_OBJ_PATH)
@@ -551,7 +555,6 @@
     def subscribe(self, sub_type, entity_jid, profile):
         self.dbus_bridge.subscribe(sub_type, entity_jid, profile)
 
-
     def register(self, name, callback):
         debug("registering DBus bridge method [%s]", name)
         self.dbus_bridge.register(name, callback)
@@ -565,4 +568,4 @@
 
     def addSignal(self, name, int_suffix, signature, doc={}):
         self.dbus_bridge.addSignal(name, int_suffix, signature, doc)
-        setattr(DBusBridge, name, getattr(self.dbus_bridge, name))
+        setattr(DBusBridge, name, getattr(self.dbus_bridge, name))
\ No newline at end of file
diff --git a/src/bridge/bridge.py b/src/bridge/bridge.py
--- a/src/bridge/bridge.py
+++ b/src/bridge/bridge.py
@@ -21,9 +21,10 @@
 
 from logging import debug, info, error
 
+
 class Bridge(object):
     def __init__(self):
-        info ("Bridge initialization")
+        info("Bridge initialization")
 
     ##signals
     def newContact(self, contact):
@@ -38,7 +39,6 @@
     def paramUpdate(self, name, value):
         raise NotImplementedError
 
-
     ##methods
     def connect(self):
         raise NotImplementedError
diff --git a/src/bridge/bridge_constructor/bridge_contructor.py b/src/bridge/bridge_constructor/bridge_contructor.py
--- a/src/bridge/bridge_constructor/bridge_contructor.py
+++ b/src/bridge/bridge_constructor/bridge_contructor.py
@@ -19,15 +19,14 @@
 along with this program.  If not, see <http://www.gnu.org/licenses/>.
 """
 
-
 #consts
 NAME = u"bridge_constructor"
-VERSION="0.1.0"
-DEST_DIR="generated"
-ABOUT = NAME+u""" v%s (c) Jérôme Poisson (aka Goffi) 2011
+VERSION = "0.1.0"
+DEST_DIR = "generated"
+ABOUT = NAME + u""" v%s (c) Jérôme Poisson (aka Goffi) 2011
 
 ---
-"""+NAME+u""" Copyright (C) 2011  Jérôme Poisson (aka Goffi)
+""" + NAME + u""" Copyright (C) 2011  Jérôme Poisson (aka Goffi)
 This program comes with ABSOLUTELY NO WARRANTY;
 This is free software, and you are welcome to redistribute it
 under certain conditions.
@@ -35,11 +34,11 @@
 
 This script construct a SàT bridge using the given protocol
 """
-MANAGED_PROTOCOLES=['dbus','mediawiki', 'dbus-xml']
-DEFAULT_PROTOCOLE='dbus'
-FLAGS=['deprecated', 'async']
+MANAGED_PROTOCOLES = ['dbus', 'mediawiki', 'dbus-xml']
+DEFAULT_PROTOCOLE = 'dbus'
+FLAGS = ['deprecated', 'async']
 
-ENV_OVERRIDE = "SAT_BRIDGE_CONST_" #Prefix used to override a constant
+ENV_OVERRIDE = "SAT_BRIDGE_CONST_"  # Prefix used to override a constant
 
 import sys
 import os
@@ -56,6 +55,7 @@
     #Used when the signature parsing is going wrong (invalid signature ?)
     pass
 
+
 class Constructor(object):
 
     def __init__(self, bridge_template, options):
@@ -66,8 +66,8 @@
         """Return values of a function in a dict
         @param name: Name of the function to get
         @return: dict, each key has the config value or None if the value is not set"""
-        function={}
-        for option in ['type','category','sig_in','sig_out','doc']:
+        function = {}
+        for option in ['type', 'category', 'sig_in', 'sig_out', 'doc']:
             try:
                 value = self.bridge_template.get(name, option)
             except NoOptionError:
@@ -79,7 +79,7 @@
         """Return default values of a function in a dict
         @param name: Name of the function to get
         @return: dict, each key is the integer param number (no key if no default value)"""
-        default_dict={}
+        default_dict = {}
         def_re = re.compile(r"param_(\d+)_default")
 
         for option in self.bridge_template.options(name):
@@ -97,7 +97,7 @@
         """Return list of flags set for this function
         @param name: Name of the function to get
         @return: List of flags (string)"""
-        flags=[]
+        flags = []
         for option in self.bridge_template.options(name):
             if option in FLAGS:
                 flags.append(option)
@@ -107,7 +107,7 @@
         """Return documentation of arguments
         @param name: Name of the function to get
         @return: dict, each key is the integer param number (no key if no argument doc), value is a tuple (name, doc)"""
-        doc_dict={}
+        doc_dict = {}
         option_re = re.compile(r"doc_param_(\d+)")
         value_re = re.compile(r"^(\w+): (.*)$", re.MULTILINE | re.DOTALL)
         for option in self.bridge_template.options(name):
@@ -123,7 +123,7 @@
                 value_match = value_re.match(self.bridge_template.get(name, option))
                 if not value_match:
                     raise ParseError("Invalid value for parameter doc [%i]" % idx)
-                doc_dict[idx]=(value_match.group(1),value_match.group(2))
+                doc_dict[idx] = (value_match.group(1), value_match.group(2))
         return doc_dict
 
     def getDoc(self, name):
@@ -134,40 +134,39 @@
             return self.bridge_template.get(name, "doc")
         return None
 
-
     def argumentsParser(self, signature):
         """Generator which return individual arguments signatures from a global signature"""
-        start=0
-        i=0
+        start = 0
+        i = 0
 
-        while i<len(signature):
-            if signature[i] not in ['b','y','n','i','x','q','u','t','d','s','a']:
+        while i < len(signature):
+            if signature[i] not in ['b', 'y', 'n', 'i', 'x', 'q', 'u', 't', 'd', 's', 'a']:
                 raise ParseError("Unmanaged attribute type [%c]" % signature[i])
 
             if signature[i] == 'a':
-                i+=1
-                if signature[i]!='{' and signature[i]!='(': #FIXME: must manage tuples out of arrays
-                    i+=1
+                i += 1
+                if signature[i] != '{' and signature[i] != '(':  # FIXME: must manage tuples out of arrays
+                    i += 1
                     yield signature[start:i]
-                    start=i
-                    continue #we have a simple type for the array
+                    start = i
+                    continue  # we have a simple type for the array
                 opening_car = signature[i]
-                assert(opening_car in ['{','('])
+                assert(opening_car in ['{', '('])
                 closing_car = '}' if opening_car == '{' else ')'
                 opening_count = 1
-                while (True): #we have a dict or a list of tuples
-                    i+=1
-                    if i>=len(signature):
+                while (True):  # we have a dict or a list of tuples
+                    i += 1
+                    if i >= len(signature):
                         raise ParseError("missing }")
                     if signature[i] == opening_car:
-                        opening_count+=1
+                        opening_count += 1
                     if signature[i] == closing_car:
-                        opening_count-=1
+                        opening_count -= 1
                         if opening_count == 0:
                             break
-            i+=1
+            i += 1
             yield signature[start:i]
-            start=i
+            start = i
 
     def getArguments(self, signature, name=None, default=None, unicode_protect=False):
         """Return arguments to user given a signature
@@ -176,16 +175,16 @@
         @param default: dictionary of default values, like given by getDefault
         @param unicode_protect: activate unicode protection on strings (return strings as unicode(str))
         @return: list of arguments that correspond to a signature (e.g.: "sss" return "arg1, arg2, arg3")"""
-        idx=0
-        attr_string=[]
+        idx = 0
+        attr_string = []
 
         for arg in self.argumentsParser(signature):
-            attr_string.append(("unicode(%(name)s)%(default)s" if (unicode_protect and arg=='s') else "%(name)s%(default)s") % {
-                'name':name[idx][0] if (name and name.has_key(idx)) else "arg_%i" % idx,
-                'default':"="+default[idx] if (default and default.has_key(idx)) else ''
-                }) #give arg_1, arg2, etc or name1, name2=default, etc. \
-                   #give unicode(arg_1), unicode(arg_2), etc. if unicode_protect is set and arg is a string
-            idx+=1
+            attr_string.append(("unicode(%(name)s)%(default)s" if (unicode_protect and arg == 's') else "%(name)s%(default)s") % {
+                'name': name[idx][0] if (name and idx in name) else "arg_%i" % idx,
+                'default': "=" + default[idx] if (default and idx in default) else ''})
+                # give arg_1, arg2, etc or name1, name2=default, etc.
+                #give unicode(arg_1), unicode(arg_2), etc. if unicode_protect is set and arg is a string
+            idx += 1
 
         return ", ".join(attr_string)
 
@@ -207,11 +206,11 @@
         try:
             if not os.path.exists(DEST_DIR):
                 os.mkdir(DEST_DIR)
-            full_path=os.path.join(DEST_DIR,filename)
+            full_path = os.path.join(DEST_DIR, filename)
             if os.path.exists(full_path) and not self.options.force:
                 print ("The destination file [%s] already exists ! Use --force to overwrite it" % full_path)
             try:
-                with open(full_path,'w') as dest_file:
+                with open(full_path, 'w') as dest_file:
                     dest_file.write('\n'.join(file_buf))
             except IOError:
                 print ("Can't open destination file [%s]" % full_path)
@@ -219,12 +218,13 @@
             print("It's not possible to generate the file, check your permissions")
             exit(1)
 
+
 class MediawikiConstructor(Constructor):
 
     def __init__(self, bridge_template, options):
         Constructor.__init__(self, bridge_template, options)
-        self.core_template="mediawiki_template.tpl"
-        self.core_dest="mediawiki.wiki"
+        self.core_template = "mediawiki_template.tpl"
+        self.core_dest = "mediawiki.wiki"
 
     def _addTextDecorations(self, text):
         """Add text decorations like coloration or shortcuts"""
@@ -247,16 +247,16 @@
         arg_doc = self.getArgumentsDoc(name)
         arg_default = self.getDefault(name)
         args_str = self.getArguments(sig_in)
-        args = args_str.split(', ') if args_str else [] #ugly but it works :)
-        wiki=[]
+        args = args_str.split(', ') if args_str else []  # ugly but it works :)
+        wiki = []
         for i in range(len(args)):
-            if arg_doc.has_key(i):
-                name,doc=arg_doc[i]
-                doc='\n:'.join(doc.rstrip('\n').split('\n'))
+            if i in arg_doc:
+                name, doc = arg_doc[i]
+                doc = '\n:'.join(doc.rstrip('\n').split('\n'))
                 wiki.append("; %s: %s" % (name, self._addTextDecorations(doc)))
             else:
                 wiki.append("; arg_%d: " % i)
-            if arg_default.has_key(i):
+            if i in arg_default:
                 wiki.append(":''DEFAULT: %s''" % arg_default[i])
         return "\n".join(wiki)
 
@@ -265,8 +265,8 @@
         @param name: name of the function
         """
         arg_doc = self.getArgumentsDoc(name)
-        wiki=[]
-        if arg_doc.has_key('return'):
+        wiki = []
+        if 'return' in arg_doc:
             wiki.append('\n|-\n! scope=row | return value\n|')
             wiki.append('<br />\n'.join(self._addTextDecorations(arg_doc['return']).rstrip('\n').split('\n')))
         return "\n".join(wiki)
@@ -283,13 +283,13 @@
             async_msg = """<br />'''This method is asynchronous'''"""
             deprecated_msg = """<br />'''<font color="#FF0000">/!\ WARNING /!\ : This method is deprecated, please don't use it !</font>'''"""
             signature_signal = \
-"""\
+            """\
 ! scope=row | signature
 | %s
 |-\
 """ % function['sig_in']
             signature_method = \
-"""\
+            """\
 ! scope=row | signature in
 | %s
 |-
@@ -298,16 +298,15 @@
 |-\
 """ % (function['sig_in'], function['sig_out'])
             completion = {
-                'signature':signature_signal if function['type']=="signal" else signature_method,
-                'sig_out':function['sig_out'] or '',
-                'category':function['category'],
-                'name':section,
-                'doc':self.getDoc(section) or "FIXME: No description available",
-                'async':async_msg if "async" in self.getFlags(section) else "",
-                'deprecated':deprecated_msg if "deprecated" in self.getFlags(section) else "",
-                'parameters':self._wikiParameter(section, function['sig_in']),
-                'return':self._wikiReturn(section) if function['type'] == 'method' else ''
-                }
+                'signature': signature_signal if function['type'] == "signal" else signature_method,
+                'sig_out': function['sig_out'] or '',
+                'category': function['category'],
+                'name': section,
+                'doc': self.getDoc(section) or "FIXME: No description available",
+                'async': async_msg if "async" in self.getFlags(section) else "",
+                'deprecated': deprecated_msg if "deprecated" in self.getFlags(section) else "",
+                'parameters': self._wikiParameter(section, function['sig_in']),
+                'return': self._wikiReturn(section) if function['type'] == 'method' else ''}
 
             dest = signals_part if function['type'] == "signal" else methods_part
             dest.append("""\
@@ -339,7 +338,7 @@
                     elif line.startswith('##TIMESTAMP##'):
                         core_bridge.append('Generated on %s' % datetime.now())
                     else:
-                        core_bridge.append(line.replace('\n',''))
+                        core_bridge.append(line.replace('\n', ''))
         except IOError:
             print ("Can't open template file [%s]" % self.core_template)
             sys.exit(1)
@@ -347,13 +346,14 @@
         #now we write to final file
         self.finalWrite(self.core_dest, core_bridge)
 
+
 class DbusConstructor(Constructor):
 
     def __init__(self, bridge_template, options):
         Constructor.__init__(self, bridge_template, options)
-        self.core_template="dbus_core_template.py"
-        self.frontend_template="dbus_frontend_template.py"
-        self.frontend_dest = self.core_dest="DBus.py"
+        self.core_template = "dbus_core_template.py"
+        self.frontend_template = "dbus_frontend_template.py"
+        self.frontend_dest = self.core_dest = "DBus.py"
 
     def generateCoreSide(self):
         signals_part = []
@@ -368,12 +368,11 @@
             arg_doc = self.getArgumentsDoc(section)
             async = "async" in self.getFlags(section)
             completion = {
-        'sig_in':function['sig_in'] or '',
-        'sig_out':function['sig_out'] or '',
-        'category':'PLUGIN' if function['category'] == 'plugin' else 'CORE',
-        'name':section,
-        'args':self.getArguments(function['sig_in'], name=arg_doc, default=default )
-        }
+                'sig_in': function['sig_in'] or '',
+                'sig_out': function['sig_out'] or '',
+                'category': 'PLUGIN' if function['category'] == 'plugin' else 'CORE',
+                'name': section,
+                'args': self.getArguments(function['sig_in'], name=arg_doc, default=default)}
 
             if function["type"] == "signal":
                 completion['body'] = "pass" if not self.options.debug else 'debug ("%s")' % section
@@ -389,7 +388,7 @@
 """ % completion)
 
             elif function["type"] == "method":
-                completion['debug'] = "" if not self.options.debug else 'debug ("%s")\n%s' % (section,8*' ')
+                completion['debug'] = "" if not self.options.debug else 'debug ("%s")\n%s' % (section, 8 * ' ')
                 completion['args_result'] = self.getArguments(function['sig_in'], name=arg_doc, unicode_protect=self.options.unicode)
                 completion['async_comma'] = ', ' if async and function['sig_in'] else ''
                 completion['async_args_def'] = 'callback=None, errback=None' if async else ''
@@ -422,9 +421,9 @@
                             const_name = line[len('const_'):line.find(' = ')]
                             if const_name in const_override:
                                 print ("const %s overriden" % const_name)
-                                core_bridge.append('const_%s = %s' % (const_name, os.environ[ENV_OVERRIDE+const_name]))
+                                core_bridge.append('const_%s = %s' % (const_name, os.environ[ENV_OVERRIDE + const_name]))
                                 continue
-                        core_bridge.append(line.replace('\n',''))
+                        core_bridge.append(line.replace('\n', ''))
         except IOError:
             print ("Can't open template file [%s]" % self.core_template)
             sys.exit(1)
@@ -443,15 +442,14 @@
             arg_doc = self.getArgumentsDoc(section)
             async = "async" in self.getFlags(section)
             completion = {
-        'sig_in':function['sig_in'] or '',
-        'sig_out':function['sig_out'] or '',
-        'category':'plugin' if function['category'] == 'plugin' else 'core',
-        'name':section,
-        'args':self.getArguments(function['sig_in'], name=arg_doc, default=default)
-        }
+                'sig_in': function['sig_in'] or '',
+                'sig_out': function['sig_out'] or '',
+                'category': 'plugin' if function['category'] == 'plugin' else 'core',
+                'name': section,
+                'args': self.getArguments(function['sig_in'], name=arg_doc, default=default)}
 
             if function["type"] == "method":
-                completion['debug'] = "" if not self.options.debug else 'debug ("%s")\n%s' % (section,8*' ')
+                completion['debug'] = "" if not self.options.debug else 'debug ("%s")\n%s' % (section, 8 * ' ')
                 completion['args_result'] = self.getArguments(function['sig_in'], name=arg_doc)
                 completion['async_args'] = ', callback=None, errback=None' if async else ''
                 completion['async_comma'] = ', ' if async and function['sig_in'] else ''
@@ -478,9 +476,9 @@
                             const_name = line[len('const_'):line.find(' = ')]
                             if const_name in const_override:
                                 print ("const %s overriden" % const_name)
-                                frontend_bridge.append('const_%s = %s' % (const_name, os.environ[ENV_OVERRIDE+const_name]))
+                                frontend_bridge.append('const_%s = %s' % (const_name, os.environ[ENV_OVERRIDE + const_name]))
                                 continue
-                        frontend_bridge.append(line.replace('\n',''))
+                        frontend_bridge.append(line.replace('\n', ''))
         except IOError:
             print ("Can't open template file [%s]" % self.frontend_template)
             sys.exit(1)
@@ -488,21 +486,21 @@
         #now we write to final file
         self.finalWrite(self.frontend_dest, frontend_bridge)
 
+
 class DbusXmlConstructor(Constructor):
     """Constructor for DBus XML syntaxt (used by Qt frontend)"""
 
     def __init__(self, bridge_template, options):
         Constructor.__init__(self, bridge_template, options)
 
-        self.template="dbus_xml_template.xml"
-        self.core_dest="org.goffi.sat.xml"
-        self.default_annotation = { 'a{ss}': 'StringDict',
-                                    'a(sa{ss}as)': 'QList<Contact>',
-                                    'a{i(ss)}': 'HistoryT',
-                                    'a(sss)': 'QList<MenuT>',
-                                    'a{sa{s(sia{ss})}}': 'PresenceStatusT',
-                                    'a{sa{ss}}': 'ActionResultExtDataT',
-                                  }
+        self.template = "dbus_xml_template.xml"
+        self.core_dest = "org.goffi.sat.xml"
+        self.default_annotation = {'a{ss}': 'StringDict',
+                                   'a(sa{ss}as)': 'QList<Contact>',
+                                   'a{i(ss)}': 'HistoryT',
+                                   'a(sss)': 'QList<MenuT>',
+                                   'a{sa{s(sia{ss})}}': 'PresenceStatusT',
+                                   'a{sa{ss}}': 'ActionResultExtDataT'}
 
     def generateCoreSide(self):
         try:
@@ -520,17 +518,17 @@
         for section in sections:
             function = self.getValues(section)
             print ("Adding %s %s" % (section, function["type"]))
-            new_elt = doc.createElement('method' if function["type"]=='method' else 'signal')
+            new_elt = doc.createElement('method' if function["type"] == 'method' else 'signal')
             new_elt.setAttribute('name', section)
             args_in_str = self.getArguments(function['sig_in'])
 
-            idx=0
+            idx = 0
             args_doc = self.getArgumentsDoc(section)
             for arg in self.argumentsParser(function['sig_in'] or ''):
                 arg_elt = doc.createElement('arg')
-                arg_elt.setAttribute('name', args_doc[idx][0] if args_doc.has_key(idx) else "arg_%i" % idx)
+                arg_elt.setAttribute('name', args_doc[idx][0] if idx in args_doc else "arg_%i" % idx)
                 arg_elt.setAttribute('type', arg)
-                _direction = 'in' if function["type"]=='method' else 'out'
+                _direction = 'in' if function["type"] == 'method' else 'out'
                 arg_elt.setAttribute('direction', _direction)
                 new_elt.appendChild(arg_elt)
                 if "annotation" in self.options.flags:
@@ -539,7 +537,7 @@
                         annot_elt.setAttribute('name', "com.trolltech.QtDBus.QtTypeName.In%d" % idx)
                         annot_elt.setAttribute('value', self.default_annotation[arg])
                         new_elt.appendChild(annot_elt)
-                idx+=1
+                idx += 1
 
             if function['sig_out']:
                 arg_elt = doc.createElement('arg')
@@ -558,19 +556,22 @@
         #now we write to final file
         self.finalWrite(self.core_dest, [doc.toprettyxml()])
 
+
 class ConstructorError(Exception):
     pass
 
+
 class ConstructorFactory(object):
     def create(self, bridge_template, options):
-       if options.protocole=='dbus':
-           return DbusConstructor(bridge_template, options)
-       elif options.protocole=='mediawiki':
-           return MediawikiConstructor(bridge_template, options)
-       elif options.protocole=='dbus-xml':
-           return DbusXmlConstructor(bridge_template, options)
+        if options.protocole == 'dbus':
+            return DbusConstructor(bridge_template, options)
+        elif options.protocole == 'mediawiki':
+            return MediawikiConstructor(bridge_template, options)
+        elif options.protocole == 'dbus-xml':
+            return DbusXmlConstructor(bridge_template, options)
 
-       raise ConstructorError('Unknown constructor type')
+        raise ConstructorError('Unknown constructor type')
+
 
 class BridgeConstructor(object):
     def __init__(self):
@@ -578,28 +579,27 @@
 
     def check_options(self):
         """Check command line options"""
-        _usage="""
+        _usage = """
         %prog [options]
 
         %prog --help for options list
         """
-        parser = OptionParser(usage=_usage,version=ABOUT % VERSION)
+        parser = OptionParser(usage=_usage, version=ABOUT % VERSION)
 
         parser.add_option("-p", "--protocole", action="store", type="string", default=DEFAULT_PROTOCOLE,
-                    help="Generate bridge using PROTOCOLE (default: %s, possible values: [%s])" % (DEFAULT_PROTOCOLE, ", ".join(MANAGED_PROTOCOLES)))
+                          help="Generate bridge using PROTOCOLE (default: %s, possible values: [%s])" % (DEFAULT_PROTOCOLE, ", ".join(MANAGED_PROTOCOLES)))
         parser.add_option("-s", "--side", action="store", type="string", default="core",
-                    help="Which side of the bridge do you want to make ? (default: %default, possible values: [core, frontend])")
+                          help="Which side of the bridge do you want to make ? (default: %default, possible values: [core, frontend])")
         parser.add_option("-t", "--template", action="store", type="string", default='bridge_template.ini',
-                    help="Use TEMPLATE to generate bridge (default: %default)")
+                          help="Use TEMPLATE to generate bridge (default: %default)")
         parser.add_option("-f", "--force", action="store_true", default=False,
-                    help=("Force overwritting of existing files"))
+                          help=("Force overwritting of existing files"))
         parser.add_option("-d", "--debug", action="store_true", default=False,
-                    help=("Add debug information printing"))
+                          help=("Add debug information printing"))
         parser.add_option("--no_unicode", action="store_false", dest="unicode", default=True,
-                    help=("Remove unicode type protection from string results"))
+                          help=("Remove unicode type protection from string results"))
         parser.add_option("--flags", action="store", type="string",
-                    help=("Constructors' specific flags, comma separated"))
-
+                          help=("Constructors' specific flags, comma separated"))
 
         (self.options, args) = parser.parse_args()
         self.options.flags = self.options.flags.split(',') if self.options.flags else []
diff --git a/src/bridge/bridge_constructor/dbus_core_template.py b/src/bridge/bridge_constructor/dbus_core_template.py
--- a/src/bridge/bridge_constructor/dbus_core_template.py
+++ b/src/bridge/bridge_constructor/dbus_core_template.py
@@ -19,7 +19,6 @@
 along with this program.  If not, see <http://www.gnu.org/licenses/>.
 """
 
-
 from bridge import Bridge
 import dbus
 import dbus.service
@@ -28,42 +27,49 @@
 from logging import debug, info, error
 from twisted.internet.defer import Deferred
 
-const_INT_PREFIX = "org.goffi.SAT"  #Interface prefix
-const_ERROR_PREFIX = const_INT_PREFIX+".error"
+const_INT_PREFIX = "org.goffi.SAT"  # Interface prefix
+const_ERROR_PREFIX = const_INT_PREFIX + ".error"
 const_OBJ_PATH = '/org/goffi/SAT/bridge'
 const_CORE_SUFFIX = ".core"
 const_PLUGIN_SUFFIX = ".plugin"
 
+
 class ParseError(Exception):
     pass
 
+
 class MethodNotRegistered(dbus.DBusException):
     _dbus_error_name = const_ERROR_PREFIX + ".MethodNotRegistered"
 
+
 class InternalError(dbus.DBusException):
     _dbus_error_name = const_ERROR_PREFIX + ".InternalError"
 
+
 class AsyncNotDeferred(dbus.DBusException):
     _dbus_error_name = const_ERROR_PREFIX + ".AsyncNotDeferred"
 
+
 class DeferredNotAsync(dbus.DBusException):
     _dbus_error_name = const_ERROR_PREFIX + ".DeferredNotAsync"
 
+
 class GenericException(dbus.DBusException):
     def __init__(self, twisted_error):
-        super(GenericException,self).__init__()
+        super(GenericException, self).__init__()
         mess = twisted_error.getErrorMessage()
-        self._dbus_error_name = const_ERROR_PREFIX+"."+ (mess or str(twisted_error.__class__))
+        self._dbus_error_name = const_ERROR_PREFIX + "." + (mess or str(twisted_error.__class__))
+
 
 class DbusObject(dbus.service.Object):
 
     def __init__(self, bus, path):
         dbus.service.Object.__init__(self, bus, path)
         debug("Init DbusObject...")
-        self.cb={}
+        self.cb = {}
 
     def register(self, name, cb):
-        self.cb[name]=cb
+        self.cb[name] = cb
 
     def _callback(self, name, *args, **kwargs):
         """call the callback if it exists, raise an exception else
@@ -86,17 +92,16 @@
             if not isinstance(result, Deferred):
                 error("Asynchronous method [%s] does not return a Deferred." % name)
                 raise AsyncNotDeferred
-            result.addCallback(lambda result: callback() if result==None else callback(result))
-            result.addErrback(lambda err:errback(GenericException(err)))
+            result.addCallback(lambda result: callback() if result is None else callback(result))
+            result.addErrback(lambda err: errback(GenericException(err)))
         else:
             if isinstance(result, Deferred):
                 error("Synchronous method [%s] return a Deferred." % name)
                 raise DeferredNotAsync
             return result
-
     ### signals ###
 
-    @dbus.service.signal(const_INT_PREFIX+const_PLUGIN_SUFFIX,
+    @dbus.service.signal(const_INT_PREFIX + const_PLUGIN_SUFFIX,
                          signature='')
     def dummySignal(self):
         #FIXME: workaround for addSignal (doesn't work if one method doensn't
@@ -105,45 +110,43 @@
         pass
 
 ##SIGNALS_PART##
-
     ### methods ###
 
 ##METHODS_PART##
-
     def __attributes(self, in_sign):
         """Return arguments to user given a in_sign
         @param in_sign: in_sign in the short form (using s,a,i,b etc)
         @return: list of arguments that correspond to a in_sign (e.g.: "sss" return "arg1, arg2, arg3")"""
-        i=0
-        idx=0
-        attr=[]
-        while i<len(in_sign):
-            if in_sign[i] not in ['b','y','n','i','x','q','u','t','d','s','a']:
+        i = 0
+        idx = 0
+        attr = []
+        while i < len(in_sign):
+            if in_sign[i] not in ['b', 'y', 'n', 'i', 'x', 'q', 'u', 't', 'd', 's', 'a']:
                 raise ParseError("Unmanaged attribute type [%c]" % in_sign[i])
 
             attr.append("arg_%i" % idx)
-            idx+=1
+            idx += 1
 
             if in_sign[i] == 'a':
-                i+=1
-                if in_sign[i]!='{' and in_sign[i]!='(': #FIXME: must manage tuples out of arrays
-                    i+=1
-                    continue #we have a simple type for the array
+                i += 1
+                if in_sign[i] != '{' and in_sign[i] != '(':  # FIXME: must manage tuples out of arrays
+                    i += 1
+                    continue  # we have a simple type for the array
                 opening_car = in_sign[i]
-                assert(opening_car in ['{','('])
+                assert(opening_car in ['{', '('])
                 closing_car = '}' if opening_car == '{' else ')'
                 opening_count = 1
-                while (True): #we have a dict or a list of tuples
-                    i+=1
-                    if i>=len(in_sign):
+                while (True):  # we have a dict or a list of tuples
+                    i += 1
+                    if i >= len(in_sign):
                         raise ParseError("missing }")
                     if in_sign[i] == opening_car:
-                        opening_count+=1
+                        opening_count += 1
                     if in_sign[i] == closing_car:
-                        opening_count-=1
+                        opening_count -= 1
                         if opening_count == 0:
                             break
-            i+=1
+            i += 1
         return attr
 
     def addMethod(self, name, int_suffix, in_sign, out_sign, method, async=False):
@@ -158,30 +161,29 @@
             del(_arguments[0])
 
         #first arguments are for the _callback method
-        arguments_callback = ', '.join([repr(name)] + ((_arguments + ['callback=callback','errback=errback']) if async else _arguments))
+        arguments_callback = ', '.join([repr(name)] + ((_arguments + ['callback=callback', 'errback=errback']) if async else _arguments))
 
         if async:
-            _arguments.extend(['callback','errback'])
+            _arguments.extend(['callback', 'errback'])
             _defaults.extend([None, None])
 
-
         #now we create a second list with default values
-        for i in range(1, len(_defaults)+1):
+        for i in range(1, len(_defaults) + 1):
             _arguments[-i] = "%s = %s" % (_arguments[-i], repr(_defaults[-i]))
 
-        arguments_defaults =  ', '.join(_arguments)
+        arguments_defaults = ', '.join(_arguments)
 
-        code = compile ('def %(name)s (self,%(arguments_defaults)s): return self._callback(%(arguments_callback)s)' %
-                        {'name':name, 'arguments_defaults':arguments_defaults, 'arguments_callback':arguments_callback}, '<DBus bridge>','exec')
-        exec (code) #FIXME: to the same thing in a cleaner way, without compile/exec
+        code = compile('def %(name)s (self,%(arguments_defaults)s): return self._callback(%(arguments_callback)s)' %
+                       {'name': name, 'arguments_defaults': arguments_defaults, 'arguments_callback': arguments_callback}, '<DBus bridge>', 'exec')
+        exec (code)  # FIXME: to the same thing in a cleaner way, without compile/exec
         method = locals()[name]
         async_callbacks = ('callback', 'errback') if async else None
         setattr(DbusObject, name, dbus.service.method(
-            const_INT_PREFIX+int_suffix, in_signature=in_sign, out_signature=out_sign,
+            const_INT_PREFIX + int_suffix, in_signature=in_sign, out_signature=out_sign,
             async_callbacks=async_callbacks)(method))
         function = getattr(self, name)
         func_table = self._dbus_class_table[self.__class__.__module__ + '.' + self.__class__.__name__][function._dbus_interface]
-        func_table[function.__name__] = function #Needed for introspection
+        func_table[function.__name__] = function  # Needed for introspection
 
     def addSignal(self, name, int_suffix, signature, doc={}):
         """Dynamically add a signal to Dbus Bridge"""
@@ -189,26 +191,26 @@
         #TODO: use doc parameter to name attributes
 
         #code = compile ('def '+name+' (self,'+attributes+'): debug ("'+name+' signal")', '<DBus bridge>','exec') #XXX: the debug is too annoying with xmllog
-        code = compile ('def '+name+' (self,'+attributes+'): pass', '<DBus bridge>','exec')
+        code = compile('def ' + name + ' (self,' + attributes + '): pass', '<DBus bridge>', 'exec')
         exec (code)
         signal = locals()[name]
         setattr(DbusObject, name, dbus.service.signal(
-            const_INT_PREFIX+int_suffix, signature=signature)(signal))
+            const_INT_PREFIX + int_suffix, signature=signature)(signal))
         function = getattr(self, name)
         func_table = self._dbus_class_table[self.__class__.__module__ + '.' + self.__class__.__name__][function._dbus_interface]
-        func_table[function.__name__] = function #Needed for introspection
+        func_table[function.__name__] = function  # Needed for introspection
+
 
 class DBusBridge(Bridge):
     def __init__(self):
         dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
         Bridge.__init__(self)
-        info ("Init DBus...")
+        info("Init DBus...")
         self.session_bus = dbus.SessionBus()
         self.dbus_name = dbus.service.BusName(const_INT_PREFIX, self.session_bus)
         self.dbus_bridge = DbusObject(self.session_bus, const_OBJ_PATH)
 
 ##DIRECT_CALLS##
-
     def register(self, name, callback):
         debug("registering DBus bridge method [%s]", name)
         self.dbus_bridge.register(name, callback)
@@ -223,4 +225,3 @@
     def addSignal(self, name, int_suffix, signature, doc={}):
         self.dbus_bridge.addSignal(name, int_suffix, signature, doc)
         setattr(DBusBridge, name, getattr(self.dbus_bridge, name))
-
diff --git a/src/bridge/bridge_constructor/dbus_frontend_template.py b/src/bridge/bridge_constructor/dbus_frontend_template.py
--- a/src/bridge/bridge_constructor/dbus_frontend_template.py
+++ b/src/bridge/bridge_constructor/dbus_frontend_template.py
@@ -26,27 +26,29 @@
 from dbus.mainloop.glib import DBusGMainLoop
 DBusGMainLoop(set_as_default=True)
 
-const_INT_PREFIX = "org.goffi.SAT"  #Interface prefix
-const_ERROR_PREFIX = const_INT_PREFIX+".error"
+const_INT_PREFIX = "org.goffi.SAT"  # Interface prefix
+const_ERROR_PREFIX = const_INT_PREFIX + ".error"
 const_OBJ_PATH = '/org/goffi/SAT/bridge'
 const_CORE_SUFFIX = ".core"
 const_PLUGIN_SUFFIX = ".plugin"
 
+
 class BridgeExceptionNoService(Exception):
     pass
 
+
 class DBusBridgeFrontend(BridgeFrontend):
     def __init__(self):
         try:
             self.sessions_bus = dbus.SessionBus()
             self.db_object = self.sessions_bus.get_object(const_INT_PREFIX,
-                                const_OBJ_PATH)
+                                                          const_OBJ_PATH)
             self.db_core_iface = dbus.Interface(self.db_object,
-                                dbus_interface=const_INT_PREFIX + const_CORE_SUFFIX)
+                                                dbus_interface=const_INT_PREFIX + const_CORE_SUFFIX)
             self.db_plugin_iface = dbus.Interface(self.db_object,
-                                dbus_interface=const_INT_PREFIX + const_PLUGIN_SUFFIX)
-        except dbus.exceptions.DBusException,e:
-            if e._dbus_error_name=='org.freedesktop.DBus.Error.ServiceUnknown':
+                                                  dbus_interface=const_INT_PREFIX + const_PLUGIN_SUFFIX)
+        except dbus.exceptions.DBusException, e:
+            if e._dbus_error_name == 'org.freedesktop.DBus.Error.ServiceUnknown':
                 raise BridgeExceptionNoService
             else:
                 raise e
@@ -79,7 +81,7 @@
                         async = True
                         _callback = kwargs.pop('callback')
                         _errback = kwargs.pop('errback')
-                elif len(args)>=2 and callable(args[-1]) and callable(args[-2]):
+                elif len(args) >= 2 and callable(args[-1]) and callable(args[-2]):
                     async = True
                     args = list(args)
                     _errback = args.pop()
@@ -89,22 +91,21 @@
 
                 if async:
                     kwargs['reply_handler'] = _callback
-                    kwargs['error_handler'] = lambda err:_errback(err._dbus_error_name[len(const_ERROR_PREFIX)+1:])
+                    kwargs['error_handler'] = lambda err: _errback(err._dbus_error_name[len(const_ERROR_PREFIX) + 1:])
 
                 return method(*args, **kwargs)
 
             return getPluginMethod
-
 ##METHODS_PART##
 
 #methods from plugins
 
     def joinMUC(self, room_jid, nick, options, profile_key):
-        if options == None:
-            options = [('', '')] #XXX: we have to do this awful hack because python dbus need to guess the signature
+        if options is None:
+            options = [('', '')]  # XXX: we have to do this awful hack because python dbus need to guess the signature
         return self.db_plugin_iface.joinMUC(room_jid, nick, options, profile_key)
 
     def gatewayRegister(self, action, target, data, profile_key):
-        if data == None:
-            data = [('', '')] #XXX: we have to do this awful hack because python dbus need to guess the signature
+        if data is None:
+            data = [('', '')]  # XXX: we have to do this awful hack because python dbus need to guess the signature
         return self.db_plugin_iface.gatewayRegister(action, target, data, profile_key)
-------------- section suivante --------------
Une pièce jointe autre que texte a été nettoyée...
Nom: non disponible
Type: application/pgp-signature
Taille: 198 octets
Desc: non disponible
URL: <http://lists.goffi.org/pipermail/dev/attachments/20130118/ce555a31/attachment-0001.pgp>


Plus d'informations sur la liste de diffusion dev