ASM #14946 - fix issue when timezone is not defined for any zone in a segment

Change-Id: I252f78cb9f5bf1cf556788c79fe14ad338b546aa

Former-commit-id: ef4c5307d5693abd834f4210e081fb8e3a21f90b
This commit is contained in:
Rici.Yu 2015-04-16 13:24:29 -04:00
parent c9337caeb2
commit 03034f57c8

View file

@ -38,7 +38,8 @@ from java.io import File
# ------------ ---------- ----------- --------------------------
# 05/29/08 njensen Initial Creation.
# 12/10/14 #14946 ryu Add getTimeZones() function.
#
# 04/16/15 #14946 ryu Fix getTimeZones to return the office TZ if timezone
# is not set for any zone in a segment.
#
#
@ -440,19 +441,18 @@ def getTimeZones(zones, officeTZ):
timezones = []
if zones is not None:
for zone in JUtil.javaStringListToPylist(zones):
area_dict = AreaDictionary.AreaDictionary.get(zone)
if area_dict is None:
continue
tzs = area_dict.get("ugcTimeZone")
if tzs is not None:
if type(tzs) is str:
tzs = [tzs]
for tz in tzs:
if tz not in timezones:
timezones.append(tz)
zdict = AreaDictionary.AreaDictionary.get(zone, {})
tzs = zdict.get("ugcTimeZone", [])
if type(tzs) is str:
tzs = [tzs]
for tz in tzs:
if tz not in timezones:
timezones.append(tz)
if officeTZ in timezones and officeTZ != timezones[0]:
timezones.remove(officeTZ)
timezones.insert(0, officeTZ)
if len(timezones) == 0:
timezones.append(officeTZ)
return JUtil.pylistToJavaStringList(timezones)
def reloadModule(moduleName):