def has_multimedia(request, domain): """Checks to see if this form export has multimedia available to export """ form_or_case = request.GET.get('form_or_case') if form_or_case != 'form': raise ValueError("has_multimedia is only available for form exports") permissions = ExportsPermissionsManager(form_or_case, domain, request.couch_user) permissions.access_download_export_or_404() export_object = FormExportInstance.get(request.GET.get('export_id')) if isinstance(export_object, ExportInstance): has_multimedia = export_object.has_multimedia else: has_multimedia = forms_have_multimedia( domain, export_object.app_id, getattr(export_object, 'xmlns', '')) return JsonResponse({ 'success': True, 'hasMultimedia': has_multimedia, })
def has_multimedia(request, domain): """Checks to see if this form export has multimedia available to export """ form_or_case = request.GET.get('form_or_case') if form_or_case != 'form': raise ValueError("has_multimedia is only available for form exports") permissions = ExportsPermissionsManager(form_or_case, domain, request.couch_user) permissions.access_download_export_or_404() export_object = FormExportInstance.get(request.GET.get('export_id')) if isinstance(export_object, ExportInstance): has_multimedia = export_object.has_multimedia else: has_multimedia = forms_have_multimedia( domain, export_object.app_id, getattr(export_object, 'xmlns', '') ) return json_response({ 'success': True, 'hasMultimedia': has_multimedia, })
def test_forms_have_multimedia(self): for app_id, xmlns, with_attachments in COMBOS: self.assertEqual(forms_have_multimedia(DOMAIN, app_id, xmlns), with_attachments, [app_id, xmlns])
def test_forms_have_multimedia(self): for app_id, xmlns, with_attachments in COMBOS: self.assertEqual(forms_have_multimedia(DOMAIN, app_id, xmlns), with_attachments, [app_id, xmlns])
def forms_have_multimedia(domain, app_id, xmlns): return forms_have_multimedia(domain, app_id, xmlns)