소스 검색

[api] Refactor _patch_operation_id_request in public APIs

Harshg999 4 년 전
부모
커밋
4fb34a60e7
1개의 변경된 파일9개의 추가작업 그리고 7개의 파일을 삭제
  1. 9 7
      desktop/core/src/desktop/api_public.py

+ 9 - 7
desktop/core/src/desktop/api_public.py

@@ -167,14 +167,16 @@ def _get_interpreter_from_dialect(dialect, user):
 
 
 def _patch_operation_id_request(django_request):
-  if django_request.POST.get('operationId') and not django_request.POST.get('snippet'):
-    data = {
-      'snippet': '{"type":"1","result":{}}',
-      'operationId': django_request.POST.get('operationId')
-    }
+  data = {}
 
-    django_request.POST = QueryDict(mutable=True)
-    django_request.POST.update(data)
+  if not django_request.POST.get('snippet'):
+    data['snippet'] = '{"type":"mysql","result":{}}'
+
+  if django_request.POST.get('operationId'):
+    data['operationId'] = django_request.POST.get('operationId')
+
+  django_request.POST = QueryDict(mutable=True)
+  django_request.POST.update(data)
 
 
 def get_django_request(request):