backport stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Tue, 18 May 2010 18:18:08 +0200
changeset 5545 25fd74c23f91
parent 5527 01a7228ab5a0 (current diff)
parent 5544 a839dc8e76a8 (diff)
child 5555 a64f48dd5fe4
backport stable
__pkginfo__.py
cwconfig.py
devtools/devctl.py
web/views/management.py
web/views/startup.py
web/views/tableview.py
--- a/.hgtags	Mon May 17 11:05:37 2010 +0200
+++ b/.hgtags	Tue May 18 18:18:08 2010 +0200
@@ -125,3 +125,5 @@
 24cc65ab2eca05729d66cef3de6f69bb7f9dfa35 cubicweb-debian-version-3.8.0-1
 1e074c6150fe00844160986852db364cc5992848 cubicweb-version-3.8.1
 eb972d125eefd0de2d0743e95c6e1f4e3e93e4c1 cubicweb-debian-version-3.8.1-1
+ef2e37d34013488a2018e73338fbbfbde5901c5c cubicweb-version-3.8.2
+2b962bb9eee8ee7156a12cf137428c292f8e3b35 cubicweb-debian-version-3.8.2-1
--- a/__pkginfo__.py	Mon May 17 11:05:37 2010 +0200
+++ b/__pkginfo__.py	Tue May 18 18:18:08 2010 +0200
@@ -22,7 +22,7 @@
 
 modname = distname = "cubicweb"
 
-numversion = (3, 8, 1)
+numversion = (3, 8, 2)
 version = '.'.join(str(num) for num in numversion)
 
 description = "a repository of entities / relations for knowledge management"
--- a/cwconfig.py	Mon May 17 11:05:37 2010 +0200
+++ b/cwconfig.py	Tue May 18 18:18:08 2010 +0200
@@ -955,7 +955,10 @@
 
     def load_site_cubicweb(self):
         """load instance's specific site_cubicweb file"""
-        for path in reversed([self.apphome] + self.cubes_path()):
+        paths = self.cubes_path()
+        if self.apphome is not None:
+            paths = [self.apphome] + paths
+        for path in reversed(paths):
             sitefile = join(path, 'site_cubicweb.py')
             if exists(sitefile) and not sitefile in self._site_loaded:
                 self._load_site_cubicweb(sitefile)
--- a/debian/changelog	Mon May 17 11:05:37 2010 +0200
+++ b/debian/changelog	Tue May 18 18:18:08 2010 +0200
@@ -1,3 +1,9 @@
+cubicweb (3.8.2-1) unstable; urgency=low
+
+  * new upstream release
+
+ -- Sylvain Thénault <sylvain.thenault@logilab.fr>  Tue, 18 May 2010 14:59:07 +0200
+
 cubicweb (3.8.1-1) unstable; urgency=low
 
   * new upstream release
--- a/devtools/devctl.py	Mon May 17 11:05:37 2010 +0200
+++ b/devtools/devctl.py	Tue May 18 18:18:08 2010 +0200
@@ -58,6 +58,7 @@
         if cubes:
             self._cubes = self.reorder_cubes(
                 self.expand_cubes(cubes, with_recommends=True))
+            self.load_site_cubicweb()
         else:
             self._cubes = ()
 
@@ -351,23 +352,23 @@
 
 def update_cubes_catalogs(cubes):
     for cubedir in cubes:
-        toedit = []
         if not isdir(cubedir):
             print '-> ignoring %s that is not a directory.' % cubedir
             continue
         try:
-            toedit += update_cube_catalogs(cubedir)
+            toedit = update_cube_catalogs(cubedir)
         except Exception:
             import traceback
             traceback.print_exc()
             print '-> error while updating catalogs for cube', cubedir
         else:
             # instructions pour la suite
