ucsschool.importer package

Subpackages

Submodules

ucsschool.importer.configuration module

Configuration classes.

ucsschool.importer.configuration.setup_configuration(conffiles, **kwargs)[source]
ucsschool.importer.configuration._set_username_maxlength(config, logger)[source]
class ucsschool.importer.configuration.ConfigurationFile(filename)[source]

Bases: object

read()[source]
write(conf)[source]
update(conf)[source]
class ucsschool.importer.configuration.ReadOnlyDict[source]

Bases: dict

classmethod _recursive_typed_update(a, b)[source]
update(E=None, **F)[source]
check_mandatory_attributes(logger)[source]
close()[source]
static _ReadOnlyDict__closed(*args, **kwargs)
class ucsschool.importer.configuration.Configuration[source]

Bases: object

Singleton to the global configuration object.

_instance = None
_Configuration__SingleConf

alias of __SingleConf

ucsschool.importer.default_user_import_factory module

Default implementation of the Abstract Factory.

class ucsschool.importer.default_user_import_factory.DefaultUserImportFactory[source]

Bases: object

Default implementation of the Abstract Factory.

Subclass this and store the fully dotted class name in config[“factory”] to make the importer code use your classes.

load_methods_from_config()[source]

Overwrite the methods in this class with constructors or methods from the configuration file.

  • Configuration keys in the configuration “classes” dict are the names of the methods here without the prepended make_.
  • It will be checked if the configured classes are really subclasses as described in the documentation (/usr/share/doc/ucs-school-import/user_import_configuration_readme.txt).
  • Please update the documentation if classes/methods are added.
  • Take care to honor the signature of the methods, this cannot be checked.
make_reader(**kwargs)[source]

Creates an input data reader.

Parameters:kwarg (dict) – passed to the reader constructor
Returns:a reader object
Return type:BaseReader
make_import_user(cur_user_roles, *arg, **kwargs)[source]

Creates a ImportUser [of specific type], depending on its roles.

Parameters:
  • cur_user_roles (list(str)) – [ucsschool.lib.roles, ..]
  • arg (tuple) – passed to constructor of created class
  • kwarg (dict) – passed to constructor of created class
Returns:

object of ImportUser subclass or ImportUser if cur_user_roles was empty

Return type:

ImportUser

make_mass_importer(dry_run=True)[source]

Creates a MassImport object.

Parameters:dry_run (bool) – set to False to actually commit changes to LDAP
Returns:a MassImport object
Return type:MassImport
make_password_exporter(*arg, **kwargs)[source]

Creates a ResultExporter object that can dump passwords to disk.

Parameters:
  • arg (tuple) – passed to constructor of created class
  • kwarg (dict) – passed to constructor of created class
Returns:

a ResultExporter object

Return type:

NewUserPasswordCsvExporter

make_result_exporter(*arg, **kwargs)[source]

Creates a ResultExporter object.

Parameters:
  • arg (tuple) – passed to constructor of created class
  • kwarg (dict) – passed to constructor of created class
Returns:

a ResultExporter object

Return type:

UserImportCsvResultExporter

make_user_importer(dry_run=True)[source]

Creates a user importer.

Parameters:dry_run (bool) – set to False to actually commit changes to LDAP
Returns:a UserImport object
Return type:UserImport
make_ucr()[source]

Get a initialized UCR instance.

Returns:ConfigRegistry object
Return type:univention.config_registry.ConfigRegistry
make_unique_email_handler(max_length=254, dry_run=True)[source]

Get a EmailHandler instance.

Parameters:
  • max_length (int) – created email adresses must not be longer than this
  • dry_run (bool) – set to False to actually commit changes to LDAP
Returns:

an EmailHandler object

Return type:

EmailHandler

make_username_handler(max_length, dry_run=True)[source]

Get a UsernameHandler instance.

Parameters:
  • max_length (int) – created usernames must not be longer than this
  • dry_run (bool) – set to False to actually commit changes to LDAP
Returns:

a UsernameHandler object

Return type:

UsernameHandler

make_user_writer(*arg, **kwargs)[source]

Creates a user writer object.

Parameters:
  • arg (tuple) – passed to constructor of created class
  • kwarg (dict) – passed to constructor of created class
Returns:

a ucsschool.importer.writer.BaseWriter object

Return type:

CsvWriter

ucsschool.importer.exceptions module

All exceptions raised by code in ucsschool.importer.

exception ucsschool.importer.exceptions.UcsSchoolImportError(*args, **kwargs)[source]

Bases: exceptions.Exception

is_fatal = False
is_countable = True
exception ucsschool.importer.exceptions.UcsSchoolImportFatalError(*args, **kwargs)[source]

Bases: ucsschool.importer.exceptions.UcsSchoolImportError

is_fatal = True
exception ucsschool.importer.exceptions.UcsSchoolImportSkipImportRecord(*args, **kwargs)[source]

Bases: ucsschool.importer.exceptions.UcsSchoolImportError

is_countable = False
exception ucsschool.importer.exceptions.BadPassword(*args, **kwargs)[source]

Bases: ucsschool.importer.exceptions.UcsSchoolImportError

exception ucsschool.importer.exceptions.BadValueStored(*args, **kwargs)[source]

Bases: ucsschool.importer.exceptions.UcsSchoolImportFatalError

exception ucsschool.importer.exceptions.ConfigurationError(*args, **kwargs)[source]

Bases: ucsschool.importer.exceptions.UcsSchoolImportFatalError

exception ucsschool.importer.exceptions.CreationError(*args, **kwargs)[source]

Bases: ucsschool.importer.exceptions.UcsSchoolImportError

exception ucsschool.importer.exceptions.DeletionError(*args, **kwargs)[source]

Bases: ucsschool.importer.exceptions.UcsSchoolImportError

exception ucsschool.importer.exceptions.FormatError(msg, scheme, data, *args, **kwargs)[source]

Bases: ucsschool.importer.exceptions.UcsSchoolImportError

exception ucsschool.importer.exceptions.EmptyFormatResultError(msg, scheme, data, *args, **kwargs)[source]

Bases: ucsschool.importer.exceptions.FormatError

exception ucsschool.importer.exceptions.EmptyMandatoryAttribute(msg, attr_name, *args, **kwargs)[source]

Bases: ucsschool.importer.exceptions.UcsSchoolImportError

exception ucsschool.importer.exceptions.InitialisationError(*args, **kwargs)[source]

Bases: ucsschool.importer.exceptions.UcsSchoolImportFatalError

exception ucsschool.importer.exceptions.InvalidBirthday(*args, **kwargs)[source]

Bases: ucsschool.importer.exceptions.UcsSchoolImportError

exception ucsschool.importer.exceptions.InvalidClassName(*args, **kwargs)[source]

Bases: ucsschool.importer.exceptions.UcsSchoolImportError

exception ucsschool.importer.exceptions.InvalidEmail(*args, **kwargs)[source]

Bases: ucsschool.importer.exceptions.UcsSchoolImportError

exception ucsschool.importer.exceptions.InvalidSchoolClasses(*args, **kwargs)[source]

Bases: ucsschool.importer.exceptions.UcsSchoolImportError

exception ucsschool.importer.exceptions.InvalidSchools(*args, **kwargs)[source]

Bases: ucsschool.importer.exceptions.UcsSchoolImportError

exception ucsschool.importer.exceptions.LDAPWriteAccessDenied(msg=None, *args, **kwargs)[source]

Bases: ucsschool.importer.exceptions.UcsSchoolImportFatalError

exception ucsschool.importer.exceptions.MissingMandatoryAttribute(msg, mandatory_attributes, *args, **kwargs)[source]

Bases: ucsschool.importer.exceptions.UcsSchoolImportError

exception ucsschool.importer.exceptions.MissingMailDomain(*args, **kwargs)[source]

Bases: ucsschool.importer.exceptions.UcsSchoolImportError

exception ucsschool.importer.exceptions.MissingSchoolName(*args, **kwargs)[source]

Bases: ucsschool.importer.exceptions.UcsSchoolImportError

exception ucsschool.importer.exceptions.MissingUid(*args, **kwargs)[source]

Bases: ucsschool.importer.exceptions.UcsSchoolImportError

exception ucsschool.importer.exceptions.ModificationError(*args, **kwargs)[source]

Bases: ucsschool.importer.exceptions.UcsSchoolImportError

exception ucsschool.importer.exceptions.MoveError(*args, **kwargs)[source]

Bases: ucsschool.importer.exceptions.UcsSchoolImportError

exception ucsschool.importer.exceptions.NameKeyExists(*args, **kwargs)[source]

Bases: ucsschool.importer.exceptions.UcsSchoolImportFatalError

exception ucsschool.importer.exceptions.NoRole(*args, **kwargs)[source]

Bases: ucsschool.importer.exceptions.UcsSchoolImportError

exception ucsschool.importer.exceptions.NotSupportedError(*args, **kwargs)[source]

Bases: ucsschool.importer.exceptions.UcsSchoolImportError

ucsschool.importer.exceptions.NoUsername

alias of MissingUid

exception ucsschool.importer.exceptions.NoUsernameAtAll(*args, **kwargs)[source]

Bases: ucsschool.importer.exceptions.UcsSchoolImportFatalError

exception ucsschool.importer.exceptions.NoValueStored(*args, **kwargs)[source]

Bases: ucsschool.importer.exceptions.UcsSchoolImportFatalError

exception ucsschool.importer.exceptions.ReadOnlyConfiguration(*args, **kwargs)[source]

Bases: ucsschool.importer.exceptions.UcsSchoolImportFatalError

exception ucsschool.importer.exceptions.TooManyErrors(msg, errors, *args, **kwargs)[source]

Bases: ucsschool.importer.exceptions.UcsSchoolImportFatalError

ucsschool.importer.exceptions.ToManyErrors

alias of TooManyErrors

exception ucsschool.importer.exceptions.UDMError(*args, **kwargs)[source]

Bases: ucsschool.importer.exceptions.UcsSchoolImportError

exception ucsschool.importer.exceptions.UDMValueError(*args, **kwargs)[source]

Bases: ucsschool.importer.exceptions.UDMError

exception ucsschool.importer.exceptions.UnknownAction(*args, **kwargs)[source]

Bases: ucsschool.importer.exceptions.UcsSchoolImportError

ucsschool.importer.exceptions.UnkownAction

alias of UnknownAction

exception ucsschool.importer.exceptions.UnknownDisabledSetting(*args, **kwargs)[source]

Bases: ucsschool.importer.exceptions.UcsSchoolImportError

ucsschool.importer.exceptions.UnkownDisabledSetting

alias of UnknownDisabledSetting

exception ucsschool.importer.exceptions.UnknownProperty(*args, **kwargs)[source]

Bases: ucsschool.importer.exceptions.UcsSchoolImportError

exception ucsschool.importer.exceptions.UnknownRole(*args, **kwargs)[source]

Bases: ucsschool.importer.exceptions.UcsSchoolImportError

ucsschool.importer.exceptions.UnkownRole

alias of UnknownRole

exception ucsschool.importer.exceptions.UnknownSchoolName(*args, **kwargs)[source]

Bases: ucsschool.importer.exceptions.UcsSchoolImportError

ucsschool.importer.exceptions.UnkownSchoolName

alias of UnknownSchoolName

exception ucsschool.importer.exceptions.UniqueIdError(*args, **kwargs)[source]

Bases: ucsschool.importer.exceptions.UcsSchoolImportError

exception ucsschool.importer.exceptions.UsernameKeyExists(*args, **kwargs)[source]

Bases: ucsschool.importer.exceptions.NameKeyExists

Deprecated. Please use NameKeyExists.

exception ucsschool.importer.exceptions.UsernameToLong(*args, **kwargs)[source]

Bases: ucsschool.importer.exceptions.UcsSchoolImportError

exception ucsschool.importer.exceptions.UserValidationError(msg, validation_error, *args, **kwargs)[source]

Bases: ucsschool.importer.exceptions.UcsSchoolImportError

Wraps ucsschool.lib.models.attributes.ValidationError

exception ucsschool.importer.exceptions.WrongUserType(msg, *args, **kwargs)[source]

Bases: ucsschool.importer.exceptions.UcsSchoolImportError

Wraps ucsschool.lib.models.base.WrongObjectType

ucsschool.importer.factory module

Singleton to the factory currently in use.

ucsschool.importer.factory.setup_factory(factory_cls_name)[source]

Create import factory.

Parameters:factory_cls_name (str) – full dotted name of class
Returns:Factory object
Return type:Factory
ucsschool.importer.factory.load_class(dotted_class_name)[source]

Load class from its full dotted name.

Parameters:dotted_class_name – str: full dotted name of class
Returns:class
Return type:type
class ucsschool.importer.factory.Factory[source]

Bases: object

Singleton to the global abstract factory object.

_instance = None
_Factory__SingleFac

alias of __SingleFac