From e4ba25e5362f467ae0cae6662e3eb18a3ed90792 Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Thu, 4 Sep 2014 18:19:48 -0700 Subject: [PATCH] lookupStation will now take a system in which to search for said station --- tradedb.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tradedb.py b/tradedb.py index 6af2f2a0..1bb5c275 100644 --- a/tradedb.py +++ b/tradedb.py @@ -465,7 +465,7 @@ def _loadStations(self): if self.debug > 1: print("# Loaded %d Stations" % len(stationByID)) - def lookupStation(self, name): + def lookupStation(self, name, system=None): """ Look up a Station object by it's name or system. """ @@ -477,6 +477,10 @@ def lookupStation(self, name): raise ValueError("System '%s' has %d stations, please specify a station instead." % (name.str(), len(name.stations))) return name.stations[0] + if system: + system = self.lookupSystem(system) + return TradeDB.listSearch("Station", name, system.stations, key=lambda system: system.dbname) + stationID, station, systemID, system = None, None, None, None try: system = TradeDB.listSearch("System", name, self.systemByID.values(), key=lambda system: system.dbname)