当前位置: 首页>>代码示例>>Python>>正文


Python Utils.get_global_password方法代码示例

本文整理汇总了Python中Mailman.Utils.get_global_password方法的典型用法代码示例。如果您正苦于以下问题:Python Utils.get_global_password方法的具体用法?Python Utils.get_global_password怎么用?Python Utils.get_global_password使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mailman.Utils的用法示例。


在下文中一共展示了Utils.get_global_password方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: AuthContextInfo

# 需要导入模块: from Mailman import Utils [as 别名]
# 或者: from Mailman.Utils import get_global_password [as 别名]
 def AuthContextInfo(self, authcontext, user=None):
     # authcontext may be one of AuthUser, AuthListModerator,
     # AuthListAdmin, AuthSiteAdmin.  Not supported is the AuthCreator
     # context.
     #
     # user is ignored unless authcontext is AuthUser
     #
     # Return the authcontext's secret and cookie key.  If the authcontext
     # doesn't exist, return the tuple (None, None).  If authcontext is
     # AuthUser, but the user isn't a member of this mailing list, a
     # NotAMemberError will be raised.  If the user's secret is None, raise
     # a MMBadUserError.
     key = self.internal_name() + '+'
     if authcontext == mm_cfg.AuthUser:
         if user is None:
             # A bad system error
             raise TypeError, 'No user supplied for AuthUser context'
         secret = self.getMemberPassword(user)
         userdata = urllib.quote(Utils.ObscureEmail(user), safe='')
         key += 'user+%s' % userdata
     elif authcontext == mm_cfg.AuthListPoster:
         secret = self.post_password
         key += 'poster'
     elif authcontext == mm_cfg.AuthListModerator:
         secret = self.mod_password
         key += 'moderator'
     elif authcontext == mm_cfg.AuthListAdmin:
         secret = self.password
         key += 'admin'
     # BAW: AuthCreator
     elif authcontext == mm_cfg.AuthSiteAdmin:
         sitepass = Utils.get_global_password()
         if mm_cfg.ALLOW_SITE_ADMIN_COOKIES and sitepass:
             secret = sitepass
             key = 'site'
         else:
             # BAW: this should probably hand out a site password based
             # cookie, but that makes me a bit nervous, so just treat site
             # admin as a list admin since there is currently no site
             # admin-only functionality.
             secret = self.password
             key += 'admin'
     else:
         return None, None
     return key, secret
开发者ID:EmilyDirsh,项目名称:Paperboy,代码行数:47,代码来源:SecurityManager.py


注:本文中的Mailman.Utils.get_global_password方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。