Timezone aware in standalone file
authorNeil Smith <neil.git@njae.me.uk>
Mon, 4 Apr 2016 13:25:43 +0000 (14:25 +0100)
committerNeil Smith <neil.git@njae.me.uk>
Mon, 4 Apr 2016 13:25:43 +0000 (14:25 +0100)
dmarc_to_database

index 530d548b984fa8267eb57c46cfbacdf983441c1b..ac7baa39c034ac7e00dc3616de4ac0c5be382c0f 100755 (executable)
@@ -117,7 +117,7 @@ def build_insert_command(table_name, report, preamble_values=None, i=None):
         field_names += [field_maps[f]['pg_field_name']]
         if field_maps[f]['pg_type'] == 'int':
             values[field_maps[f]['pg_field_name']] = int(report.find(fp).text)
-        elif field_maps[f]['pg_type'] == 'timestamp':
+        elif field_maps[f]['pg_type'] == 'timestamptz':
             # values[field_maps[f]['pg_field_name']] = datetime.datetime.utcfromtimestamp(int(report.find(fp).text))
             values[field_maps[f]['pg_field_name']] = \
                 datetime.datetime.fromtimestamp(int(report.find(fp).text),