-            print '-> regenerated .po catalogs for cube %s.' % cubedir
-            print '\nYou can now edit the following files:'
-            print '* ' + '\n* '.join(toedit)
-            print ('When you are done, run "cubicweb-ctl i18ninstance '
-                   '<yourinstance>" to see changes in your instances.')
+            if toedit:
+                print '-> regenerated .po catalogs for cube %s.' % cubedir
+                print '\nYou can now edit the following files:'
+                print '* ' + '\n* '.join(toedit)
+                print ('When you are done, run "cubicweb-ctl i18ninstance '
+                       '<yourinstance>" to see changes in your instances.')
 
 def update_cube_catalogs(cubedir):
     import shutil
@@ -375,7 +376,6 @@
     from logilab.common.fileutils import ensure_fs_mode
     from logilab.common.shellutils import find, rm
     from cubicweb.i18n import extract_from_tal, execute
-    toedit = []
     cube = basename(normpath(cubedir))
     tempdir = tempfile.mkdtemp()
     print underline_title('Updating i18n catalogs for cube %s' % cube)
@@ -420,8 +420,14 @@
     print '-> merging %i .pot files:' % len(potfiles)
     execute('msgcat -o %s %s' % (potfile,
                                  ' '.join('"%s"' % f for f in potfiles)))
+    if not exists(potfile):
+        print 'no message catalog for cube', cube, 'nothing to translate'
+        # cleanup
+        rm(tempdir)
+        return ()
     print '-> merging main pot file with existing translations:'
     chdir('i18n')
+    toedit = []
     for lang in LANGS:
         print '-> language', lang
         cubepo = '%s.po' % lang
@@ -520,6 +526,7 @@
 # You should have received a copy of the GNU Lesser General Public License along
 # with this program. If not, see <http://www.gnu.org/licenses/>.
 ''',
+
         'GPL': '''\
 # This program is free software: you can redistribute it and/or modify it under
 # the terms of the GNU General Public License as published by the Free Software
--- a/entities/test/unittest_wfobjs.py	Mon May 17 11:05:37 2010 +0200
+++ b/entities/test/unittest_wfobjs.py	Tue May 18 18:18:08 2010 +0200
@@ -56,7 +56,7 @@
         self.commit()
         wf.add_state(u'foo')
         ex = self.assertRaises(ValidationError, self.commit)
-        self.assertEquals(ex.errors, {'state_of-subject': 'workflow already have a state of that name'})
+        self.assertEquals(ex.errors, {'name-subject': 'workflow already have a state of that name'})
         # no pb if not in the same workflow
         wf2 = add_wf(self, 'Company')
         foo = wf2.add_state(u'foo', initial=True)
--- a/hooks/integrity.py	Mon May 17 11:05:37 2010 +0200
+++ b/hooks/integrity.py	Tue May 18 18:18:08 2010 +0200
@@ -136,10 +136,10 @@
             if rdef.role_cardinality(role) in '1+':
                 if role == 'subject':
                     set_operation(self._cw, '_cwisrel', (eid, rschema.type),
-                                  _CheckSRelationOp)
+                                  _CheckSRelationOp, list)
                 else:
                     set_operation(self._cw, '_cwiorel', (eid, rschema.type),
-                                  _CheckORelationOp)
+                                  _CheckORelationOp, list)
 
     def before_delete_relation(self):
         rtype = self.rtype
@@ -153,10 +153,10 @@
         card = session.schema_rproperty(rtype, eidfrom, eidto, 'cardinality')
         if card[0] in '1+' and not session.deleted_in_transaction(eidfrom):
             set_operation(self._cw, '_cwisrel', (eidfrom, rtype),
-                          _CheckSRelationOp)
+                          _CheckSRelationOp, list)
         if card[1] in '1+' and not session.deleted_in_transaction(eidto):
             set_operation(self._cw, '_cwiorel', (eidto, rtype),
-                          _CheckORelationOp)
+                          _CheckORelationOp, list)
 
 
 class _CheckConstraintsOp(hook.LateOperation):
