merge cubicweb-version-3_0_2
authorsylvain.thenault@logilab.fr
Wed, 14 Jan 2009 13:26:04 +0100
changeset 406 221886d8e3c8
parent 402 e0cb1579eba2 (diff)
parent 405 295f3cd70915 (current diff)
child 407 68783684ec2f
child 410 18d3e56c1de4
merge
--- a/__pkginfo__.py	Wed Jan 14 12:36:35 2009 +0100
+++ b/__pkginfo__.py	Wed Jan 14 13:26:04 2009 +0100
@@ -6,7 +6,7 @@
 distname = "cubicweb"
 modname = "cubicweb"
 
-numversion = (3, 0, 1)
+numversion = (3, 0, 2)
 version = '.'.join(str(num) for num in numversion)
 
 license = 'LCL'
--- a/common/selectors.py	Wed Jan 14 12:36:35 2009 +0100
+++ b/common/selectors.py	Wed Jan 14 13:26:04 2009 +0100
@@ -33,7 +33,7 @@
 
 
 :organization: Logilab
-:copyright: 2001-2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+:copyright: 2001-2009 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
 """
 
--- a/debian/changelog	Wed Jan 14 12:36:35 2009 +0100
+++ b/debian/changelog	Wed Jan 14 13:26:04 2009 +0100
@@ -1,3 +1,9 @@
+cubicweb (3.0.2-1) DISTRIBUTION; urgency=low
+
+  * new upstream release
+
+ -- Sylvain Thénault <sylvain.thenault@logilab.fr>  Wed, 14 Jan 2009 13:25:21 +0100
+
 cubicweb (3.0.1-1) DISTRIBUTION; urgency=low
 
   * new upstream release
--- a/web/views/actions.py	Wed Jan 14 12:36:35 2009 +0100
+++ b/web/views/actions.py	Wed Jan 14 13:26:04 2009 +0100
@@ -1,7 +1,7 @@
 """Set of HTML base actions
 
 :organization: Logilab
-:copyright: 2001-2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+:copyright: 2001-2009 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
 """
 __docformat__ = "restructuredtext en"
@@ -16,6 +16,7 @@
 
 _ = unicode
 
+# generic primary actions #####################################################
 
 class SelectAction(EntityAction):
     """base class for link search actions. By default apply on
@@ -73,7 +74,8 @@
         params = self.req.form.copy()
         params.pop('vid', None)
         params.pop('__message', None)
-        return self.build_url(self.req.relative_path(includeparams=False), **params)
+        return self.build_url(self.req.relative_path(includeparams=False),
+                              **params)
 
 
 class ModifyAction(EntityAction):
@@ -92,9 +94,11 @@
             return True
         # if user has no update right but it can modify some relation,
         # display action anyway
-        for dummy in entity.srelations_by_category(('generic', 'metadata'), 'add'):
+        for dummy in entity.srelations_by_category(('generic', 'metadata'),
+                                                   'add'):
             return True
-        for rschema, targetschemas, role in entity.relations_by_category(('primary', 'secondary'), 'add'):
+        for rschema, targetschemas, role in entity.relations_by_category(
+            ('primary', 'secondary'), 'add'):
             if not rschema.is_final():
                 return True
         return False
@@ -102,6 +106,37 @@
     def url(self):
         entity = self.rset.get_entity(self.row or 0, self.col or 0)
         return entity.absolute_url(vid='edition')
+        
+
+class MultipleEditAction(EntityAction):
+    category = 'mainactions'
+    __selectors__ = (two_lines_rset, oneetyperset_selector,
+                     searchstate_accept)
+    schema_action = 'update'
+    order = 10
+    
+    id = 'muledit' # XXX get strange conflicts if id='edit'
+    title = _('modify')
+    
+    def url(self):
+        return self.build_url('view', rql=self.rset.rql, vid='muledit')
+
+
+# generic secondary actions ###################################################
+
+class ManagePermissions(LinkToEntityAction):
+    accepts = ('Any',)
+    category = 'moreactions'
+    id = 'addpermission'
+    title = _('manage permissions')
+    order = 100
+
+    etype = 'EPermission'
+    rtype = 'require_permission'
+    target = 'object'
+    
+    def url(self):
+        return self.rset.get_entity(0, 0).absolute_url(vid='security')
 
     
 class DeleteAction(EntityAction):
@@ -131,20 +166,6 @@
     def url(self):
         entity = self.rset.get_entity(self.row or 0, self.col or 0)
         return entity.absolute_url(vid='copy')
-        
-
-class MultipleEditAction(EntityAction):
-    category = 'mainactions'
-    __selectors__ = (two_lines_rset, oneetyperset_selector,
-                     searchstate_accept)
-    schema_action = 'update'
-    order = 10
-    
-    id = 'muledit' # XXX get strange conflicts if id='edit'
-    title = _('modify')
-    
-    def url(self):
-        return self.build_url('view', rql=self.rset.rql, vid='muledit')
 
 
 class AddNewAction(MultipleEditAction):
