tcms.rpc.utils module

tcms.rpc.utils.add_attachment(obj_id, app_model, user, filename, b64content)[source]

High-level function which performs the attachment process by constructing an HttpRequest object and passing it to attachments.views.add_attachment() as if it came from the browser.

tcms.rpc.utils.encode_multipart(csrf_token, filename, b64content)[source]

Build a multipart/form-data body with generated random boundary suitable for parsing by django.http.request.HttpRequest and the parser classes related to it!

Note

\r\n are expected! Do not change!

tcms.rpc.utils.get_attachments_for(request, obj)[source]
tcms.rpc.utils.request_for_upload(user, filename, b64content)[source]

Return a request object containing all fields necessary for file upload as if it was sent by the browser.