@@ -205,7 +205,7 @@
         if constraints:
             hook.set_operation(self._cw, 'check_constraints_op',
                                (self.eidfrom, self.rtype, self.eidto, tuple(constraints)),
-                               _CheckConstraintsOp)
+                               _CheckConstraintsOp, list)
 
 
 class CheckAttributeConstraintHook(IntegrityHook):
@@ -226,7 +226,7 @@
                 if constraints:
                     hook.set_operation(self._cw, 'check_constraints_op',
                                        (self.entity.eid, attr, None, tuple(constraints)),
-                                       _CheckConstraintsOp)
+                                       _CheckConstraintsOp, list)
 
 
 class CheckUniqueHook(IntegrityHook):
--- a/rset.py	Mon May 17 11:05:37 2010 +0200
+++ b/rset.py	Tue May 18 18:18:08 2010 +0200
@@ -475,7 +475,10 @@
                 if role == 'subject':
                     rschema = eschema.subjrels[attr]
                     if rschema.final:
-                        entity[attr] = rowvalues[outerselidx]
+                        if attr == 'eid':
+                            entity.eid = rowvalues[outerselidx]
+                        else:
+                            entity[attr] = rowvalues[outerselidx]
                         continue
                 else:
                     rschema = eschema.objrels[attr]
--- a/schema.py	Mon May 17 11:05:37 2010 +0200
+++ b/schema.py	Tue May 18 18:18:08 2010 +0200
@@ -866,6 +866,11 @@
                 if self.eid is not None:
                     session.local_perm_cache[key] = False
                 return False
+            except Unauthorized, ex:
+                self.debug('unauthorized %s: %s', rql, str(ex))
+                if self.eid is not None:
+                    session.local_perm_cache[key] = False
+                return False
         else:
             rset = session.eid_rset(kwargs[keyarg])
         # if no special has_*_permission relation in the rql expression, just
--- a/server/hook.py	Mon May 17 11:05:37 2010 +0200
+++ b/server/hook.py	Tue May 18 18:18:08 2010 +0200
@@ -473,23 +473,27 @@
 
 set_log_methods(Operation, getLogger('cubicweb.session'))
 
+def _container_add(container, value):
+    {set: set.add, list: list.append}[container.__class__](container, value)
 
-def set_operation(session, datakey, value, opcls, **opkwargs):
+def set_operation(session, datakey, value, opcls, containercls=set, **opkwargs):
     """Search for session.transaction_data[`datakey`] (expected to be a set):
 
     * if found, simply append `value`
 
-    * else, initialize it to set([`value`]) and instantiate the given `opcls`
-      operation class with additional keyword arguments.
+    * else, initialize it to containercls([`value`]) and instantiate the given
+      `opcls` operation class with additional keyword arguments. `containercls`
+      is a set by default. Give `list` if you want to keep arrival ordering.
 
     You should use this instead of creating on operation for each `value`,
     since handling operations becomes coslty on massive data import.
     """
     try:
-        session.transaction_data[datakey].add(value)
+        _container_add(session.transaction_data[datakey], value)
     except KeyError:
         opcls(session, **opkwargs)
-        session.transaction_data[datakey] = set((value,))
+        session.transaction_data[datakey] = containercls()
+        _container_add(session.transaction_data[datakey], value)
 
 
 class LateOperation(Operation):
