# HG changeset patch # User Thinker K.F. Li # Date 1225614781 -28800 # Node ID bff16e6ee3efda608dda7f7db1f9bad4cbbe05fe # Parent 6adad3bcca789f7a574734aedced281ba7fe458a Extract status of reearching for Academy. diff -r 6adad3bcca78 -r bff16e6ee3ef pyikriam/buildings.py --- a/pyikriam/buildings.py Sun Nov 02 15:14:51 2008 +0800 +++ b/pyikriam/buildings.py Sun Nov 02 16:33:01 2008 +0800 @@ -103,6 +103,23 @@ def __init__(self, city_id, idx, baseurl): super(academy, self).__init__('academy', city_id, idx, baseurl) pass + + def _sync(self, page_dom): + xpath_research_name = '/descendant::*[@class=\'researchName\']/a' + anodes = page_dom.xpath(xpath_research_name) + if len(anodes) == 1: + anode = anodes[0] + self.researching = anode.get('title') + xpath_countdown = '/descendant::div[@id=\'researchCountDown\']/text()' + txtnodes = page_dom.xpath(xpath_countdown) + self.researching_countdown = txtnodes[0] + else: + self.researching = None + self.researching_countdown = None + pass + + super(academy, self)._sync(page_dom) + pass pass class warehouse(building):