本文整理汇总了Python中models.private_key.PrivateKey.set方法的典型用法代码示例。如果您正苦于以下问题:Python PrivateKey.set方法的具体用法?Python PrivateKey.set怎么用?Python PrivateKey.set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.private_key.PrivateKey
的用法示例。
在下文中一共展示了PrivateKey.set方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create
# 需要导入模块: from models.private_key import PrivateKey [as 别名]
# 或者: from models.private_key.PrivateKey import set [as 别名]
def create(self, key):
"""Set the private key."""
if not users.is_current_user_admin():
handlers.http_error(403, "Only admins may set the private key.")
PrivateKey.set(key)
handlers.flash("Private key set successfully.")
raise cherrypy.HTTPRedirect("/admin#tab-private-key")
示例2: setUp
# 需要导入模块: from models.private_key import PrivateKey [as 别名]
# 或者: from models.private_key.PrivateKey import set [as 别名]
def setUp(self):
"""Initialize stubs for testing.
This initializes the following fields:
self.testbed: An App Engine Testbed used for mocking App Engine
services. This is activated, and any necessary stubs are
initialized.
self.testapp: A webtest.TestApp wrapping the CherryPy application.
Subclasses that define their own setUp method should be sure to call
this one as well.
"""
self.__users = {}
self.__admins = {}
self.testbed = Testbed()
self.testbed.activate()
self.testbed.init_app_identity_stub()
self.testbed.init_blobstore_stub()
self.testbed.init_datastore_v3_stub()
self.testbed.init_files_stub()
self.testbed.init_memcache_stub()
self.testbed.init_taskqueue_stub()
self.testbed.init_user_stub()
self.testapp = webtest.TestApp(Application())
# Pretend we are running on AppEngine so that things like the error
# page that behave differently when run locally act like they do in
# production.
os.environ['SERVER_SOFTWARE'] = 'Google App Engine/TESTING'
# This private key is not actually used for anything other than testing.
PrivateKey.set('''-----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
DEK-Info: DES-EDE3-CBC,CEB8C6541017AC8B
q1SgqAfgHXK5cQvtdIF8rkSlbAS6a92T5tYMVKJIW24giF5cw+1++X7X6S5ECykC
/iECExP7WfVlPDVoJMZpWGsYLMPhxncnKfUDICbVgwsO4KKeEv8lYTrvkY1sCZIx
kSja/lGAWpyxBnmxwoLh0LbLJBGUxUgn2Uqv/8Iid+w0m3NlgrllV+kOo4gUYF9q
bestH4nEQj6F0CeI8VPW0FxzMwn0vreHFBT5hul6xbNdB1vnRcz6ed4FiGXoAB5K
/8/Q2qyy1UPe2Hr9IoC6wo4h2kXq7pmhy/rtzU9/gjsGPD33ByavbgHAen0ajY5p
RmCx0AGidK9T6/SNoyDD9CMq7ypL+0JWoCeVoAEw2aZqN4rMJNbKMgPH+ajgiAXe
AWuMVjWN6uTL5+QJmWQct6a6TF8GPKdTcOZfNIXU5U9drHB2hggLcy6XkCYGjVJv
MvLascE4oAtOHnwz7WhrpcmX6F6Fww+TPnFzjk+IGJrnBUnAArEcM13IjiDUgg9B
iLuKimwrqasdBBY3Ua3SRMoG8PJoNKdsk1hDGlpxLnqOVUCvPKZuz4QnFusnUJrR
kiv+aqVBpZYymMh2Q1MWcogA7rL7LIowAkyLzS8dNwDhyk9jbO+1uoFSHKr5BTNv
cMJfCVm8pqhXwCVx3uYnhUzvth7mcEseXh5Dcg1RHka5rCXUz4eVxTkj1u3FOy9o
9jgARPpnDYsXH1lESxmiNZucHa50qI/ezNvQx8CbNa1/+JWoZ77yqM9qnDlXUwDY
1Sxqx9+4kthG9oyCzzUwFvhf1kTEHd0RfIapgjJ16HBQmzLnEPtjPA==
-----END RSA PRIVATE KEY-----''')
self.dont_be_oauth_user()