# HG changeset patch # User Sylvain Thénault # Date 1299754737 -3600 # Node ID 90ddf608fe2b85071774fb4445ffbc6bad8ed3a2 # Parent dca2215c5e8288c6685b9e30aa1c751116c8b608# Parent f239da8e7c396bb88aafc6c411d10870b6d7a131 backport stable diff -r dca2215c5e82 -r 90ddf608fe2b devtools/__init__.py --- a/devtools/__init__.py Tue Mar 08 22:35:19 2011 +0100 +++ b/devtools/__init__.py Thu Mar 10 11:58:57 2011 +0100 @@ -89,8 +89,11 @@ ServerConfiguration.options + tuple((opt, optdict) for opt, optdict in TwistedConfiguration.options if opt in ('anonymous-user', 'anonymous-password'))) + # By default anonymous login are allow but some test need to deny of to + # change the default user. Set it to None to prevent anonymous login. + anonymous_credential = ('anon', 'anon') - def __init__(self, appid, apphome=None, log_threshold=logging.CRITICAL+10): + def __init__(self, appid='data', apphome=None, log_threshold=logging.CRITICAL+10): # must be set before calling parent __init__ if apphome is None: if exists(appid): @@ -112,8 +115,10 @@ def load_configuration(self): super(TestServerConfiguration, self).load_configuration() - self.global_set_option('anonymous-user', 'anon') - self.global_set_option('anonymous-password', 'anon') + if self.anonymous_credential: + user, password = self.anonymous_credential + self.global_set_option('anonymous-user', user) + self.global_set_option('anonymous-password', password) # no undo support in tests self.global_set_option('undo-support', '') diff -r dca2215c5e82 -r 90ddf608fe2b devtools/httptest.py --- a/devtools/httptest.py Tue Mar 08 22:35:19 2011 +0100 +++ b/devtools/httptest.py Thu Mar 10 11:58:57 2011 +0100 @@ -89,8 +89,8 @@ """Class for running test web server. See :class:`CubicWebServerConfig`. Class attributes: - * ` anonymous_logged`: flag telling ifs anonymous user should be log logged - by default (True by default) + * `anonymous_logged`: flag telling if anonymous user should be logged-in + by default (True by default) XXX (syt) s/logged-in/allowed/ ? """ configcls = CubicWebServerConfig # anonymous is logged by default in cubicweb test cases @@ -189,9 +189,6 @@ @classmethod def init_config(cls, config): + if not cls.anonymous_logged: + config.anonymous_credential = None super(CubicWebServerTC, cls).init_config(config) - if not cls.anonymous_logged: - config.global_set_option('anonymous-user', None) - else: - config.global_set_option('anonymous-user', 'anon') - config.global_set_option('anonymous-password', 'anon') diff -r dca2215c5e82 -r 90ddf608fe2b hooks/notification.py --- a/hooks/notification.py Tue Mar 08 22:35:19 2011 +0100 +++ b/hooks/notification.py Thu Mar 10 11:58:57 2011 +0100 @@ -1,4 +1,4 @@ -# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved. +# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved. # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr # # This file is part of CubicWeb. @@ -15,9 +15,8 @@ # # You should have received a copy of the GNU Lesser General Public License along # with CubicWeb. If not, see . -"""some hooks to handle notification on entity's changes +"""some hooks to handle notification on entity's changes""" -""" __docformat__ = "restructuredtext en" from logilab.common.textutils import normalize_text diff -r dca2215c5e82 -r 90ddf608fe2b server/repository.py --- a/server/repository.py Tue Mar 08 22:35:19 2011 +0100 +++ b/server/repository.py Thu Mar 10 11:58:57 2011 +0100 @@ -536,7 +536,13 @@ return self.config[option] pool = self._get_pool() try: - return pool.connection(sourceuri).get_option_value(option, extid) + cnx = pool.connection(sourceuri) + # needed to check connection is valid and usable by the current + # thread + newcnx = self.sources_by_uri[sourceuri].check_connection(cnx) + if newcnx is not None: + cnx = newcnx + return cnx.get_option_value(option, extid) finally: self._free_pool(pool) diff -r dca2215c5e82 -r 90ddf608fe2b web/views/autoform.py --- a/web/views/autoform.py Tue Mar 08 22:35:19 2011 +0100 +++ b/web/views/autoform.py Thu Mar 10 11:58:57 2011 +0100 @@ -785,7 +785,8 @@ def editable_attributes(self, strict=False): """return a list of (relation schema, role) to edit for the entity""" if self.display_fields is not None: - return self.display_fields + schema = self._cw.vreg.schema + return [(schema[rtype], role) for rtype, role in self.display_fields] if self.edited_entity.has_eid() and not self.edited_entity.cw_has_perm('update'): return [] # XXX we should simply put eid in the generated section, no? diff -r dca2215c5e82 -r 90ddf608fe2b web/views/tabs.py --- a/web/views/tabs.py Tue Mar 08 22:35:19 2011 +0100 +++ b/web/views/tabs.py Thu Mar 10 11:58:57 2011 +0100 @@ -46,7 +46,9 @@ reloadable=False, show_spinbox=True, w=None): """a lazy version of wview""" w = w or self.w - urlparams = {'vid' : vid, 'fname' : 'view'} + self._cw.add_js('cubicweb.lazy.js') + urlparams = self._cw.form.copy() + urlparams.update({'vid' : vid, 'fname' : 'view'}) if rql: urlparams['rql'] = rql elif eid: