merge
authorNicolas Chauvat <nicolas.chauvat@logilab.fr>
Thu, 23 Jul 2009 14:13:43 +0200
changeset 2441 d7f0e551d0fa
parent 2440 8e6b83e3b6b5 (diff)
parent 2435 85be7a811afe (current diff)
child 2442 bd8be3295233
merge
schemas/base.py
--- a/schemas/base.py	Thu Jul 23 13:35:06 2009 +0200
+++ b/schemas/base.py	Thu Jul 23 14:13:43 2009 +0200
@@ -102,7 +102,7 @@
     # 0..n cardinality for entities created by internal session (no attached user)
     # and to support later deletion of a user which has created some entities
     cardinality = '**'
-    subject = '**'
+    subject = '*'
     object = 'CWUser'
 
 class created_by(RelationType):
@@ -115,20 +115,20 @@
     # 0..1 cardinality for entities created by internal session (no attached user)
     # and to support later deletion of a user which has created some entities
     cardinality = '?*'
-    subject = '**'
+    subject = '*'
     object = 'CWUser'
 
 
 class creation_date(RelationType):
     """creation time of an entity"""
     cardinality = '11'
-    subject = '**'
+    subject = '*'
     object = 'Datetime'
 
 class modification_date(RelationType):
     """latest modification time of an entity"""
     cardinality = '11'
-    subject = '**'
+    subject = '*'
     object = 'Datetime'
 
 
--- a/schemas/bootstrap.py	Thu Jul 23 13:35:06 2009 +0200
+++ b/schemas/bootstrap.py	Thu Jul 23 14:13:43 2009 +0200
@@ -233,7 +233,7 @@
         'delete': (),
         }
     cardinality = '1*'
-    subject = '**'
+    subject = '*'
     object = 'CWEType'
 
 class is_instance_of(RelationType):
@@ -248,7 +248,7 @@
         'delete': (),
         }
     cardinality = '+*'
-    subject = '**'
+    subject = '*'
     object = 'CWEType'
 
 class specializes(RelationType):
