本文整理汇总了Python中soil.DownloadBase.get_start_response方法的典型用法代码示例。如果您正苦于以下问题:Python DownloadBase.get_start_response方法的具体用法?Python DownloadBase.get_start_response怎么用?Python DownloadBase.get_start_response使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类soil.DownloadBase
的用法示例。
在下文中一共展示了DownloadBase.get_start_response方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: export_all_form_metadata_async
# 需要导入模块: from soil import DownloadBase [as 别名]
# 或者: from soil.DownloadBase import get_start_response [as 别名]
def export_all_form_metadata_async(req, domain):
datespan = req.datespan if req.GET.get("startdate") and req.GET.get("enddate") else None
group_id = req.GET.get("group")
ufilter = UserTypeFilter.get_user_filter(req)[0]
users = util.get_all_users_by_domain(
domain=domain,
group=group_id,
user_filter=ufilter,
simplified=True,
include_inactive=True
)
user_ids = filter(None, [u["user_id"] for u in users])
format = req.GET.get("format", Format.XLS_2007)
filename = "%s_forms" % domain
download = DownloadBase()
download.set_task(create_metadata_export.delay(
download.download_id,
domain,
format=format,
filename=filename,
datespan=datespan,
user_ids=user_ids,
))
return download.get_start_response()
示例2: prepare_export
# 需要导入模块: from soil import DownloadBase [as 别名]
# 或者: from soil.DownloadBase import get_start_response [as 别名]
def prepare_export(self, export_tags, export_filter):
self.generate_bulk_files(export_tags, export_filter)
download = DownloadBase()
couchexport.tasks.bulk_export_async.delay(
self,
download.download_id,
domain=self.domain
)
return download.get_start_response()
示例3: export_data_async
# 需要导入模块: from soil import DownloadBase [as 别名]
# 或者: from soil.DownloadBase import get_start_response [as 别名]
def export_data_async(self, format=None, **kwargs):
format = format or self.default_format
download = DownloadBase()
download.set_task(couchexport.tasks.export_async.delay(
self,
download.download_id,
format=format,
**kwargs
))
return download.get_start_response()
示例4: download_item_lists
# 需要导入模块: from soil import DownloadBase [as 别名]
# 或者: from soil.DownloadBase import get_start_response [as 别名]
def download_item_lists(request, domain):
"""Asynchronously serve excel download for edit_lookup_tables
"""
download = DownloadBase()
download.set_task(fixture_download_async.delay(
prepare_fixture_download,
table_ids=request.GET.getlist("table_id"),
domain=domain,
download_id=download.download_id,
))
return download.get_start_response()
示例5: export_all_form_metadata_async
# 需要导入模块: from soil import DownloadBase [as 别名]
# 或者: from soil.DownloadBase import get_start_response [as 别名]
def export_all_form_metadata_async(req, domain):
format = req.GET.get("format", Format.XLS_2007)
filename = "%s_forms" % domain
download = DownloadBase()
download.set_task(create_metadata_export.delay(
download.download_id,
domain,
format=format,
filename=filename,
))
return download.get_start_response()
示例6: generate_payload
# 需要导入模块: from soil import DownloadBase [as 别名]
# 或者: from soil.DownloadBase import get_start_response [as 别名]
def generate_payload(payload_func):
if async:
download = DownloadBase()
a_task = prepare_download.delay(download.download_id, payload_func, content_disposition, mimetype)
download.set_task(a_task)
return download.get_start_response()
else:
payload = payload_func()
response = HttpResponse(payload)
response["Content-Type"] = mimetype
response["Content-Disposition"] = content_disposition
return response
示例7: get
# 需要导入模块: from soil import DownloadBase [as 别名]
# 或者: from soil.DownloadBase import get_start_response [as 别名]
def get(self, request, *args, **kwargs):
assert self.include_multimedia_files or self.include_index_files
error_response = self.check_before_zipping()
if error_response:
return error_response
download = DownloadBase()
download.set_task(build_application_zip.delay(
include_multimedia_files=self.include_multimedia_files,
include_index_files=self.include_index_files,
app=self.app,
download_id=download.download_id,
compress_zip=self.compress_zip,
filename=self.zip_name)
)
return download.get_start_response()
示例8: get
# 需要导入模块: from soil import DownloadBase [as 别名]
# 或者: from soil.DownloadBase import get_start_response [as 别名]
def get(self, request, *args, **kwargs):
assert self.include_multimedia_files or self.include_index_files
error_response = self.check_before_zipping()
if error_response:
return error_response
message = request.GET['message'] if 'message' in request.GET else None
download = DownloadBase(message=message)
build_profile_id = None
if domain_has_privilege(request.domain, privileges.BUILD_PROFILES):
build_profile_id = request.GET.get('profile')
download.set_task(build_application_zip.delay(
include_multimedia_files=self.include_multimedia_files,
include_index_files=self.include_index_files,
app=self.app,
download_id=download.download_id,
compress_zip=self.compress_zip,
filename=self.zip_name,
build_profile_id=build_profile_id)
)
return download.get_start_response()