[merge] backport stable
authorAurelien Campeas <aurelien.campeas@logilab.fr>
Tue, 30 Nov 2010 15:05:07 +0100
changeset 6712 3e6cd6048be8
parent 6689 b00f31b3b045 (current diff)
parent 6711 df56089ba9f9 (diff)
child 6723 a2ccbcbb08a6
[merge] backport stable
--- a/.hgtags	Fri Nov 05 17:11:40 2010 +0100
+++ b/.hgtags	Tue Nov 30 15:05:07 2010 +0100
@@ -167,6 +167,8 @@
 49f1226f2fab6d9ff17eb27d5a66732a4e5b5add cubicweb-debian-version-3.10.4-1
 df0b2de62cec10c84a2fff5233db05852cbffe93 cubicweb-version-3.9.9
 1ba51b00fc44faa0d6d57448000aaa1fd5c6ab57 cubicweb-debian-version-3.9.9-1
+b7db1f59355832a409d2032e19c84cfffdb3b265 cubicweb-debian-version-3.9.9-2
+09c98763ae9d43616d047c1b25d82b4e41a4362f cubicweb-debian-version-3.9.9-3
 3829498510a754b1b8a40582cb8dcbca9145fc9d cubicweb-version-3.10.4
 d73733479a3af453f06b849ed88d120784ce9224 cubicweb-version-3.10.4
 49f1226f2fab6d9ff17eb27d5a66732a4e5b5add cubicweb-debian-version-3.10.4-1
--- a/debian/changelog	Fri Nov 05 17:11:40 2010 +0100
+++ b/debian/changelog	Tue Nov 30 15:05:07 2010 +0100
@@ -34,6 +34,18 @@
 
  -- Sylvain Thénault <sylvain.thenault@logilab.fr>  Wed, 13 Oct 2010 22:18:39 +0200
 
+cubicweb (3.9.9-3) unstable; urgency=low
+
+  * cubicweb-common must actually include shared/i18n folder
+
+ -- Pierre-Yves David <pierre-yves.david@logilab.fr>  Tue, 23 Nov 2010 16:18:46 +0200
+
+cubicweb (3.9.9-2) unstable; urgency=low
+
+  * fix cubicweb-common content
+
+ -- Pierre-Yves David <pierre-yves.david@logilab.fr>  Tue, 23 Nov 2010 14:00:46 +0200
+
 cubicweb (3.9.9-1) unstable; urgency=low
 
   * new upstream release
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/debian/source/format	Tue Nov 30 15:05:07 2010 +0100
@@ -0,0 +1,1 @@
+1.0
--- a/devtools/testlib.py	Fri Nov 05 17:11:40 2010 +0100
+++ b/devtools/testlib.py	Tue Nov 30 15:05:07 2010 +0100
@@ -184,6 +184,7 @@
     * `repo`, the repository object
     * `admlogin`, login of the admin user
     * `admpassword`, password of the admin user
