Feature #172
Replaced minidom with ElementTree
| Status: | Resolved | Start: | 01/30/2010 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assigned to: | Ben Hai | % Done: | 100% |
|
| Category: | - | |||
| Target version: | - |
Description
Replaced xml.dom.minidom with xml.etree.cElementTree.ElementTree. ElementTree is quicker and more functional than minidom.
Example:
name = raw_data.find('name').text
instead of:
name = raw_data.getElementsByTagName('name')[0].toxml()[6:-7]
and:
price = extract.find("offer/price").text
instead of:
price = extract.getElementsByTagName('price')[0].toxml()[7:-8]
This allows for element positions in the api feed to be moved wherever within their respective parent elements without anything breaking.
I also removed some redundant function calling, and changed the spelling and grammar of one of the privmsg replies that annoyed me. :P I still have a bit more I want to edit, but this will do for now.
I'm not able to test it all, so I hope there's no errors.
History
Updated by Ben W. 6 months ago
- Status changed from Unassigned to Assigned
- Assigned to set to Ben Hai
Updated by Ben Hai 6 months ago
- File rev7_edit_psm_erepublik.py added
Forgot to sign in. Here's the file.
Updated by Ben Hai 6 months ago
- File rev7_edit2_psm_erepublik.py added
Okay, I've had a chance to test it and found a typo. Other than that it seemed to be working fine. The updated file is attached.