Created
May 24, 2010 22:46
-
-
Save steadicat/412524 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/__init__.py b/__init__.pyindex 66f0f05..57574d6 100644 | |
--- a/__init__.py | |
+++ b/__init__.py | |
@@ -5,7 +5,7 @@ import re | |
import sys | |
from exceptions import * | |
from utils import * | |
-from lxml import etree | |
+from xml.etree import ElementTree | |
from urllib import urlencode | |
VERSION = '0.9.2' | |
@@ -101,7 +101,7 @@ class CheddarGetter: | |
# parse the XML | |
try: | |
- content = etree.fromstring(content) | |
+ content = ElementTree.fromstring(content) | |
except: | |
raise UnexpectedResponse, "The server sent back something that wasn't valid XML." | |
@@ -294,7 +294,7 @@ class CheddarObject(object): | |
('subscription', 'plans'), | |
) | |
- for child in xml.iterchildren(): | |
+ for child in xml.getchildren(): | |
# is this an element with children? if so, it's an object | |
# relationship, not just an attribute | |
if len(child.getchildren()) > 0: | |
@@ -316,7 +316,7 @@ class CheddarObject(object): | |
# okay, it's not a single relationship -- follow my normal | |
# process for a many to many | |
setattr(self, child.tag, []) | |
- for indiv_xml in child.iterchildren(): | |
+ for indiv_xml in child.getchildren(): | |
# get the class that this item is | |
try: | |
klass = getattr(sys.modules[__name__], indiv_xml.tag.capitalize()) | |
@@ -389,7 +389,7 @@ class Plan(CheddarObject): | |
xml = CheddarGetter.request('/plans/get/') | |
# make a list of Plan objects and return it | |
- for plan_xml in xml.iterchildren(tag = 'plan'): | |
+ for plan_xml in xml.getiterator(tag = 'plan'): | |
plans.append(Plan.from_xml(plan_xml)) | |
return plans | |
@@ -406,7 +406,7 @@ class Plan(CheddarObject): | |
xml = CheddarGetter.request('/plans/get/', code = code) | |
# return a plan object | |
- for plan_xml in xml.iterchildren(tag = 'plan'): | |
+ for plan_xml in xml.getiterator(tag = 'plan'): | |
return Plan.from_xml(plan_xml) | |
@@ -479,7 +479,7 @@ class Customer(CheddarObject): | |
try: | |
customers = [] | |
xml = CheddarGetter.request('/customers/get/', **kwargs) | |
- for customer_xml in xml.iterchildren('customer'): | |
+ for customer_xml in xml.getiterator(tag='customer'): | |
customers.append(Customer.from_xml(customer_xml)) | |
return customers | |
@@ -496,7 +496,7 @@ class Customer(CheddarObject): | |
in CheddarGetter.""" | |
xml = CheddarGetter.request('/customers/get/', code = code) | |
- for customer_xml in xml.iterchildren('customer'): | |
+ for customer_xml in xml.getiterator(tag='customer'): | |
return Customer.from_xml(customer_xml) | |
@@ -556,7 +556,7 @@ class Customer(CheddarObject): | |
# either way, I should get a well-formed customer XML response | |
# that can now be loaded into this object | |
- for customer_xml in xml.iterchildren('customer'): | |
+ for customer_xml in xml.getiterator(tag='customer'): | |
self._load_data_from_xml(customer_xml) | |
break | |
@@ -702,7 +702,7 @@ class Subscription(CheddarObject): | |
# either way, I should get a well-formed customer XML response | |
# that can now be loaded into this object | |
- for subscription_xml in xml.iterchildren('subscription'): | |
+ for subscription_xml in xml.getiterator(tag='subscription'): | |
self._load_data_from_xml(subscription_xml) | |
break | |
@@ -801,4 +801,4 @@ try: | |
if hasattr(settings, 'CHEDDARGETTER_PRODUCT_CODE'): | |
CheddarGetter.set_product_code(settings.CHEDDARGETTER_PRODUCT_CODE) | |
except ImportError: | |
- pass | |
\ No newline at end of file | |
+ pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment