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

Change-Id: I252f78cb9f5bf1cf556788c79fe14ad338b546aa

Former-commit-id: 03034f57c8 [formerly ef4c5307d5693abd834f4210e081fb8e3a21f90b]
Former-commit-id: 3b59050996
This commit is contained in:
Rici.Yu 2015-04-16 13:24:29 -04:00
parent c1511407bc
commit 524fa004d3

View file

@ -38,7 +38,8 @@ from java.io import File
# ------------ ---------- ----------- -------------------------- # ------------ ---------- ----------- --------------------------
# 05/29/08 njensen Initial Creation. # 05/29/08 njensen Initial Creation.
# 12/10/14 #14946 ryu Add getTimeZones() function. # 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,11 +441,8 @@ def getTimeZones(zones, officeTZ):
timezones = [] timezones = []
if zones is not None: if zones is not None:
for zone in JUtil.javaStringListToPylist(zones): for zone in JUtil.javaStringListToPylist(zones):
area_dict = AreaDictionary.AreaDictionary.get(zone) zdict = AreaDictionary.AreaDictionary.get(zone, {})
if area_dict is None: tzs = zdict.get("ugcTimeZone", [])
continue
tzs = area_dict.get("ugcTimeZone")
if tzs is not None:
if type(tzs) is str: if type(tzs) is str:
tzs = [tzs] tzs = [tzs]
for tz in tzs: for tz in tzs:
@ -453,6 +451,8 @@ def getTimeZones(zones, officeTZ):
if officeTZ in timezones and officeTZ != timezones[0]: if officeTZ in timezones and officeTZ != timezones[0]:
timezones.remove(officeTZ) timezones.remove(officeTZ)
timezones.insert(0, officeTZ) timezones.insert(0, officeTZ)
if len(timezones) == 0:
timezones.append(officeTZ)
return JUtil.pylistToJavaStringList(timezones) return JUtil.pylistToJavaStringList(timezones)
def reloadModule(moduleName): def reloadModule(moduleName):