本文整理匯總了Python中couchexport.models.SavedBasicExport.get_payload方法的典型用法代碼示例。如果您正苦於以下問題:Python SavedBasicExport.get_payload方法的具體用法?Python SavedBasicExport.get_payload怎麽用?Python SavedBasicExport.get_payload使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類couchexport.models.SavedBasicExport
的用法示例。
在下文中一共展示了SavedBasicExport.get_payload方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_file_save_and_load
# 需要導入模塊: from couchexport.models import SavedBasicExport [as 別名]
# 或者: from couchexport.models.SavedBasicExport import get_payload [as 別名]
def test_file_save_and_load(self):
payload = 'something small and simple'
for name in ['normal', u'हिंदी', None]:
saved = SavedBasicExport(configuration=_mk_config(name))
saved.save()
saved.set_payload(payload)
self.assertEqual(payload, saved.get_payload())
示例2: testFileSaveAndLoad
# 需要導入模塊: from couchexport.models import SavedBasicExport [as 別名]
# 或者: from couchexport.models.SavedBasicExport import get_payload [as 別名]
def testFileSaveAndLoad(self):
def _mk_config(name):
return ExportConfiguration(index="dummy_index", name=name, format="xlsx")
payload = "something small and simple"
for name in ["normal", u"हिंदी", None]:
saved = SavedBasicExport(configuration=_mk_config(name))
saved.save()
saved.set_payload(payload)
self.assertEqual(payload, saved.get_payload())
示例3: test_save_basic_export_to_blobdb
# 需要導入模塊: from couchexport.models import SavedBasicExport [as 別名]
# 或者: from couchexport.models.SavedBasicExport import get_payload [as 別名]
def test_save_basic_export_to_blobdb(self):
index = ['single']
saved_export = SavedBasicExport(configuration=_mk_config(index=index))
saved_export.save()
saved_export.set_payload("content")
name = saved_export.get_attachment_name()
self.assertTrue(saved_export.has_file())
self.assertIn(name, saved_export.external_blobs)
self.assertEqual(saved_export.size, 7)
with saved_export.get_payload(stream=True) as fh:
self.assertEqual(fh.read(), "content")