justquick / django-activity-stream

Generate generic activity streams from the actions on your site. Users can follow any actors' activities for personalized streams.
http://django-activity-stream.rtfd.io/en/latest/
BSD 3-Clause "New" or "Revised" License
2.38k stars 482 forks source link

Remove usage of `datetime_safe` #524

Closed lociii closed 1 year ago

lociii commented 1 year ago

django.utils.datetime_safe has been deprecated and will be removed in DJango 5.0

DJango source code described it's purpose as following:

# These classes override date and datetime to ensure that strftime('%Y')
# returns four digits (with leading zeros) on years < 1000.
# https://bugs.python.org/issue13305
#
# Based on code submitted to comp.lang.python by Andrew Dalke
#
# >>> datetime_safe.date(10, 8, 2).strftime("%Y/%m/%d was a %A")
# '0010/08/02 was a Monday'

This may break for actions dated before the year 1000.
If a removal without replacement is accepted, I would go ahead and provide a pull request.

justquick commented 1 year ago

anything throwing deprecation warnings for future django releases should be fine. please go ahead and make a PR

i dont think a lot of folks are using this app to track actions from the roman empire but it should b removed anyway

lociii commented 1 year ago

After some investigation, this seems like a packaging/release issue.

You already removed the datetime_safe calls in March 2022 in https://github.com/justquick/django-activity-stream/commit/df4b56904ccd540c71e38f3491e89dfd8b5caf93 and they are not found anymore in the main branch but the current package 1.4.2 still contains them in e.g. actstream/feed.py:10

from django.utils import datetime_safe

Package has been downloaded from GitHub and PyPI both containing the outdated imports and usages.

lociii commented 1 year ago

@justquick pinging here as this might be a severe issue.

justquick commented 1 year ago

fixed in version 1.4.3