data_transfer: fix indentation/whitespaces (#29545)

This commit is contained in:
Benjamin Dauvergne 2019-01-08 15:25:49 +01:00
parent 53b9f74ab2
commit ce72b9a24e
1 changed files with 5 additions and 7 deletions

View File

@ -110,8 +110,7 @@ class RoleDeserializer(object):
ou = None if not has_ou else search_ou(ou_d)
if has_ou and not ou:
raise DataImportError(
"Can't import role because missing Organizational Unit : "
"%s" % ou_d)
"Can't import role because missing Organizational Unit: %s" % ou_d)
kwargs = self._role_d.copy()
del kwargs['ou']
@ -163,7 +162,7 @@ class RoleDeserializer(object):
for parent_d in self._parents:
parent = search_role(parent_d)
if not parent:
raise DataImportError("Could not find role : %s" % parent_d)
raise DataImportError("Could not find role: %s" % parent_d)
created.append(Parenting.objects.create(
child=self._obj, direct=True, parent=parent))
@ -234,7 +233,6 @@ class ImportResult(object):
def import_ou(ou_d):
OU = get_ou_model()
# ou = search_ou([ou_d['slug']])
ou = search_ou(ou_d)
if ou is None:
ou = OU.objects.create(**ou_d)
@ -276,13 +274,13 @@ def import_site(json_d, import_context):
if import_context.ou_delete_orphans:
raise DataImportError(
"Unsupported context value for ou_delete_orphans : %s" % (
"Unsupported context value for ou_delete_orphans: %s" % (
import_context.ou_delete_orphans))
if import_context.role_delete_orphans:
# FIXME : delete each role that is in DB but not in the export
# FIXME: delete each role that is in DB but not in the export
raise DataImportError(
"Unsupported context value for role_delete_orphans : %s" % (
"Unsupported context value for role_delete_orphans: %s" % (
import_context.role_delete_orphans))
return result