From c0f74cd0a3e4a56b701b168e47f7347fba3234c4 Mon Sep 17 00:00:00 2001 From: blitzmann Date: Fri, 21 Apr 2017 23:43:40 -0400 Subject: [PATCH 1/2] Fix old issue with trying to open previous fits that don't exist. --- gui/itemStats.py | 2 +- gui/mainFrame.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/gui/itemStats.py b/gui/itemStats.py index 6dbec6a9e..788414292 100644 --- a/gui/itemStats.py +++ b/gui/itemStats.py @@ -1381,7 +1381,7 @@ class ItemProperties(wx.Panel): else: attrName = name.title() value = getattr(self.item, name) - except Exception as e: + except: # TODO: Add logging to this. # We couldn't get a property for some reason. Skip it for now. continue diff --git a/gui/mainFrame.py b/gui/mainFrame.py index 8a66e78d2..5e1ad08c6 100644 --- a/gui/mainFrame.py +++ b/gui/mainFrame.py @@ -255,7 +255,9 @@ class MainFrame(wx.Frame): # Remove any fits that cause exception when fetching (non-existent fits) for id in fits[:]: try: - sFit.getFit(id, basic=True) + fit = sFit.getFit(id, basic=True) + if fit is None: + fits.remove(id) except: fits.remove(id) From f7349316b4219a23247fcfab2ada40a0e94ddfba Mon Sep 17 00:00:00 2001 From: blitzmann Date: Mon, 24 Apr 2017 00:34:04 -0400 Subject: [PATCH 2/2] Revert "Change to using inspect() instead of the current shitty way" This reverts commit 711537dcf4c70a73243988ad146bcc84536d82d7. Turns out inspect() was introduced in 0.8, and mac-deprecated has 0.6.4 (without an easy way to jack it up). Stuck with this ugly, but functional code for now. --- eos/gamedata.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/eos/gamedata.py b/eos/gamedata.py index d12940a8a..f6ea5183c 100644 --- a/eos/gamedata.py +++ b/eos/gamedata.py @@ -20,7 +20,6 @@ import re from sqlalchemy.orm import reconstructor -from sqlalchemy import inspect import eos.db from eqBase import EqBase @@ -444,9 +443,8 @@ class Item(EqBase): @property def price(self): - # This happens when the price record is deleted from the database. We dynamically refresh the price object - # attached to the fit if it's determined to have been deleted - if self.__price is not None and inspect(self.__price).deleted: + # todo: use `from sqlalchemy import inspect` instead (mac-deprecated doesn't have inspect(), was imp[lemented in 0.8) + if self.__price is not None and getattr(self.__price, '_sa_instance_state', None) and self.__price._sa_instance_state.deleted: pyfalog.debug("Price data for {} was deleted (probably from a cache reset), resetting object".format(self.ID)) self.__price = None