[PATCH 2 of 2 saem_ref V2] [seda] Plug activities onto archive transfer

Yann Vote yann.vote at logilab.fr
Tue Mar 14 11:18:03 CET 2017


On 03/14/2017 11:09 AM, Sylvain Thenault wrote:
> # HG changeset patch
> # User Sylvain Thénault <sylvain.thenault at logilab.fr>
> # Date 1489081332 -3600
> #      Thu Mar 09 18:42:12 2017 +0100
> # Node ID fa90b7236de0e15341a537d1f720dec5392fecbc
> # Parent  cd42804332f89bf44ef924a48b254a2ec148dd55
> [seda] Plug activities onto archive transfer
>
> Related to extranet #3101354
>
> Notice a container relation is added in the message catalog, this is because
> this relation is added in post_build_callback of the seda cube. We actually
> don't need, so don't bother adding migration for it.
>
> diff --git a/cubicweb_saem_ref/i18n/en.po b/cubicweb_saem_ref/i18n/en.po
> --- a/cubicweb_saem_ref/i18n/en.po
> +++ b/cubicweb_saem_ref/i18n/en.po
> @@ -447,10 +447,14 @@ msgstr "contact point of"
>
>  msgctxt "Agent"
>  msgid "contact_point_object"
>  msgstr ""
>
> +msgctxt "Activity"
> +msgid "container"
> +msgstr ""
> +
>  msgid "control"
>  msgstr "control service"
>
>  msgid "created"
>  msgstr ""
> @@ -657,10 +661,14 @@ msgstr ""
>
>  msgctxt "ConceptScheme"
>  msgid "generated_object"
>  msgstr ""
>
> +msgctxt "SEDAArchiveTransfer"
> +msgid "generated_object"
> +msgstr ""
> +
>  msgid "latest update on"
>  msgstr ""
>
>  msgid "modified"
>  msgstr ""
> @@ -851,10 +859,14 @@ msgstr ""
>
>  msgctxt "ConceptScheme"
>  msgid "used_object"
>  msgstr ""
>
> +msgctxt "SEDAArchiveTransfer"
> +msgid "used_object"
> +msgstr ""
> +
>  msgid "view"
>  msgstr ""
>
>  msgid "view this relation"
>  msgstr ""
> diff --git a/cubicweb_saem_ref/i18n/fr.po b/cubicweb_saem_ref/i18n/fr.po
> --- a/cubicweb_saem_ref/i18n/fr.po
> +++ b/cubicweb_saem_ref/i18n/fr.po
> @@ -462,10 +462,14 @@ msgstr "point de contact de"
>
>  msgctxt "Agent"
>  msgid "contact_point_object"
>  msgstr ""
>
> +msgctxt "Activity"
> +msgid "container"
> +msgstr ""
> +
>  msgid "control"
>  msgstr "service de contrôle"
>
>  msgid "created"
>  msgstr "création"
> @@ -675,10 +679,14 @@ msgstr ""
>
>  msgctxt "ConceptScheme"
>  msgid "generated_object"
>  msgstr ""
>
> +msgctxt "SEDAArchiveTransfer"
> +msgid "generated_object"
> +msgstr ""
> +
>  msgid "latest update on"
>  msgstr "dernière mise à jour"
>
>  msgid "modified"
>  msgstr "modification"
> @@ -876,10 +884,14 @@ msgstr ""
>
>  msgctxt "ConceptScheme"
>  msgid "used_object"
>  msgstr ""
>
> +msgctxt "SEDAArchiveTransfer"
> +msgid "used_object"
> +msgstr ""
> +
>  msgid "view"
>  msgstr "voir"
>
>  msgid "view this relation"
>  msgstr "voir cette relation"
> diff --git a/cubicweb_saem_ref/migration/0.15.0_Any.py b/cubicweb_saem_ref/migration/0.15.0_Any.py
> new file mode 100644
> --- /dev/null
> +++ b/cubicweb_saem_ref/migration/0.15.0_Any.py
> @@ -0,0 +1,2 @@
> +add_relation_definition('Activity', 'generated', 'SEDAArchiveTransfer')
> +add_relation_definition('Activity', 'used', 'SEDAArchiveTransfer')
> diff --git a/cubicweb_saem_ref/schema.py b/cubicweb_saem_ref/schema.py
> --- a/cubicweb_saem_ref/schema.py
> +++ b/cubicweb_saem_ref/schema.py
> @@ -282,16 +282,16 @@ class related_concept_scheme(RelationDef
>      description = _('concept schemes used by the agent')
>
>
>  class generated(RelationDefinition):
>      subject = 'Activity'
> -    object = ('Concept', 'ConceptScheme')
> +    object = ('Concept', 'ConceptScheme', 'SEDAArchiveTransfer')
>
>
>  class used(RelationDefinition):
>      subject = 'Activity'
> -    object = ('Concept', 'ConceptScheme')
> +    object = ('Concept', 'ConceptScheme', 'SEDAArchiveTransfer')
>
>
>  # ARK ##########################################################################
>
>  class ark(RelationDefinition):
> diff --git a/cubicweb_saem_ref/views/seda.py b/cubicweb_saem_ref/views/seda.py
> --- a/cubicweb_saem_ref/views/seda.py
> +++ b/cubicweb_saem_ref/views/seda.py
> @@ -15,10 +15,11 @@
>  # with this program. If not, see <http://www.gnu.org/licenses/>.
>  """cubicweb-saem-ref views related to SEDA"""
>
>  from cubicweb.web.views import uicfg
>
> +from cubicweb_seda.views import archivetransfer
>  from cubicweb_seda.views.simplified import simplified_afs, simplified_pvs
>
>
>  # primary view configuration #######################################################################
>
> @@ -44,5 +45,8 @@ simplified_pvs.tag_object_of(('*', 'use_
>  simplified_afs.tag_object_of(('*', 'use_profile', '*'), 'main', 'hidden')
>
>  simplified_pvs.tag_attribute(('SEDABinaryDataObject', 'filename'), 'hidden')
>  simplified_afs.tag_attribute(('SEDABinaryDataObject', 'filename'), 'main', 'hidden')
>  afs.tag_attribute(('SEDABinaryDataObject', 'filename'), 'main', 'hidden')
> +
> +
> +archivetransfer.ArchiveTransferTabbedPrimaryView.tabs.append('saem.lifecycle_tab')
> diff --git a/test/unittest_hooks.py b/test/unittest_hooks.py
> --- a/test/unittest_hooks.py
> +++ b/test/unittest_hooks.py
> @@ -473,10 +473,20 @@ class EntityLifeCycleTC(CubicWebTC):
>              rset = cnx.execute('Activity X ORDERBY X DESC WHERE X type "modify", X used %(x)s',
>                                 {'x': scheme.eid})
>              self.assertEqual(len(rset), 2)
>              self.assertEqual(rset.get_entity(0, 0).description, 'added in_scheme_object')
>
> +    def test_archive_transfer_create_update(self):
> +        with self.new_access(u'bob').cnx() as cnx:
> +            transfer = testutils.setup_profile(cnx)
> +            cnx.commit()
> +            self._check_create(cnx, transfer.eid, 'created sedaarchivetransfer')
> +            transfer.cw_set(title=u'123')
> +            cnx.commit()
> +            self._check_modification(cnx, transfer.eid,
> +                                     'modified title')
> +
>
>  class SEDAArchiveTransferHooksTC(CubicWebTC):
>
>      def test_profile_deprecated(self):
>          """Test hook deprecating a SEDA Profile upon successor publication."""
>
ok for the whole branch



More information about the saem-devel mailing list