[urlpublishing] handle sub-types in RestPathEvaluator
authorJulien Cristau <julien.cristau@logilab.fr>
Mon, 24 Nov 2014 17:43:29 +0100
changeset 10047 a1fde2d343b6
parent 10046 96f5ca0a86e5
child 10058 d47c318f95b2
[urlpublishing] handle sub-types in RestPathEvaluator Since commit 31a1813d53f3 "[entity/url publishing] fetch_rqlst should use 'is_instance_of' instead of 'is'", the RestPathEvaluator's input rset can have more than one etype, so it can't always use sameetypelist. Related to #3825488
web/views/urlpublishing.py
--- a/web/views/urlpublishing.py	Mon Nov 24 14:43:28 2014 +0100
+++ b/web/views/urlpublishing.py	Mon Nov 24 17:43:29 2014 +0100
@@ -209,7 +209,10 @@
         if rset.rowcount == 1:
             req.form.setdefault('vid', 'primary')
         else: # rset.rowcount >= 1
-            req.form.setdefault('vid', 'sameetypelist')
+            if len(rset.column_types(0)) > 1:
+                req.form.setdefault('vid', 'list')
+            else:
+                req.form.setdefault('vid', 'sameetypelist')
 
     def handle_etype(self, req, cls):
         rset = req.execute(cls.fetch_rql(req.user))