[PATCH 1 of 2 eac] Do not export empty "descriptiveNote" elements

Denis Laxalde denis.laxalde at logilab.fr
Mon Dec 18 15:36:24 CET 2017


# HG changeset patch
# User Denis Laxalde <denis.laxalde at logilab.fr>
# Date 1513606950 -3600
#      Mon Dec 18 15:22:30 2017 +0100
# Node ID 0553a7429acaaba90617cddd09b50f89b3842338
# Parent  82b5defa1894cbf0b38a20713c025a2cc1238df7
Do not export empty "descriptiveNote" elements

diff --git a/cubicweb_eac/entities.py b/cubicweb_eac/entities.py
--- a/cubicweb_eac/entities.py
+++ b/cubicweb_eac/entities.py
@@ -275,8 +275,11 @@ def add_descriptive_note(func):
     def wrapper(self, entity, *args, **kwargs):
         element = func(self, entity, *args, **kwargs)
         if element is not None and entity.description:
-            self.element('descriptiveNote', parent=element).extend(
-                self._eac_richstring_paragraph_elements(entity, "description"))
+            description = self._eac_richstring_paragraph_elements(
+                entity, "description")
+            if description:
+                self.element('descriptiveNote', parent=element).extend(
+                    description)
         return element
     return wrapper
 



More information about the saem-devel mailing list