Skip to content
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

Event default timestamp #24

Merged
merged 3 commits into from
Jan 19, 2023

Conversation

armstrys
Copy link
Contributor

@armstrys armstrys commented Jan 2, 2023

Changed the Event default value for created_at to None and set time stamp within __init__. Also added a test file for events.

nostr/event.py Outdated Show resolved Hide resolved
Copy link
Contributor

@callebtc callebtc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM apart from the nit

Co-authored-by: calle <93376500+callebtc@users.noreply.github.com>
@armstrys
Copy link
Contributor Author

Wow. I had never seen that solution. That’s going to save me a lot of text in my other work. Thanks :)

Also I wasn’t sure how to link it here, but this request will close issue 23.

@jeffthibault
Copy link
Owner

I'm not clear on why this change is needed. I think having the created_at time default to the current time is both logical and convenient.

If you want to use a custom time, you can do something similar to my suggestion in #23

@armstrys
Copy link
Contributor Author

I also left a comment on #23, but wanted to leave one here to make sure it is clear. I agree that using the current time as a default is the most logical approach, but I don't think the current implementation behaves as expected - I see this PR as a bug fix as opposed to a new feature.

@jeffthibault
Copy link
Owner

Thanks, I was able to reproduce the bug. LGTM

@jeffthibault jeffthibault merged commit 87f4207 into jeffthibault:main Jan 19, 2023
kdmukai added a commit to kdmukai/python-nostr that referenced this pull request Jan 20, 2023
@kdmukai
Copy link
Contributor

kdmukai commented Jan 20, 2023

@armstrys Can you add a follow-up update to document in the test what the test is addressing?

In general, each test should explain itself (""" should use time of instantiation as...""") and in this case I'd also reference the Issue num/link as further explanation.

@kdmukai
Copy link
Contributor

kdmukai commented Jan 21, 2023

Also I think a better test approach would be to create two Event instances w/a delay between them and verify that they have different created_at times.

@armstrys
Copy link
Contributor Author

Thanks for the feedback - That makes sense to me. Working on an update with both of those changes. Relatively new to contributions... can I push that update back up to this pull request or do I need to open a new one?

@kdmukai
Copy link
Contributor

kdmukai commented Jan 21, 2023

New PR. But reference this one in the PR notes. If you write #24 (just as normal text), github will autolink it: #24.

@armstrys
Copy link
Contributor Author

Okay, new PR is up and this all is making more sense. Thanks to both of you for your patience and help!

kdmukai added a commit to kdmukai/python-nostr that referenced this pull request Jan 21, 2023
kdmukai added a commit to kdmukai/python-nostr that referenced this pull request Jan 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants