You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Android client gets Internal Server Error logging into 8.0.3 server that has been made timezone aware by setting TIMEZONE and USE_TZ=True in seahub_settings.py.
Traceback in seahub.log ends with:
File "/opt/seafile/seafile-server-8.0.3/seahub/seahub/api2/authentication.py", line 130, in authenticate_v2
if not within_time_range(token.last_accessed, datetime.datetime.now(), 10 * 60):
File "/opt/seafile/seafile-server-8.0.3/seahub/seahub/utils/init.py", line 1335, in within_time_range
delta = d2 - d1 if d2 > d1 else d1 - d2
TypeError: can't compare offset-naive and offset-aware datetimes
2021-03-01 07:32:24,435 [ERROR] django.request:228 log_response Internal Server Error: /seafile/api2/account/inf
o/
vi /opt/seafile/seafile-server-8.0.3/seahub/seahub/api2/authentication.py # near line 130, fix mobile login
# 13.0.8.5.12-t6 jimays token.last_accessed is timezone-aware, so must be compared with such
# gratitude stackoverflow questions/4530069/how-do-i-get-a-value-of-datetime-today-in-py
thon-that-is-timezone-aware/25421145
# gratitude stackoverflow questions/5802108/how-to-check-if-a-datetime-object-is-localiz
ed-with-pytz
# if not within_time_range(token.last_accessed, datetime.datetime.now(), 10 * 60):
import pytz
if not within_time_range(token.last_accessed, datetime.datetime.now() if (token.last_accessed.tzinfo is None or token.last_accessed.tzinfo.utcoffset(token.last_accessed) is None) else datetime.datetime.utcnow().replace(tzinfo=pytz.utc), 10 * 60):
The text was updated successfully, but these errors were encountered:
jimays
changed the title
Androd client gets internal server error logging into timezone-aware server 8.0.3
Android client gets internal server error logging into timezone-aware server 8.0.3
Mar 1, 2021
Android client gets Internal Server Error logging into 8.0.3 server that has been made timezone aware by setting TIMEZONE and USE_TZ=True in seahub_settings.py.
Traceback in seahub.log ends with:
File "/opt/seafile/seafile-server-8.0.3/seahub/seahub/api2/authentication.py", line 130, in authenticate_v2
if not within_time_range(token.last_accessed, datetime.datetime.now(), 10 * 60):
File "/opt/seafile/seafile-server-8.0.3/seahub/seahub/utils/init.py", line 1335, in within_time_range
delta = d2 - d1 if d2 > d1 else d1 - d2
TypeError: can't compare offset-naive and offset-aware datetimes
2021-03-01 07:32:24,435 [ERROR] django.request:228 log_response Internal Server Error: /seafile/api2/account/inf
o/
I fixed this issue with a patch as I posted in https://forum.seafile.com/t/seafile-client-doesnt-connect-to-server/11983/3
The text was updated successfully, but these errors were encountered: