Jason R. Coombs  committed 243c73e

Construct the 'E' class programmatically

  • Participants
  • Parent commits 8ae20e6

Comments (0)

Files changed (1)

File openpack/

 from collections import defaultdict
 from lxml.etree import Element, fromstring, tostring
+from lxml.builder import ElementMaker as _ElementMaker
 from .util import validator, parse_tag, get_ext
 ContentType.Override = Override
 del Override
-from lxml.builder import ElementMaker as _ElementMaker
-class E:
-	pass
+# Construct E, a convient namespace for making elements in the OOXML
+# namespaces.
+E = type('E', (object,), dict(
 	(key, _ElementMaker(namespace=namespace, nsmap=ooxml_namespaces))
 	for key, namespace in ooxml_namespaces.items()
-	))
 class CoreProperties(Part):
 	content_type = ("application/"