Loading...
Searching...
No Matches
odf.userfield.UserFields Class Reference

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

## Public Member Functions

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

## Public Attributes

| document

## Static Public Attributes

| src_file = None
| dest_file = None

## Detailed Description

List, view and manipulate user fields.

Definition at line 51 of file userfield.py.

## Constructor & Destructor Documentation

## __init__()

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

Constructor.

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

Definition at line 64 of file userfield.py.

## Member Function Documentation

## get()

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 139 of file userfield.py.

Here is the call graph for this function:

## get_type_and_value()

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 152 of file userfield.py.

Here is the call graph for this function:

## list_fields()

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

List (extract) all known user-fields.

       @return list of user-field names as unicode strings.

Definition at line 94 of file userfield.py.

Here is the call graph for this function:

## list_fields_and_values()

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

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

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

       @return list of tuples (<field name>, <field type>, <value>)
       as type (unicode string, stringified type, unicode string).

Definition at line 106 of file userfield.py.

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

## list_values()

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

Extract the contents of given field names from the file.

       @param field_names list of field names as unicode strings

       @return list of field values as unicode strings.

Definition at line 131 of file userfield.py.

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

## loaddoc()

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

Definition at line 71 of file userfield.py.

Here is the caller graph for this function:

## savedoc()

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

Definition at line 82 of file userfield.py.

Here is the caller graph for this function:

## update()

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 167 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 55 of file userfield.py.

## document

odf.userfield.UserFields.document

Definition at line 69 of file userfield.py.

## src_file

odf.userfield.UserFields.src_file = None

static

Definition at line 54 of file userfield.py.

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

- odf/userfield.py