Skip to content

Commit

Permalink
Revert "OpenConceptLab/ocl_issues#1588 | Can except OCL Source versio…
Browse files Browse the repository at this point in the history
…n export for import into same or different owner and as same or different version"

This reverts commit eff591c.
  • Loading branch information
snyaggarwal committed Jul 24, 2023
1 parent eff591c commit 5d86616
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 21 deletions.
18 changes: 1 addition & 17 deletions core/importers/input_parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from zipfile import ZipFile

import requests
from ocldev.oclexporttoimportconverter import OCLExportToImportConverter
from ocldev.oclcsvtojsonconverter import OclStandardCsvToJsonConverter
from pydash import get, compact

Expand All @@ -20,11 +19,10 @@ class ImportContentParser:
2. Processes json/csv/zip file url from 'file_url' arg
3. Processes json/csv/zip file from 'file' arg
"""
def __init__(self, content=None, file_url=None, file=None, **kwargs):
def __init__(self, content=None, file_url=None, file=None):
self.content = content
self.file_url = file_url
self.file = file
self.kwargs = kwargs
self.file_name = get(self, 'file.name') if self.file else None
self.errors = []
self.extracted_file = None
Expand Down Expand Up @@ -83,20 +81,6 @@ def set_content(self):
self.content = self.content.decode('utf-8')
if self.is_csv_file:
self.set_csv_content()
if self.is_ocl_source_version_export():
converter = OCLExportToImportConverter(
content=self.content,
return_output=True,
version=self.kwargs.get('version', None),
owner=self.kwargs.get('owner', None),
owner_type=self.kwargs.get('owner_type', None)
)
converter.process()
self.content = converter.result

def is_ocl_source_version_export(self):
return isinstance(self.content, str) and self.content.startswith(
'{"type": "Source Version"') and '"concepts":' in self.content and '"mappings":' in self.content

def set_csv_content(self):
try:
Expand Down
5 changes: 1 addition & 4 deletions core/importers/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,10 +237,7 @@ def post(self, request, import_queue=None):
parser = ImportContentParser(
file=get(request.data, 'file') if is_upload else None,
file_url=get(request.data, 'file_url') if is_file_url else None,
content=get(request.data, 'data') if is_data else None,
owner=get(request.data, 'owner') or None,
owner_type=get(request.data, 'owner_type') or None,
version=get(request.data, 'version') or None,
content=get(request.data, 'data') if is_data else None
)
parser.parse()
if parser.errors:
Expand Down

0 comments on commit 5d86616

Please sign in to comment.