backport stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 11 Jan 2012 18:29:33 +0100
changeset 8159 f8678956bd05
parent 8158 2ee254e74382 (current diff)
parent 8157 098c83a99807 (diff)
child 8161 6f4229eb8178
backport stable
debian/control
web/views/tableview.py
--- a/debian/control	Wed Jan 11 18:29:21 2012 +0100
+++ b/debian/control	Wed Jan 11 18:29:33 2012 +0100
@@ -12,7 +12,7 @@
 # python-sphinx, python-logilab-common, python-unittest2, logilab-doctools, logilab-xml
 Standards-Version: 3.9.1
 Homepage: http://www.cubicweb.org
-XS-Python-Version: >= 2.5, << 2.7
+XS-Python-Version: >= 2.5, << 3.0
 
 Package: cubicweb
 Architecture: all
--- a/doc/book/en/annexes/rql/language.rst	Wed Jan 11 18:29:21 2012 +0100
+++ b/doc/book/en/annexes/rql/language.rst	Wed Jan 11 18:29:33 2012 +0100
@@ -354,17 +354,43 @@
   tagged by the expected tag. This implies that : you won't get any result if the
   in_state or tag
 
+Another common case where you may want to use ``EXISTS`` is when you
+find yourself using ``DISTINCT`` at the beginning of your query to
+remove duplicate results. The typical case is when you have a
+multivalued relation such as Version version_of Project and you want
+to retrieve projects which have a version:
 
-You can also use the question mark (`?`) to mark optional relations which allow
+.. sourcecode:: sql
+
+  Any P WHERE V version_of P
+
+will return each project number of versions times. So you may be
+tempted to use:
+
+.. sourcecode:: sql
+
+  DISTINCT ANY P WHERE V version_of P
+
+This will work, but is not efficient, as it will use the ``SELECT
+DISTINCT`` SQL predicate, which needs to retrieve all projects, then
+sort them and discard duplicates, which can have a very high cost for
+large result sets. So the best way to write this is:
+
+.. sourcecode:: sql
+
+  ANY P WHERE EXISTS V version_of P
+
+
+You can also use the question mark (`?`) to mark optional relations. This allows
 you to select entities related **or not** to another. It is a similar concept
-that the `Left outer join`_:
+to `Left outer join`_:
 
     the result of a left outer join (or simply left join) for table A and B
     always contains all records of the "left" table (A), even if the
     join-condition does not find any matching record in the "right" table (B).
 
-You must use the `?` behind a variable to specify that the relation toward it
-is optional. For instance:
+You must use the `?` behind a variable to specify that the relation to
+that variable is optional. For instance:
 
 - Bugs of a project attached or not to a version
 
@@ -373,7 +399,7 @@
        Any X, V WHERE X concerns P, P eid 42, X corrected_in V?
 
   You will get a result set containing all the project's tickets, with either the
-  version in which it's corrected or None for tickets not related to a version.
+  version in which it's fixed or None for tickets not related to a version.
 
 
 - All cards and the project they document if any
--- a/etwist/server.py	Wed Jan 11 18:29:21 2012 +0100
+++ b/etwist/server.py	Wed Jan 11 18:29:33 2012 +0100
@@ -340,7 +340,7 @@
             self.appli.connect(req)
         except Redirect, ex:
             return self.redirect(request=req, location=ex.location)
-        if https and req.session.anonymous_session:
+        if https and req.session.anonymous_session and self.config['https-deny-anonymous']:
             # don't allow anonymous on https connection
             return self.request_auth(request=req)
         if self.url_rewriter is not None:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/migration/3.14.3_Any.py	Wed Jan 11 18:29:33 2012 +0100
@@ -0,0 +1,2 @@
+# keep the same behavior on existing instance but use the new one on new instance.
+config['https-deny-anonymous'] = True
--- a/rqlrewrite.py	Wed Jan 11 18:29:21 2012 +0100
+++ b/rqlrewrite.py	Wed Jan 11 18:29:33 2012 +0100
@@ -295,7 +295,7 @@
                     if parent is None:
                         self.current_statement().remove_node(new, undefine=True)
                     else:
