comparison markup/builder.py @ 182:41db0260ebb1

Renamed `Attributes` to `Attrs` to reduce the verbosity.
author cmlenz
date Mon, 21 Aug 2006 20:03:13 +0000
parents b9a0031d4bbb
children
comparison
equal deleted inserted replaced
181:d07ce6c1dbbe 182:41db0260ebb1
9 # 9 #
10 # This software consists of voluntary contributions made by many 10 # This software consists of voluntary contributions made by many
11 # individuals. For the exact contribution history, see the revision 11 # individuals. For the exact contribution history, see the revision
12 # history and logs, available at http://markup.edgewall.org/log/. 12 # history and logs, available at http://markup.edgewall.org/log/.
13 13
14 from markup.core import Attributes, Namespace, QName, Stream, START, END, TEXT 14 from markup.core import Attrs, Namespace, QName, Stream, START, END, TEXT
15 15
16 __all__ = ['Fragment', 'Element', 'tag'] 16 __all__ = ['Fragment', 'Element', 'tag']
17 17
18 18
19 class Fragment(object): 19 class Fragment(object):
155 __slots__ = ['tag', 'attrib'] 155 __slots__ = ['tag', 'attrib']
156 156
157 def __init__(self, tag_, **attrib): 157 def __init__(self, tag_, **attrib):
158 Fragment.__init__(self) 158 Fragment.__init__(self)
159 self.tag = QName(tag_) 159 self.tag = QName(tag_)
160 self.attrib = Attributes() 160 self.attrib = Attrs()
161 for attr, value in attrib.items(): 161 for attr, value in attrib.items():
162 if value is not None: 162 if value is not None:
163 if not isinstance(value, basestring): 163 if not isinstance(value, basestring):
164 value = unicode(value) 164 value = unicode(value)
165 self.attrib.append((QName(attr.rstrip('_').replace('_', '-')), 165 self.attrib.append((QName(attr.rstrip('_').replace('_', '-')),
Copyright (C) 2012-2017 Edgewall Software