New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
USE_TZ = True. #2263
USE_TZ = True. #2263
Conversation
Hi @fossilet. We cannot simply enable |
Oops, let me see. |
The difference of the objects in the failed test is two hours. I cannot find why. @mkurek can you have a look at it? |
@fossilet it looks like openstack importer has issue which blocks this pull request. |
@xliiv great. |
The bug which I mentioned earlier is because timezone is skipped here: |
@xliiv, there is still a flake error even if I have fixed one. |
@ar4s, I saw the error, but it is in fact used by the newly added code by @xliiv. That's why I asked him to have a look. Maybe its an error of flake8 itself. |
@fossilet no it's not used - he replaced |
I have fixed it. |
@@ -306,8 +306,7 @@ def _add_server(self, openstack_server, server_id, project): | |||
|
|||
# workaround - created field has auto_now_add attribute | |||
new_server.save() | |||
new_server.created = datetime.strptime(openstack_server['created'], | |||
self.DATETIME_FORMAT) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self.DATETIME_FORMAT
is not used anymore - could you delete it in line 49?
TestOpenstackSync ignored timezone of created field. Now it doesn't.
@mkurek I've added it. |
@fossilet thanks. we'll pull and test your code if it works well with our current setup. |
Continued in #2391 |
We are using the following settings regarding timezone:
When
USE_TZ
is False, Django would store timestamps in the timezone ofTIME_ZONE
, and this is how ralph is storing time. After I realised I should changeTIME_ZONE
, even if I changedTIME_ZONE to
'Asia/Beijing'
, the stored time are still in the old timezone (GMT+1). How about it that we changeUSE_TZ
toTrue
, to make sue time is always saved as UTC? This is also recommended by Django.