[PATCH seda] [seda] Don't consider agency may be None in agency_id/name methods

Sylvain Thenault sylvain.thenault at logilab.fr
Tue Jun 6 10:22:32 CEST 2017


# HG changeset patch
# User Sylvain Thénault <sylvain.thenault at logilab.fr>
# Date 1496294601 -7200
#      Thu Jun 01 07:23:21 2017 +0200
# Node ID 5cda167cef433720c0fa214e66ebd17fa5f65ced
# Parent  67558c0fc5ee8628956bdda371aa3c6e408198e7
# Available At https://hg.logilab.org/review/cubes/seda
#              hg pull https://hg.logilab.org/review/cubes/seda -r 5cda167cef43
[seda] Don't consider agency may be None in agency_id/name methods

since this is handled by the caller.

diff --git a/cubicweb_seda/entities/profile_generation.py b/cubicweb_seda/entities/profile_generation.py
--- a/cubicweb_seda/entities/profile_generation.py
+++ b/cubicweb_seda/entities/profile_generation.py
@@ -1101,14 +1101,14 @@ class SEDA1XSDExport(SEDA2ExportAdapter)
     def archive_unit_name(self, archive_unit):
         seq = archive_unit.first_level_choice.content_sequence
         return seq.title
 
     def agency_name(self, agency):
-        return agency.agency.dc_title() if agency and agency.agency else None
+        return agency.agency.dc_title() if agency.agency is not None else None
 
     def agency_id(self, agency):
-        return text_type(agency.agency.eid) if agency and agency.agency else None
+        return text_type(agency.agency.eid) if agency.agency is not None else None
 
     def archive_unit_content(self, archive_unit):
         return archive_unit.first_level_choice.content_sequence
 
     def system_id(self, data_object):


More information about the saem-devel mailing list