Commit c1a967629561c1287fef80e8656e407dfc358c70

Authored by hitier
1 parent 29ef4446
Exists in rhitier-dev

Move duplicated to function

Showing 1 changed file with 4 additions and 8 deletions   Show diff stats
web/run.py
... ... @@ -328,6 +328,10 @@ def datetime_from_list(time_list):
328 328 with DayOfYear starting at 0. We want it starting at 1 because it's what
329 329 vendor parsers use, both in python and javascript.
330 330 """
  331 + try:
  332 + time_list = [str(i, 'UTF8') for i in time_list]
  333 + except Exception as e:
  334 + log.error(e)
331 335 # Day Of Year starts at 0, but for our datetime parser it starts at 1
332 336 doy = '{:03d}'.format(int(''.join(time_list[4:7])) + 1)
333 337 return datetime.datetime.strptime(
... ... @@ -711,10 +715,6 @@ def get_data_for_target(target_config, input_slug,
711 715 (target_config['name'], orbit_file))
712 716 for ltime, datum_hee in zip(times, data_hee):
713 717 try:
714   - try:
715   - ltime = [str(i, 'UTF8') for i in ltime]
716   - except Exception as e:
717   - print(e)
718 718 dtime = datetime_from_list(ltime)
719 719 except Exception:
720 720 log.error("Failed to parse time from get__data_for_target %s." % ltime)
... ... @@ -776,10 +776,6 @@ def get_data_for_target(target_config, input_slug,
776 776 in zip(times, data_v, data_b, data_t, data_n, data_p, data_a):
777 777  
778 778 try:
779   - try:
780   - ltime = [str(i, 'UTF8') for i in ltime]
781   - except Exception as e:
782   - print(e)
783 779 dtime = datetime_from_list(ltime)
784 780 except Exception:
785 781 log.error("Failed to parse time from %s." % ltime)
... ...