def last_modified_on_armory(self): # cflewis | 2009-04-11 | It's safe to cache because there's no way # the lifetime of a character object will exceed that of an armory # refresh. downloader = XMLDownloader.XMLDownloader() source = downloader.download_url(self.url) try: if self._last_modified_on_armory != None: return self._last_modified_on_armory except AttributeError: try: armory_date_string = re.search("lastModified=\"(.*?)\"", source).group(1) except Exception, e: log.debug("Couldn't find last modified, returning what I had") return self.last_modified else: self._last_modified_on_armory = \ WoWSpyderLib.convert_last_modified_to_datetime(armory_date_string) log.debug("Saved last modified on armory as " + str(self._last_modified_on_armory)) return self._last_modified_on_armory
else: guild_name = guild.name # cflewis | 2009-04-02 | Last modified continues to be weird and # I can't track this bug down! last_modified = None log.debug("Guilds done, working on last modified date...") try: last_modified_string = character_node.attributes["lastModified"].value except KeyError, e: log.warning("Couldn't get last modified date. ERROR: " + str(e)) last_modified = None else: last_modified = WoWSpyderLib.convert_last_modified_to_datetime(last_modified_string) log.debug("Last modified date is " + str(last_modified)) if last_modified.year < 2008: log.warning("Last modified year was broken, fixing it to this year") # cflewis | 2009-03-30 | The Armory has been returning strange # years intermittently, not replicable when I manually visit # the page. I'll set the year to what the current year is. last_modified.replace(year=datetime.datetime.now().year) else: log.debug("Last modified year is " + str(last_modified.year) + " so continuing") log.debug("Character done, getting items...") items = [] for i in range(0, 19):