data_transfer: fix indentation/whitespaces (#29545)
This commit is contained in:
parent
53b9f74ab2
commit
ce72b9a24e
|
@ -110,8 +110,7 @@ class RoleDeserializer(object):
|
||||||
ou = None if not has_ou else search_ou(ou_d)
|
ou = None if not has_ou else search_ou(ou_d)
|
||||||
if has_ou and not ou:
|
if has_ou and not ou:
|
||||||
raise DataImportError(
|
raise DataImportError(
|
||||||
"Can't import role because missing Organizational Unit : "
|
"Can't import role because missing Organizational Unit: %s" % ou_d)
|
||||||
"%s" % ou_d)
|
|
||||||
|
|
||||||
kwargs = self._role_d.copy()
|
kwargs = self._role_d.copy()
|
||||||
del kwargs['ou']
|
del kwargs['ou']
|
||||||
|
@ -163,7 +162,7 @@ class RoleDeserializer(object):
|
||||||
for parent_d in self._parents:
|
for parent_d in self._parents:
|
||||||
parent = search_role(parent_d)
|
parent = search_role(parent_d)
|
||||||
if not parent:
|
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(
|
created.append(Parenting.objects.create(
|
||||||
child=self._obj, direct=True, parent=parent))
|
child=self._obj, direct=True, parent=parent))
|
||||||
|
|
||||||
|
@ -234,7 +233,6 @@ class ImportResult(object):
|
||||||
|
|
||||||
def import_ou(ou_d):
|
def import_ou(ou_d):
|
||||||
OU = get_ou_model()
|
OU = get_ou_model()
|
||||||
# ou = search_ou([ou_d['slug']])
|
|
||||||
ou = search_ou(ou_d)
|
ou = search_ou(ou_d)
|
||||||
if ou is None:
|
if ou is None:
|
||||||
ou = OU.objects.create(**ou_d)
|
ou = OU.objects.create(**ou_d)
|
||||||
|
@ -276,13 +274,13 @@ def import_site(json_d, import_context):
|
||||||
|
|
||||||
if import_context.ou_delete_orphans:
|
if import_context.ou_delete_orphans:
|
||||||
raise DataImportError(
|
raise DataImportError(
|
||||||
"Unsupported context value for ou_delete_orphans : %s" % (
|
"Unsupported context value for ou_delete_orphans: %s" % (
|
||||||
import_context.ou_delete_orphans))
|
import_context.ou_delete_orphans))
|
||||||
|
|
||||||
if import_context.role_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(
|
raise DataImportError(
|
||||||
"Unsupported context value for role_delete_orphans : %s" % (
|
"Unsupported context value for role_delete_orphans: %s" % (
|
||||||
import_context.role_delete_orphans))
|
import_context.role_delete_orphans))
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
Loading…
Reference in New Issue