[PATCH seda] [pkg] Update usage of compound to its new API

Sylvain Thenault sylvain.thenault at logilab.fr
Tue Dec 12 18:26:39 CET 2017


# HG changeset patch
# User Sylvain Thénault <sylvain.thenault at logilab.fr>
# Date 1513099186 -3600
#      Tue Dec 12 18:19:46 2017 +0100
# Node ID ee68ebb504d237582b36773c47628cf8dc9ca288
# Parent  451328134bee3f42ec84ed06f41202e114c5ef59
# Available At https://hg.logilab.org/review/cubes/seda
#              hg pull https://hg.logilab.org/review/cubes/seda -r ee68ebb504d2
[pkg] Update usage of compound to its new API

diff --git a/cubicweb_seda/views/clone.py b/cubicweb_seda/views/clone.py
--- a/cubicweb_seda/views/clone.py
+++ b/cubicweb_seda/views/clone.py
@@ -1,6 +1,6 @@
-# copyright 2015-2017 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+# copyright 2015 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
 # contact http://www.logilab.fr -- mailto:contact at logilab.fr
 #
 # This program is free software: you can redistribute it and/or modify it under
 # the terms of the GNU Lesser General Public License as published by the Free
 # Software Foundation, either version 2.1 of the License, or (at your option)
@@ -18,11 +18,10 @@
 from cubicweb import uilib, _
 from cubicweb.predicates import is_instance, match_form_params, score_entity
 from cubicweb.web import Redirect, controller
 from cubicweb.web.views import uicfg
 
-from cubicweb_compound.entities import copy_entity
 from cubicweb_compound import views as compound
 from cubes.relationwidget import views as rwdg
 
 from .widgets import configure_relation_widget
 
@@ -65,12 +64,13 @@ class DoImportView(controller.Controller
         else:
             parent = ui_parent.first_level_choice.content_sequence
         clones = []
         for cloned_eid in self._cw.form['cloned'].split(','):
             original = self._cw.entity_from_eid(int(cloned_eid))
-            clones.append(copy_entity(original, seda_archive_unit=parent,
-                                      clone_of=original))
+            iclone = original.cw_adapt_to('IClonable')
+            clones.append(iclone.copy_entity(
+                original, seda_archive_unit=parent, clone_of=original))
         basemsg = (_('{0} has been imported') if len(clones) == 1 else
                    _('{0} have been imported'))
         msg = self._cw._(basemsg).format(u', '.join(clone.dc_title() for clone in clones))
         raise Redirect(ui_parent.absolute_url(__message=msg))
 
diff --git a/dev-requirements.txt b/dev-requirements.txt
--- a/dev-requirements.txt
+++ b/dev-requirements.txt
@@ -1,1 +1,2 @@
 pytest
+http://hg.logilab.org/review/cubes/compound/archive/tip.tar.bz2#egg=cubicweb-compound


More information about the saem-devel mailing list