kill dead/useless code as suggested by pylint stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 26 Feb 2010 13:19:14 +0100
branchstable
changeset 4719 aaed3f813ef8
parent 4718 3dc3ad02d091
child 4720 ddf4f19eb07a
kill dead/useless code as suggested by pylint
appobject.py
cwvreg.py
devtools/devctl.py
devtools/realdbtest.py
devtools/testlib.py
entity.py
etwist/service.py
etwist/twconfig.py
etwist/twctl.py
ext/rest.py
ext/xhtml2fo.py
hooks/notification.py
hooks/storages.py
hooks/syncschema.py
hooks/workflow.py
i18n.py
mail.py
mixins.py
rqlrewrite.py
schemas/base.py
schemas/workflow.py
selectors.py
server/hookhelper.py
server/migractions.py
server/msplanner.py
server/querier.py
server/repository.py
server/rqlannotation.py
server/schemaserial.py
server/serverconfig.py
server/serverctl.py
server/sources/ldapuser.py
server/sources/rql2sql.py
server/sqlutils.py
sobjects/notification.py
vregistry.py
web/action.py
web/controller.py
web/facet.py
web/form.py
web/htmlwidgets.py
web/request.py
web/test/unittest_views_editforms.py
web/uicfg.py
web/views/basecontrollers.py
web/views/boxes.py
web/views/cwuser.py
web/views/forms.py
web/views/navigation.py
web/views/old_calendar.py
web/views/plots.py
web/views/sparql.py
web/views/treeview.py
web/views/xbel.py
web/webconfig.py
wsgi/handler.py
--- a/appobject.py	Fri Feb 26 13:12:01 2010 +0100
+++ b/appobject.py	Fri Feb 26 13:19:14 2010 +0100
@@ -13,12 +13,9 @@
 from logging import getLogger
 from warnings import warn
 
-from logilab.common.decorators import classproperty
 from logilab.common.deprecation import deprecated
 from logilab.common.logging_ext import set_log_methods
 
-from cubicweb import Unauthorized, NoSelectableObject
-
 
 # selector base classes and operations ########################################
 
--- a/cwvreg.py	Fri Feb 26 13:12:01 2010 +0100
+++ b/cwvreg.py	Fri Feb 26 13:19:14 2010 +0100
@@ -8,7 +8,7 @@
 __docformat__ = "restructuredtext en"
 _ = unicode
 
-from logilab.common.decorators import cached, clear_cache, monkeypatch
+from logilab.common.decorators import cached, clear_cache
 from logilab.common.deprecation import  deprecated
 from logilab.common.modutils import cleanup_sys_modules
 
--- a/devtools/devctl.py	Fri Feb 26 13:12:01 2010 +0100
+++ b/devtools/devctl.py	Fri Feb 26 13:19:14 2010 +0100
@@ -13,7 +13,7 @@
 # completion). So import locally in command helpers.
 import sys
 from datetime import datetime
-from os import mkdir, chdir, getcwd
+from os import mkdir, chdir
 from os.path import join, exists, abspath, basename, normpath, split, isdir
 from warnings import warn
 
@@ -230,21 +230,6 @@
                     break
 
 
-def defined_in_library(etype, rtype, tetype, role):
-    """return true if the given relation definition exists in cubicweb's library
-    """
-    if libschema is None:
-        return False
-    if role == 'subject':
-        subjtype, objtype = etype, tetype
-    else:
-        subjtype, objtype = tetype, etype
-    try:
-        return libschema.rschema(rtype).has_rdef(subjtype, objtype)
-    except KeyError:
-        return False
-
-
 LANGS = ('en', 'fr', 'es')
 I18NDIR = join(BASEDIR, 'i18n')
 DEFAULT_POT_HEAD = r'''msgid ""
--- a/devtools/realdbtest.py	Fri Feb 26 13:12:01 2010 +0100
+++ b/devtools/realdbtest.py	Fri Feb 26 13:19:14 2010 +0100
@@ -1,4 +1,3 @@
-import logging
 from cubicweb import toolsutils
 from cubicweb.devtools import DEFAULT_SOURCES, BaseApptestConfiguration
 
--- a/devtools/testlib.py	Fri Feb 26 13:12:01 2010 +0100
+++ b/devtools/testlib.py	Fri Feb 26 13:19:14 2010 +0100
@@ -474,7 +474,7 @@
         Redirect exception
         """
         try:
-            res = callback(req)
+            callback(req)
         except Redirect, ex:
             try:
                 path, params = ex.location.split('?', 1)
--- a/entity.py	Fri Feb 26 13:12:01 2010 +0100
+++ b/entity.py	Fri Feb 26 13:19:14 2010 +0100
@@ -12,10 +12,8 @@
 from logilab.common import interface
 from logilab.common.compat import all
 from logilab.common.decorators import cached
-from logilab.common.deprecation import deprecated
 from logilab.mtconverter import TransformData, TransformError, xml_escape
 
-from rql import parse
 from rql.utils import rqlvar_maker
 
 from cubicweb import Unauthorized, typed_eid
--- a/etwist/service.py	Fri Feb 26 13:12:01 2010 +0100
+++ b/etwist/service.py	Fri Feb 26 13:19:14 2010 +0100
@@ -1,6 +1,4 @@
 import os
-import os.path as osp
-import sys
 
 import win32serviceutil
 import win32service
--- a/etwist/twconfig.py	Fri Feb 26 13:12:01 2010 +0100
+++ b/etwist/twconfig.py	Fri Feb 26 13:19:14 2010 +0100
@@ -16,7 +16,9 @@
 
 from os.path import join
 
-from cubicweb.web.webconfig import WebConfiguration, merge_options, Method
+from logilab.common.configuration import Method
+
+from cubicweb.web.webconfig import WebConfiguration, merge_options
 
 class TwistedConfiguration(WebConfiguration):
     """web instance (in a twisted web server) client of a RQL server"""
--- a/etwist/twctl.py	Fri Feb 26 13:12:01 2010 +0100
+++ b/etwist/twctl.py	Fri Feb 26 13:19:14 2010 +0100
@@ -6,8 +6,6 @@
 :license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses
 """
 
-import sys
-
 from cubicweb.toolsutils import CommandHandler
 from cubicweb.web.webctl import WebCreateHandler
 
--- a/ext/rest.py	Fri Feb 26 13:12:01 2010 +0100
+++ b/ext/rest.py	Fri Feb 26 13:19:14 2010 +0100
@@ -147,7 +147,7 @@
 
 try:
     from pygments import highlight
-    from pygments.lexers import get_lexer_by_name, LEXERS
+    from pygments.lexers import get_lexer_by_name
     from pygments.formatters import HtmlFormatter
 except ImportError:
     pygments_directive = None
--- a/ext/xhtml2fo.py	Fri Feb 26 13:12:01 2010 +0100
+++ b/ext/xhtml2fo.py	Fri Feb 26 13:19:14 2010 +0100
@@ -1,4 +1,4 @@
-from xml.etree.ElementTree import QName, fromstring
+from xml.etree.ElementTree import QName
 from pysixt.standard.xhtml_xslfo.transformer import XHTML2FOTransformer
 from pysixt.utils.xslfo.standard import cm
 from pysixt.utils.xslfo import SimplePageMaster
--- a/hooks/notification.py	Fri Feb 26 13:12:01 2010 +0100
+++ b/hooks/notification.py	Fri Feb 26 13:19:14 2010 +0100
@@ -9,7 +9,6 @@
 
 from logilab.common.textutils import normalize_text
 
-from cubicweb import RegistryException
 from cubicweb.selectors import implements
 from cubicweb.server import hook
 from cubicweb.sobjects.supervising import SupervisionMailOp
--- a/hooks/storages.py	Fri Feb 26 13:12:01 2010 +0100
+++ b/hooks/storages.py	Fri Feb 26 13:19:14 2010 +0100
@@ -1,7 +1,5 @@
 """hooks to handle attributes mapped to a custom storage
 """
-from os import unlink
-
 from cubicweb.server.hook import Hook
 from cubicweb.server.sources.storages import ETYPE_ATTR_STORAGE
 
@@ -16,7 +14,6 @@
     """"""
     __regid__ = 'bfss_add_entity'
     events = ('before_add_entity', )
-    #__select__ = Hook.__select__ & implements('Repository')
 
     def __call__(self):
         etype = self.entity.__regid__
@@ -27,7 +24,6 @@
     """"""
     __regid__ = 'bfss_update_entity'
     events = ('before_update_entity', )
-    #__select__ = Hook.__select__ & implements('Repository')
 
     def __call__(self):
         for attr in ETYPE_ATTR_STORAGE.get(self.entity.__regid__, ()):
@@ -37,7 +33,6 @@
     """"""
     __regid__ = 'bfss_delete_entity'
     events = ('before_delete_entity', )
-    #__select__ = Hook.__select__ & implements('Repository')
 
     def __call__(self):
         for attr in ETYPE_ATTR_STORAGE.get(self.entity.__regid__, ()):
--- a/hooks/syncschema.py	Fri Feb 26 13:12:01 2010 +0100
+++ b/hooks/syncschema.py	Fri Feb 26 13:19:14 2010 +0100
@@ -18,7 +18,7 @@
 
 from logilab.common.decorators import clear_cache
 
-from cubicweb import ValidationError, RepositoryError
+from cubicweb import ValidationError
 from cubicweb.selectors import implements
 from cubicweb.schema import META_RTYPES, VIRTUAL_RTYPES, CONSTRAINTS, display_name
 from cubicweb.server import hook, schemaserial as ss
@@ -939,18 +939,6 @@
             SourceDbCWRTypeUpdate(self._cw, rschema=rschema, values=newvalues,
                                   entity=entity)
 
-def check_valid_changes(session, entity, ro_attrs=('name', 'final')):
-    errors = {}
-    # don't use getattr(entity, attr), we would get the modified value if any
-    for attr in ro_attrs:
-        if attr in entity.edited_attributes:
-            origval, newval = hook.entity_oldnewvalue(entity, attr)
-            if newval != origval:
-                errors[attr] = session._("can't change the %s attribute") % \
-                               display_name(session, attr)
-    if errors:
-        raise ValidationError(entity.eid, errors)
-
 
 class AfterDelRelationTypeHook(SyncSchemaHook):
     """before deleting a CWAttribute or CWRelation entity:
--- a/hooks/workflow.py	Fri Feb 26 13:12:01 2010 +0100
+++ b/hooks/workflow.py	Fri Feb 26 13:19:14 2010 +0100
@@ -13,7 +13,6 @@
 from cubicweb.interfaces import IWorkflowable
 from cubicweb.selectors import implements
 from cubicweb.server import hook
-from cubicweb.entities.wfobjs import WorkflowTransition
 
 
 def _change_state(session, x, oldstate, newstate):
@@ -52,7 +51,6 @@
     """try to fire auto transition after state changes"""
 
     def precommit_event(self):
-        session = self.session
         entity = self.entity
         autotrs = list(entity.possible_transitions('auto'))
         if autotrs:
--- a/i18n.py	Fri Feb 26 13:12:01 2010 +0100
+++ b/i18n.py	Fri Feb 26 13:19:14 2010 +0100
@@ -9,7 +9,6 @@
 
 import re
 import os
-import sys
 from os.path import join, basename, splitext, exists
 from glob import glob
 
--- a/mail.py	Fri Feb 26 13:12:01 2010 +0100
+++ b/mail.py	Fri Feb 26 13:19:14 2010 +0100
@@ -8,7 +8,6 @@
 __docformat__ = "restructuredtext en"
 
 from base64 import b64encode, b64decode
-from itertools import repeat
 from time import time
 from email.MIMEMultipart import MIMEMultipart
 from email.MIMEText import MIMEText
--- a/mixins.py	Fri Feb 26 13:12:01 2010 +0100
+++ b/mixins.py	Fri Feb 26 13:19:14 2010 +0100
@@ -10,10 +10,8 @@
 
 from itertools import chain
 
-from logilab.common.deprecation import deprecated
 from logilab.common.decorators import cached
 
-from cubicweb import typed_eid
 from cubicweb.selectors import implements
 from cubicweb.interfaces import IEmailable, ITree
 
--- a/rqlrewrite.py	Fri Feb 26 13:12:01 2010 +0100
+++ b/rqlrewrite.py	Fri Feb 26 13:19:14 2010 +0100
@@ -12,7 +12,6 @@
 
 from rql import nodes as n, stmts, TypeResolverException
 
-from logilab.common.compat import any
 from logilab.common.graph import has_path
 
 from cubicweb import Unauthorized, typed_eid
@@ -291,7 +290,7 @@
     def snippet_subquery(self, varmap, transformedsnippet):
         """introduce the given snippet in a subquery"""
         subselect = stmts.Select()
-        selectvar, snippetvar = varmap
+        selectvar = varmap[0]
         subselect.append_selected(n.VariableRef(
             subselect.get_variable(selectvar)))
         aliases = [selectvar]
@@ -408,7 +407,7 @@
                 cardindex = 1
                 ttypes_func = rschema.subjects
                 rdef = lambda x, y: rschema.rdef(y, x)
-        except KeyError, ex:
+        except KeyError:
             # may be raised by self.varinfo['xhs_rels'][sniprel.r_type]
             return None
         # can't share neged relation or relations with different outer join
--- a/schemas/base.py	Fri Feb 26 13:12:01 2010 +0100
+++ b/schemas/base.py	Fri Feb 26 13:19:14 2010 +0100
@@ -9,7 +9,7 @@
 _ = unicode
 
 from yams.buildobjs import (EntityType, RelationType, SubjectRelation,
-                            String, Boolean, Datetime, Password)
+                            String, Datetime, Password)
 from cubicweb.schema import (RQLConstraint, WorkflowableEntityType,
                              ERQLExpression, RRQLExpression)
 from cubicweb.schemas import META_ETYPE_PERMS, META_RTYPE_PERMS
--- a/schemas/workflow.py	Fri Feb 26 13:12:01 2010 +0100
+++ b/schemas/workflow.py	Fri Feb 26 13:19:14 2010 +0100
@@ -9,7 +9,7 @@
 _ = unicode
 
 from yams.buildobjs import (EntityType, RelationType, SubjectRelation,
-                            ObjectRelation, RichString, String)
+                            RichString, String)
 from cubicweb.schema import RQLConstraint, RQLUniqueConstraint
 from cubicweb.schemas import (META_ETYPE_PERMS, META_RTYPE_PERMS,
                               HOOKS_RTYPE_PERMS)
--- a/selectors.py	Fri Feb 26 13:12:01 2010 +0100
+++ b/selectors.py	Fri Feb 26 13:19:14 2010 +0100
@@ -43,7 +43,7 @@
 __docformat__ = "restructuredtext en"
 
 import logging
-from warnings import warn, filterwarnings
+from warnings import warn
 
 from logilab.common.deprecation import class_renamed
 from logilab.common.compat import all, any
@@ -51,8 +51,7 @@
 
 from yams import BASE_TYPES
 
-from cubicweb import (Unauthorized, NoSelectableObject, NotAnEntity,
-                      role, typed_eid)
+from cubicweb import Unauthorized, NoSelectableObject, NotAnEntity, role
 # even if not used, let yes here so it's importable through this module
 from cubicweb.appobject import Selector, objectify_selector, yes
 from cubicweb.vregistry import class_regid
@@ -163,7 +162,6 @@
     def score_interfaces(self, req, cls_or_inst, cls):
         score = 0
         etypesreg = req.vreg['etypes']
-        eschema = cls_or_inst.e_schema
         for iface in self.expected_ifaces:
             if isinstance(iface, basestring):
                 # entity type
--- a/server/hookhelper.py	Fri Feb 26 13:12:01 2010 +0100
+++ b/server/hookhelper.py	Fri Feb 26 13:19:14 2010 +0100
@@ -9,7 +9,6 @@
 
 from logilab.common.deprecation import deprecated, class_moved
 
-from cubicweb import RepositoryError
 from cubicweb.server import hook
 
 @deprecated('[3.6] entity_oldnewvalue should be imported from cw.server.hook')
--- a/server/migractions.py	Fri Feb 26 13:12:01 2010 +0100
+++ b/server/migractions.py	Fri Feb 26 13:19:14 2010 +0100
@@ -29,12 +29,11 @@
 
 from logilab.common.deprecation import deprecated
 from logilab.common.decorators import cached, clear_cache
-from logilab.common.adbh import get_adv_func_helper
 
 from yams.constraints import SizeConstraint
 from yams.schema2sql import eschema2sql, rschema2sql
 
-from cubicweb import AuthenticationError, ETYPE_NAME_MAP
+from cubicweb import AuthenticationError
 from cubicweb.schema import (META_RTYPES, VIRTUAL_RTYPES,
                              CubicWebRelationSchema, order_eschemas)
 from cubicweb.dbapi import get_repository, repo_connect
@@ -170,7 +169,6 @@
         # check
         if not osp.exists(backupfile):
             raise Exception("Backup file %s doesn't exist" % backupfile)
-            return
         if askconfirm and not self.confirm('Restore %s database from %s ?'
                                            % (self.config.appid, backupfile)):
             return
--- a/server/msplanner.py	Fri Feb 26 13:12:01 2010 +0100
+++ b/server/msplanner.py	Fri Feb 26 13:19:14 2010 +0100
@@ -90,7 +90,6 @@
 from cubicweb.server.ssplanner import (SSPlanner, OneFetchStep,
                                        add_types_restriction)
 from cubicweb.server.mssteps import *
-from cubicweb.server.sources import AbstractSource
 
 Variable._ms_table_key = lambda x: x.name
 Relation._ms_table_key = lambda x: x.r_type
@@ -465,7 +464,7 @@
                     try:
                         lhsv = self._extern_term(lhs, termssources, inserted)
                         rhsv = self._extern_term(rhs, termssources, inserted)
-                    except KeyError, ex:
+                    except KeyError:
                         continue
                     self._remove_term_sources(lhsv, rel, rhsv, termssources)
                     self._remove_term_sources(rhsv, rel, lhsv, termssources)
@@ -857,7 +856,6 @@
         terms = [term]
         sources = sorted(sources)
         sourcesterms = self._sourcesterms
-        nbunlinked = 1
         linkedterms = self._linkedterms
         # term has to belong to the same scope if there is more
         # than the system source remaining
@@ -873,7 +871,7 @@
         for source in sources:
             cross_rels.update(self._crossrelations.get(source, {}))
         exclude = {}
-        for rel, crossvars in cross_rels.iteritems():
+        for crossvars in cross_rels.itervalues():
             vars = [t for t in crossvars if isinstance(t, Variable)]
             try:
                 exclude[vars[0]] = vars[1]
@@ -897,7 +895,6 @@
             modified = False
             for term in candidates[:]:
                 if isinstance(term, Constant):
-                    relation = term.relation()
                     if sorted(set(x[0] for x in self._term_sources(term))) != sources:
                         continue
                     terms.append(term)
@@ -1023,12 +1020,6 @@
         if server.DEBUG & server.DBG_MS:
             print '-'*80
             print 'PLANNING', rqlst
-        for select in rqlst.children:
-            if len(select.solutions) > 1:
-                hasmultiplesols = True
-                break
-        else:
-            hasmultiplesols = False
         # preprocess deals with security insertion and returns a new syntax tree
         # which have to be executed to fulfill the query: according
         # to permissions for variable's type, different rql queries may have to
--- a/server/querier.py	Fri Feb 26 13:12:01 2010 +0100
+++ b/server/querier.py	Fri Feb 26 13:19:14 2010 +0100
@@ -12,7 +12,7 @@
 
 from logilab.common.cache import Cache
 from logilab.common.compat import any
-from rql import RQLHelper, RQLSyntaxError
+from rql import RQLSyntaxError
 from rql.stmts import Union, Select
 from rql.nodes import Relation, VariableRef, Constant, SubQuery
 
@@ -210,7 +210,6 @@
             self.cache_key = None
 
     def _insert_security(self, union, noinvariant):
-        rh = self.rqlhelper
         for select in union.children[:]:
             for subquery in select.with_:
                 self._insert_security(subquery.query, noinvariant)
--- a/server/repository.py	Fri Feb 26 13:12:01 2010 +0100
+++ b/server/repository.py	Fri Feb 26 13:19:14 2010 +0100
@@ -19,7 +19,7 @@
 
 import sys
 import Queue
-from os.path import join, exists
+from os.path import join
 from datetime import datetime
 from time import time, localtime, strftime
 
@@ -29,7 +29,7 @@
 from yams import BadSchemaDefinition
 from rql import RQLSyntaxError
 
-from cubicweb import (CW_SOFTWARE_ROOT, CW_MIGRATION_MAP, CW_EVENT_MANAGER,
+from cubicweb import (CW_SOFTWARE_ROOT, CW_MIGRATION_MAP,
                       UnknownEid, AuthenticationError, ExecutionError,
                       ETypeNotSupportedBySources, MultiSourcesError,
                       BadConnectionId, Unauthorized, ValidationError,
--- a/server/rqlannotation.py	Fri Feb 26 13:12:01 2010 +0100
+++ b/server/rqlannotation.py	Fri Feb 26 13:19:14 2010 +0100
@@ -30,7 +30,7 @@
                     need_distinct = True
                     # XXX could mark as not invariant
                     break
-    for name, var in rqlst.defined_vars.items():
+    for var in rqlst.defined_vars.itervalues():
         stinfo = var.stinfo
         if stinfo.get('ftirels'):
             has_text_query = True
@@ -139,13 +139,11 @@
     """
     # _sort argument is there for test
     diffscope_rels = {}
-    has_same_scope_rel = False
     ored_rels = set()
     diffscope_rels = set()
     for rel in _sort(relations):
         # note: only eid and has_text among all final relations may be there
         if rel.r_type in ('eid', 'identity'):
-            has_same_scope_rel = rel.sqlscope is sqlscope
             continue
         if rel.ored(traverse_scope=True):
             ored_rels.add(rel)
--- a/server/schemaserial.py	Fri Feb 26 13:12:01 2010 +0100
+++ b/server/schemaserial.py	Fri Feb 26 13:19:14 2010 +0100
@@ -8,8 +8,6 @@
 __docformat__ = "restructuredtext en"
 
 import os
-import sys
-import os
 from itertools import chain
 
 from logilab.common.shellutils import ProgressBar
@@ -284,19 +282,15 @@
     relations = ['X %s %%(%s)s' % (attr, attr) for attr in sorted(values)]
     return relations, values
 
-# XXX 2.47 migration
-HAS_FULLTEXT_CONTAINER = True
-
 def rschema_relations_values(rschema):
     values = _ervalues(rschema)
     values['final'] = rschema.final
     values['symmetric'] = rschema.symmetric
     values['inlined'] = rschema.inlined
-    if HAS_FULLTEXT_CONTAINER:
-        if isinstance(rschema.fulltext_container, str):
-            values['fulltext_container'] = unicode(rschema.fulltext_container)
-        else:
-            values['fulltext_container'] = rschema.fulltext_container
+    if isinstance(rschema.fulltext_container, str):
+        values['fulltext_container'] = unicode(rschema.fulltext_container)
+    else:
+        values['fulltext_container'] = rschema.fulltext_container
     relations = ['X %s %%(%s)s' % (attr, attr) for attr in sorted(values)]
     return relations, values
 
--- a/server/serverconfig.py	Fri Feb 26 13:12:01 2010 +0100
+++ b/server/serverconfig.py	Fri Feb 26 13:19:14 2010 +0100
@@ -7,14 +7,12 @@
 """
 __docformat__ = "restructuredtext en"
 
-import os
 from os.path import join, exists
 
 from logilab.common.configuration import REQUIRED, Method, Configuration, \
      ini_format_section
 from logilab.common.decorators import wproperty, cached, clear_cache
 
-from cubicweb import CW_SOFTWARE_ROOT, RegistryNotFound
 from cubicweb.toolsutils import read_config, restrict_perms_to_user
 from cubicweb.cwconfig import CubicWebConfiguration, merge_options
 from cubicweb.server import SOURCE_TYPES
--- a/server/serverctl.py	Fri Feb 26 13:12:01 2010 +0100
+++ b/server/serverctl.py	Fri Feb 26 13:19:14 2010 +0100
@@ -446,7 +446,6 @@
 
     def run(self, args):
         """run the command with its specific arguments"""
-        from cubicweb.server.sqlutils import sqlexec, SQL_PREFIX
         from cubicweb.server.utils import crypt_password, manager_userpasswd
         appid = pop_arg(args, 1, msg='No instance specified !')
         config = ServerConfiguration.config_for(appid)
--- a/server/sources/ldapuser.py	Fri Feb 26 13:12:01 2010 +0100
+++ b/server/sources/ldapuser.py	Fri Feb 26 13:19:14 2010 +0100
@@ -210,11 +210,11 @@
                 if res:
                     ldapemailaddr = res[0].get(ldap_emailattr)
                     if ldapemailaddr:
-                        rset = session.execute('EmailAddress X,A WHERE '
+                        rset = session.execute('EmailAddress A WHERE '
                                                'U use_email X, U eid %(u)s',
                                                {'u': eid})
                         ldapemailaddr = unicode(ldapemailaddr)
-                        for emaileid, emailaddr in rset:
+                        for emailaddr, in rset:
                             if emailaddr == ldapemailaddr:
                                 break
                         else:
--- a/server/sources/rql2sql.py	Fri Feb 26 13:12:01 2010 +0100
+++ b/server/sources/rql2sql.py	Fri Feb 26 13:19:14 2010 +0100
@@ -38,7 +38,6 @@
 from rql.nodes import (SortTerm, VariableRef, Constant, Function, Not,
                        Variable, ColumnAlias, Relation, SubQuery, Exists)
 
-from cubicweb import server
 from cubicweb.server.sqlutils import SQL_PREFIX
 from cubicweb.server.utils import cleanup_solutions
 
--- a/server/sqlutils.py	Fri Feb 26 13:12:01 2010 +0100
+++ b/server/sqlutils.py	Fri Feb 26 13:19:14 2010 +0100
@@ -9,9 +9,7 @@
 
 import os
 import subprocess
-from os.path import exists
-from warnings import warn
-from datetime import datetime, date, timedelta
+from datetime import datetime, date
 
 import logilab.common as lgc
 from logilab.common import db
@@ -24,7 +22,6 @@
 
 from cubicweb import Binary, ConfigurationError
 from cubicweb.uilib import remove_html_tags
-from cubicweb.toolsutils import restrict_perms_to_user
 from cubicweb.schema import PURE_VIRTUAL_RTYPES
 from cubicweb.server import SQL_CONNECT_HOOKS
 from cubicweb.server.utils import crypt_password
--- a/sobjects/notification.py	Fri Feb 26 13:12:01 2010 +0100
+++ b/sobjects/notification.py	Fri Feb 26 13:19:14 2010 +0100
@@ -11,7 +11,7 @@
 from itertools import repeat
 
 from logilab.common.textutils import normalize_text
-from logilab.common.deprecation import class_renamed, deprecated
+from logilab.common.deprecation import class_renamed, class_moved, deprecated
 
 from cubicweb.selectors import yes
 from cubicweb.view import Component
@@ -183,7 +183,6 @@
                                   entity.eid, self.user_data['login'])
 
 
-from logilab.common.deprecation import class_renamed, class_moved, deprecated
 from cubicweb.hooks.notification import RenderAndSendNotificationView
 from cubicweb.mail import parse_message_id
 
--- a/vregistry.py	Fri Feb 26 13:12:01 2010 +0100
+++ b/vregistry.py	Fri Feb 26 13:19:14 2010 +0100
@@ -23,7 +23,7 @@
 
 import sys
 from os import listdir, stat
-from os.path import dirname, join, realpath, split, isdir, exists
+from os.path import dirname, join, realpath, isdir, exists
 from logging import getLogger
 from warnings import warn
 
--- a/web/action.py	Fri Feb 26 13:12:01 2010 +0100
+++ b/web/action.py	Fri Feb 26 13:19:14 2010 +0100
@@ -10,7 +10,7 @@
 
 from cubicweb import target
 from cubicweb.selectors import (partial_relation_possible, match_search_state,
-                                one_line_rset, yes)
+                                one_line_rset)
 from cubicweb.appobject import AppObject
 
 
--- a/web/controller.py	Fri Feb 26 13:12:01 2010 +0100
+++ b/web/controller.py	Fri Feb 26 13:19:14 2010 +0100
@@ -8,9 +8,6 @@
 """
 __docformat__ = "restructuredtext en"
 
-import datetime
-
-from cubicweb import typed_eid
 from cubicweb.selectors import yes
 from cubicweb.appobject import AppObject
 from cubicweb.web import LOGGER, Redirect, RequestError
--- a/web/facet.py	Fri Feb 26 13:12:01 2010 +0100
+++ b/web/facet.py	Fri Feb 26 13:19:14 2010 +0100
@@ -15,7 +15,7 @@
 from logilab.mtconverter import xml_escape
 from logilab.common.graph import has_path
 from logilab.common.decorators import cached
-from logilab.common.date import datetime2ticks, ustrftime
+from logilab.common.date import datetime2ticks
 from logilab.common.compat import all
 
 from rql import parse, nodes
--- a/web/form.py	Fri Feb 26 13:12:01 2010 +0100
+++ b/web/form.py	Fri Feb 26 13:19:14 2010 +0100
@@ -14,8 +14,7 @@
 
 from cubicweb.appobject import AppObject
 from cubicweb.view import NOINDEX, NOFOLLOW
-from cubicweb import tags
-from cubicweb.web import stdmsgs, httpcache, formfields, controller
+from cubicweb.web import httpcache, formfields, controller
 
 
 class FormViewMixIn(object):
--- a/web/htmlwidgets.py	Fri Feb 26 13:12:01 2010 +0100
+++ b/web/htmlwidgets.py	Fri Feb 26 13:19:14 2010 +0100
@@ -15,7 +15,7 @@
 from logilab.mtconverter import xml_escape
 
 from cubicweb.utils import UStringIO
-from cubicweb.uilib import toggle_action, limitsize, htmlescape
+from cubicweb.uilib import toggle_action, htmlescape
 from cubicweb.web import jsonize
 
 # XXX HTMLWidgets should have access to req (for datadir / static urls,
@@ -316,7 +316,7 @@
             self.w(u'<th %s>%s</th>' % (' '.join(attrs), column.name))
         self.w(u'</tr>')
         self.w(u'</thead><tbody>')
-        for rowindex, row in enumerate(self.model.get_rows()):
+        for rowindex in xrange(len(self.model.get_rows())):
             klass = (rowindex%2==1) and 'odd' or 'even'
             self.w(u'<tr class="%s" %s>' % (klass, self.highlight))
             for column, sortvalue in self.itercols(rowindex):
@@ -373,14 +373,10 @@
         budget = self.budget
         if budget == 0:
             pourcent = 100
-            todo_pourcent = 0
         else:
             pourcent = done*100./budget
-            todo_pourcent = min(todo*100./budget, 100-pourcent)
-        bar_pourcent = pourcent
         if pourcent > 100.1:
             color = 'red'
-            bar_pourcent = 100
         elif todo+done > self.red_threshold*budget:
             color = 'red'
         elif todo+done > self.orange_threshold*budget:
--- a/web/request.py	Fri Feb 26 13:12:01 2010 +0100
+++ b/web/request.py	Fri Feb 26 13:19:14 2010 +0100
@@ -135,7 +135,7 @@
                                             self.user.properties['ui.language'])
                     self.set_language(lang)
                     return
-                except KeyError, ex:
+                except KeyError:
                     pass
             if vreg.config['language-negociation']:
                 # 2. http negociated language
@@ -671,7 +671,7 @@
                     try:
                         scorekey, scoreval = score.split('=')
                         if scorekey == 'q': # XXX 'level'
-                            score = float(score[2:]) # remove 'q='
+                            score = float(scoreval)
                     except ValueError:
                         continue
             values.append((score, value))
--- a/web/test/unittest_views_editforms.py	Fri Feb 26 13:12:01 2010 +0100
+++ b/web/test/unittest_views_editforms.py	Fri Feb 26 13:19:14 2010 +0100
@@ -35,9 +35,6 @@
 
 
     def test_cwuser_relations_by_category(self):
-        #for (rtype, role, stype, otype), tag in AEF.rcategories._tagdefs.items():
-        #    if rtype == 'tags':
-        #        print rtype, role, stype, otype, ':', tag
         e = self.vreg['etypes'].etype_class('CWUser')(self.request())
         # see custom configuration in views.cwuser
         self.assertEquals(rbc(e, 'main', 'attributes'),
--- a/web/uicfg.py	Fri Feb 26 13:12:01 2010 +0100
+++ b/web/uicfg.py	Fri Feb 26 13:19:14 2010 +0100
@@ -112,7 +112,6 @@
 from cubicweb.rtags import (RelationTags, RelationTagsBool, RelationTagsSet,
                             RelationTagsDict, register_rtag, _ensure_str_key)
 from cubicweb.schema import META_RTYPES
-from cubicweb.web import formwidgets
 
 
 # primary view configuration ##################################################
--- a/web/views/basecontrollers.py	Fri Feb 26 13:12:01 2010 +0100
+++ b/web/views/basecontrollers.py	Fri Feb 26 13:19:14 2010 +0100
@@ -172,7 +172,9 @@
 
 def _validation_error(req, ex):
     req.cnx.rollback()
-    forminfo = req.get_session_data(req.form.get('__errorurl'), pop=True)
+    # XXX necessary to remove existant validation error?
+    # imo (syt), it's not necessary
+    req.get_session_data(req.form.get('__errorurl'), pop=True)
     foreid = ex.entity
     eidmap = req.data.get('eidmap', {})
     for var, eid in eidmap.items():
--- a/web/views/boxes.py	Fri Feb 26 13:12:01 2010 +0100
+++ b/web/views/boxes.py	Fri Feb 26 13:19:14 2010 +0100
@@ -24,7 +24,6 @@
 from cubicweb.view import EntityView
 from cubicweb.schema import display_name
 from cubicweb.web.htmlwidgets import BoxWidget, BoxMenu, BoxHtml, RawBoxItem
-from cubicweb.web import uicfg
 from cubicweb.web.box import BoxTemplate
 
 
--- a/web/views/cwuser.py	Fri Feb 26 13:12:01 2010 +0100
+++ b/web/views/cwuser.py	Fri Feb 26 13:19:14 2010 +0100
@@ -12,17 +12,16 @@
 from cubicweb.selectors import one_line_rset, implements, match_user_groups
 from cubicweb.view import EntityView
 from cubicweb.web import action, uicfg
-from cubicweb.web.views import primary
 
-uicfg.primaryview_section.tag_attribute(('CWUser', 'login'), 'hidden')
-
-uicfg.primaryview_section.tag_attribute(('CWGroup', 'name'), 'hidden')
-uicfg.primaryview_section.tag_subject_of(('CWGroup', 'read_permission', '*'), 'relations')
-uicfg.primaryview_section.tag_subject_of(('CWGroup', 'add_permission', '*'), 'relations')
-uicfg.primaryview_section.tag_subject_of(('CWGroup', 'delete_permission', '*'), 'relations')
-uicfg.primaryview_section.tag_subject_of(('CWGroup', 'update_permission', '*'), 'relations')
-uicfg.primaryview_section.tag_object_of(('*', 'in_group', 'CWGroup'), 'relations')
-uicfg.primaryview_section.tag_object_of(('*', 'require_group', 'CWGroup'), 'relations')
+_pvs = uicfg.primaryview_section
+_pvs.tag_attribute(('CWUser', 'login'), 'hidden')
+_pvs.tag_attribute(('CWGroup', 'name'), 'hidden')
+_pvs.tag_subject_of(('CWGroup', 'read_permission', '*'), 'relations')
+_pvs.tag_subject_of(('CWGroup', 'add_permission', '*'), 'relations')
+_pvs.tag_subject_of(('CWGroup', 'delete_permission', '*'), 'relations')
+_pvs.tag_subject_of(('CWGroup', 'update_permission', '*'), 'relations')
+_pvs.tag_object_of(('*', 'in_group', 'CWGroup'), 'relations')
+_pvs.tag_object_of(('*', 'require_group', 'CWGroup'), 'relations')
 
 class UserPreferencesEntityAction(action.Action):
     __regid__ = 'prefs'
--- a/web/views/forms.py	Fri Feb 26 13:12:01 2010 +0100
+++ b/web/views/forms.py	Fri Feb 26 13:19:14 2010 +0100
@@ -15,9 +15,7 @@
 
 from cubicweb import typed_eid
 from cubicweb.selectors import non_final_entity, match_kwargs, one_line_rset
-from cubicweb.web import INTERNAL_FIELD_VALUE, eid_param
 from cubicweb.web import uicfg, form, formwidgets as fwdgs
-from cubicweb.web.controller import NAV_FORM_PARAMETERS
 from cubicweb.web.formfields import StringField, relvoc_unrelated, guess_field
 
 
--- a/web/views/navigation.py	Fri Feb 26 13:12:01 2010 +0100
+++ b/web/views/navigation.py	Fri Feb 26 13:19:14 2010 +0100
@@ -59,7 +59,6 @@
     nb_chars = 5
 
     def display_func(self, rset, col, attrname):
-        req = self._cw
         if attrname is not None:
             def index_display(row):
                 if not rset[row][col]: # outer join
--- a/web/views/old_calendar.py	Fri Feb 26 13:12:01 2010 +0100
+++ b/web/views/old_calendar.py	Fri Feb 26 13:19:14 2010 +0100
@@ -40,7 +40,6 @@
 
     def nav_header(self, date, smallshift=3, bigshift=9):
         """prints shortcut links to go to previous/next steps (month|week)"""
-        prev1 = next1 = prev2 = nex2 = date
         prev1 = previous_month(date, smallshift)
         next1 = next_month(date, smallshift)
         prev2 = previous_month(date, bigshift)
--- a/web/views/plots.py	Fri Feb 26 13:12:01 2010 +0100
+++ b/web/views/plots.py	Fri Feb 26 13:19:14 2010 +0100
@@ -7,16 +7,12 @@
 """
 __docformat__ = "restructuredtext en"
 
-import os
-import time
-
 from simplejson import dumps
 
-from logilab.common import flatten
 from logilab.common.date import datetime2ticks
 from logilab.mtconverter import xml_escape
 
-from cubicweb.utils import make_uid, UStringIO
+from cubicweb.utils import UStringIO
 from cubicweb.appobject import objectify_selector
 from cubicweb.selectors import multi_columns_rset
 from cubicweb.web.views import baseviews
--- a/web/views/sparql.py	Fri Feb 26 13:12:01 2010 +0100
+++ b/web/views/sparql.py	Fri Feb 26 13:19:14 2010 +0100
@@ -15,7 +15,7 @@
 
 from cubicweb.view import StartupView, AnyRsetView
 from cubicweb.web import Redirect, form, formfields, formwidgets as fwdgs
-from cubicweb.web.views import forms, urlrewrite
+from cubicweb.web.views import forms
 try:
     from cubicweb.spa2rql import Sparql2rqlTranslator, UnsupportedQuery
 except ImportError:
@@ -45,7 +45,7 @@
         if sparql:
             try:
                 qinfo = Sparql2rqlTranslator(self._cw.vreg.schema).translate(sparql)
-            except rql.TypeResolverException, ex:
+            except rql.TypeResolverException:
                 self.w(self._cw._('can not resolve entity types:') + u' ' + unicode('ex'))
             except UnsupportedQuery:
                 self.w(self._cw._('we are not yet ready to handle this query'))
--- a/web/views/treeview.py	Fri Feb 26 13:12:01 2010 +0100
+++ b/web/views/treeview.py	Fri Feb 26 13:19:14 2010 +0100
@@ -9,7 +9,6 @@
 
 import simplejson as json
 
-from logilab.common.decorators import monkeypatch
 from logilab.mtconverter import xml_escape
 from cubicweb.utils import make_uid
 from cubicweb.interfaces import ITree
@@ -115,7 +114,6 @@
 
     def cell_call(self, row, col, vid='oneline', treeid=None, **morekwargs):
         assert treeid is not None
-        entity = self.cw_rset.get_entity(row, col)
         itemview = self._cw.view(vid, self.cw_rset, row=row, col=col)
         last_class = morekwargs['is_last'] and ' class="last"' or ''
         self.w(u'<li%s>%s</li>' % (last_class, itemview))
--- a/web/views/xbel.py	Fri Feb 26 13:12:01 2010 +0100
+++ b/web/views/xbel.py	Fri Feb 26 13:19:14 2010 +0100
@@ -26,8 +26,6 @@
 
     def call(self):
         """display a list of entities by calling their <item_vid> view"""
-        title = self.page_title()
-        url = self._cw.build_url(rql=self._cw.form.get('rql', ''))
         self.w(u'<?xml version="1.0" encoding="%s"?>\n' % self._cw.encoding)
         self.w(u'<!DOCTYPE xbel PUBLIC "+//IDN python.org//DTD XML Bookmark Exchange Language 1.0//EN//XML" "http://www.python.org/topics/xml/dtds/xbel-1.0.dtd">')
         self.w(u'<xbel version="1.0">')
--- a/web/webconfig.py	Fri Feb 26 13:12:01 2010 +0100
+++ b/web/webconfig.py	Fri Feb 26 13:19:14 2010 +0100
@@ -11,7 +11,6 @@
 import os
 from os.path import join, exists, split
 
-from logilab.common.configuration import Method
 from logilab.common.decorators import cached
 
 from cubicweb.toolsutils import read_config
--- a/wsgi/handler.py	Fri Feb 26 13:12:01 2010 +0100
+++ b/wsgi/handler.py	Fri Feb 26 13:19:14 2010 +0100
@@ -8,7 +8,7 @@
 
 __docformat__ = "restructuredtext en"
 
-from cubicweb import ObjectNotFound, AuthenticationError
+from cubicweb import AuthenticationError
 from cubicweb.web import (NotFound, Redirect, DirectResponse, StatusResponse,
                        ExplicitLogin)
 from cubicweb.web.application import CubicWebPublisher