Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 854245 Details for
Bug 1044085
[RFE] make the times and dates displayed in the frontend location aware
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
[PATCH] 1044085 - frontend: display time in user timezone
0001-1044085-frontend-display-time-in-user-timezone.patch (text/plain), 4.35 KB, created by
Igor Gnatenko
on 2014-01-23 08:27:32 UTC
(
hide
)
Description:
[PATCH] 1044085 - frontend: display time in user timezone
Filename:
MIME Type:
Creator:
Igor Gnatenko
Created:
2014-01-23 08:27:32 UTC
Size:
4.35 KB
patch
obsolete
>From fa022af21ed2f205a9403d0417898a55788c7c9c Mon Sep 17 00:00:00 2001 >From: Igor Gnatenko <i.gnatenko.brain@gmail.com> >Date: Thu, 23 Jan 2014 12:25:28 +0400 >Subject: [PATCH] 1044085 - frontend: display time in user timezone > >Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com> >--- > .../versions/498884ac47db_add_timezone_field.py | 24 ++++++++++++++++++++++ > coprs_frontend/coprs/models.py | 2 ++ > .../templates/coprs/detail/_builds_table.html | 15 +++++++++++--- > coprs_frontend/coprs/views/misc.py | 2 +- > 4 files changed, 39 insertions(+), 4 deletions(-) > create mode 100644 coprs_frontend/alembic/versions/498884ac47db_add_timezone_field.py > >diff --git a/coprs_frontend/alembic/versions/498884ac47db_add_timezone_field.py b/coprs_frontend/alembic/versions/498884ac47db_add_timezone_field.py >new file mode 100644 >index 0000000..5c5948b >--- /dev/null >+++ b/coprs_frontend/alembic/versions/498884ac47db_add_timezone_field.py >@@ -0,0 +1,24 @@ >+"""add timezone field >+ >+Revision ID: 498884ac47db >+Revises: 3a415c6392bc >+Create Date: 2014-01-23 12:15:04.450292 >+ >+""" >+ >+# revision identifiers, used by Alembic. >+revision = '498884ac47db' >+down_revision = '3a415c6392bc' >+ >+from alembic import op >+import sqlalchemy as sa >+ >+ >+def upgrade(): >+ """ Add 'data' colum to action table. """ >+ op.add_column('user', sa.Column('timezone', sa.String(length=50), nullable=False)) >+ >+ >+def downgrade(): >+ """ Drop 'data' colum from action table. """ >+ op.drop_column('user', 'timezone') >diff --git a/coprs_frontend/coprs/models.py b/coprs_frontend/coprs/models.py >index 4352661..3499400 100644 >--- a/coprs_frontend/coprs/models.py >+++ b/coprs_frontend/coprs/models.py >@@ -61,6 +61,8 @@ class User(db.Model, Serializer): > openid_name = db.Column(db.String(100), nullable = False) > # just mail :) > mail = db.Column(db.String(150), nullable = False) >+ # just timezone ;) >+ timezone = db.Column(db.String(50), nullable = False) > # is this user proven? proven users can modify builder memory and timeout for single builds > proven = db.Column(db.Boolean, default = False) > # is this user admin of the system? >diff --git a/coprs_frontend/coprs/templates/coprs/detail/_builds_table.html b/coprs_frontend/coprs/templates/coprs/detail/_builds_table.html >index a70b53c..ef95297 100644 >--- a/coprs_frontend/coprs/templates/coprs/detail/_builds_table.html >+++ b/coprs_frontend/coprs/templates/coprs/detail/_builds_table.html >@@ -1,4 +1,13 @@ > {% from "coprs/detail/_builds_forms.html" import copr_build_cancel_form, copr_build_repeat_form, copr_build_delete_form %} >+{% from datetime import datetime %} >+{% from dateutil import tz %} >+{{ format_tz = "%%d-%%m-%%y %%H:%%M:%%S" }} >+{{ utc_tz = tz.tzutc() }} >+{% if g.user.timezone %} >+ {{ user_tz = g.user.timezone }} >+{% else %} >+ {{ user_tz = utc_tz }} >+{% endif %} > > {% macro builds_table(builds) %} > {% if builds %} >@@ -14,10 +23,10 @@ > {% for build in builds %} > <tr class="build-{{ build.state }} build-state"> > <td>{{ build.id }}</td> >- <td>{{ build.submitted_on|date_from_secs }}</td> >+ <td>{{ datetime.strptime(build.submitted_on|date_from_secs, format_tz).replace(tzinfo=utc_tz).astimezone(g.user.timezone).strftime(format_tz) }}</td> > <td>{{ build.user.name }}</td> >- <td>{{ build.started_on|date_from_secs or 'Not yet' }}</td> >- <td>{{ build.ended_on|date_from_secs or 'Not yet' }}</td> >+ <td>{{ datetime.strptime(build.started_on|date_from_secs, format_tz).replace(tzinfo=utc_tz).astimezone(g.user.timezone).strftime(format_tz) or 'Not yet' }}</td> >+ <td>{{ datetime.strptime(build.ended_on|date_from_secs, format_tz).replace(tzinfo=utc_tz).astimezone(g.user.timezone).strftime(format_tz) or 'Not yet' }}</td> > <td>{{ build.state }}</td> > </tr> > <tr class="details"> >diff --git a/coprs_frontend/coprs/views/misc.py b/coprs_frontend/coprs/views/misc.py >index 3f2b953..b78e490 100644 >--- a/coprs_frontend/coprs/views/misc.py >+++ b/coprs_frontend/coprs/views/misc.py >@@ -33,7 +33,7 @@ def login(): > if flask.g.user is not None: > return flask.redirect(oid.get_next_url()) > else: >- return oid.try_login('https://id.fedoraproject.org/', ask_for=['email']) >+ return oid.try_login('https://id.fedoraproject.org/', ask_for=['email', 'timezone']) > > @oid.after_login > def create_or_login(resp): >-- >1.8.5.3 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 1044085
:
853506
| 854245