# HG changeset patch # User Thierry Florac # Date 1529664691 -7200 # Node ID 91e0b2a7a5449f7c33a5ae59a01020a56ff7696b # Parent 56f01a2bcb3253094cf04761f2d8181365dc9707 Small code refactoring diff -r 56f01a2bcb32 -r 91e0b2a7a544 src/pyams_workflow/content.py --- a/src/pyams_workflow/content.py Fri Jun 22 09:11:25 2018 +0200 +++ b/src/pyams_workflow/content.py Fri Jun 22 12:51:31 2018 +0200 @@ -172,6 +172,8 @@ (self.publication_expiration_date >= now)) def is_visible(self, request=None, check_parent=True): + if request is None: + request = check_request() # associated workflow? content = IWorkflowManagedContent(self.__parent__, None) if content is not None: @@ -179,11 +181,9 @@ if not wf_name: return True # check workflow? - if content.view_permission: - if request is None: - request = check_request() - if not request.has_permission(content.view_permission, context=self.__parent__): - return False + if content.view_permission and \ + not request.has_permission(content.view_permission, context=self.__parent__): + return False else: if not request.has_permission(VIEW_PERMISSION, context=self.__parent__): return False