--- a/skeleton/MANIFEST.in	Mon May 17 11:05:37 2010 +0200
+++ b/skeleton/MANIFEST.in	Tue May 18 18:18:08 2010 +0200
@@ -2,3 +2,4 @@
 include */*.py
 recursive-include data external_resources *.gif *.png *.css *.ico *.js
 recursive-include i18n *.pot *.po
+recursive-include wdoc *
--- a/skeleton/__pkginfo__.py.tmpl	Mon May 17 11:05:37 2010 +0200
+++ b/skeleton/__pkginfo__.py.tmpl	Tue May 18 18:18:08 2010 +0200
@@ -34,7 +34,7 @@
     [THIS_CUBE_DIR, [fname for fname in glob('*.py') if fname != 'setup.py']],
     ]
 # check for possible extended cube layout
-for dname in ('entities', 'views', 'sobjects', 'hooks', 'schema', 'data', 'i18n', 'migration'):
+for dname in ('entities', 'views', 'sobjects', 'hooks', 'schema', 'data', 'wdoc', 'i18n', 'migration'):
     if isdir(dname):
         data_files.append([join(THIS_CUBE_DIR, dname), listdir(dname)])
 # Note: here, you'll need to add subdirectories if you want
--- a/view.py	Mon May 17 11:05:37 2010 +0200
+++ b/view.py	Tue May 18 18:18:08 2010 +0200
@@ -15,10 +15,8 @@
 #
 # You should have received a copy of the GNU Lesser General Public License along
 # with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
-"""abstract views and templates classes for CubicWeb web client
+"""abstract views and templates classes for CubicWeb web client"""
 
-
-"""
 __docformat__ = "restructuredtext en"
 _ = unicode
 
@@ -74,6 +72,7 @@
  cubicweb:tindex            CDATA   #IMPLIED
  cubicweb:tlunit            CDATA   #IMPLIED
  cubicweb:type              CDATA   #IMPLIED
+ cubicweb:unselimg          CDATA   #IMPLIED
  cubicweb:uselabel          CDATA   #IMPLIED
  cubicweb:value             CDATA   #IMPLIED
  cubicweb:variables         CDATA   #IMPLIED
--- a/web/views/cwproperties.py	Mon May 17 11:05:37 2010 +0200
+++ b/web/views/cwproperties.py	Tue May 18 18:18:08 2010 +0200
@@ -121,9 +121,11 @@
         # user's preference but not site's configuration
         for key in vreg.user_property_keys(self.__regid__=='systempropertiesform'):
             parts = key.split('.')
-            if parts[0] in vreg:
+            if parts[0] in vreg and len(parts) >= 3:
                 # appobject configuration
-                reg, oid, propid = parts
+                reg = parts[0]
+                propid = parts[-1]
+                oid = '.'.join(parts[1:-1])
                 groupedopts.setdefault(reg, {}).setdefault(oid, []).append(key)
             else:
                 mainopts.setdefault(parts[0], []).append(key)
--- a/web/views/management.py	Mon May 17 11:05:37 2010 +0200
+++ b/web/views/management.py	Tue May 18 18:18:08 2010 +0200
@@ -15,10 +15,8 @@
 #
 # You should have received a copy of the GNU Lesser General Public License along
 # with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
-"""security management and error screens
+"""security management and error screens"""
 
-
-"""
 __docformat__ = "restructuredtext en"
 _ = unicode
 
--- a/web/views/startup.py	Mon May 17 11:05:37 2010 +0200
+++ b/web/views/startup.py	Tue May 18 18:18:08 2010 +0200
@@ -100,7 +100,7 @@
         if not views:
             return
         self.w(u'<ul>')
-        for v in views:
+        for v in sorted(views, key=lambda x: self._cw._(x.title)):
             if v.category != 'startupview' or v.__regid__ in ('index', 'tree', 'manage'):
                 continue
             self.w('<li><a href="%s">%s</a></li>' % (
--- a/web/views/tableview.py	Mon May 17 11:05:37 2010 +0200
+++ b/web/views/tableview.py	Tue May 18 18:18:08 2010 +0200
@@ -15,10 +15,7 @@
 #
 # You should have received a copy of the GNU Lesser General Public License along
 # with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
-"""generic table view, including filtering abilities
-
-
-"""
+"""generic table view, including filtering abilities"""
 __docformat__ = "restructuredtext en"
 
 try:
@@ -79,7 +76,7 @@
         # drop False / None values from vidargs
         vidargs = dict((k, v) for k, v in vidargs.iteritems() if v)
         w(u'<form method="post" cubicweb:facetargs="%s" action="">' %
-          xml_escape(dumps([divid, 'table', False, vidargs])))
+          xml_escape(dumps([divid, self.__regid__, False, vidargs])))
         w(u'<fieldset id="%sForm" class="%s">' % (divid, hidden and 'hidden' or ''))
         w(u'<input type="hidden" name="divid" value="%s" />' % divid)
         w(u'<input type="hidden" name="fromformfilter" value="1" />')
--- a/web/wdoc/ChangeLog_en	Mon May 17 11:05:37 2010 +0200
+++ b/web/wdoc/ChangeLog_en	Tue May 18 18:18:08 2010 +0200
@@ -4,6 +4,36 @@
 .. _SPARQL: http://www.w3.org/TR/rdf-sparql-query/
 .. _schema: schema
 .. _OWL: http://www.w3.org/TR/owl-features/
+.. _pdfexport: http://www.cubicweb.org/project/cubicweb-pdfexport
+
+2010-04-20  --  3.8.0
+   * nicer schema_ and workflow views (clickable image!)
+
+   * more power to undo, though not yet complete (missing entity updates, soon available...)
+
+   * pdf export functionnality moved to its own cube. If it's no more
+     present on this site while you found it useful, ask you site
+     administrator to install the pdfexport_ cube.
+
+
+2010-03-16  --  3.7.0
+   * experimental support for undoing of deletion. If you're not proposed to *undo*
+     deletion of one or several entities, ask you site administrator to activate
+     the feature.
+
+
+2010-02-10  --  3.6.0
+   * nice 'demo widget' to edit bookmark's path, e.g. a relative url, splitted
+     as path and parameters and dealing nicely with url encodings. Try to
+     edit your bookmarks!
+
+   * hell lot of refactorings, but you should hopefuly not see that from the outside
+
+2009-09-17  --  3.5.0
+
+    * selectable workflows: authorized users may change the workflow used
+      by some workflowable entities
+
 
 2009-08-07  --  3.4.0
 
--- a/web/wdoc/ChangeLog_fr	Mon May 17 11:05:37 2010 +0200
+++ b/web/wdoc/ChangeLog_fr	Tue May 18 18:18:08 2010 +0200
@@ -4,6 +4,45 @@
 .. _SPARQL: http://www.w3.org/TR/rdf-sparql-query/
 .. _schema: schema
 .. _OWL: http://www.w3.org/TR/owl-features/
+.. _pdfexport: http://www.cubicweb.org/project/cubicweb-pdfexport
+
+2010-04-20  --  3.8.0
+
+   * amélioration des vues de schema_ et des vues de workflows
+     (images clickable !)
+
+   * meilleure support du "undo", mais il manque toujours le support
+     sur la modification d'entité (bientôt...)
+
+   * la fonctionnalité d'export d'pdf a été déplacé dans son propre
+     cube. Si cette fonctionalité n'est plus disponible sur ce site et
+     que vous la trouviez utile, demander à l'administrateur
+     d'installer le cube pdfexport_.
+
+
+2010-03-16  --  3.7.0
+
+   * support experimental pour l'annulation ("undo") de la
+     suppression. Si, après une suppression d'une ou plusieurs
+     entités, on ne vous propose pas d'annuler l'opération, demander à
+     l'administrateur d'activé la fonctionnalité
+
+
+2010-02-10  --  3.6.0
+
+   * nouvelle widget (de démonstration :) pour éditer le chemin des
+     signets. Celui-ci, une url relative finalement, est décomposée de
+     chemin et paramètres que vous pouvez éditer individuellement et
+     surtout lisiblement car la gestion de l'échappement de l'url est
+     géré de manière transparente
+
+   * beaucoup de refactoring, mais vous ne devriez rien remarquer :)
+
+2009-09-17  --  3.5.0
+
+    * workflow sélectionnable: les utilisateurs autorisés peuvent
+      changer le workflow à utilister pour les entités le supportant
+
 
 2009-08-07  --  3.4.0