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

Laurent Peuch cortex at worlddomination.be
Fri Feb 14 16:00:09 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 9170cbf7f940fd2a33532eed096372b04439e2ea
# Parent  c2fd360f320a8ae2f06c72960732f3eee5de29bb
# Available At https://hg.logilab.org/users/lpeuch/yams
#              hg pull https://hg.logilab.org/users/lpeuch/yams -r 9170cbf7f940
[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
@@ -1160,8 +1160,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