--- a/web/test/data/schema/testschema.py	Thu Jul 23 13:35:06 2009 +0200
+++ b/web/test/data/schema/testschema.py	Thu Jul 23 14:13:43 2009 +0200
@@ -5,6 +5,11 @@
 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
 :license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses
 """
+
+from yams.buildobjs import (EntityType, RelationDefinition, RelationType, String,
+                            Int, SubjectRelation)
+from yams.constraints import IntervalBoundConstraint
+
 class Salesterm(EntityType):
     described_by_test = SubjectRelation('File', cardinality='1*', composite='subject')
     amount = Int(constraints=[IntervalBoundConstraint(0, 100)])
--- a/web/test/unittest_form.py	Thu Jul 23 13:35:06 2009 +0200
+++ b/web/test/unittest_form.py	Thu Jul 23 14:13:43 2009 +0200
@@ -161,7 +161,7 @@
 
     def test_richtextfield_2(self):
         self.req.use_fckeditor = lambda: True
-        self._test_richtextfield('<input name="description_format:%(eid)s" style="display: block" type="hidden" value="text/rest"></input><textarea cols="80" cubicweb:type="wysiwyg" id="description:%(eid)s" name="description:%(eid)s" onkeyup="autogrow(this)" rows="2" tabindex="0"></textarea>')
+        self._test_richtextfield('<input name="description_format:%(eid)s" style="display: block" type="hidden" value="text/rest" /><textarea cols="80" cubicweb:type="wysiwyg" id="description:%(eid)s" name="description:%(eid)s" onkeyup="autogrow(this)" rows="2" tabindex="0"></textarea>')
 
 
     def test_filefield(self):
@@ -172,14 +172,14 @@
                                data=Binary('new widgets system'))
         form = FFForm(self.req, redirect_path='perdu.com', entity=file)
         self.assertTextEquals(self._render_entity_field('data', form),
-                              '''<input id="data:%(eid)s" name="data:%(eid)s" tabindex="0" type="file" value=""></input>
+                              '''<input id="data:%(eid)s" name="data:%(eid)s" tabindex="0" type="file" value="" />
 <a href="javascript: toggleVisibility(&#39;data:%(eid)s-advanced&#39;)" title="show advanced fields"><img src="http://testing.fr/cubicweb/data/puce_down.png" alt="show advanced fields"/></a>
 <div id="data:%(eid)s-advanced" class="hidden">
-<label for="data_format:%(eid)s">data_format</label><input id="data_format:%(eid)s" maxlength="50" name="data_format:%(eid)s" size="45" tabindex="1" type="text" value="text/plain"></input><br/>
-<label for="data_encoding:%(eid)s">data_encoding</label><input id="data_encoding:%(eid)s" maxlength="20" name="data_encoding:%(eid)s" size="20" tabindex="2" type="text" value="UTF-8"></input><br/>
+<label for="data_format:%(eid)s">data_format</label><input id="data_format:%(eid)s" maxlength="50" name="data_format:%(eid)s" size="45" tabindex="1" type="text" value="text/plain" /><br/>
+<label for="data_encoding:%(eid)s">data_encoding</label><input id="data_encoding:%(eid)s" maxlength="20" name="data_encoding:%(eid)s" size="20" tabindex="2" type="text" value="UTF-8" /><br/>
 </div>
 <br/>
-<input name="data:%(eid)s__detach" type="checkbox"></input>
+<input name="data:%(eid)s__detach" type="checkbox" />
 detach attached file
 ''' % {'eid': file.eid})
 
@@ -196,14 +196,14 @@
                                data=Binary('new widgets system'))
         form = EFFForm(self.req, redirect_path='perdu.com', entity=file)
         self.assertTextEquals(self._render_entity_field('data', form),
-                              '''<input id="data:%(eid)s" name="data:%(eid)s" tabindex="0" type="file" value=""></input>
+                              '''<input id="data:%(eid)s" name="data:%(eid)s" tabindex="0" type="file" value="" />
 <a href="javascript: toggleVisibility(&#39;data:%(eid)s-advanced&#39;)" title="show advanced fields"><img src="http://testing.fr/cubicweb/data/puce_down.png" alt="show advanced fields"/></a>
 <div id="data:%(eid)s-advanced" class="hidden">
-<label for="data_format:%(eid)s">data_format</label><input id="data_format:%(eid)s" maxlength="50" name="data_format:%(eid)s" size="45" tabindex="1" type="text" value="text/plain"></input><br/>
-<label for="data_encoding:%(eid)s">data_encoding</label><input id="data_encoding:%(eid)s" maxlength="20" name="data_encoding:%(eid)s" size="20" tabindex="2" type="text" value="UTF-8"></input><br/>
+<label for="data_format:%(eid)s">data_format</label><input id="data_format:%(eid)s" maxlength="50" name="data_format:%(eid)s" size="45" tabindex="1" type="text" value="text/plain" /><br/>
+<label for="data_encoding:%(eid)s">data_encoding</label><input id="data_encoding:%(eid)s" maxlength="20" name="data_encoding:%(eid)s" size="20" tabindex="2" type="text" value="UTF-8" /><br/>
 </div>
 <br/>
-<input name="data:%(eid)s__detach" type="checkbox"></input>
+<input name="data:%(eid)s__detach" type="checkbox" />
 detach attached file
 <p><b>You can either submit a new file using the browse button above, or choose to remove already uploaded file by checking the "detach attached file" check-box, or edit file content online with the widget below.</b></p>
 <textarea cols="80" name="data:%(eid)s" onkeyup="autogrow(this)" rows="3" tabindex="3">new widgets system</textarea>''' % {'eid': file.eid})
@@ -214,9 +214,9 @@
             upassword = StringField(widget=PasswordInput)
         form = PFForm(self.req, redirect_path='perdu.com', entity=self.entity)
         self.assertTextEquals(self._render_entity_field('upassword', form),
-                              '''<input id="upassword:%(eid)s" name="upassword:%(eid)s" tabindex="0" type="password" value="__cubicweb_internal_field__"></input>
+                              '''<input id="upassword:%(eid)s" name="upassword:%(eid)s" tabindex="0" type="password" value="__cubicweb_internal_field__" />
 <br/>
-<input name="upassword-confirm:%(eid)s" tabindex="0" type="password" value="__cubicweb_internal_field__"></input>
+<input name="upassword-confirm:%(eid)s" tabindex="0" type="password" value="__cubicweb_internal_field__" />
 &nbsp;
 <span class="emphasis">confirm password</span>''' % {'eid': self.entity.eid})
 
--- a/web/test/unittest_urlrewrite.py	Thu Jul 23 13:35:06 2009 +0200
+++ b/web/test/unittest_urlrewrite.py	Thu Jul 23 14:13:43 2009 +0200
@@ -29,12 +29,14 @@
         self.assertListEquals(rules, [
             ('foo' , dict(rql='Foo F')),
             ('/index' , dict(vid='index2')),
-            ('/schema', {'vid': 'schema'}),
+            ('/schema', dict(vid='schema')),
             ('/myprefs', dict(vid='propertiesform')),
             ('/siteconfig', dict(vid='systempropertiesform')),
+            ('/siteinfo', dict(vid='info')),
             ('/manage', dict(vid='manage')),
-            ('/notfound', {'vid': '404'}),
-            ('/error', {'vid': 'error'}),
+            ('/notfound', dict(vid='404')),
+            ('/error', dict(vid='error')),
+            ('/sparql', dict(vid='sparql')),
             ('/schema/([^/]+?)/?$', {'rql': r'Any X WHERE X is CWEType, X name "\1"', 'vid': 'eschema'}),
             ('/add/([^/]+?)/?$' , dict(vid='creation', etype=r'\1')),
             ('/doc/images/(.+?)/?$', dict(fid='\\1', vid='wdocimages')),
--- a/web/test/unittest_viewselector.py	Thu Jul 23 13:35:06 2009 +0200
+++ b/web/test/unittest_viewselector.py	Thu Jul 23 14:13:43 2009 +0200
@@ -22,8 +22,9 @@
                ('logout', actions.LogoutAction)]
 SITEACTIONS = [('siteconfig', actions.SiteConfigurationAction),
                ('manage', actions.ManageAction),
-               ('schema', schema.ViewSchemaAction)]
-
+               ('schema', schema.ViewSchemaAction),
+               ('siteinfo', actions.SiteInfoAction),
+               ]
 
 class ViewSelectorTC(EnvBasedTC):
 
@@ -173,6 +174,7 @@
                               ('text', baseviews.TextView),
                               ('treeview', treeview.TreeView),
                               ('vcard', vcard.VCardCWUserView),
+                              ('wfhistory', workflow.WFHistoryView),
                               ('xbel', xbel.XbelView),
                               ('xml', xmlrss.XMLView),
                               ])
--- a/web/views/actions.py	Thu Jul 23 13:35:06 2009 +0200
+++ b/web/views/actions.py	Thu Jul 23 14:13:43 2009 +0200
@@ -286,7 +286,7 @@
     title = _('manage')
     order = 20
 
-class ManageAction(ManagersAction):
+class SiteInfoAction(ManagersAction):
     id = 'siteinfo'
     title = _('info')
     order = 30
--- a/web/views/workflow.py	Thu Jul 23 13:35:06 2009 +0200
+++ b/web/views/workflow.py	Thu Jul 23 14:13:43 2009 +0200
@@ -18,6 +18,7 @@
 from cubicweb.selectors import (implements, has_related_entities,
                                 relation_possible, match_form_params)
 from cubicweb.interfaces import IWorkflowable
+from cubicweb.view import EntityView
 from cubicweb.web import stdmsgs, action, component, form
 from cubicweb.web.form import FormViewMixIn
 from cubicweb.web.formfields import StringField,  RichTextField
@@ -66,13 +67,9 @@
     def redirectpath(self, entity):
         return entity.rest_path()
 
-
-class WFHistoryVComponent(component.EntityVComponent):
-    """display the workflow history for entities supporting it"""
+class WFHistoryView(EntityView):
     id = 'wfhistory'
-    __select__ = (component.EntityVComponent.__select__
-                  & relation_possible('wf_info_for', role='object'))
-    context = 'navcontentbottom'
+    __select__ = relation_possible('wf_info_for', role='object')
     title = _('Workflow history')
 
     def cell_call(self, row, col, view=None):
@@ -101,6 +98,15 @@
             self.wview('table', rset, title=_(self.title), displayactions=False,
                        displaycols=displaycols, headers=headers)
 
+class WFHistoryVComponent(component.EntityVComponent):
+    """display the workflow history for entities supporting it"""
+    id = 'wfhistory'
+    __select__ = WFHistoryView.__select__ & component.EntityVComponent.__select__
+    context = 'navcontentbottom'
+    title = _('Workflow history')
+
+    def cell_call(self, row, col, view=None):
+        self.wview('wfhistory', self.rset, row=row, col=col, view=view)
 
 # workflow entity types views #################################################