fix some pylint detected errors stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 26 Feb 2010 13:09:12 +0100
branchstable
changeset 4716 55b6a3262071
parent 4715 d3f87ee74fe4
child 4717 535705688f4f
fix some pylint detected errors
appobject.py
dbapi.py
entities/wfobjs.py
hooks/storages.py
server/migractions.py
server/msplanner.py
server/sources/ldapuser.py
web/views/sparql.py
--- a/appobject.py	Fri Feb 26 09:54:32 2010 +0100
+++ b/appobject.py	Fri Feb 26 13:09:12 2010 +0100
@@ -268,7 +268,7 @@
             pdef['default'] = getattr(cls, propid, pdef['default'])
             pdef['sitewide'] = getattr(cls, 'site_wide', pdef.get('sitewide'))
             registry.vreg.register_property(cls._cwpropkey(propid), **pdef)
-        assert callable(cls.__select__), obj
+        assert callable(cls.__select__), cls
         return cls
 
     def __init__(self, req, **extra):
--- a/dbapi.py	Fri Feb 26 09:54:32 2010 +0100
+++ b/dbapi.py	Fri Feb 26 13:09:12 2010 +0100
@@ -27,7 +27,7 @@
 
 def _fake_property_value(self, name):
     try:
-        return super(dbapi.DBAPIRequest, self).property_value(name)
+        return super(DBAPIRequest, self).property_value(name)
     except KeyError:
         return ''
 
--- a/entities/wfobjs.py	Fri Feb 26 09:54:32 2010 +0100
+++ b/entities/wfobjs.py	Fri Feb 26 13:09:12 2010 +0100
@@ -161,9 +161,9 @@
         execute = self._cw.unsafe_execute
         execute('SET X in_state S WHERE S eid %(s)s', {'s': todelstate.eid}, 's')
         execute('SET X from_state NS WHERE X to_state OS, OS eid %(os)s, NS eid %(ns)s',
-                {'os': todelstate.eid, 'ns': newstate.eid}, 's')
+                {'os': todelstate.eid, 'ns': replacement.eid}, 's')
         execute('SET X to_state NS WHERE X to_state OS, OS eid %(os)s, NS eid %(ns)s',
-                {'os': todelstate.eid, 'ns': newstate.eid}, 's')
+                {'os': todelstate.eid, 'ns': replacement.eid}, 's')
         todelstate.delete()
 
 
@@ -219,7 +219,7 @@
         """
         if self.transition_of:
             return self.transition_of[0].rest_path(), {}
-        return super(Transition, self).after_deletion_path()
+        return super(BaseTransition, self).after_deletion_path()
 
     def set_permissions(self, requiredgroups=(), conditions=(), reset=True):
         """set or add (if `reset` is False) groups and conditions for this
@@ -330,7 +330,7 @@
         return result
 
     def clear_all_caches(self):
-        super(WorkflowableMixIn, self).clear_all_caches()
+        super(WorkflowTransition, self).clear_all_caches()
         clear_cache(self, 'exit_points')
 
 
--- a/hooks/storages.py	Fri Feb 26 09:54:32 2010 +0100
+++ b/hooks/storages.py	Fri Feb 26 13:09:12 2010 +0100
@@ -19,10 +19,9 @@
     #__select__ = Hook.__select__ & implements('Repository')
 
     def __call__(self):
-        for attr in ETYPE_ATTR_STORAGE.get(self.entity.__regid__, ()):
-            fpath = ETYPE_ATTR_STORAGE[self.entity.__regid__][attr].entity_added(self.entity, attr)
-            if fpath is not None:
-                AddFileOp(filepath=fpath)
+        etype = self.entity.__regid__
+        for attr in ETYPE_ATTR_STORAGE.get(etype, ()):
+            ETYPE_ATTR_STORAGE[etype][attr].entity_added(self.entity, attr)
 
 class PreUpdateEntityHook(BFSSHook):
     """"""
--- a/server/migractions.py	Fri Feb 26 09:54:32 2010 +0100
+++ b/server/migractions.py	Fri Feb 26 13:09:12 2010 +0100
@@ -293,9 +293,6 @@
             apc = osp.join(self.config.migration_scripts_dir(), '%s.py' % event)
         if osp.exists(apc):
             if self.config.free_wheel:
-                from cubicweb.server.hooks import setowner_after_add_entity
-                self.repo.hm.unregister_hook(setowner_after_add_entity,
-                                             'after_add_entity', '')
                 self.cmd_deactivate_verification_hooks()
             self.info('executing %s', apc)
             confirm = self.confirm
@@ -308,8 +305,6 @@
                 self.confirm = confirm
                 self.execscript_confirm = execscript_confirm
                 if self.config.free_wheel:
-                    self.repo.hm.register_hook(setowner_after_add_entity,
-                                               'after_add_entity', '')
                     self.cmd_reactivate_verification_hooks()
 
     def install_custom_sql_scripts(self, directory, driver):
--- a/server/msplanner.py	Fri Feb 26 09:54:32 2010 +0100
+++ b/server/msplanner.py	Fri Feb 26 13:09:12 2010 +0100
@@ -1191,7 +1191,7 @@
                                             for step in steps
                                             for select in step.union.children):
                 if temptable:
-                    step = IntersectFetchStep(plan)
+                    step = IntersectFetchStep(plan) # XXX not implemented
                 else:
                     step = IntersectStep(plan)
             else:
--- a/server/sources/ldapuser.py	Fri Feb 26 09:54:32 2010 +0100
+++ b/server/sources/ldapuser.py	Fri Feb 26 13:09:12 2010 +0100
@@ -448,12 +448,12 @@
     def _auth_cram_md5(self, conn, user, userpwd):
         from ldap import sasl
         auth_token = sasl.cram_md5(user['dn'], userpwd)
-        conn.sasl_interactive_bind_s('', auth_tokens)
+        conn.sasl_interactive_bind_s('', auth_token)
 
     def _auth_digest_md5(self, conn, user, userpwd):
         from ldap import sasl
         auth_token = sasl.digest_md5(user['dn'], userpwd)
-        conn.sasl_interactive_bind_s('', auth_tokens)
+        conn.sasl_interactive_bind_s('', auth_token)
 
     def _auth_gssapi(self, conn, user, userpwd):
         # print XXX not proper sasl/gssapi
--- a/web/views/sparql.py	Fri Feb 26 09:54:32 2010 +0100
+++ b/web/views/sparql.py	Fri Feb 26 13:09:12 2010 +0100
@@ -5,7 +5,7 @@
 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
 :license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses
 """
-v__docformat__ = "restructuredtext en"
+__docformat__ = "restructuredtext en"
 
 import rql
 from yams import xy
@@ -17,7 +17,7 @@
 from cubicweb.web import Redirect, form, formfields, formwidgets as fwdgs
 from cubicweb.web.views import forms, urlrewrite
 try:
-    from cubicweb.spa2rql import Sparql2rqlTranslator
+    from cubicweb.spa2rql import Sparql2rqlTranslator, UnsupportedQuery
 except ImportError:
     # fyzz not available (only a recommends)
     Sparql2rqlTranslator = None