Forking what is left of ZeroNet and hopefully adding an AT Proto Frontend/Proxy
at main 22 lines 683 B view raw
1from collections import defaultdict 2 3 4class 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 22flag = Flag()