本文整理汇总了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