Closed GoogleCodeExporter closed 9 years ago
You can check if your distro has a backport named python2.4-elementtree or
similar.
If not, you can mock "get_categories" so it returns a static dict with pairs
(term, label).
Original comment by tokland
on 5 Oct 2010 at 11:12
Sorry mate, my Python is not that good, I have confirmed I dont have
python2.4-elementtree .
Are you able to give me more info on the mock "get_categories" ?
Original comment by cam...@campersalmanac.com
on 5 Oct 2010 at 11:37
I only ever use the Travel category. Can I do something like the below?
@classmethod
def get_categories(cls):
"""Return categories dictionary with pairs (term, label)."""
#def get_pair(element):
# """Return pair (term, label) for a (non-deprecated) XML element."""
# if all(not(str(x.tag).endswith("deprecated")) for x in element.getchildren()):
# return (element.get("term"), element.get("label"))
#xmldata = urllib.urlopen(cls.CATEGORIES_SCHEME).read()
#xml = ElementTree.XML(xmldata)
return ('Travel', 'Travel')
Original comment by cam...@campersalmanac.com
on 5 Oct 2010 at 12:35
It expects a dictionary:
return {"Travel": "Travel"}
Original comment by tokland
on 5 Oct 2010 at 1:24
Original comment by tokland
on 13 May 2014 at 2:55
Original issue reported on code.google.com by
cam...@campersalmanac.com
on 5 Oct 2010 at 10:53