June 6, 2020

How to Deactivate Auto Import in Pylance

Unfortunately, the auto-import feature in PyLance surprised me with random imports. e.g. with from unittest.case import expectedFailure just when I typed assert result == expected. Luckily, the developers listened to the users, and with version 2020.8.0 this “feature” is optional. In order to deactivate it, set the following option to false: python.analysis.autoImportCompletions Thank you, Savannah!

April 11, 2020

How to Replace the Old With the New Decorator Syntax for Zope's Security Declarations

Zope’s security architecture is built upon security declarations, which scope can be either a method, several methods or even a complete class. Until recently you usually declared the security for a method like this… from AccessControl import getSecurityManager class Suggestions(SomeBaseClass): security = ClassSecurityInfo() security.declareProtected("View", "all_suggestions") def all_suggestions(): ... Then, when accessing this method, e.g. the logged in user’s role or group was checked against the security declaration. One big disadvantage was that you could easily introduce typos....