示例#1
0
 def instance(cls):
     if cls._instance is None:
         # Call startup() to fill UserTypes also in a
         # multi-threaded environment:
         settings.SITE.startup()
         cls._instance = AnonymousUser()
         from lino.modlib.users.choicelists import UserTypes
         cls._instance.profile = UserTypes.get_by_name('anonymous', None)
         # cls._instance.profile = UserTypes.get_by_value(
         #     settings.SITE.anonymous_user_type, None)
         # if cls._instance.profile is None:
         #     raise Exception(
         #         "Invalid value %r for `SITE.anonymous_user_type`. "
         #         "Must be one of %s" % (
         #             settings.SITE.anonymous_user_type,
         #             [i.value for i in list(UserTypes.items())]))
     return cls._instance
示例#2
0
文件: utils.py 项目: gary-ops/lino
 def __init__(self):
     settings.SITE.startup()
     from lino.modlib.users.choicelists import UserTypes
     self.user_type = UserTypes.get_by_name(self.username, None)
示例#3
0
 def __init__(self):
     settings.SITE.startup()
     from lino.modlib.users.choicelists import UserTypes
     self.user_type = UserTypes.get_by_name(self.username, None)