Feature #172

Replaced minidom with ElementTree

Added by Anonymous 6 months ago. Updated 6 months ago.

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.

rev7_edit2_psm_erepublik.py (15.7 KB) Ben Hai, 02/03/2010 01:05 am

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

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.

Updated by Ben Hai 6 months ago

  • File deleted (rev7_edit_psm_erepublik.py)

Updated by Ben W. 6 months ago

  • Status changed from Assigned to Resolved
  • % Done changed from 0 to 100

implemented on live network

Also available in: Atom PDF