merge stable branch back into default branch
authorNicolas Chauvat <nicolas.chauvat@logilab.fr>
Fri, 22 May 2009 01:31:21 +0200
changeset 1906 7c266edf28bd
parent 1898 39b37f90a8a4 (current diff)
parent 1905 9c96dd7cc624 (diff)
child 1909 58374d1f6d9b
child 1910 864aa3ea0db5
merge stable branch back into default branch
--- a/doc/book/en/annexes/faq.rst	Fri May 22 00:20:50 2009 +0200
+++ b/doc/book/en/annexes/faq.rst	Fri May 22 01:31:21 2009 +0200
@@ -289,7 +289,7 @@
 
   If your schema has an attribute of type Date or Datetime, you might
   want to format it. First, you should define your preferred format using
-  the site configuration panel ``http://appurl/view?vid=systemepropertiesform``
+  the site configuration panel ``http://appurl/view?vid=systempropertiesform``
   and then set ``ui.date`` and/or ``ui.datetime``.
   Then in the view code, use::
     
--- a/entity.py	Fri May 22 00:20:50 2009 +0200
+++ b/entity.py	Fri May 22 01:31:21 2009 +0200
@@ -379,7 +379,7 @@
         # XXX search_state is web specific
         if getattr(self.req, 'search_state', ('normal',))[0] == 'normal':
             kwargs['base_url'] = self.metainformation()['source'].get('base-url')
-        if method is None or method == 'view':
+        if method in (None, 'view'):
             try:
                 kwargs['_restpath'] = self.rest_path(kwargs.get('base_url'))
             except TypeError:
@@ -404,11 +404,10 @@
                 # make sure url is not ambiguous
                 rql = 'Any COUNT(X) WHERE X is %s, X %s %%(value)s' % (
                     etype, mainattr)
-                if value is not None:
-                    nbresults = self.req.execute(rql, {'value' : value})[0][0]
-                    if nbresults != 1: # ambiguity?
-                        mainattr = 'eid'
-                        path += '/eid'
+                nbresults = self.req.execute(rql, {'value' : value})[0][0]
+                if nbresults != 1: # ambiguity?
+                    mainattr = 'eid'
+                    path += '/eid'
         if mainattr == 'eid':
             if use_ext_eid:
                 value = self.metainformation()['extid']
--- a/server/test/unittest_multisources.py	Fri May 22 00:20:50 2009 +0200
+++ b/server/test/unittest_multisources.py	Fri May 22 01:31:21 2009 +0200
@@ -77,7 +77,7 @@
                            'type': u'Card', 'extid': None})
         externent = rset.get_entity(3, 0)
         metainf = externent.metainformation()
-        self.assertEquals(metainf['source'], {'adapter': 'pyrorql', 'uri': 'extern'})
+        self.assertEquals(metainf['source'], {'adapter': 'pyrorql', 'base-url': 'http://extern.org', 'uri': 'extern'})
         self.assertEquals(metainf['type'], 'Card')
         self.assert_(metainf['extid'])
         etype = self.execute('Any ETN WHERE X is ET, ET name ETN, X eid %(x)s',
--- a/sobjects/test/data/sobjects/__init__.py	Fri May 22 00:20:50 2009 +0200
+++ b/sobjects/test/data/sobjects/__init__.py	Fri May 22 01:31:21 2009 +0200
@@ -1,4 +1,5 @@
+from cubicweb.selectors import implements
 from cubicweb.sobjects.notification import StatusChangeMixIn, NotificationView
 
 class UserStatusChangeView(StatusChangeMixIn, NotificationView):
-    accepts = ('CWUser',)
+    __select__ = NotificationView.__select__ & implements('CWUser')
--- a/sobjects/test/unittest_notification.py	Fri May 22 00:20:50 2009 +0200
+++ b/sobjects/test/unittest_notification.py	Fri May 22 01:31:21 2009 +0200
@@ -78,9 +78,9 @@
 
 yeah
 
-url: http://testing.fr/cubicweb/euser/toto
+url: http://testing.fr/cubicweb/cwuser/toto
 ''')
-        self.assertEquals(v.subject(), 'status changed euser #%s (admin)' % u.eid)
+        self.assertEquals(v.subject(), 'status changed cwuser #%s (admin)' % u.eid)
 
 if __name__ == '__main__':
     unittest_main()
--- a/sobjects/test/unittest_supervising.py	Fri May 22 00:20:50 2009 +0200
+++ b/sobjects/test/unittest_supervising.py	Fri May 22 01:31:21 2009 +0200
@@ -43,23 +43,23 @@
         data = re.sub('/\d+', '/EID', data)
         self.assertTextEquals('''user admin has made the following change(s):
 
-* added euser #EID (toto)
-  http://testing.fr/cubicweb/euser/toto
+* added cwuser #EID (toto)
+  http://testing.fr/cubicweb/cwuser/toto
 
-* added relation in_group from euser #EID to egroup #EID
+* added relation in_group from cwuser #EID to cwgroup #EID
 
 * deleted card #EID (une news !)
 
-* added relation bookmarked_by from bookmark #EID to euser #EID
+* added relation bookmarked_by from bookmark #EID to cwuser #EID
 
 * updated comment #EID (#EID)
   http://testing.fr/cubicweb/comment/EID
 
 * deleted relation comments from comment #EID to card #EID
 
-* changed state of euser #EID (anon)
+* changed state of cwuser #EID (anon)
   from state activated to state deactivated
-  http://testing.fr/cubicweb/euser/anon''',
+  http://testing.fr/cubicweb/cwuser/anon''',
                               data)
         # check prepared email
         op._prepare_email()
--- a/test/unittest_entity.py	Fri May 22 00:20:50 2009 +0200
+++ b/test/unittest_entity.py	Fri May 22 01:31:21 2009 +0200
@@ -374,14 +374,15 @@
         self.assertEquals(person.prenom, u'sylvain')
         self.assertEquals(person.nom, u'thénault')
 
-    def test_metainformation(self):
+    def test_metainformation_and_external_absolute_url(self):
         note = self.add_entity('Note', type=u'z')
         metainf = note.metainformation()
         self.assertEquals(metainf, {'source': {'adapter': 'native', 'uri': 'system'}, 'type': u'Note', 'extid': None})
         self.assertEquals(note.absolute_url(), 'http://testing.fr/cubicweb/note/%s' % note.eid)
         metainf['source'] = metainf['source'].copy()
         metainf['source']['base-url']  = 'http://cubicweb2.com/'
-        self.assertEquals(note.absolute_url(), 'http://cubicweb2.com/note/%s' % note.eid)
+        metainf['extid']  = 1234
+        self.assertEquals(note.absolute_url(), 'http://cubicweb2.com/note/1234')
 
 if __name__ == '__main__':
     from logilab.common.testlib import unittest_main
--- a/web/test/unittest_urlrewrite.py	Fri May 22 00:20:50 2009 +0200
+++ b/web/test/unittest_urlrewrite.py	Fri May 22 01:31:21 2009 +0200
@@ -23,8 +23,8 @@
             ('foo' , dict(rql='Foo F')),
             ('/index' , dict(vid='index2')),
             ('/schema', {'vid': 'schema'}),
-            ('/myprefs', dict(vid='epropertiesform')),
-            ('/siteconfig', dict(vid='systemepropertiesform')),
+            ('/myprefs', dict(vid='propertiesform')),
+            ('/siteconfig', dict(vid='systempropertiesform')),
             ('/manage', dict(vid='manage')),
             ('/notfound', {'vid': '404'}),
             ('/error', {'vid': 'error'}),
--- a/web/test/unittest_views_basecontrollers.py	Fri May 22 00:20:50 2009 +0200
+++ b/web/test/unittest_views_basecontrollers.py	Fri May 22 01:31:21 2009 +0200
@@ -1,7 +1,7 @@
 """cubicweb.web.views.basecontrollers unit tests"""
 import simplejson
 
-from logilab.common.testlib import unittest_main
+from logilab.common.testlib import unittest_main, mock_object
 
 from cubicweb import Binary, Unauthorized
 from cubicweb.devtools._apptest import TestEnvironment
@@ -533,7 +533,7 @@
         rset = self.john.as_rset()
         rset.req = req
         self.assertTextEquals(ctrl.publish(),
-                              xhtml_wrap(ctrl.view('primary', rset)))
+                              xhtml_wrap(mock_object(req=req), ctrl.view('primary', rset)))
 
 #     def test_json_exec(self):
 #         rql = 'Any T,N WHERE T is Tag, T name N'
@@ -562,7 +562,7 @@
                          ('eid', 'firstname:%s' % eid, '__maineid', '__type:%s'% eid, 'edits-firstname:%s' % eid ),
                          (str(eid), u'Remi', str(eid), 'CWUser', self.john.firstname),
                          'firstname',
-                         eid)
+                         eid, 'default_value')
         self.commit()
         rset = self.execute('CWUser P')
         # make sure we did not insert a new cwuser here
--- a/web/test/unittest_viewselector.py	Fri May 22 00:20:50 2009 +0200
+++ b/web/test/unittest_viewselector.py	Fri May 22 01:31:21 2009 +0200
@@ -66,13 +66,13 @@
         self.assertListEqual(self.pviews(req, None),
                              [('changelog', wdoc.ChangeLogView),
                               ('debug', debug.DebugView),
-                              ('epropertiesform', cwproperties.EPropertiesForm),
                               ('index', startup.IndexView),
                               ('info', management.ProcessInformationView),
                               ('manage', startup.ManageView),
                               ('owl', owl.OWLView),
+                              ('propertiesform', cwproperties.CWPropertiesForm),
                               ('schema', startup.SchemaView),
-                              ('systemepropertiesform', cwproperties.SystemEPropertiesForm)])
+                              ('systempropertiesform', cwproperties.SystemCWPropertiesForm)])
 
     def test_possible_views_noresult(self):
         rset, req = self.env.get_rset_and_req('Any X WHERE X eid 999999')