本文整理汇总了Python中globaleaks.rest.apicache.GLApiCache.get方法的典型用法代码示例。如果您正苦于以下问题:Python GLApiCache.get方法的具体用法?Python GLApiCache.get怎么用?Python GLApiCache.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类globaleaks.rest.apicache.GLApiCache
的用法示例。
在下文中一共展示了GLApiCache.get方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_set
# 需要导入模块: from globaleaks.rest.apicache import GLApiCache [as 别名]
# 或者: from globaleaks.rest.apicache.GLApiCache import get [as 别名]
def test_set(self):
self.assertTrue("passante_di_professione" not in GLApiCache.memory_cache_dict)
pdp_it = yield GLApiCache.get("passante_di_professione", "it", self.mario, "come", "una", "catapulta!")
self.assertTrue("passante_di_professione" in GLApiCache.memory_cache_dict)
self.assertTrue(pdp_it == "come una catapulta!")
yield GLApiCache.set("passante_di_professione", "it", "ma io ho visto tutto!")
self.assertTrue("passante_di_professione" in GLApiCache.memory_cache_dict)
pdp_it = yield GLApiCache.get("passante_di_professione", "it", self.mario, "already", "cached")
self.assertEqual(pdp_it, "ma io ho visto tutto!")
示例2: test_get
# 需要导入模块: from globaleaks.rest.apicache import GLApiCache [as 别名]
# 或者: from globaleaks.rest.apicache.GLApiCache import get [as 别名]
def test_get(self):
self.assertTrue("passante_di_professione" not in GLApiCache.memory_cache_dict)
pdp_it = yield GLApiCache.get("passante_di_professione", "it", self.mario, "come", "una", "catapulta!")
pdp_en = yield GLApiCache.get("passante_di_professione", "en", self.mario, "like", "a", "catapult!")
self.assertTrue("passante_di_professione" in GLApiCache.memory_cache_dict)
self.assertTrue("it" in GLApiCache.memory_cache_dict['passante_di_professione'])
self.assertTrue("en" in GLApiCache.memory_cache_dict['passante_di_professione'])
self.assertEqual(pdp_it, "come una catapulta!")
self.assertEqual(pdp_en, "like a catapult!")
示例3: get
# 需要导入模块: from globaleaks.rest.apicache import GLApiCache [as 别名]
# 或者: from globaleaks.rest.apicache.GLApiCache import get [as 别名]
def get(self):
"""
Get the Ahmia.fi descriptor
"""
node_info = yield GLApiCache.get("node", self.request.language, serialize_node, self.request.language)
if node_info["ahmia"]:
ret = yield GLApiCache.get("ahmia", self.request.language, serialize_ahmia, self.request.language)
self.finish(ret)
else: # in case of disabled option we return 404
self.set_status(404)
self.finish()
示例4: get
# 需要导入模块: from globaleaks.rest.apicache import GLApiCache [as 别名]
# 或者: from globaleaks.rest.apicache.GLApiCache import get [as 别名]
def get(self):
"""
Get the ahmia.fi descriptor
"""
node_info = yield GLApiCache.get('node', self.request.language,
serialize_node, self.request.language)
if node_info['ahmia']:
ret = yield GLApiCache.get('ahmia', self.request.language,
serialize_ahmia, self.request.language)
self.write(ret)
else: # in case of disabled option we return 404
self.set_status(404)
示例5: get
# 需要导入模块: from globaleaks.rest.apicache import GLApiCache [as 别名]
# 或者: from globaleaks.rest.apicache.GLApiCache import get [as 别名]
def get(self):
"""
Get all the receivers.
"""
ret = yield GLApiCache.get('receivers', self.request.language,
get_public_receiver_list, self.request.language)
self.finish(ret)
示例6: get
# 需要导入模块: from globaleaks.rest.apicache import GLApiCache [as 别名]
# 或者: from globaleaks.rest.apicache.GLApiCache import get [as 别名]
def get(self, lang):
self.set_header('Content-Type', 'application/json')
l10n = yield GLApiCache.get('l10n', self.request.language,
get_l10n, self.request.language)
self.write(l10n)
示例7: test_invalidate
# 需要导入模块: from globaleaks.rest.apicache import GLApiCache [as 别名]
# 或者: from globaleaks.rest.apicache.GLApiCache import get [as 别名]
def test_invalidate(self):
self.assertTrue("passante_di_professione" not in GLApiCache.memory_cache_dict)
pdp_it = yield GLApiCache.get("passante_di_professione", "it", self.mario, "come", "una", "catapulta!")
self.assertTrue("passante_di_professione" in GLApiCache.memory_cache_dict)
self.assertEqual(pdp_it, "come una catapulta!")
yield GLApiCache.invalidate("passante_di_professione")
self.assertTrue("passante_di_professione" not in GLApiCache.memory_cache_dict)
示例8: get
# 需要导入模块: from globaleaks.rest.apicache import GLApiCache [as 别名]
# 或者: from globaleaks.rest.apicache.GLApiCache import get [as 别名]
def get(self):
"""
Return a list of all the fields templates available.
:return: the list of field templates registered on the node.
:rtype: list
"""
response = yield GLApiCache.get('fieldtemplates', self.request.language,
get_fieldtemplate_list, self.request.language, self.request.request_type)
self.write(response)
示例9: get
# 需要导入模块: from globaleaks.rest.apicache import GLApiCache [as 别名]
# 或者: from globaleaks.rest.apicache.GLApiCache import get [as 别名]
def get(self):
"""
Return all the questionnaires.
Parameters: None
Response: adminQuestionnaireList
Errors: None
"""
response = yield GLApiCache.get('questionnaires', self.request.language,
get_questionnaire_list, self.request.language)
self.write(response)