Author: hwright
Date: Tue Jul 27 21:58:13 2010
New Revision: 979885
URL: http://svn.apache.org/viewvc?rev=979885&view=rev
Log:
Sundry fixes to Mouse.
* mouse.py
(Item.get_content): Read from the file object, not the global method.
(Resource.to_element): Use the SubElement() method to get child elements.
Also, add the text for the files of questionable repute.
Modified:
labs/mouse/mouse.py
Modified: labs/mouse/mouse.py
URL:
http://svn.apache.org/viewvc/labs/mouse/mouse.py?rev=979885&r1=979884&r2=979885&view=diff
==============================================================================
--- labs/mouse/mouse.py (original)
+++ labs/mouse/mouse.py Tue Jul 27 21:58:13 2010
@@ -72,7 +72,7 @@ class Item(object):
def get_content(self):
'''Return the contents of this item.'''
if not self._content:
- self._content = file.read()
+ self._content = self.file.read()
return self._content
@@ -85,11 +85,13 @@ class Resource(object):
elem = ElementTree.Element('resource')
elem.set('name', self._item.name)
- elem.append(ElementTree.Element('header-sample'))
- elem.append(ElementTree.Element('header-type'))
- elem.append(ElementTree.Element('license-family'))
- elem.append(ElementTree.Element('license-approval'))
- elem.append(ElementTree.Element('type'))
+ child = ElementTree.SubElement(elem, 'header-sample')
+ child.text = self._item.get_content()
+
+ child = ElementTree.SubElement(elem, 'header-type')
+ child = ElementTree.SubElement('license-family')
+ child = ElementTree.SubElement('license-approval')
+ child = ElementTree.SubElement('type')
return elem
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]