-                        parent.parent.replace(or_, or_.children[0])
+                        grandpa.replace(or_, parent)
                         self._cleanup_inserted(new)
                     raise
                 else:
--- a/server/sources/storages.py	Wed Jan 11 18:29:21 2012 +0100
+++ b/server/sources/storages.py	Wed Jan 11 18:29:33 2012 +0100
@@ -113,6 +113,8 @@
 class BytesFileSystemStorage(Storage):
     """store Bytes attribute value on the file system"""
     def __init__(self, defaultdir, fsencoding='utf-8'):
+        if type(defaultdir) is unicode:
+            defaultdir = defaultdir.encode(fsencoding)
         self.default_directory = defaultdir
         self.fsencoding = fsencoding
 
@@ -201,7 +203,8 @@
         name = entity.cw_attr_metadata(attr, 'name')
         if name is not None:
             basename.append(name.encode(self.fsencoding))
-        fspath = uniquify_path(self.default_directory, '_'.join(basename))
+        fspath = uniquify_path(self.default_directory,
+                               '_'.join(basename))
         if fspath is None:
             msg = entity._cw._('failed to uniquify path (%s, %s)') % (
                 self.default_directory, '_'.join(basename))
--- a/server/test/data/ldap_test.ldif	Wed Jan 11 18:29:21 2012 +0100
+++ b/server/test/data/ldap_test.ldif	Wed Jan 11 18:29:33 2012 +0100
@@ -31,6 +31,7 @@
 gecos: Sylvain Thenault
 mail: sylvain.thenault@logilab.fr
 mail: syt@logilab.fr
+userPassword: {SSHA}v/8xJQP3uoaTBZz1T7Y0B3qOxRN1cj7D
 
 dn: uid=adim,ou=People,dc=cubicweb,dc=test
 loginShell: /bin/bash
@@ -52,4 +53,5 @@
 gecos: Adrien Di Mascio
 mail: adim@logilab.fr
 mail: adrien.dimascio@logilab.fr
+userPassword: {SSHA}cPQOWqkkLDlfWFwxcl1m8V2JdySQBHfS
 
--- a/server/test/unittest_ldapuser.py	Wed Jan 11 18:29:21 2012 +0100
+++ b/server/test/unittest_ldapuser.py	Wed Jan 11 18:29:33 2012 +0100
@@ -32,9 +32,6 @@
 
 from cubicweb.server.sources.ldapuser import *
 
-SYT = 'syt'
-SYT_EMAIL = 'Sylvain Thenault'
-ADIM = 'adim'
 CONFIG = u'''host=%s
 user-base-dn=ou=People,dc=cubicweb,dc=test
 user-scope=ONELEVEL
@@ -45,24 +42,6 @@
 '''
 
 
-def nopwd_authenticate(self, session, login, password):
-    """used to monkey patch the source to get successful authentication without
-    upassword checking
-    """
-    assert login, 'no login!'
-    searchfilter = [filter_format('(%s=%s)', (self.user_login_attr, login))]
-    searchfilter.extend(self.base_filters)
-    searchstr = '(&%s)' % ''.join(searchfilter)
-    # first search the user
-    try:
-        user = self._search(session, self.user_base_dn, self.user_base_scope,
-                            searchstr)[0]
-    except IndexError:
-        # no such user
-        raise AuthenticationError()
-    # don't check upassword !
-    return self.repo.extid2eid(self, user['dn'], 'CWUser', session)
-
 def setUpModule(*args):
     create_slapd_configuration(LDAPUserSourceTC.config)
 
@@ -91,7 +70,7 @@
     host = 'localhost:%s' % port
     ldapuri = 'ldap://%s' % host
     cmdline = ["/usr/sbin/slapd", "-f",  slapdconf,  "-h",  ldapuri, "-d", "0"]
-    print "Starting slapd on", ldapuri
+    print 'Starting slapd:', ' '.join(cmdline)
     slapd_process = subprocess.Popen(cmdline)
     time.sleep(0.2)
     if slapd_process.poll() is None:
@@ -121,20 +100,11 @@
     @classmethod
     def pre_setup_database(cls, session, config):
         session.create_entity('CWSource', name=u'ldapuser', type=u'ldapuser',
-                                    config=CONFIG)
+                              config=CONFIG)
         session.commit()
         # XXX keep it there
         session.execute('CWUser U')
 
-    def patch_authenticate(self):
-        self._orig_authenticate = LDAPUserSource.authenticate
-        LDAPUserSource.authenticate = nopwd_authenticate
-
-    def tearDown(self):
-        if hasattr(self, '_orig_authenticate'):
-            LDAPUserSource.authenticate = self._orig_authenticate
-        CubicWebTC.tearDown(self)
-
     def test_authenticate(self):
         source = self.repo.sources_by_uri['ldapuser']
         self.session.set_cnxset()
@@ -147,50 +117,50 @@
 
     def test_base(self):
         # check a known one
-        rset = self.sexecute('CWUser X WHERE X login %(login)s', {'login': SYT})
+        rset = self.sexecute('CWUser X WHERE X login %(login)s', {'login': 'syt'})
         e = rset.get_entity(0, 0)
-        self.assertEqual(e.login, SYT)
+        self.assertEqual(e.login, 'syt')
         e.complete()
         self.assertEqual(e.creation_date, None)
         self.assertEqual(e.modification_date, None)
         self.assertEqual(e.firstname, None)
         self.assertEqual(e.surname, None)
         self.assertEqual(e.in_group[0].name, 'users')
-        self.assertEqual(e.owned_by[0].login, SYT)
+        self.assertEqual(e.owned_by[0].login, 'syt')
         self.assertEqual(e.created_by, ())
-        self.assertEqual(e.primary_email[0].address, SYT_EMAIL)
+        self.assertEqual(e.primary_email[0].address, 'Sylvain Thenault')
         # email content should be indexed on the user
         rset = self.sexecute('CWUser X WHERE X has_text "thenault"')
         self.assertEqual(rset.rows, [[e.eid]])
 
     def test_not(self):
-        eid = self.sexecute('CWUser X WHERE X login %(login)s', {'login': SYT})[0][0]
+        eid = self.sexecute('CWUser X WHERE X login %(login)s', {'login': 'syt'})[0][0]
         rset = self.sexecute('CWUser X WHERE NOT X eid %s' % eid)
         self.assert_(rset)
         self.assert_(not eid in (r[0] for r in rset))
 
     def test_multiple(self):
-        seid = self.sexecute('CWUser X WHERE X login %(login)s', {'login': SYT})[0][0]
-        aeid = self.sexecute('CWUser X WHERE X login %(login)s', {'login': ADIM})[0][0]
+        seid = self.sexecute('CWUser X WHERE X login %(login)s', {'login': 'syt'})[0][0]
+        aeid = self.sexecute('CWUser X WHERE X login %(login)s', {'login': 'adim'})[0][0]
         rset = self.sexecute('CWUser X, Y WHERE X login %(syt)s, Y login %(adim)s',
-                            {'syt': SYT, 'adim': ADIM})
+                            {'syt': 'syt', 'adim': 'adim'})
         self.assertEqual(rset.rows, [[seid, aeid]])
         rset = self.sexecute('Any X,Y,L WHERE X login L, X login %(syt)s, Y login %(adim)s',
-                            {'syt': SYT, 'adim': ADIM})
-        self.assertEqual(rset.rows, [[seid, aeid, SYT]])
+                            {'syt': 'syt', 'adim': 'adim'})
+        self.assertEqual(rset.rows, [[seid, aeid, 'syt']])
 
     def test_in(self):
-        seid = self.sexecute('CWUser X WHERE X login %(login)s', {'login': SYT})[0][0]
-        aeid = self.sexecute('CWUser X WHERE X login %(login)s', {'login': ADIM})[0][0]
-        rset = self.sexecute('Any X,L ORDERBY L WHERE X login IN("%s", "%s"), X login L' % (SYT, ADIM))
-        self.assertEqual(rset.rows, [[aeid, ADIM], [seid, SYT]])
+        seid = self.sexecute('CWUser X WHERE X login %(login)s', {'login': 'syt'})[0][0]
+        aeid = self.sexecute('CWUser X WHERE X login %(login)s', {'login': 'adim'})[0][0]
+        rset = self.sexecute('Any X,L ORDERBY L WHERE X login IN("%s", "%s"), X login L' % ('syt', 'adim'))
+        self.assertEqual(rset.rows, [[aeid, 'adim'], [seid, 'syt']])
 
     def test_relations(self):
-        eid = self.sexecute('CWUser X WHERE X login %(login)s', {'login': SYT})[0][0]
+        eid = self.sexecute('CWUser X WHERE X login %(login)s', {'login': 'syt'})[0][0]
         rset = self.sexecute('Any X,E WHERE X is CWUser, X login L, X primary_email E')
         self.assert_(eid in (r[0] for r in rset))
         rset = self.sexecute('Any X,L,E WHERE X is CWUser, X login L, X primary_email E')
-        self.assert_(SYT in (r[1] for r in rset))
+        self.assert_('syt' in (r[1] for r in rset))
 
     def test_count(self):
         nbusers = self.sexecute('Any COUNT(X) WHERE X is CWUser')[0][0]
@@ -199,15 +169,15 @@
         self.assert_(nbusers < 30, nbusers)
 
     def test_upper(self):
-        eid = self.sexecute('CWUser X WHERE X login %(login)s', {'login': SYT})[0][0]
+        eid = self.sexecute('CWUser X WHERE X login %(login)s', {'login': 'syt'})[0][0]
         rset = self.sexecute('Any UPPER(L) WHERE X eid %s, X login L' % eid)
-        self.assertEqual(rset[0][0], SYT.upper())
+        self.assertEqual(rset[0][0], 'syt'.upper())
 
     def test_unknown_attr(self):
-        eid = self.sexecute('CWUser X WHERE X login %(login)s', {'login': SYT})[0][0]
+        eid = self.sexecute('CWUser X WHERE X login %(login)s', {'login': 'syt'})[0][0]
         rset = self.sexecute('Any L,C,M WHERE X eid %s, X login L, '
                             'X creation_date C, X modification_date M' % eid)
-        self.assertEqual(rset[0][0], SYT)
+        self.assertEqual(rset[0][0], 'syt')
         self.assertEqual(rset[0][1], None)
         self.assertEqual(rset[0][2], None)
 
@@ -221,20 +191,19 @@
 
     def test_or(self):
         rset = self.sexecute('DISTINCT Any X WHERE X login %(login)s OR (X in_group G, G name "managers")',
-                            {'login': SYT})
+                            {'login': 'syt'})
         self.assertEqual(len(rset), 2, rset.rows) # syt + admin
 
     def test_nonregr_set_owned_by(self):
         # test that when a user coming from ldap is triggering a transition
         # the related TrInfo has correct owner information
-        self.sexecute('SET X in_group G WHERE X login %(syt)s, G name "managers"', {'syt': SYT})
+        self.sexecute('SET X in_group G WHERE X login %(syt)s, G name "managers"', {'syt': 'syt'})
         self.commit()
-        syt = self.sexecute('CWUser X WHERE X login %(login)s', {'login': SYT}).get_entity(0, 0)
+        syt = self.sexecute('CWUser X WHERE X login %(login)s', {'login': 'syt'}).get_entity(0, 0)
         self.assertEqual([g.name for g in syt.in_group], ['managers', 'users'])
-        self.patch_authenticate()
-        cnx = self.login(SYT, password='dummypassword')
+        cnx = self.login('syt', password='syt')
         cu = cnx.cursor()
-        adim = cu.execute('CWUser X WHERE X login %(login)s', {'login': ADIM}).get_entity(0, 0)
+        adim = cu.execute('CWUser X WHERE X login %(login)s', {'login': 'adim'}).get_entity(0, 0)
         iworkflowable = adim.cw_adapt_to('IWorkflowable')
         iworkflowable.fire_transition('deactivate')
         try:
@@ -242,7 +211,7 @@
             adim.cw_clear_all_caches()
             self.assertEqual(adim.in_state[0].name, 'deactivated')
             trinfo = iworkflowable.latest_trinfo()
-            self.assertEqual(trinfo.owned_by[0].login, SYT)
+            self.assertEqual(trinfo.owned_by[0].login, 'syt')
             # select from_state to skip the user's creation TrInfo
             rset = self.sexecute('Any U ORDERBY D DESC WHERE WF wf_info_for X,'
                                 'WF creation_date D, WF from_state FS,'
@@ -252,9 +221,9 @@
         finally:
             # restore db state
             self.restore_connection()
-            adim = self.sexecute('CWUser X WHERE X login %(login)s', {'login': ADIM}).get_entity(0, 0)
+            adim = self.sexecute('CWUser X WHERE X login %(login)s', {'login': 'adim'}).get_entity(0, 0)
             adim.cw_adapt_to('IWorkflowable').fire_transition('activate')
-            self.sexecute('DELETE X in_group G WHERE X login %(syt)s, G name "managers"', {'syt': SYT})
+            self.sexecute('DELETE X in_group G WHERE X login %(syt)s, G name "managers"', {'syt': 'syt'})
 
     def test_same_column_names(self):
         self.sexecute('Any X, Y WHERE X copain Y, X login "comme", Y login "cochon"')
@@ -262,17 +231,17 @@
     def test_multiple_entities_from_different_sources(self):
         req = self.request()
         self.create_user(req, 'cochon')
-        self.assertTrue(self.sexecute('Any X,Y WHERE X login %(syt)s, Y login "cochon"', {'syt': SYT}))
+        self.assertTrue(self.sexecute('Any X,Y WHERE X login %(syt)s, Y login "cochon"', {'syt': 'syt'}))
 
     def test_exists1(self):
         self.session.set_cnxset()
         self.session.create_entity('CWGroup', name=u'bougloup1')
         self.session.create_entity('CWGroup', name=u'bougloup2')
         self.sexecute('SET U in_group G WHERE G name ~= "bougloup%", U login "admin"')
-        self.sexecute('SET U in_group G WHERE G name = "bougloup1", U login %(syt)s', {'syt': SYT})
+        self.sexecute('SET U in_group G WHERE G name = "bougloup1", U login %(syt)s', {'syt': 'syt'})
         rset = self.sexecute('Any L,SN ORDERBY L WHERE X in_state S, '
                              'S name SN, X login L, EXISTS(X in_group G, G name ~= "bougloup%")')
-        self.assertEqual(rset.rows, [['admin', 'activated'], [SYT, 'activated']])
+        self.assertEqual(rset.rows, [['admin', 'activated'], ['syt', 'activated']])
 
     def test_exists2(self):
         req = self.request()
@@ -289,11 +258,11 @@
         self.create_user(req, 'cochon')
         self.sexecute('SET X copain Y WHERE X login "comme", Y login "cochon"')
         self.assertTrue(self.sexecute('Any X, Y WHERE X copain Y, X login "comme", Y login "cochon"'))
-        self.sexecute('SET X copain Y WHERE X login %(syt)s, Y login "cochon"', {'syt': SYT})
-        self.assertTrue(self.sexecute('Any X, Y WHERE X copain Y, X login %(syt)s, Y login "cochon"', {'syt': SYT}))
+        self.sexecute('SET X copain Y WHERE X login %(syt)s, Y login "cochon"', {'syt': 'syt'})
+        self.assertTrue(self.sexecute('Any X, Y WHERE X copain Y, X login %(syt)s, Y login "cochon"', {'syt': 'syt'}))
         rset = self.sexecute('Any GN,L WHERE X in_group G, X login L, G name GN, G name "managers" '
                              'OR EXISTS(X copain T, T login in ("comme", "cochon"))')
-        self.assertEqual(sorted(rset.rows), [['managers', 'admin'], ['users', 'comme'], ['users', SYT]])
+        self.assertEqual(sorted(rset.rows), [['managers', 'admin'], ['users', 'comme'], ['users', 'syt']])
 
     def test_exists4(self):
         req = self.request()
@@ -303,7 +272,7 @@
         self.sexecute('SET X copain Y WHERE X login "comme", Y login "cochon"')
         self.sexecute('SET X copain Y WHERE X login "cochon", Y login "cochon"')
         self.sexecute('SET X copain Y WHERE X login "comme", Y login "billy"')
-        self.sexecute('SET X copain Y WHERE X login %(syt)s, Y login "billy"', {'syt': SYT})
+        self.sexecute('SET X copain Y WHERE X login %(syt)s, Y login "billy"', {'syt': 'syt'})
         # search for group name, login where
         #   CWUser copain with "comme" or "cochon" AND same login as the copain
         # OR
@@ -315,7 +284,7 @@
                            'EXISTS(X in_state S, S name "activated", NOT X copain T2, T2 login "billy")')
         all = self.sexecute('Any GN, L WHERE X in_group G, X login L, G name GN')
         all.rows.remove(['users', 'comme'])
-        all.rows.remove(['users', SYT])
+        all.rows.remove(['users', 'syt'])
         self.assertEqual(sorted(rset.rows), sorted(all.rows))
 
     def test_exists5(self):
@@ -326,17 +295,17 @@
         self.sexecute('SET X copain Y WHERE X login "comme", Y login "cochon"')
         self.sexecute('SET X copain Y WHERE X login "cochon", Y login "cochon"')
         self.sexecute('SET X copain Y WHERE X login "comme", Y login "billy"')
-        self.sexecute('SET X copain Y WHERE X login %(syt)s, Y login "cochon"', {'syt': SYT})
+        self.sexecute('SET X copain Y WHERE X login %(syt)s, Y login "cochon"', {'syt': 'syt'})
         rset= self.sexecute('Any L WHERE X login L, '
                            'EXISTS(X copain T, T login in ("comme", "cochon")) AND '
                            'NOT EXISTS(X copain T2, T2 login "billy")')
-        self.assertEqual(sorted(rset.rows), [['cochon'], [SYT]])
+        self.assertEqual(sorted(rset.rows), [['cochon'], ['syt']])
         rset= self.sexecute('Any GN,L WHERE X in_group G, X login L, G name GN, '
                            'EXISTS(X copain T, T login in ("comme", "cochon")) AND '
                            'NOT EXISTS(X copain T2, T2 login "billy")')
         self.assertEqual(sorted(rset.rows), [['guests', 'cochon'],
                                               ['users', 'cochon'],
-                                              ['users', SYT]])
+                                              ['users', 'syt']])
 
     def test_cd_restriction(self):
         rset = self.sexecute('CWUser X WHERE X creation_date > "2009-02-01"')
@@ -359,32 +328,32 @@
 
     def test_security1(self):
         cu = self._init_security_test()
-        rset = cu.execute('CWUser X WHERE X login %(login)s', {'login': SYT})
+        rset = cu.execute('CWUser X WHERE X login %(login)s', {'login': 'syt'})
         self.assertEqual(rset.rows, [])
         rset = cu.execute('Any X WHERE X login "iaminguestsgrouponly"')
         self.assertEqual(len(rset.rows), 1)
 
     def test_security2(self):
         cu = self._init_security_test()
-        rset = cu.execute('Any X WHERE X has_text %(syt)s', {'syt': SYT})
+        rset = cu.execute('Any X WHERE X has_text %(syt)s', {'syt': 'syt'})
         self.assertEqual(rset.rows, [])
         rset = cu.execute('Any X WHERE X has_text "iaminguestsgrouponly"')
         self.assertEqual(len(rset.rows), 1)
 
     def test_security3(self):
         cu = self._init_security_test()
-        rset = cu.execute('Any F WHERE X has_text %(syt)s, X firstname F', {'syt': SYT})
+        rset = cu.execute('Any F WHERE X has_text %(syt)s, X firstname F', {'syt': 'syt'})
         self.assertEqual(rset.rows, [])
         rset = cu.execute('Any F WHERE X has_text "iaminguestsgrouponly", X firstname F')
         self.assertEqual(rset.rows, [[None]])
 
     def test_copy_to_system_source(self):
         source = self.repo.sources_by_uri['ldapuser']
-        eid = self.sexecute('CWUser X WHERE X login %(login)s', {'login': SYT})[0][0]
+        eid = self.sexecute('CWUser X WHERE X login %(login)s', {'login': 'syt'})[0][0]
         self.sexecute('SET X cw_source S WHERE X eid %(x)s, S name "system"', {'x': eid})
         self.commit()
         source.reset_caches()
-        rset = self.sexecute('CWUser X WHERE X login %(login)s', {'login': SYT})
+        rset = self.sexecute('CWUser X WHERE X login %(login)s', {'login': 'syt'})
         self.assertEqual(len(rset), 1)
         e = rset.get_entity(0, 0)
         self.assertEqual(e.eid, eid)
@@ -396,7 +365,7 @@
         self.assertTrue(e.modification_date)
         # XXX test some password has been set
         source.synchronize()
-        rset = self.sexecute('CWUser X WHERE X login %(login)s', {'login': SYT})
+        rset = self.sexecute('CWUser X WHERE X login %(login)s', {'login': 'syt'})
         self.assertEqual(len(rset), 1)
 
     def test_nonregr1(self):
--- a/web/data/cubicweb.gmap.js	Wed Jan 11 18:29:21 2012 +0100
+++ b/web/data/cubicweb.gmap.js	Wed Jan 11 18:29:33 2012 +0100
@@ -23,9 +23,24 @@
             var jsonurl = wdgnode.getAttribute('cubicweb:loadurl');
             var self = this; // bind this to a local variable
             jQuery.getJSON(jsonurl, function(geodata) {
+                var zoomLevel;
+                var center;
+                var latlngbounds = new GLatLngBounds( );
+                for (var i = 0; i < geodata.markers.length; i++) {
+                    var marker = geodata.markers[i];
+                    var latlng = new GLatLng(marker.latitude, marker.longitude);
+                    latlngbounds.extend( latlng );
+                }
+                if (geodata.zoomlevel) {
+                    zoomLevel = geodata.zoomlevel;
+                } else {
+                    zoomLevel = map.getBoundsZoomLevel( latlngbounds ) - 1;
                 if (geodata.center) {
-                    var zoomLevel = geodata.zoomlevel;
-                    map.setCenter(new GLatLng(geodata.center.latitude, geodata.center.longitude), zoomLevel);
+                    center = new GLatng(geodata.center.latitude, geodata.center.longitude);
+                } else {
+                    center = latlngbounds.getCenter();
+                }
+                map.setCenter(center, zoomLevel);
                 }
                 for (var i = 0; i < geodata.markers.length; i++) {
                     var marker = geodata.markers[i];
--- a/web/views/calendar.py	Wed Jan 11 18:29:21 2012 +0100
+++ b/web/views/calendar.py	Wed Jan 11 18:29:33 2012 +0100
@@ -26,7 +26,7 @@
 from logilab.mtconverter import xml_escape
 from logilab.common.date import todatetime
 
-from cubicweb.utils import json_dumps
+from cubicweb.utils import json_dumps, make_uid
 from cubicweb.interfaces import ICalendarable
 from cubicweb.selectors import implements, adaptable
 from cubicweb.view import EntityView, EntityAdapter, implements_adapter_compat
@@ -198,9 +198,10 @@
         self._cw.demote_to_html()
         self._cw.add_css(('fullcalendar.css', 'cubicweb.calendar.css'))
         self._cw.add_js(('jquery.ui.js', 'fullcalendar.min.js', 'jquery.qtip.min.js'))
+        self.calendar_id = 'cal' + make_uid('uid')
         self.add_onload()
         # write calendar div to load jquery fullcalendar object
-        self.w(u'<div id="calendar"></div>')
+        self.w(u'<div id="%s"></div>' % self.calendar_id)
 
 
     def add_onload(self):
@@ -220,9 +221,9 @@
           // allow to have html tags in event's title
           $element.find('span.fc-event-title').html($element.find('span.fc-event-title').text());
         };
-        $("#calendar").fullCalendar(options);
+        $("#%s").fullCalendar(options);
         """ #"
-        self._cw.add_onload(js % json_dumps(fullcalendar_options))
+        self._cw.add_onload(js % (json_dumps(fullcalendar_options), self.calendar_id))
 
 
     def get_events(self):
--- a/web/views/cwsources.py	Wed Jan 11 18:29:21 2012 +0100
+++ b/web/views/cwsources.py	Wed Jan 11 18:29:33 2012 +0100
@@ -47,6 +47,8 @@
 _abaa.tag_object_of(('CWDataImport', 'cw_import_of', '*'), False)
 
 _afs = uicfg.autoform_section
+_afs.tag_attribute(('CWSource', 'latest_retrieval'), 'main', 'hidden')
+_afs.tag_attribute(('CWSource', 'in_synchronization'), 'main', 'hidden')
 _afs.tag_object_of(('*', 'cw_for_source', 'CWSource'), 'main', 'hidden')
 
 _affk = uicfg.autoform_field_kwargs
--- a/web/views/igeocodable.py	Wed Jan 11 18:29:21 2012 +0100
+++ b/web/views/igeocodable.py	Wed Jan 11 18:29:33 2012 +0100
@@ -62,7 +62,7 @@
     content_type = 'application/json'
 
     def call(self):
-        zoomlevel = self._cw.form.pop('zoomlevel', 8)
+        zoomlevel = self._cw.form.pop('zoomlevel', None)
         extraparams = self._cw.form.copy()
         extraparams.pop('vid', None)
         extraparams.pop('rql', None)
@@ -74,15 +74,13 @@
                 continue
             markers.append(self.build_marker_data(entity, igeocodable,
                                                   extraparams))
-        center = {
-            'latitude': sum(marker['latitude'] for marker in markers) / len(markers),
-            'longitude': sum(marker['longitude'] for marker in markers) / len(markers),
-            }
+        if not markers:
+            return
         geodata = {
-            'zoomlevel': int(zoomlevel),
-            'center': center,
             'markers': markers,
             }
+        if zoomlevel:
+            geodata['zoomlevel'] = zoomlevel
         self.w(json_dumps(geodata))
 
     def build_marker_data(self, entity, igeocodable, extraparams):
--- a/web/views/tableview.py	Wed Jan 11 18:29:21 2012 +0100
+++ b/web/views/tableview.py	Wed Jan 11 18:29:33 2012 +0100
@@ -507,11 +507,10 @@
 
 class RsetTableColRenderer(AbstractColumnRenderer):
     """Default renderer for :class:`RsetTableView`."""
-    default_cellvid = 'incontext'
 
-    def __init__(self, cellvid=None, **kwargs):
+    def __init__(self, cellvid, **kwargs):
         super(RsetTableColRenderer, self).__init__(**kwargs)
-        self.cellvid = cellvid or self.default_cellvid
+        self.cellvid = cellvid
 
     def bind(self, view, colid):
         super(RsetTableColRenderer, self).bind(view, colid)
--- a/web/webconfig.py	Wed Jan 11 18:29:21 2012 +0100
+++ b/web/webconfig.py	Wed Jan 11 18:29:33 2012 +0100
@@ -115,6 +115,16 @@
           'where the cubicweb web server is listening on port 8080.',
           'group': 'main', 'level': 3,
           }),
+        ('https-deny-anonymous',
+         {'type': 'string',
+          'default': False,
+          'help': 'Prevent anonymous user to browse thought https version of '
+                  'the site (https-url). Login form will then be displayed '
+                  'until logged',
+          'group': 'web',
+          'level': 2
+         }
+          ),
         ('auth-mode',
          {'type' : 'choice',
           'choices' : ('cookie', 'http'),