changeset 45:fc685d0c9342 trunk

define `__contains__` for using the `in` operator w/ the permission cache
author mgood
date Tue, 04 Jul 2006 00:52:41 +0000
parents 436e30c8420b
children 3e2eea892ebd
files examples/trac/trac/perm.py
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/examples/trac/trac/perm.py
+++ b/examples/trac/trac/perm.py
@@ -268,6 +268,7 @@
 
     def has_permission(self, action):
         return self.perms.has_key(action)
+    __contains__ = has_permission
 
     def assert_permission(self, action):
         if not self.perms.has_key(action):
@@ -282,6 +283,7 @@
 
     def has_permission(self, action):
         return False
+    __contains__ = has_permission
 
     def assert_permission(self, action):
         raise PermissionError(action)
Copyright (C) 2012-2017 Edgewall Software