| 447 | |
| 448 | @property |
| 449 | def price(self): |
| 450 | # todo: use `from sqlalchemy import inspect` instead (mac-deprecated doesn't have inspect(), was imp[lemented in 0.8) |
| 451 | if self.__priceObj is not None and getattr(self.__priceObj, '_sa_instance_state', None) and self.__priceObj._sa_instance_state.deleted: |
| 452 | pyfalog.debug("Price data for {} was deleted (probably from a cache reset), resetting object".format(self.ID)) |
| 453 | self.__priceObj = None |
| 454 | |
| 455 | if self.__priceObj is None: |
| 456 | db_price = eos.db.getPrice(self.ID) |
| 457 | # do not yet have a price in the database for this item, create one |
| 458 | if db_price is None: |
| 459 | pyfalog.debug("Creating a price for {}".format(self.ID)) |
| 460 | self.__priceObj = types_Price(self.ID) |
| 461 | eos.db.add(self.__priceObj) |
| 462 | eos.db.flush() |
| 463 | else: |
| 464 | self.__priceObj = db_price |
| 465 | |
| 466 | return self.__priceObj |
| 467 | |
| 468 | @property |
| 469 | def isAbyssal(self): |