Skip to content

Commit

Permalink
updateLocalStation fixes and name-change support
Browse files Browse the repository at this point in the history
  • Loading branch information
kfsone committed Feb 15, 2015
1 parent ecd3e35 commit d619e13
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tradedb.py
Original file line number Diff line number Diff line change
Expand Up @@ -1107,6 +1107,7 @@ def addLocalStation(

def updateLocalStation(
self, station,
name=None,
lsFromStar=None,
blackMarket=None,
maxPadSize=None,
Expand All @@ -1117,12 +1118,22 @@ def updateLocalStation(
"""
changes = False

if name is not None:
if name != station.dbname or force:
station.dbname = name
changes = True
else:
name = station.dbname

if lsFromStar is not None:
assert lsFromStar >= 0
if lsFromStar != station.lsFromStar:
if lsFromStar > 0 or force:
station.lsFromStar = lsFromStar
changes = True
else:
lsFromStar = station.lsFromStar


if blackMarket is not None:
blackMarket = blackMarket.upper()
Expand All @@ -1131,6 +1142,8 @@ def updateLocalStation(
if blackMarket != '?' or force:
station.blackMarket = blackMarket
changes = True
else:
blackMarket = station.blackMarket

if maxPadSize is not None:
maxPadSize = maxPadSize.upper()
Expand All @@ -1139,6 +1152,8 @@ def updateLocalStation(
if maxPadSize != '?' or force:
station.maxPadSize = maxPadSize
changes = True
else:
maxPadSize = station.maxPadSize

if not changes:
return False
Expand Down

0 comments on commit d619e13

Please sign in to comment.