33 if sys.version_info.major==3:
 
   41     u'float': (OFFICENS, 
u'value'),
 
   42     u'percentage': (OFFICENS, 
u'value'),
 
   43     u'currency': (OFFICENS, 
u'value'),
 
   44     u'date': (OFFICENS, 
u'date-value'),
 
   45     u'time': (OFFICENS, 
u'time-value'),
 
   46     u'boolean': (OFFICENS, 
u'boolean-value'),
 
   47     u'string': (OFFICENS, 
u'string-value'),
 
   68         assert(src==
None or 'rb' in repr(src) 
or 'BufferedReader' in repr(src) 
or 'BytesIO' in repr(src) 
or type(src)==type(
u""))
 
   69         assert(dest==
None or 'wb' in repr(dest) 
or 'BufferedWriter' in repr(dest) 
or 'BytesIO' in repr(dest) 
or type(dest)==type(
u""))
 
   75         if (sys.version_info.major==3 
and (isinstance(self.
src_file, str) 
or (isinstance(self.
src_file, io.IOBase)))) 
or (sys.version_info.major==2 
and isinstance(self.
src_file, basestring)):
 
   77             if not zipfile.is_zipfile(self.
src_file):
 
   78                 raise TypeError(
u"%s is no odt file." % self.
src_file)
 
   89             self.document.save(
u'-')
 
  114         all_fields = self.document.getElementsByType(UserFieldDecl)
 
  116             value_type = f.getAttribute(
u'valuetype')
 
  117             if value_type == 
u'string':
 
  118                 value = f.getAttribute(
u'stringvalue')
 
  120                 value = f.getAttribute(
u'value')
 
  121             field_name = f.getAttribute(
u'name')
 
  123             if field_names 
is None or field_name 
in field_names:
 
  124                 found_fields.append((field_name,
 
  146     def get(self, field_name):
 
  147         assert(type(field_name)==type(
u""))
 
  161         assert(type(field_name)==type(
u""))
 
  165         field_name, value_type, value = fields[0]
 
  166         return value_type, value
 
  178         all_fields = self.document.getElementsByType(UserFieldDecl)
 
  180             field_name = f.getAttribute(
u'name')
 
  181             if field_name 
in data:
 
  182                 value_type = f.getAttribute(
u'valuetype')
 
  183                 value = data.get(field_name)
 
  184                 if value_type == 
u'string':
 
  185                     f.setAttribute(
u'stringvalue', value)
 
  187                     f.setAttribute(
u'value', value)
 
def update
Set the value of user fields. 
List, view and manipulate user fields. 
def list_fields
List (extract) all known user-fields. 
def get
Extract the contents of this field from the file. 
def load
Load an ODF file into memory. 
def list_values
Extract the contents of given field names from the file. 
def get_type_and_value
Extract the type and contents of this field from the file. 
def list_fields_and_values
List (extract) user-fields with type and value.