From 524fa004d3c118e79a83201eebf187da359e5568 Mon Sep 17 00:00:00 2001 From: "Rici.Yu" Date: Thu, 16 Apr 2015 13:24:29 -0400 Subject: [PATCH] ASM #14946 - fix issue when timezone is not defined for any zone in a segment Change-Id: I252f78cb9f5bf1cf556788c79fe14ad338b546aa Former-commit-id: 03034f57c8bb0ee566679206a81524b2ffc60755 [formerly ef4c5307d5693abd834f4210e081fb8e3a21f90b] Former-commit-id: 3b590509961b9c9771e34593420ad51a7b729ba6 --- .../textUtilities/headline/FormatterRunner.py | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/cave/com.raytheon.viz.gfe/localization/gfe/userPython/textUtilities/headline/FormatterRunner.py b/cave/com.raytheon.viz.gfe/localization/gfe/userPython/textUtilities/headline/FormatterRunner.py index 4d4b3f22d8..e87d3503f4 100644 --- a/cave/com.raytheon.viz.gfe/localization/gfe/userPython/textUtilities/headline/FormatterRunner.py +++ b/cave/com.raytheon.viz.gfe/localization/gfe/userPython/textUtilities/headline/FormatterRunner.py @@ -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):