backport stable 3.5
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 09 Sep 2009 15:07:58 +0200
branch3.5
changeset 3136 ed303cf3a048
parent 3134 3cda74b5534c (current diff)
parent 3135 996c1ec7376c (diff)
child 3137 5598bec9be7f
backport stable
__pkginfo__.py
entity.py
sobjects/supervising.py
test/unittest_entity.py
web/data/cubicweb.edition.js
web/uicfg.py
--- a/debian/changelog	Wed Sep 09 14:38:50 2009 +0200
+++ b/debian/changelog	Wed Sep 09 15:07:58 2009 +0200
@@ -1,3 +1,9 @@
+cubicweb (3.4.7-1) unstable; urgency=low
+
+  * new upstream release
+
+ -- Sylvain Thénault <sylvain.thenault@logilab.fr>  Wed, 09 Sep 2009 14:08:41 +0200
+
 cubicweb (3.4.6-1) unstable; urgency=low
 
   * new upstream release
--- a/entity.py	Wed Sep 09 14:38:50 2009 +0200
+++ b/entity.py	Wed Sep 09 15:07:58 2009 +0200
@@ -682,14 +682,16 @@
         self.set_related_cache(rtype, role, rset)
         return self.related(rtype, role, limit, entities)
 
-    def related_rql(self, rtype, role='subject'):
+    def related_rql(self, rtype, role='subject', targettypes=None):
         rschema = self.schema[rtype]
         if role == 'subject':
-            targettypes = rschema.objects(self.e_schema)
+            if targettypes is None:
+                targettypes = rschema.objects(self.e_schema)
             restriction = 'E eid %%(x)s, E %s X' % rtype
             card = greater_card(rschema, (self.e_schema,), targettypes, 0)
         else:
-            targettypes = rschema.subjects(self.e_schema)
+            if targettypes is None:
+                targettypes = rschema.subjects(self.e_schema)
             restriction = 'E eid %%(x)s, X %s E' % rtype
             card = greater_card(rschema, targettypes, (self.e_schema,), 1)
         if len(targettypes) > 1:
--- a/sobjects/supervising.py	Wed Sep 09 14:38:50 2009 +0200
+++ b/sobjects/supervising.py	Wed Sep 09 15:07:58 2009 +0200
@@ -23,6 +23,8 @@
     accepts = ('Any',)
 
     def call(self, session, *args):
+        if session.is_super_session or session.repo.config.repairing:
+            return # ignore changes triggered by hooks or maintainance shell
         dest = self.config['supervising-addrs']
         if not dest: # no supervisors, don't do this for nothing...
             return
--- a/test/unittest_entity.py	Wed Sep 09 14:38:50 2009 +0200
+++ b/test/unittest_entity.py	Wed Sep 09 15:07:58 2009 +0200
@@ -182,15 +182,16 @@
         from cubicweb.entities import fetch_config
         Personne = self.vreg['etypes'].etype_class('Personne')
         Note = self.vreg['etypes'].etype_class('Note')
+        self.failUnless(issubclass(self.vreg['etypes'].etype_class('SubNote'), Note))
         Personne.fetch_attrs, Personne.fetch_order = fetch_config(('nom', 'type'))
         Note.fetch_attrs, Note.fetch_order = fetch_config(('type',))
-        aff = self.add_entity('Personne', nom=u'pouet')
-        self.assertEquals(aff.related_rql('evaluee'),
+        p = self.add_entity('Personne', nom=u'pouet')
+        self.assertEquals(p.related_rql('evaluee'),
                           'Any X,AA,AB ORDERBY AA ASC WHERE E eid %(x)s, E evaluee X, '
                           'X type AA, X modification_date AB')
         Personne.fetch_attrs, Personne.fetch_order = fetch_config(('nom', ))
         # XXX
-        self.assertEquals(aff.related_rql('evaluee'),
+        self.assertEquals(p.related_rql('evaluee'),
                           'Any X,AA ORDERBY Z DESC WHERE X modification_date Z, E eid %(x)s, E evaluee X, X modification_date AA')
 
     def test_entity_unrelated(self):
--- a/web/data/cubicweb.edition.js	Wed Sep 09 14:38:50 2009 +0200
+++ b/web/data/cubicweb.edition.js	Wed Sep 09 15:07:58 2009 +0200
@@ -255,6 +255,11 @@
         updateInlinedEntitiesCounters(rtype);
         reorderTabindex();
         form.trigger('inlinedform-added');
+        // if the inlined form contains a file input, we must force
+        // the form enctype to multipart/form-data
+        if (form.find('input:file').length) {
+            form.closest('form').attr('enctype', 'multipart/form-data');
+        }
         postAjaxLoad(dom);
     });
     d.addErrback(function (xxx) {
--- a/web/data/cubicweb.facets.js	Wed Sep 09 14:38:50 2009 +0200
+++ b/web/data/cubicweb.facets.js	Wed Sep 09 15:07:58 2009 +0200
@@ -66,6 +66,7 @@
 	extraparams['divid'] = divid;
 	copyParam(zipped, extraparams, 'divid');
 	copyParam(zipped, extraparams, 'subvid');
+	copyParam(zipped, extraparams, 'fromformfilter');
 	// paginate used to know if the filter box is acting, in which case we
 	// want to reload action box to match current selection (we don't want
 	// this from a table filter)
--- a/web/views/tableview.py	Wed Sep 09 14:38:50 2009 +0200
+++ b/web/views/tableview.py	Wed Sep 09 15:07:58 2009 +0200
@@ -51,6 +51,7 @@
         """display a form to filter table's content. This should only
         occurs when a context eid is given
         """
+        self.req.add_css('cubicweb.facets.css')
         self.req.add_js( ('cubicweb.ajax.js', 'cubicweb.facets.js'))
         # drop False / None values from vidargs
         vidargs = dict((k, v) for k, v in vidargs.iteritems() if v)
@@ -58,7 +59,9 @@
                xml_escape(dumps([divid, 'table', False, vidargs])))
         self.w(u'<fieldset id="%sForm" class="%s">' % (divid, hidden and 'hidden' or ''))
         self.w(u'<input type="hidden" name="divid" value="%s" />' % divid)
-        filter_hiddens(self.w, facets=','.join(wdg.facet.id for wdg in fwidgets), baserql=baserql)
+        self.w(u'<input type="hidden" name="fromformfilter" value="1" />')
+        filter_hiddens(self.w, facets=','.join(wdg.facet.id for wdg in fwidgets),
+                       baserql=baserql)
         self.w(u'<table class="filter">\n')
         self.w(u'<tr>\n')
         for wdg in fwidgets:
@@ -138,7 +141,6 @@
                 actions += self.form_filter(divid, displaycols, displayfilter,
                                             displayactions)
         elif displayfilter:
-            req.add_css('cubicweb.facets.css')
             actions += self.show_hide_actions(divid, True)
         self.w(u'<div id="%s"' % divid)
         if displayactions: