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


Python Utils.hexlify方法代码示例

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


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

示例1: MakeCookie

# 需要导入模块: from Mailman import Utils [as 别名]
# 或者: from Mailman.Utils import hexlify [as 别名]
 def MakeCookie(self, key):
     # Ingredients for our cookie: our `secret' which is the list's admin
     # password (never sent in the clear) and the time right now in seconds
     # since the epoch.
     secret = self.password
     issued = int(time.time())
     # Get a digest of the secret, plus other information.
     mac = sha.new(secret + `issued`).hexdigest()
     # Create the cookie object.  The way the cookie module converts
     # non-strings to pickles can cause problems if the resulting string
     # needs to be quoted.  So we'll do the conversion ourselves.
     c = Cookie.Cookie()
     c[key] = Utils.hexlify(marshal.dumps((issued, mac)))
     # The path to all Mailman stuff, minus the scheme and host,
     # i.e. usually the string `/mailman'
     path = urlparse(self.web_page_url)[2]
     c[key]['path'] = path
     # Should we use session or persistent cookies?
     if mm_cfg.ADMIN_COOKIE_LIFE > 0:
         c[key]['expires'] = mm_cfg.ADMIN_COOKIE_LIFE
         c[key]['max-age'] = mm_cfg.ADMIN_COOKIE_LIFE
     # Set the RFC 2109 required header
     c[key]['version'] = 1
     return c
开发者ID:OS2World,项目名称:APP-SERVER-MailMan,代码行数:26,代码来源:SecurityManager.py


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