[Python-modules-commits] [python-odf] 46/118: Cleanup for release 0.9
Wolfgang Borgert
debacle at moszumanska.debian.org
Fri Oct 3 21:27:21 UTC 2014
This is an automated email from the git hooks/post-receive script.
debacle pushed a commit to reference refs/remotes/upstream/master
in repository python-odf.
commit 9c23f83de6b8575cef3c83c75b3b2d7057ce34fa
Author: Søren Roug <soren.roug at eea.europa.eu>
Date: Sat Mar 14 21:24:29 2009 +0000
Cleanup for release 0.9
---
ChangeLog | 2 +
README | 5 +-
contrib/csv2ods/csv-ods.py | 151 -------------------
contrib/syntaxhighlight/syntaxhighlight.1 | 220 ++++++++++++++++++++++++++++
contrib/syntaxhighlight/syntaxhighlight.xml | 9 ++
examples/loadsave.py | 30 ++++
examples/ods2odt.py | 3 +-
odf/element.py | 24 ++-
odf/load.py | 11 +-
odf/odf2xhtml.py | 6 +-
odf/odfmanifest.py | 7 +-
odf/userfield.py | 6 +-
odf/xforms.py | 5 +
13 files changed, 286 insertions(+), 193 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index b6b186e..d71c97d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,5 @@
+0.9
+ Updated to ODF version 1.1
0.8
Added the ability to load a document.
0.7
diff --git a/README b/README
index b681549..3f1e4a5 100644
--- a/README
+++ b/README
@@ -12,7 +12,7 @@ For your own use of the odf library, see api-for-odfpy.odt
First you get the package.
-$ svn export http://opendocumentfellowship.com/repos/odfpy/trunk odfpy
+$ svn export https://svn.forge.osor.eu/svn/odfpy/trunk odfpy
$ python setup.py build
$ su
@@ -27,9 +27,6 @@ problems with large MHT files.
mailodf is a program that will create a MIME-encapsulated web archive
and then sends it as an email.
-odt2war is a program that will create a KDE Web Archive (.war) that can be
-read by Konqueror.
-
-o- TODO / IDEAS -o-
* html2odf
diff --git a/contrib/csv2ods/csv-ods.py b/contrib/csv2ods/csv-ods.py
deleted file mode 100644
index f3fc8c1..0000000
--- a/contrib/csv2ods/csv-ods.py
+++ /dev/null
@@ -1,151 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-# Copyright (C) 2008 Agustin Henze -> agustinhenze at gmail.com
-#
-# This is free software. You may redistribute it under the terms
-# of the Apache license and the GNU General Public License Version
-# 2 or at your option any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public
-# License along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-#
-# Contributor(s):
-#
-
-from odf.opendocument import OpenDocumentSpreadsheet
-from odf.style import Style, TextProperties, ParagraphProperties, TableColumnProperties
-from odf.text import P
-from odf.table import Table, TableColumn, TableRow, TableCell
-from optparse import OptionParser
-import sys,csv,re
-
-PWENC = "utf-8"
-
-def csvToOds( pathFileCSV, pathFileODS, tableName='table', delimiter=',', quoting=csv.QUOTE_MINIMAL, quotechar = '"',
- escapechar = None, skipinitialspace = False, lineterminator = '\r\n'):
- textdoc = OpenDocumentSpreadsheet()
- # Create a style for the table content. One we can modify
- # later in the word processor.
- tablecontents = Style(name="Table Contents", family="paragraph")
- tablecontents.addElement(ParagraphProperties(numberlines="false", linenumber="0"))
- tablecontents.addElement(TextProperties(fontweight="bold"))
- textdoc.styles.addElement(tablecontents)
-
- # Start the table
- table = Table( name=tableName )
-
- reader = csv.reader(open(pathFileCSV), delimiter=delimiter,
- quoting=quoting, quotechar=quotechar, escapechar=escapechar,
- skipinitialspace=skipinitialspace, lineterminator=lineterminator)
- fltExp = re.compile('^\s*[-+]?\d+(\.\d+)?\s*$')
-
- for row in reader:
- tr = TableRow()
- table.addElement(tr)
- for val in row:
- if fltExp.match(val):
- tc = TableCell(valuetype="float", value=val.strip())
- else:
- tc = TableCell(valuetype="string")
- tr.addElement(tc)
- p = P(stylename=tablecontents,text=unicode(val,PWENC))
- tc.addElement(p)
-
- textdoc.spreadsheet.addElement(table)
- textdoc.save( pathFileODS )
-
-if __name__ == "__main__":
- usage = "%prog -i file.csv -o file.ods -d"
- parser = OptionParser(usage=usage, version="%prog 0.1")
- parser.add_option('-i','--input', action='store',
- dest='input', help='File input in csv')
- parser.add_option('-o','--output', action='store',
- dest='output', help='File output in ods')
- parser.add_option('-d','--delimiter', action='store',
- dest='delimiter', help='specifies a one-character string to use as the field separator. It defaults to ",".')
-
- parser.add_option('-c','--encoding', action='store',
- dest='encoding', help='specifies the encoding the file csv. It defaults utf-8')
-
- parser.add_option('-t','--table', action='store',
- dest='tableName', help='The table name in the output file')
-
- parser.add_option('-s','--skipinitialspace',
- dest='skipinitialspace', help='''specifies how to interpret whitespace which
- immediately follows a delimiter. It defaults to False, which
- means that whitespace immediately following a delimiter is part
- of the following field.''')
-
- parser.add_option('-l','--lineterminator', action='store',
- dest='lineterminator', help='''specifies the character sequence which should
- terminate rows.''')
-
- parser.add_option('-q','--quoting', action='store',
- dest='quoting', help='''It can take on any of the following module constants:
- 0 = QUOTE_MINIMAL means only when required, for example, when a field contains either the quotechar or the delimiter
- 1 = QUOTE_ALL means that quotes are always placed around fields.
- 2 = QUOTE_NONNUMERIC means that quotes are always placed around fields which do not parse as integers or floating point numbers.
- 3 = QUOTE_NONE means that quotes are never placed around fields.
- It defaults is QUOTE_MINIMAL''')
-
- parser.add_option('-e','--escapechar', action='store',
- dest='escapechar', help='''specifies a one-character string used to escape the delimiter when quoting is set to QUOTE_NONE.''')
-
- parser.add_option('-r','--quotechar', action='store',
- dest='quotechar', help='''specifies a one-character string to use as the quoting character. It defaults to ".''')
-
- (options, args) = parser.parse_args()
-
- if options.input:
- pathFileCSV = options.input
- else:
- parser.print_help()
- exit( 0 )
-
- if options.output:
- pathFileODS = options.output
- else:
- parser.print_help()
- exit( 0 )
-
- if options.delimiter:
- delimiter = options.delimiter
- else:
- delimiter = ","
-
- if options.skipinitialspace:
- skipinitialspace = True
- else:
- skipinitialspace=False
-
- if options.lineterminator:
- lineterminator = options.lineterminator
- else:
- lineterminator ="\r\n"
-
- if options.escapechar:
- escapechar = options.escapechar
- else:
- escapechar=None
-
- if options.encoding:
- PWENC = options.encoding
-
- if options.tableName:
- tableName = options.tableName
- else:
- tableName = "table"
-
- if options.quotechar:
- quotechar = options.quotechar
- else:
- quotechar = "\""
-
- csvToOds( pathFileCSV=pathFileCSV, pathFileODS=pathFileODS, delimiter=delimiter, skipinitialspace=skipinitialspace,
- escapechar=escapechar, lineterminator=lineterminator, tableName=tableName, quotechar=quotechar)
diff --git a/contrib/syntaxhighlight/syntaxhighlight.1 b/contrib/syntaxhighlight/syntaxhighlight.1
new file mode 100644
index 0000000..53f9fec
--- /dev/null
+++ b/contrib/syntaxhighlight/syntaxhighlight.1
@@ -0,0 +1,220 @@
+.\" Title: syntaxhighlight
+.\" Author: S\(/oren Roug
+.\" Generator: DocBook XSL Stylesheets v1.74.0 <http://docbook.sf.net/>
+.\" Date: 03/08/2009
+.\" Manual: User commands
+.\" Source: odfpy
+.\" Language: English
+.\"
+.TH "SYNTAXHIGHLIGHT" "1" "03/08/2009" "odfpy" "User commands"
+.\" -----------------------------------------------------------------
+.\" * (re)Define some macros
+.\" -----------------------------------------------------------------
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" toupper - uppercase a string (locale-aware)
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de toupper
+.tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ
+\\$*
+.tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH-xref - format a cross-reference to an SH section
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de SH-xref
+.ie n \{\
+.\}
+.toupper \\$*
+.el \{\
+\\$*
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH - level-one heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SH
+.\" put an extra blank line of space above the head in non-TTY output
+.if t \{\
+.sp 1
+.\}
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[an-margin]u
+.ti 0
+.HTML-TAG ".NH \\n[an-level]"
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+\." make the size of the head bigger
+.ps +3
+.ft B
+.ne (2v + 1u)
+.ie n \{\
+.\" if n (TTY output), use uppercase
+.toupper \\$*
+.\}
+.el \{\
+.nr an-break-flag 0
+.\" if not n (not TTY), use normal case (not uppercase)
+\\$1
+.in \\n[an-margin]u
+.ti 0
+.\" if not n (not TTY), put a border/line under subheading
+.sp -.6
+\l'\n(.lu'
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SS - level-two heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SS
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[IN]u
+.ti \\n[SN]u
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.ps \\n[PS-SS]u
+\." make the size of the head bigger
+.ps +2
+.ft B
+.ne (2v + 1u)
+.if \\n[.$] \&\\$*
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BB/BE - put background/screen (filled box) around block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BB
+.if t \{\
+.sp -.5
+.br
+.in +2n
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EB
+.if t \{\
+.if "\\$2"adjust-for-leading-newline" \{\
+.sp -1
+.\}
+.br
+.di
+.in
+.ll
+.gcolor
+.nr BW \\n(.lu-\\n(.i
+.nr BH \\n(dn+.5v
+.ne \\n(BHu+.5v
+.ie "\\$2"adjust-for-leading-newline" \{\
+\M[\\$1]\h'1n'\v'+.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.el \{\
+\M[\\$1]\h'1n'\v'-.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.in 0
+.sp -.5v
+.nf
+.BX
+.in
+.sp .5v
+.fi
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BM/EM - put colored marker in margin next to block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BM
+.if t \{\
+.br
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EM
+.if t \{\
+.br
+.di
+.ll
+.gcolor
+.nr BH \\n(dn
+.ne \\n(BHu
+\M[\\$1]\D'P -.75n 0 0 \\n(BHu -(\\n[.i]u - \\n(INu - .75n) 0 0 -\\n(BHu'\M[]
+.in 0
+.nf
+.BX
+.in
+.fi
+.\}
+..
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "Name"
+syntaxhighlight \- Create OpenDocument with syntax highlighted programming code
+.SH "Synopsis"
+.fam C
+.HP \w'\fBsyntaxhighlight\fR\ 'u
+\fBsyntaxhighlight\fR [\-e\ \fIencoding\fR] [\-l\ \fIlanguage\fR] [\fIinputfile\fR] [\fIoutputfile\fR]
+.fam
+.SH "Description"
+.PP
+The syntaxhighlight program will read a source code file, format it with syntax highlighting and write an OpenDocument text file\&.
+.SH "Options"
+.PP
+\-e \fIencoding\fR
+.RS 4
+Enter the encoding of the source file\&. Common encodings are: iso\-8859\-1, cp1252, ascii and utf\-8 (default)\&.
+.RE
+.PP
+\-l \fIlanguage\fR
+.RS 4
+Programming language of the input file\&. If not specified, it is guessed fron the file ending\&. Values can be: Python, HTML, C, C++ and PHP\&.
+.RE
+.SH "Example"
+.sp
+.if n \{\
+.RS 4
+.\}
+.fam C
+.ps -1
+.nf
+.if t \{\
+.sp -1
+.\}
+.BB lightgray adjust-for-leading-newline
+.sp -1
+
+syntaxhighlight \-e cp1252 \-l Python example\&.py example\&.odt
+.EB lightgray adjust-for-leading-newline
+.if t \{\
+.sp 1
+.\}
+.fi
+.fam
+.ps +1
+.if n \{\
+.RE
+.\}
+.SH "Author"
+.PP
+\fBS\(/oren Roug\fR
+.RS 4
+Original author
+.RE
diff --git a/contrib/syntaxhighlight/syntaxhighlight.xml b/contrib/syntaxhighlight/syntaxhighlight.xml
index 158825e..dcc0ffd 100644
--- a/contrib/syntaxhighlight/syntaxhighlight.xml
+++ b/contrib/syntaxhighlight/syntaxhighlight.xml
@@ -1,9 +1,18 @@
<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
<refentry id="syntaxhighlight">
+ <refentryinfo>
+ <productname>odfpy</productname>
+ <author>
+ <firstname>Søren</firstname>
+ <surname>Roug</surname>
+ <contrib>Original author</contrib>
+ </author>
+ </refentryinfo>
<refmeta>
<refentrytitle>syntaxhighlight</refentrytitle>
<manvolnum>1</manvolnum>
+ <refmiscinfo class="manual">User commands</refmiscinfo>
</refmeta>
<refnamediv>
<refname>syntaxhighlight</refname>
diff --git a/examples/loadsave.py b/examples/loadsave.py
new file mode 100644
index 0000000..1c4029d
--- /dev/null
+++ b/examples/loadsave.py
@@ -0,0 +1,30 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+# Copyright (C) 2009 Søren Roug, European Environment Agency
+#
+# This is free software. You may redistribute it under the terms
+# of the Apache license and the GNU General Public License Version
+# 2 or at your option any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+# Contributor(s):
+#
+
+#
+# This script simply loads a document into memory and saves it again.
+# It takes the filename as argument
+import sys
+from odf.opendocument import load
+infile = sys.argv[1]
+doc = load(infile)
+outfile = infile[:-4] + "-bak" + infile[-4:]
+doc.save(outfile)
+
diff --git a/examples/ods2odt.py b/examples/ods2odt.py
index a233a1f..0ed4997 100644
--- a/examples/ods2odt.py
+++ b/examples/ods2odt.py
@@ -20,7 +20,7 @@
# This script converts a spreadsheet to a text file. I.e. it copies
# the sheets and turns them into tables in the textfile
-# Note: Does not copy images
+# Note: Copy of images does not work?
#
import sys, getopt
from odf.opendocument import OpenDocumentText, load
@@ -72,4 +72,5 @@ if __name__ == "__main__":
textdoc.text.addElement(sheet)
textdoc.text.addElement(P())
+ textdoc.Pictures = spreadsheetdoc.Pictures
textdoc.save(outputfile)
diff --git a/odf/element.py b/odf/element.py
index e6b3637..d376f94 100644
--- a/odf/element.py
+++ b/odf/element.py
@@ -258,10 +258,7 @@ class Element(Node):
self.ownerDocument = None
self.childNodes=[]
self.allowed_children = grammar.allowed_children.get(self.qname)
- namespace = self.qname[0]
- prefix = _nsassign(namespace)
- if not self.namespaces.has_key(namespace):
- self.namespaces[namespace] = prefix
+ prefix = self.get_nsprefix(self.qname[0])
self.tagName = prefix + ":" + self.qname[1]
if text is not None:
self.addText(text)
@@ -296,6 +293,13 @@ class Element(Node):
if self.getAttrNS(r[0],r[1]) is None:
raise AttributeError, "Required attribute missing: %s in <%s>" % (r[1].lower().replace('-',''), self.tagName)
+ def get_nsprefix(self, namespace):
+ if namespace is None: namespace = ""
+ prefix = _nsassign(namespace)
+ if not self.namespaces.has_key(namespace):
+ self.namespaces[namespace] = prefix
+ return prefix
+
def allowed_attributes(self):
return grammar.allowed_attributes.get(self.qname)
@@ -378,24 +382,18 @@ class Element(Node):
Must overwrite, If attribute already exists.
"""
allowed_attrs = self.allowed_attributes()
- prefix = _nsassign(namespace)
- if not self.namespaces.has_key(namespace):
- self.namespaces[namespace] = prefix
+ prefix = self.get_nsprefix(namespace)
# if allowed_attrs and (namespace, localpart) not in allowed_attrs:
# raise AttributeError, "Attribute %s:%s is not allowed in element <%s>" % ( prefix, localpart, self.tagName)
c = AttrConverters()
self.attributes[prefix + ":" + localpart] = c.convert((namespace, localpart), value, self.qname)
def getAttrNS(self, namespace, localpart):
- prefix = _nsassign(namespace)
- if not self.namespaces.has_key(namespace):
- self.namespaces[namespace] = prefix
+ prefix = self.get_nsprefix(namespace)
return self.attributes.get(prefix + ":" + localpart)
def removeAttrNS(self, namespace, localpart):
- prefix = _nsassign(namespace)
- if not self.namespaces.has_key(namespace):
- self.namespaces[namespace] = prefix
+ prefix = self.get_nsprefix(namespace)
del self.attributes[prefix + ":" + localpart]
def getAttribute(self, attr):
diff --git a/odf/load.py b/odf/load.py
index a2b6b74..1f0e45e 100644
--- a/odf/load.py
+++ b/odf/load.py
@@ -29,12 +29,7 @@ from xml.sax.xmlreader import InputSource
import xml.sax.saxutils
from element import Element
from namespaces import OFFICENS
-
-try:
- from cStringIO import StringIO
-except ImportError:
- from StringIO import StringIO
-
+from cStringIO import StringIO
#
# Parse the XML files
@@ -70,7 +65,7 @@ class LoadParser(handler.ContentHandler):
# Add any accumulated text content
content = ''.join(self.data).strip()
if len(content) > 0:
- self.parent.addText(content)
+ self.parent.addText(content, check_grammar=False)
self.data = []
# Create the element
attrdict = {}
@@ -109,7 +104,7 @@ class LoadParser(handler.ContentHandler):
self.level = self.level - 1
str = ''.join(self.data)
if len(str.strip()) > 0:
- self.curr.addText(str)
+ self.curr.addText(str, check_grammar=False)
self.data = []
self.curr = self.curr.parentNode
self.parent = self.curr
diff --git a/odf/odf2xhtml.py b/odf/odf2xhtml.py
index 229b930..add4744 100644
--- a/odf/odf2xhtml.py
+++ b/odf/odf2xhtml.py
@@ -25,11 +25,7 @@ import xml.sax
from xml.sax import handler, expatreader
from xml.sax.xmlreader import InputSource
from xml.sax.saxutils import escape, quoteattr
-
-try:
- from cStringIO import StringIO
-except ImportError:
- from StringIO import StringIO
+from cStringIO import StringIO
from namespaces import ANIMNS, CHARTNS, CONFIGNS, DCNS, DR3DNS, DRAWNS, FONS, \
FORMNS, MATHNS, METANS, NUMBERNS, OFFICENS, PRESENTATIONNS, SCRIPTNS, \
diff --git a/odf/odfmanifest.py b/odf/odfmanifest.py
index fef00c9..07754fd 100644
--- a/odf/odfmanifest.py
+++ b/odf/odfmanifest.py
@@ -24,12 +24,7 @@ import zipfile
from xml.sax import make_parser,handler
from xml.sax.xmlreader import InputSource
import xml.sax.saxutils
-
-try:
- from cStringIO import StringIO
-except ImportError:
- from StringIO import StringIO
-
+from cStringIO import StringIO
MANIFESTNS="urn:oasis:names:tc:opendocument:xmlns:manifest:1.0"
diff --git a/odf/userfield.py b/odf/userfield.py
index 3d97724..0e63976 100644
--- a/odf/userfield.py
+++ b/odf/userfield.py
@@ -31,11 +31,7 @@ import xml.sax.saxutils
from odf.namespaces import OFFICENS, TEXTNS
-try:
- from cStringIO import StringIO
-except ImportError:
- from StringIO import StringIO
-
+from cStringIO import StringIO
OUTENCODING = "utf-8"
diff --git a/odf/xforms.py b/odf/xforms.py
index 35eeeb9..f28b96e 100644
--- a/odf/xforms.py
+++ b/odf/xforms.py
@@ -27,3 +27,8 @@ from element import Element
def Model(**args):
return Element(qname = (XFORMSNS,'model'), **args)
+def Instance(**args):
+ return Element(qname = (XFORMSNS,'instance'), **args)
+
+def Bind(**args):
+ return Element(qname = (XFORMSNS,'bind'), **args)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-odf.git
More information about the Python-modules-commits
mailing list