tcms.xmlrpc.utils module

tcms.xmlrpc.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.xmlrpc.utils.distinct_filter(cls, values)[source]
tcms.xmlrpc.utils.distinct_m2m_rows(cls, values, op_type)[source]

By django model field looking up syntax, loop values and check the condition if there is a multi-tables query.

@param cls: table model class @type cls: subclass of django.db.models.Model @param values: fields in where condition. @type values: dict @return: QuerySet @rtype: django.db.models.query.QuerySet

tcms.xmlrpc.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!


\r\n are expected! Do not change!

tcms.xmlrpc.utils.get_attachments_for(request, obj)[source]
tcms.xmlrpc.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.