class documentation

Write LDIF entry or change records to file object.

Parameters
output_fileFile for output
base64_attrsList of attribute types to be base64-encoded in any case
colsSpecifies how many columns a line may have before it is folded into many lines
line_sepline separator
encodingEncoding to use for converting values to bytes. Note that the spec requires the dn field to be UTF-8 encoded, so it does not really make sense to use anything else. Default: 'utf8'.
Method __init__ Undocumented
Method unparse Write an entry or change record to the output file.
Instance Variable records_written Undocumented
Method _fold_line Output string line as one or more folded lines.
Method _needs_base64_encoding Return True if attr_value has to be base-64 encoded.
Method _unparse_attr Write a single attribute type/value pair.
Method _unparse_change_record No summary
Method _unparse_changetype Detect and write the changetype.
Method _unparse_entry_record No summary
Instance Variable _base64_attrs Undocumented
Instance Variable _cols Undocumented
Instance Variable _encoding Undocumented
Instance Variable _line_sep Undocumented
Instance Variable _output_file Undocumented
def __init__(self, output_file, base64_attrs=(), cols=76, line_sep=b'\n', encoding='utf8'): (source)

Undocumented

def unparse(self, dn: str, record: list | dict): (source)

Write an entry or change record to the output file.

Parameters
dn:stringdistinguished name
record:Union[Dict[string, List[string]], List[Tuple]]Either a dictionary holding an entry or a list of additions (2-tuple) or modifications (3-tuple).
records_written: int = (source)

Undocumented

def _fold_line(self, line: bytes): (source)

Output string line as one or more folded lines.

def _needs_base64_encoding(self, attr_type, attr_value): (source)

Return True if attr_value has to be base-64 encoded.

This is the case because of special chars or because attr_type is in self._base64_attrs

def _unparse_attr(self, attr_type, attr_value): (source)

Write a single attribute type/value pair.

def _unparse_change_record(self, modlist): (source)
Parameters
modlist:List[Tuple]List of additions (2-tuple) or modifications (3-tuple)
def _unparse_changetype(self, mod_len): (source)

Detect and write the changetype.

def _unparse_entry_record(self, entry): (source)
Parameters
entry:Dict[string, List[string]]Dictionary holding an entry
_base64_attrs = (source)

Undocumented

Undocumented

_encoding = (source)

Undocumented

_line_sep = (source)

Undocumented

_output_file = (source)

Undocumented