+    * `shell`, create and use shell environment
     """
     appid = 'data'
     configcls = devtools.ApptestConfiguration
@@ -291,6 +292,14 @@
         """return current server side session (using default manager account)"""
         return self.repo._sessions[self._orig_cnx[0].sessionid]
 
+    def shell(self):
+        """return a shell session object"""
+        from cubicweb.server.migractions import ServerMigrationHelper
+        return ServerMigrationHelper(None, repo=self.repo, cnx=self.cnx,
+                                     interactive=False,
+                                     # hack so it don't try to load fs schema
+                                     schema=1)
+
     def set_option(self, optname, value):
         self.config.global_set_option(optname, value)
 
@@ -663,7 +672,7 @@
 
     def assertDocTestFile(self, testfile):
         # doctest returns tuple (failure_count, test_count)
-        result = self.shell.process_script(testfile)
+        result = self.shell().process_script(testfile)
         if result[0] and result[1]:
             raise self.failureException("doctest file '%s' failed"
                                         % testfile)
--- a/migration.py	Fri Nov 05 17:11:40 2010 +0100
+++ b/migration.py	Tue Nov 30 15:05:07 2010 +0100
@@ -334,14 +334,15 @@
         if not self.execscript_confirm(migrscript):
             return
         scriptlocals = self._create_context().copy()
+        scriptlocals.update({'__file__': migrscript,
+                             '__args__': kwargs.pop("scriptargs", [])})
         self._context_stack.append(scriptlocals)
         if script_mode == 'python':
             if funcname is None:
                 pyname = '__main__'
             else:
                 pyname = splitext(basename(migrscript))[0]
-            scriptlocals.update({'__file__': migrscript, '__name__': pyname,
-                                 '__args__': kwargs.pop("scriptargs", [])})
+            scriptlocals['__name__'] = pyname
             execfile(migrscript, scriptlocals)
             if funcname is not None:
                 try:
--- a/misc/migration/3.10.4_Any.py	Fri Nov 05 17:11:40 2010 +0100
+++ b/misc/migration/3.10.4_Any.py	Tue Nov 30 15:05:07 2010 +0100
@@ -1,6 +1,6 @@
 for eschema in schema.entities():
     if not (eschema.final or 'cw_source' in eschema.subjrels):
-        add_relation_definition(eschema.type, 'cw_source', 'CWSource')
+        add_relation_definition(eschema.type, 'cw_source', 'CWSource', ask_confirm=False)
 
 sql('INSERT INTO cw_source_relation(eid_from, eid_to) '
     'SELECT e.eid,s.cw_eid FROM entities as e, cw_CWSource as s '
--- a/server/serverctl.py	Fri Nov 05 17:11:40 2010 +0100
+++ b/server/serverctl.py	Tue Nov 30 15:05:07 2010 +0100
@@ -550,7 +550,7 @@
 
 
 class StartRepositoryCommand(Command):
-    """Start an CubicWeb RQL server for a given instance.
+    """Start a CubicWeb RQL server for a given instance.
 
     The server will be accessible through pyro
 
--- a/server/sources/ldapuser.py	Fri Nov 05 17:11:40 2010 +0100
+++ b/server/sources/ldapuser.py	Tue Nov 30 15:05:07 2010 +0100
@@ -369,8 +369,14 @@
         try:
             results = self._query_cache[rqlkey]
         except KeyError:
-            results = self.rqlst_search(session, rqlst, args)
-            self._query_cache[rqlkey] = results
+            try:
+                results = self.rqlst_search(session, rqlst, args)
+                self._query_cache[rqlkey] = results
+            except ldap.SERVER_DOWN:
+                # cant connect to server
+                msg = session._("can't connect to source %s, some data may be missing")
+                session.set_shared_data('sources_error', msg % self.uri)
+                return []
         return results
 
     def rqlst_search(self, session, rqlst, args):
--- a/web/formfields.py	Fri Nov 05 17:11:40 2010 +0100
+++ b/web/formfields.py	Tue Nov 30 15:05:07 2010 +0100
@@ -428,7 +428,9 @@
                 vocab[i] = option
         return vocab
 
-    def format(self, form):
+    # support field as argument to avoid warning when used as format field value
+    # callback
+    def format(self, form, field=None):
         """return MIME type used for the given (text or bytes) field"""
         if self.eidparam and self.role == 'subject':
             entity = form.edited_entity
--- a/web/test/windmill/test_connexion.py	Fri Nov 05 17:11:40 2010 +0100
+++ b/web/test/windmill/test_connexion.py	Tue Nov 30 15:05:07 2010 +0100
@@ -4,7 +4,6 @@
 # Generated by the windmill services transformer
 from windmill.authoring import WindmillTestClient
 
-
 def test_connect():
     client = WindmillTestClient(__name__)
 
@@ -16,6 +15,7 @@
 
     client.execJS(js=u"$('#loginForm').submit()")
     client.waits.forPageLoad(timeout=u'20000')
+    client.waits.sleep(milliseconds=u'5000')
     client.asserts.assertJS(js=u'$(\'.message\').text() == "welcome %s !"' % LOGIN)
     client.open(url=u'/logout')
     client.waits.forPageLoad(timeout=u'20000')
--- a/web/test/windmill/test_creation.py	Fri Nov 05 17:11:40 2010 +0100
+++ b/web/test/windmill/test_creation.py	Tue Nov 30 15:05:07 2010 +0100
@@ -34,6 +34,7 @@
     client.waits.forPageLoad(timeout=u'20000')
     client.click(value=u'button_ok')
     client.waits.forPageLoad(timeout=u'20000')
+    client.waits.sleep(milliseconds=u'5000')
     client.asserts.assertJS(js=u'$(\'.message\').text() == "entity created"')
     client.open(url=u'/?rql=Any U WHERE U is CWUser, U login "myuser"')
     client.waits.forPageLoad(timeout=u'20000')
--- a/web/views/actions.py	Fri Nov 05 17:11:40 2010 +0100
+++ b/web/views/actions.py	Tue Nov 30 15:05:07 2010 +0100
@@ -47,7 +47,7 @@
         # if user has no update right but it can modify some relation,
         # display action anyway
         form = entity._cw.vreg['forms'].select('edition', entity._cw,
-                                               entity=entity)
+                                               entity=entity, mainform=False)
         for dummy in form.editable_relations():
             return 1
         try:
--- a/web/views/basetemplates.py	Fri Nov 05 17:11:40 2010 +0100
+++ b/web/views/basetemplates.py	Tue Nov 30 15:05:07 2010 +0100
@@ -328,6 +328,8 @@
     """default html page header"""
     __regid__ = 'header'
     main_cell_components = ('appliname', 'breadcrumbs')
+    headers = (('headtext', 'header-left'),
+               ('header-right', 'header-right'))
 
     def call(self, view, **kwargs):
         self.main_header(view)
@@ -339,9 +341,7 @@
         """build the top menu with authentification info and the rql box"""
         w = self.w
         w(u'<table id="header"><tr>\n')
-        for colid, context in (('headtext', 'header-left'),
-                               ('header-right', 'header-right'),
-                               ):
+        for colid, context in self.headers:
             w(u'<td id="%s">' % colid)
             components = self._cw.vreg['ctxcomponents'].poss_visible_objects(
                 self._cw, rset=self.cw_rset, view=view, context=context)
--- a/web/views/ibreadcrumbs.py	Fri Nov 05 17:11:40 2010 +0100
+++ b/web/views/ibreadcrumbs.py	Tue Nov 30 15:05:07 2010 +0100
@@ -112,6 +112,7 @@
     __select__ = (basecomponents.HeaderComponent.__select__
                   & one_line_rset() & adaptable('IBreadCrumbs'))
     order = basecomponents.ApplicationName.order + 1
+    context = basecomponents.ApplicationName.context
     separator = u'&#160;&gt;&#160;'
     link_template = u'<a href="%s">%s</a>'
     first_separator = True
--- a/web/views/idownloadable.py	Fri Nov 05 17:11:40 2010 +0100
+++ b/web/views/idownloadable.py	Tue Nov 30 15:05:07 2010 +0100
@@ -57,11 +57,15 @@
     order = 10
     title = _('download')
 
+    def init_rendering(self):
+        self.items = [self.entity]
+
     def render_body(self, w):
-        w(u'<a href="%s"><img src="%s" alt="%s"/> %s</a>'
-          % (xml_escape(self.entity.cw_adapt_to('IDownloadable').download_url()),
-             self._cw.uiprops['DOWNLOAD_ICON'],
-             self._cw._('download icon'), xml_escape(self.entity.dc_title())))
+        for item in self.items:
+            w(u'<a href="%s"><img src="%s" alt="%s"/> %s</a>'
+              % (xml_escape(item.cw_adapt_to('IDownloadable').download_url()),
+                 self._cw.uiprops['DOWNLOAD_ICON'],
+                 self._cw._('download icon'), xml_escape(item.dc_title())))
 
 
 class DownloadView(EntityView):
--- a/web/views/workflow.py	Fri Nov 05 17:11:40 2010 +0100
+++ b/web/views/workflow.py	Tue Nov 30 15:05:07 2010 +0100
@@ -80,7 +80,9 @@
 # IWorkflowable views #########################################################
 
 class ChangeStateForm(forms.CompositeEntityForm):
-    __regid__ = 'changestate'
+    # set dom id to ensure there is no conflict with edition form (see
+    # session_key() implementation)
+    __regid__ = domid = 'changestate'
 
     form_renderer_id = 'base' # don't want EntityFormRenderer
     form_buttons = [fwdgs.SubmitButton(),
@@ -104,7 +106,7 @@
             'st1': entity.cw_adapt_to('IWorkflowable').printable_state,
             'st2': self._cw._(transition.destination(entity).name)}
         self.w(u'<p>%s</p>\n' % msg)
-        self.w(form.render())
+        form.render(w=self.w)
 
     def redirectpath(self, entity):
         return entity.rest_path()