[PATCH 19 of 24 yams V2] [fix] add another condition to please mypy

Laurent Peuch cortex at worlddomination.be
Wed Mar 4 15:17:55 CET 2020


# HG changeset patch
# User Laurent Peuch <cortex at worlddomination.be>
# Date 1580312291 -3600
#      Wed Jan 29 16:38:11 2020 +0100
# Node ID 6cb63a3499a9633d0748987e747fb8e81c8f0e3d
# Parent  0d0a7dd7272ed0043b00c8c353779ddbcbf1bff2
# Available At https://hg.logilab.org/users/lpeuch/yams
#              hg pull https://hg.logilab.org/users/lpeuch/yams -r 6cb63a3499a9
# EXP-Topic type_annotations
[fix] add another condition to please mypy

diff --git a/yams/schema.py b/yams/schema.py
--- a/yams/schema.py
+++ b/yams/schema.py
@@ -1191,8 +1191,8 @@ class RelationSchema(ERSchema):
         for rdef in self.rdefs.values():
             rdef.check_permission_definitions()
 
-        if self.rule and (self.permissions.get('add')
-                          or self.permissions.get('delete')):
+        if self.rule and self.permissions and (self.permissions.get('add')
+                                               or self.permissions.get('delete')):
             raise BadSchemaDefinition(
                 'Cannot set add/delete permissions on computed relation %s'
                 % self.type)



More information about the cubicweb-devel mailing list