Commit 6fd2cc39 authored by Michal Čihař's avatar Michal Čihař

Consistent handling of extra params

Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent e50279c7
...@@ -71,7 +71,7 @@ class Command(BaseCommand): ...@@ -71,7 +71,7 @@ class Command(BaseCommand):
help='File format type, defaults to autodetection', help='File format type, defaults to autodetection',
), ),
make_option( make_option(
'--language-filter', '--language-regex',
default=None, default=None,
help=( help=(
'Language filter regular expression to be used for created' 'Language filter regular expression to be used for created'
...@@ -108,7 +108,7 @@ class Command(BaseCommand): ...@@ -108,7 +108,7 @@ class Command(BaseCommand):
self.filemask = None self.filemask = None
self.component_re = None self.component_re = None
self.file_format = None self.file_format = None
self.language_filter = None self.language_regex = None
self.license = None self.license = None
self.license_url = None self.license_url = None
self.main_component = None self.main_component = None
...@@ -209,7 +209,7 @@ class Command(BaseCommand): ...@@ -209,7 +209,7 @@ class Command(BaseCommand):
self.filemask = args[3] self.filemask = args[3]
self.vcs = options['vcs'] self.vcs = options['vcs']
self.file_format = options['file_format'] self.file_format = options['file_format']
self.language_filter = options['language_filter'] self.language_regex = options['language_regex']
self.main_component = options['main_component'] self.main_component = options['main_component']
self.name_template = options['name_template'] self.name_template = options['name_template']
self.license = options['license'] self.license = options['license']
...@@ -300,13 +300,15 @@ class Command(BaseCommand): ...@@ -300,13 +300,15 @@ class Command(BaseCommand):
'vcs': self.vcs, 'vcs': self.vcs,
} }
optionals = ('license', 'license_url') optionals = (
'license',
'license_url',
'language_regex'
)
for key in optionals: for key in optionals:
value = getattr(self, key) value = getattr(self, key)
if value is not None: if value is not None:
result[key] = value result[key] = value
if self.language_filter is not None:
result['language_regex'] = self.language_filter
return result return result
def import_initial(self, project, repo, branch): def import_initial(self, project, repo, branch):
......
...@@ -87,7 +87,7 @@ class ImportProjectTest(RepoTestCase): ...@@ -87,7 +87,7 @@ class ImportProjectTest(RepoTestCase):
self.git_repo_path, self.git_repo_path,
'master', 'master',
'**/*.po', '**/*.po',
language_filter='cs' language_regex='cs'
) )
# We should have loaded four subprojects # We should have loaded four subprojects
self.assertEqual(project.subproject_set.count(), 4) self.assertEqual(project.subproject_set.count(), 4)
......
Markdown is supported
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