We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6750682 commit adffbd1Copy full SHA for adffbd1
1 file changed
src/util/Flag.py
@@ -0,0 +1,22 @@
1
+from collections import defaultdict
2
+
3
4
+class Flag(object):
5
+ def __init__(self):
6
+ self.valid_flags = set([
7
+ "admin", # Only allowed to run sites with ADMIN permission
8
+ "async_run", # Action will be ran async with gevent.spawn
9
+ "no_multiuser" # Action disabled if Multiuser plugin running in open proxy mode
10
+ ])
11
+ self.db = defaultdict(set)
12
13
+ def __getattr__(self, key):
14
+ def func(f):
15
+ if key not in self.valid_flags:
16
+ raise Exception("Invalid flag: %s (valid: %s)" % (key, self.valid_flags))
17
+ self.db[f.__name__].add(key)
18
+ return f
19
+ return func
20
21
22
+flag = Flag()
0 commit comments