--- a/cwvreg.py Mon Mar 23 18:53:53 2009 +0100
+++ b/cwvreg.py Wed Mar 25 10:40:22 2009 +0100
@@ -126,7 +126,7 @@
for cls in classes:
for iface in cls.__implements__:
interfaces.update(iface.__mro__)
- interfaces.update(expand_parent_classes(cls.__mro__))
+ interfaces.update(cls.__mro__)
for obj, ifaces in self._needs_iface.items():
ifaces = frozenset(isinstance(iface, basestring)
and iface in self.schema
--- a/devtools/_apptest.py Mon Mar 23 18:53:53 2009 +0100
+++ b/devtools/_apptest.py Wed Mar 25 10:40:22 2009 +0100
@@ -61,6 +61,7 @@
def ignore_relations(*relations):
+ global SYSTEM_RELATIONS
SYSTEM_RELATIONS += relations
class TestEnvironment(object):
@@ -83,7 +84,6 @@
self.restore_database()
if verbose:
print "init done"
- login = source['db-user']
config.repository = lambda x=None: self.repo
self.app = CubicWebPublisher(config, vreg=vreg)
self.verbose = verbose
--- a/devtools/devctl.py Mon Mar 23 18:53:53 2009 +0100
+++ b/devtools/devctl.py Wed Mar 25 10:40:22 2009 +0100
@@ -16,10 +16,11 @@
from logilab.common import STD_BLACKLIST
from logilab.common.modutils import get_module_files
from logilab.common.textutils import get_csv
+from logilab.common.clcommands import register_commands
from cubicweb import CW_SOFTWARE_ROOT as BASEDIR, BadCommandUsage
from cubicweb.__pkginfo__ import version as cubicwebversion
-from cubicweb.toolsutils import Command, register_commands, confirm, copy_skeleton
+from cubicweb.toolsutils import Command, confirm, copy_skeleton
from cubicweb.web.webconfig import WebConfiguration
from cubicweb.server.serverconfig import ServerConfiguration
--- a/devtools/livetest.py Mon Mar 23 18:53:53 2009 +0100
+++ b/devtools/livetest.py Wed Mar 25 10:40:22 2009 +0100
@@ -36,12 +36,9 @@
"""Indicate which resource to use to process down the URL's path"""
if len(segments) and segments[0] == 'data':
# Anything in data/ is treated as static files
- dirlist = [self.data_dir, join(dirname(cubicweb.web.__file__), 'data')]
- for alternative in dirlist:
- filepath = join(alternative, *segments[1:])
- if exists(filepath):
- self.info('publish static file: %s', '/'.join(segments))
- return static.File(filepath), ()
+ datadir = self.config.locate_resource(segments[1])
+ if datadir:
+ return static.File(str(datadir), segments[1:])
# Otherwise we use this single resource
return self, ()
--- a/devtools/repotest.py Mon Mar 23 18:53:53 2009 +0100
+++ b/devtools/repotest.py Wed Mar 25 10:40:22 2009 +0100
@@ -256,7 +256,7 @@
from cubicweb.server.msplanner import PartPlanInformation
except ImportError:
class PartPlanInformation(object):
- def merge_input_maps(*args):
+ def merge_input_maps(self, *args):
pass
def _choose_var(self, sourcevars):
pass
--- a/entity.py Mon Mar 23 18:53:53 2009 +0100
+++ b/entity.py Wed Mar 25 10:40:22 2009 +0100
@@ -226,12 +226,13 @@
__registry__ = 'etypes'
__select__ = yes()
widgets = {}
+ rtags = None
id = None
e_schema = None
eid = None
rest_attr = None
+ fetch_attrs = None
skip_copy_for = ()
-
@classmethod
def registered(cls, registry):
"""build class using descriptor at registration time"""
--- a/gettext.py Mon Mar 23 18:53:53 2009 +0100
+++ b/gettext.py Wed Mar 25 10:40:22 2009 +0100
@@ -442,7 +442,6 @@
def bindtextdomain(domain, localedir=None):
- global _localedirs
if localedir is not None:
_localedirs[domain] = localedir
return _localedirs.get(domain, _default_localedir)
--- a/goa/goactl.py Mon Mar 23 18:53:53 2009 +0100
+++ b/goa/goactl.py Wed Mar 25 10:40:22 2009 +0100
@@ -10,10 +10,9 @@
from logilab.common.clcommands import register_commands
-from cubicweb import BadCommandUsage
-from cubicweb import CW_SOFTWARE_ROOT
-from cubicweb.toolsutils import (Command, register_commands, copy_skeleton,
- create_dir, create_symlink)
+from cubicweb import CW_SOFTWARE_ROOT, BadCommandUsage
+from cubicweb.toolsutils import (Command, copy_skeleton, create_symlink,
+ create_dir)
from cubicweb.cwconfig import CubicWebConfiguration
from logilab import common as lgc
--- a/goa/testlib.py Mon Mar 23 18:53:53 2009 +0100
+++ b/goa/testlib.py Wed Mar 25 10:40:22 2009 +0100
@@ -17,8 +17,8 @@
from cubicweb.goa import db, do_monkey_patch
import_appengine_failed = None
except ImportError, exc:
- raise
- class db:
+ # XXX necessary ?
+ class db:
class Model:
pass
class DummyProperty:
--- a/hercule.py Mon Mar 23 18:53:53 2009 +0100
+++ b/hercule.py Wed Mar 25 10:40:22 2009 +0100
@@ -1,7 +1,7 @@
"""RQL client for cubicweb, connecting to application using pyro
:organization: Logilab
-:copyright: 2001-2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+:copyright: 2001-2009 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
"""
__docformat__ = "restructuredtext en"
@@ -132,11 +132,11 @@
def do_description(self):
"""display the description of the latest result"""
- if self.cursor.description is None:
+ if self.rset.description is None:
print _('No query has been executed')
else:
print '\n'.join([', '.join(line_desc)
- for line_desc in self.cursor.description])
+ for line_desc in self.rset.description])
help_do_description = ('description', "description", _(do_description.__doc__))
@@ -200,7 +200,7 @@
self._previous_lines = []
# search results
try:
- self.cursor.execute(query)
+ self.rset = rset = self.cursor.execute(query)
except:
if self.autocommit:
self.cnx.rollback()
@@ -208,18 +208,18 @@
else:
if self.autocommit:
self.cnx.commit()
- self.handle_result(self.cursor.fetchall(), self.cursor.description)
+ self.handle_result(rset)
- def handle_result(self, result, description):
+ def handle_result(self, rset):
"""display query results if any"""
- if not result:
+ if not rset:
print _('No result matching query')
else:
from logilab.common.ureports import Table
- children = flatten(izip2(description, result), to_string)
- layout = Table(cols=2*len(result[0]), children=children, cheaders=1)
+ children = flatten(izip2(rset.description, rset.rows), to_string)
+ layout = Table(cols=2*len(rset.rows[0]), children=children, cheaders=1)
self._format(self.writer, layout)
- print _('%s results matching query') % len(result)
+ print _('%s results matching query') % rset.rowcount
def display_schema(self, schema):
"""display a schema object"""
--- a/schema.py Mon Mar 23 18:53:53 2009 +0100
+++ b/schema.py Wed Mar 25 10:40:22 2009 +0100
@@ -22,6 +22,7 @@
from rql import parse, nodes, RQLSyntaxError, TypeResolverException
from cubicweb import ETYPE_NAME_MAP, ValidationError, Unauthorized
+from cubicweb import set_log_methods
# XXX <3.2 bw compat
from yams import schema
@@ -981,8 +982,6 @@
CONSTRAINTS['FormatConstraint'] = FormatConstraint
PyFileReader.context['format_constraint'] = format_constraint
-from logging import getLogger
-from cubicweb import set_log_methods
set_log_methods(CubicWebSchemaLoader, getLogger('cubicweb.schemaloader'))
set_log_methods(BootstrapSchemaLoader, getLogger('cubicweb.bootstrapschemaloader'))
set_log_methods(RQLExpression, getLogger('cubicweb.schema'))
--- a/selectors.py Mon Mar 23 18:53:53 2009 +0100
+++ b/selectors.py Wed Mar 25 10:40:22 2009 +0100
@@ -218,10 +218,13 @@
# very basic selectors ########################################################
-@objectify_selector
-def yes(cls, *args, **kwargs):
- """accept everything"""
- return 1
+
+class yes(Selector):
+ """return arbitrary score"""
+ def __init__(self, score=1):
+ self.score = score
+ def __call__(self, *args, **kwargs):
+ return self.score
@objectify_selector
@lltrace
@@ -908,7 +911,7 @@
return a score >= 0
"""
def __init__(self, scorefunc, once_is_enough=False):
- super(EntitySelector, self).__init__(once_is_enough)
+ super(score_entity, self).__init__(once_is_enough)
self.score_entity = scorefunc
--- a/server/repository.py Mon Mar 23 18:53:53 2009 +0100
+++ b/server/repository.py Wed Mar 25 10:40:22 2009 +0100
@@ -394,11 +394,13 @@
return euser
def _build_user(self, session, eid):
+ """return a EUser entity for user with the given eid"""
cls = self.vreg.etype_class('EUser')
rql = cls.fetch_rql(session.user, ['X eid %(x)s'])
rset = session.execute(rql, {'x': eid}, 'x')
assert len(rset) == 1, rset
euser = rset.get_entity(0, 0)
+ # pylint: disable-msg=W0104
# prefetch / cache euser's groups and properties. This is especially
# useful for internal sessions to avoid security insertions
euser.groups
--- a/server/rqlrewrite.py Mon Mar 23 18:53:53 2009 +0100
+++ b/server/rqlrewrite.py Wed Mar 25 10:40:22 2009 +0100
@@ -315,7 +315,7 @@
return cmp_
def visit_mathexpression(self, mexpr):
- cmp_ = nodes.MathExpression(cmp.operator)
+ cmp_ = nodes.MathExpression(mexpr.operator)
for c in cmp.children:
cmp_.append(c.accept(self))
return cmp_
--- a/server/schemahooks.py Mon Mar 23 18:53:53 2009 +0100
+++ b/server/schemahooks.py Wed Mar 25 10:40:22 2009 +0100
@@ -100,6 +100,7 @@
class DropTableOp(PreCommitOperation):
"""actually remove a database from the application's schema"""
+ table = None # make pylint happy
def precommit_event(self):
dropped = self.session.query_data('droppedtables',
default=set(), setdefault=True)
@@ -113,6 +114,7 @@
"""actually remove the attribut's column from entity table in the system
database
"""
+ table = column = None # make pylint happy
def precommit_event(self):
session, table, column = self.session, self.table, self.column
# drop index if any
@@ -236,6 +238,7 @@
class AddEETypeOp(EarlySchemaOperation):
"""actually add the entity type to the application's schema"""
+ eid = None # make pylint happy
def commit_event(self):
eschema = self.schema.add_entity_type(self.kobj)
eschema.eid = self.eid
@@ -296,6 +299,7 @@
class AddERTypeOp(EarlySchemaOperation):
"""actually add the relation type to the application's schema"""
+ eid = None # make pylint happy
def commit_event(self):
rschema = self.schema.add_relation_type(self.kobj)
rschema.set_default_groups()
@@ -355,6 +359,7 @@
constraints are handled by specific hooks
"""
+ entity = None # make pylint happy
def precommit_event(self):
session = self.session
entity = self.entity
@@ -439,6 +444,7 @@
constraints are handled by specific hooks
"""
+ entity = None # make pylint happy
def precommit_event(self):
session = self.session
entity = self.entity
@@ -530,6 +536,7 @@
class UpdateEntityTypeName(SchemaOperation):
"""this operation updates physical storage accordingly"""
+ oldname = newname = None # make pylint happy
def precommit_event(self):
# we need sql to operate physical changes on the system database
@@ -547,6 +554,7 @@
class UpdateRdefOp(SchemaOperation):
"""actually update some properties of a relation definition"""
+ rschema = values = None # make pylint happy
def precommit_event(self):
if 'indexed' in self.values:
@@ -581,6 +589,8 @@
class UpdateRtypeOp(SchemaOperation):
"""actually update some properties of a relation definition"""
+ rschema = values = entity = None # make pylint happy
+
def precommit_event(self):
session = self.session
rschema = self.rschema
@@ -655,6 +665,8 @@
class ConstraintOp(SchemaOperation):
"""actually update constraint of a relation definition"""
+ entity = None # make pylint happy
+
def prepare_constraints(self, rtype, subjtype, objtype):
constraints = rtype.rproperty(subjtype, objtype, 'constraints')
self.constraints = list(constraints)
@@ -708,6 +720,7 @@
class DelConstraintOp(ConstraintOp):
"""actually remove a constraint of a relation definition"""
+ rtype = subjtype = objtype = None # make pylint happy
def precommit_event(self):
self.prepare_constraints(self.rtype, self.subjtype, self.objtype)
--- a/server/sources/pyrorql.py Mon Mar 23 18:53:53 2009 +0100
+++ b/server/sources/pyrorql.py Wed Mar 25 10:40:22 2009 +0100
@@ -24,7 +24,7 @@
from cubicweb.cwconfig import register_persistent_options
from cubicweb.server.sources import AbstractSource, ConnectionWrapper
-class ReplaceByInOperator:
+class ReplaceByInOperator(Exception):
def __init__(self, eids):
self.eids = eids
--- a/server/utils.py Mon Mar 23 18:53:53 2009 +0100
+++ b/server/utils.py Wed Mar 25 10:40:22 2009 +0100
@@ -117,7 +117,7 @@
func()
finally:
self.running_threads.remove(self)
- Thread.__init__(self, target=target)
+ Thread.__init__(self, target=auto_remove_func)
self.running_threads = running_threads
self._name = target.__name__
--- a/sobjects/email.py Mon Mar 23 18:53:53 2009 +0100
+++ b/sobjects/email.py Wed Mar 25 10:40:22 2009 +0100
@@ -14,7 +14,8 @@
already setting the relation
"""
rtype = 'use_email'
-
+ fromeid = toeid = None # make pylint happy
+
def condition(self):
"""check entity has use_email set for the email address"""
return not self.session.unsafe_execute(
--- a/sobjects/hooks.py Mon Mar 23 18:53:53 2009 +0100
+++ b/sobjects/hooks.py Wed Mar 25 10:40:22 2009 +0100
@@ -22,6 +22,7 @@
class AutoDeleteBookmark(PreCommitOperation):
+ beid = None # make pylint happy
def precommit_event(self):
session = self.session
if not self.beid in session.query_data('pendingeids', ()):
--- a/toolsutils.py Mon Mar 23 18:53:53 2009 +0100
+++ b/toolsutils.py Wed Mar 25 10:40:22 2009 +0100
@@ -114,7 +114,7 @@
tfpath = tfpath[:-5]
if not askconfirm or not exists(tfpath) or \
confirm('%s exists, overwrite?' % tfpath):
- fname = fill_templated_file(fpath, tfpath, context)
+ fill_templated_file(fpath, tfpath, context)
print '[generate] %s <-- %s' % (tfpath, fpath)
elif exists(tfpath):
show_diffs(tfpath, fpath, askconfirm)
--- a/web/views/baseforms.py Mon Mar 23 18:53:53 2009 +0100
+++ b/web/views/baseforms.py Wed Mar 25 10:40:22 2009 +0100
@@ -68,6 +68,13 @@
</form>
'''
+ def initialize_varmaker(self):
+ varmaker = self.req.get_page_data('rql_varmaker')
+ if varmaker is None:
+ varmaker = self.req.varmaker
+ self.req.set_page_data('rql_varmaker', varmaker)
+ self.varmaker = varmaker
+
def cell_call(self, row, col, **kwargs):
self.req.add_js( ('cubicweb.ajax.js', ) )
entity = self.complete_entity(row, col)
--- a/web/views/basetemplates.py Mon Mar 23 18:53:53 2009 +0100
+++ b/web/views/basetemplates.py Wed Mar 25 10:40:22 2009 +0100
@@ -297,7 +297,7 @@
req = self.req
pid = make_uid(id(req))
req.pageid = pid
- req.html_headers.define_var('pageid', pid);
+ req.html_headers.define_var('pageid', pid)
class HTMLPageHeader(View):
--- a/web/views/editforms.py Mon Mar 23 18:53:53 2009 +0100
+++ b/web/views/editforms.py Wed Mar 25 10:40:22 2009 +0100
@@ -103,7 +103,8 @@
super(AutomaticEntityForm, self).__init__(*args, **kwargs)
self.entity.complete()
for rschema, target in self.editable_attributes(self.entity):
- field = guess_field(entity.__class__, self.entity.e_schema, rschema, target)
+ field = guess_field(self.entity.__class__, self.entity.e_schema,
+ rschema, target)
self.fields.append(field)
def form_buttons(self):
--- a/web/views/igeocodable.py Mon Mar 23 18:53:53 2009 +0100
+++ b/web/views/igeocodable.py Wed Mar 25 10:40:22 2009 +0100
@@ -67,7 +67,7 @@
def call(self, gmap_key, width=400, height=400, uselabel=True, urlparams=None):
self.req.add_js('http://maps.google.com/maps?file=api&v=2&key=%s' % gmap_key,
- localfile=False);
+ localfile=False)
self.req.add_js( ('cubicweb.widgets.js', 'cubicweb.gmap.js', 'gmap.utility.labeledmarker.js') )
rql = self.rset.printable_rql()
if urlparams is None:
--- a/web/views/magicsearch.py Mon Mar 23 18:53:53 2009 +0100
+++ b/web/views/magicsearch.py Wed Mar 25 10:40:22 2009 +0100
@@ -187,7 +187,7 @@
priority = 4
def preprocess_query(self, uquery, req):
- """"""
+ """try to get rql from an unicode query string"""
args = None
self.req = req
try:
--- a/web/views/tableview.py Mon Mar 23 18:53:53 2009 +0100
+++ b/web/views/tableview.py Wed Mar 25 10:40:22 2009 +0100
@@ -214,7 +214,7 @@
if cellattrs and colindex in cellattrs:
for name, value in cellattrs[colindex].iteritems():
- column.add_attr(name,value)
+ column.add_attr(name, value)
# add column
columns.append(column)
return columns