Commits

Jason R. Coombs committed 243c73e

Construct the 'E' class programmatically

Comments (0)

Files changed (1)

openpack/basepack.py

 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
-vars(E).update(dict(
+# 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/"