List, view and manipulate user fields. More...
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 | |
List, view and manipulate user fields.
Definition at line 53 of file userfield.py.
def 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 67 of file userfield.py.
def odf.userfield.UserFields.get | ( | self, | |
field_name | |||
) |
Extract the contents of this field from the file.
field_name | unicode string: name of a field |
Definition at line 146 of file userfield.py.
def odf.userfield.UserFields.get_type_and_value | ( | self, | |
field_name | |||
) |
Extract the type and contents of this field from the file.
field_name | unicode string: name of a field |
Definition at line 160 of file userfield.py.
def odf.userfield.UserFields.list_fields | ( | self | ) |
List (extract) all known user-fields.
@return list of user-field names as unicode strings.
Definition at line 98 of file userfield.py.
def 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 111 of file userfield.py.
def 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 137 of file userfield.py.
def odf.userfield.UserFields.loaddoc | ( | self | ) |
Definition at line 74 of file userfield.py.
def odf.userfield.UserFields.savedoc | ( | self | ) |
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.
|
static |
Definition at line 57 of file userfield.py.
odf.userfield.UserFields.document |
Definition at line 72 of file userfield.py.
|
static |
Definition at line 56 of file userfield.py.