@@ -152,6 +173,8 @@
     add a new one
     """
     category = 'moreactions'
+    id = 'addentity'
+    order = 40
     
     def etype_rset_selector(cls, req, rset, **kwargs):
         if rset is not None and not rset.rowcount:
@@ -177,8 +200,6 @@
                      chainfirst(etype_rset_selector,
                                 chainall(two_lines_rset, oneetyperset_selector,
                                          has_add_perm_selector)))
-    order = 40
-    id = 'addentity'
 
     @property
     def rsettype(self):
@@ -194,15 +215,7 @@
         return self.build_url('add/%s' % self.rsettype)
 
 
-class FollowAction(EntityAction):
-    category = 'mainactions'
-    accepts = ('Bookmark',)
-    
-    id = 'follow'
-    title = _('follow')
-    
-    def url(self):
-        return self.rset.get_entity(self.row or 0, self.col or 0).actual_url()
+# logged user actions #########################################################
 
 class UserPreferencesAction(Action):
     category = 'useractions'
@@ -215,6 +228,78 @@
     def url(self):
         return self.build_url(self.id)
 
+
+class UserInfoAction(Action):
+    category = 'useractions'
+    __selectors__ = not_anonymous_selector,
+    order = 20
+    
+    id = 'myinfos'
+    title = _('personnal informations')
+
+    def url(self):
+        return self.build_url('euser/%s'%self.req.user.login, vid='edition')
+
+
+class LogoutAction(Action):
+    category = 'useractions'
+    __selectors__ = not_anonymous_selector,
+    order = 30
+    
+    id = 'logout'
+    title = _('logout')
+
+    def url(self):
+        return self.build_url(self.id)
+
+    
+# site actions ################################################################
+
+class ManagersAction(Action):
+    category = 'siteactions'
+    __abstract__ = True
+    __selectors__ = in_group_selector,
+    require_groups = ('managers',)
+
+    def url(self):
+        return self.build_url(self.id)
+
+    
+class SiteConfigurationAction(ManagersAction):
+    order = 10
+    id = 'siteconfig'
+    title = _('site configuration')
+
+    
+class ManageAction(ManagersAction):
+    order = 20
+    id = 'manage'
+    title = _('manage')
+
+
+class ViewSchemaAction(Action):
+    category = 'siteactions'
+    id = 'schema'
+    title = _("site schema")
+    __selectors__ = yes,
+    order = 30
+    
+    def url(self):
+        return self.build_url(self.id)
+
+
+# content type specific actions ###############################################
+
+class FollowAction(EntityAction):
+    category = 'mainactions'
+    accepts = ('Bookmark',)
+    
+    id = 'follow'
+    title = _('follow')
+    
+    def url(self):
+        return self.rset.get_entity(self.row or 0, self.col or 0).actual_url()
+
 class UserPreferencesEntityAction(EntityAction):
     __selectors__ = EntityAction.__selectors__ + (one_line_rset, in_group_selector,)
     require_groups = ('owners', 'managers')
@@ -228,59 +313,3 @@
         login = self.rset.get_entity(self.row or 0, self.col or 0).login
         return self.build_url('euser/%s'%login, vid='epropertiesform')
 
-class UserInfoAction(Action):
-    category = 'useractions'
-    __selectors__ = not_anonymous_selector,
-    order = 20
-    
-    id = 'myinfos'
-    title = _('personnal informations')
-
-    def url(self):
-        return self.build_url('euser/%s'%self.req.user.login, vid='edition')
-
-class LogoutAction(Action):
-    category = 'useractions'
-    __selectors__ = not_anonymous_selector,
-    order = 30
-    
-    id = 'logout'
-    title = _('logout')
-
-    def url(self):
-        return self.build_url(self.id)
-    
-
-class ManagersAction(Action):
-    category = 'siteactions'
-    __abstract__ = True
-    __selectors__ = in_group_selector,
-    require_groups = ('managers',)
-
-    def url(self):
-        return self.build_url(self.id)
-    
-class SiteConfigurationAction(ManagersAction):
-    order = 10
-    
-    id = 'siteconfig'
-    title = _('site configuration')
-    
-class ManageAction(ManagersAction):
-    order = 20
-    
-    id = 'manage'
-    title = _('manage')
-
-
-class ViewSchemaAction(Action):
-    category = 'siteactions'
-    __selectors__ = yes,
-    order = 30
-    
-    id = 'schema'
-    title = _("site schema")
-
-    def url(self):
-        return self.build_url(self.id)
-
--- a/web/views/baseviews.py	Wed Jan 14 12:36:35 2009 +0100
+++ b/web/views/baseviews.py	Wed Jan 14 13:26:04 2009 +0100
@@ -32,7 +32,6 @@
 
 _ = unicode
 
-
 class NullView(AnyRsetView):
     """default view when no result has been found"""
     id = 'null'
@@ -765,8 +764,8 @@
         for index in xrange(len(self.rset)):
             entity = self.complete_entity(index)
             if entity.e_schema not in rows_by_type:
-                rowdef_by_type[entity.e_schema] = [rs for rs, as in entity.e_schema.attribute_definitions()
-                                                   if as.type != 'Bytes']
+                rowdef_by_type[entity.e_schema] = [rs for rs, at in entity.e_schema.attribute_definitions()
+                                                   if at != 'Bytes']
                 rows_by_type[entity.e_schema] = [[display_name(req, rschema.type)
                                                   for rschema in rowdef_by_type[entity.e_schema]]]
             rows = rows_by_type[entity.e_schema]
--- a/web/views/boxes.py	Wed Jan 14 12:36:35 2009 +0100
+++ b/web/views/boxes.py	Wed Jan 14 13:26:04 2009 +0100
@@ -105,6 +105,7 @@
 
     def workflow_actions(self, entity, box):
         if 'in_state' in entity.e_schema.subject_relations() and entity.in_state:
+            _ = self.req._
             state = entity.in_state[0]
             transitions = list(state.transitions(entity))
             if transitions: