def create_containers_and_parents(container_dn):
 import univention.admin.uexceptions as uexcp
 assert container_dn.startswith('cn=')
 try:
  parent = ldap_dn_tree_parent(container_dn)
  obj = umc_module_for_add('container/cn', parent)
  obj['name'] = container_dn.split(',')[0].split('=')[1]
  obj['description'] = 'container created by import'
 except uexcp.ldapError:
  create_containers_and_parents(parent)
  obj = umc_module_for_add('container/cn', parent)
  obj['name'] = container_dn.split(',')[0].split('=')[1]
  obj['description'] = 'container created by import'

def create_containers_and_parents ( container_dn ) : import univention . admin . uexceptions as uexcp assert container_dn . startswith ( 'cn=' ) try : parent = ldap_dn_tree_parent ( container_dn ) obj = umc_module_for_add ( 'container/cn' , parent ) obj [ 'name' ] = container_dn . split ( ',' ) [ 0 ] . split ( '=' ) [ 1 ] obj [ 'description' ] = 'container created by import' except uexcp . ldapError : create_containers_and_parents ( parent ) obj = umc_module_for_add ( 'container/cn' , parent ) obj [ 'name' ] = container_dn . split ( ',' ) [ 0 ] . split ( '=' ) [ 1 ] obj [ 'description' ] = 'container created by import'
create a container and if needed the parents containers .