odf.userfield.UserFields Class Reference

List, view and manipulate user fields. More...

Inheritance diagram for odf.userfield.UserFields:
[legend]
Collaboration diagram for odf.userfield.UserFields:
[legend]

## Public Member Functions

def | __init__ (self, src=None, dest=None)
| Constructor. More...
def | loaddoc (self)
def | savedoc (self)
def | list_fields (self)
| List (extract) all known user-fields. More...
def | list_fields_and_values (self, field_names=None)
| List (extract) user-fields with type and value. More...
def | list_values (self, field_names)
| Extract the contents of given field names from the file. More...
def | get (self, field_name)
| Extract the contents of this field from the file. More...
def | get_type_and_value (self, field_name)
| Extract the type and contents of this field from the file. More...
def | update (self, data)
| Set the value of user fields. More...

## Public Attributes

| document

## Static Public Attributes

| src_file = None
| dest_file = None

## Detailed Description

List, view and manipulate user fields.

Definition at line 53 of file userfield.py.

## Constructor & Destructor Documentation

## __init__()

def odf.userfield.UserFields.__init__ | ( |  | self,
|  |  | src = `None`,
|  |  | dest = `None`
| ) |  |

Constructor.

Parameters

  src | open file in binary mode: source document, or filename as a unicode string, or None for stdin.
  dest | opendile in binary mode: destination document, or filename as a unicode string, or None for stdout.

Definition at line 67 of file userfield.py.

## Member Function Documentation

## get()

def odf.userfield.UserFields.get | ( |  | self,
|  |  | field_name
| ) |  |

Extract the contents of this field from the file.

Parameters

  field_name | unicode string: name of a field

Returns
  field value as a unicode string or None if field does not exist.

Definition at line 146 of file userfield.py.

Here is the call graph for this function:

## get_type_and_value()

def odf.userfield.UserFields.get_type_and_value | ( |  | self,
|  |  | field_name
| ) |  |

Extract the type and contents of this field from the file.

Parameters

  field_name | unicode string: name of a field

Returns
  tuple (<type>, <field-value>) as a pair of unicode strings or None if field does not exist.

Definition at line 160 of file userfield.py.

Here is the call graph for this function:

## list_fields()

def odf.userfield.UserFields.list_fields | ( |  | self | ) |

List (extract) all known user-fields.

Returns
  list of user-field names as unicode strings.

Definition at line 98 of file userfield.py.

Here is the call graph for this function:

## list_fields_and_values()

def odf.userfield.UserFields.list_fields_and_values | ( |  | self,
|  |  | field_names = `None`
| ) |  |

List (extract) user-fields with type and value.

Parameters

  field_names | list of field names as unicode strings to show, or None for all.

Returns
  list of tuples (<field name>="">, <field type>="">,

) as type (unicode string, stringified type, unicode string).

Definition at line 111 of file userfield.py.

Here is the call graph for this function:
Here is the caller graph for this function:

## list_values()

def odf.userfield.UserFields.list_values | ( |  | self,
|  |  | field_names
| ) |  |

Extract the contents of given field names from the file.

Parameters

  field_names | list of field names as unicode strings

Returns
  list of field values as unicode strings.

Definition at line 137 of file userfield.py.

Here is the call graph for this function:
Here is the caller graph for this function:

## loaddoc()

def odf.userfield.UserFields.loaddoc | ( |  | self | ) |

Definition at line 74 of file userfield.py.

Here is the call graph for this function:
Here is the caller graph for this function:

## savedoc()

def odf.userfield.UserFields.savedoc | ( |  | self | ) |

Definition at line 85 of file userfield.py.

Here is the caller graph for this function:

## update()

def odf.userfield.UserFields.update | ( |  | self,
|  |  | data
| ) |  |

Set the value of user fields.

The field types will be the same.

        data ... dict, with field name as key, field value as value

        Returns None

Definition at line 176 of file userfield.py.

Here is the call graph for this function:

## Member Data Documentation

## dest_file

odf.userfield.UserFields.dest_file = None

static

Definition at line 57 of file userfield.py.

## document

odf.userfield.UserFields.document

Definition at line 72 of file userfield.py.

## src_file

odf.userfield.UserFields.src_file = None

static

Definition at line 56 of file userfield.py.

The documentation for this class was generated from the following file:

- odf/userfield.py