本文整理汇总了Python中gnupg.GPG.key_is_expired方法的典型用法代码示例。如果您正苦于以下问题:Python GPG.key_is_expired方法的具体用法?Python GPG.key_is_expired怎么用?Python GPG.key_is_expired使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gnupg.GPG
的用法示例。
在下文中一共展示了GPG.key_is_expired方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: login_common_checks
# 需要导入模块: from gnupg import GPG [as 别名]
# 或者: from gnupg.GPG import key_is_expired [as 别名]
def login_common_checks(username):
try:
user = User.objects.get(username = username)
if user.is_active:
gpg = GPG(gpgbinary=settings.GNUPGBINARY, gnupghome=settings.GNUPGHOME)
if not gpg.key_is_expired(user.pgpkey.fingerprint):
key = gpg.get_key(user.pgpkey.fingerprint)
if key['ownertrust'] in settings.TRUST_LEVELS:
error = False
else:
error = 'PGP key for user \'%s\' is not trusted (yet)' % username
else:
error = 'PGP key for user \'%s\' has expired' % username
else:
error = 'Account for user \'%s\' is disabled' % username
gpg = None
except ObjectDoesNotExist:
error = 'User \'%s\' does not exist' % username
user = None
gpg = None
return user, error, gpg