Commit c3984fb3 authored by Okhin's avatar Okhin
Browse files

Let's try to guess the file kind

parent e4250010
Pipeline #1238 failed with stage
in 3 seconds
......@@ -31,10 +31,10 @@ class Importer(models.Model):
def kind(self):
if self.url is None and is None:
return None
if self.url is not '' and self.url is not None:
return 'url'
if is not None:
return 'file'
return 'url'
def representative(self, import_data):
......@@ -134,6 +134,7 @@ class ImporterTest(TestCase):
importer.file = 'a'
importer.url = ''
self.assertEqual(importer.kind(), 'file')
importer.file = None
importer.url = ''
self.assertEqual(importer.kind(), 'url')
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment