Skip to content

Commit

Permalink
add timezone to 'created' timestamp. close #302
Browse files Browse the repository at this point in the history
  • Loading branch information
mfrasca committed Jan 3, 2018
1 parent 2378b91 commit 0f1d92d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions bauble/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,9 +348,10 @@ def create(import_defaults=True):
meta_table.insert(bind=connection).\
execute(name=meta.VERSION_KEY,
value=unicode(bauble.version)).close()
from dateutil.tz import tzlocal
meta_table.insert(bind=connection).\
execute(name=meta.CREATED_KEY,
value=unicode(datetime.datetime.now())).close()
value=unicode(datetime.datetime.now(tz=tzlocal()))).close()
except GeneratorExit, e:
# this is here in case the main windows is closed in the middle
# of a task
Expand Down Expand Up @@ -455,7 +456,7 @@ def verify_connection(engine, show_error_dialogs=False):
query = session.query # (meta.BaubleMeta)

# check that the database we connected to has a "created" timestamp
# in the bauble meta table
# in the bauble meta table. we're not using the value though.
result = query(meta.BaubleMeta).filter_by(name=meta.CREATED_KEY).first()
if not result:
session.close()
Expand Down

0 comments on commit 0f1d92d

Please sign in to comment.