Cannot use postgres due to bug "can't compare offset-naive and offset-aware datetimes" at webutils.py", line 577

Jamie Love jlove at nsquared.nz
Tue Aug 19 00:15:19 UTC 2025


Hi there,

Before going into the code and fixing this myself, I was wondering if anyone had come across the following error before. This is with the latest version of the code from the repository.

This occurs with Postgres, but not with SQLite (we have had to roll back from postgres to SQLite because of this error):

*  **File "/home/kallithea/kallithea/kallithea/lib/webutils.py", line 577, in age*
*    if prevdate > now:*
*TypeError: can't compare offset-naive and offset-aware datetimes*
*Traceback (most recent call last):*
  File "/home/kallithea/kallithea/venv/lib/python3.9/site-packages/tg/appwrappers/session.py", line 71, in __call__
    response = self.next_handler(controller, environ, context)
  File "/home/kallithea/kallithea/venv/lib/python3.9/site-packages/tg/appwrappers/i18n.py", line 71, in __call__
    return self.next_handler(controller, environ, context)
  File "/home/kallithea/kallithea/venv/lib/python3.9/site-packages/tg/wsgiapp.py", line 243, in _dispatch
    return controller(environ, context)
  File "/home/kallithea/kallithea/kallithea/controllers/base.py", line 531, in __call__
    return super(BaseController, self).__call__(environ, context)
  File "/home/kallithea/kallithea/venv/lib/python3.9/site-packages/tg/controllers/dispatcher.py", line 118, in __call__
    response = self._perform_call(context)
  File "/home/kallithea/kallithea/venv/lib/python3.9/site-packages/tg/controllers/dispatcher.py", line 107, in _perform_call
    r = self._call(action, params, remainder=remainder, context=context)
  File "/home/kallithea/kallithea/venv/lib/python3.9/site-packages/tg/controllers/decoratedcontroller.py", line 129, in _call
    output = controller_caller(context_config, bound_controller_callable, remainder, params)
  File "/home/kallithea/kallithea/venv/lib/python3.9/site-packages/tg/controllers/decoration.py", line 21, in _decorated_controller_caller
    return application_controller_caller(tg_config, controller, remainder, params)
  File "/home/kallithea/kallithea/venv/lib/python3.9/site-packages/tg/configurator/components/dispatch.py", line 114, in _call_controller
    return controller(*remainder, **params)
  File "/home/kallithea/kallithea/kallithea/controllers/admin/repo_groups.py", line 278, in show_by_name
    return self.show(group_name)
  File "/home/kallithea/kallithea/venv/lib/python3.9/site-packages/decorator.py", line 232, in fun
    return caller(func, *(extras + args), **kw)
  File "/home/kallithea/kallithea/kallithea/lib/auth.py", line 575, in __wrapper
    return func(*fargs, **fkwargs)
  File "/home/kallithea/kallithea/kallithea/controllers/admin/repo_groups.py", line 291, in show
    c.data = RepoModel().get_repos_as_dict(repos_list,
  File "/home/kallithea/kallithea/kallithea/model/repo.py", line 178, in get_repos_as_dict
    "last_change": last_change(repo.last_db_change),
  File "/home/kallithea/kallithea/kallithea/model/repo.py", line 130, in last_change
    return _render("last_change", last_change)
  File "/home/kallithea/kallithea/kallithea/model/repo.py", line 102, in _render_datatable
    return tmpl.render_unicode(
  File "/home/kallithea/kallithea/venv/lib/python3.9/site-packages/mako/template.py", line 439, in render_unicode
    return runtime._render(
  File "/home/kallithea/kallithea/venv/lib/python3.9/site-packages/mako/runtime.py", line 874, in _render
    _render_context(
  File "/home/kallithea/kallithea/venv/lib/python3.9/site-packages/mako/runtime.py", line 920, in _render_context
    _exec_template(callable_, context, args=args, kwargs=kwargs)
  File "/home/kallithea/kallithea/venv/lib/python3.9/site-packages/mako/runtime.py", line 943, in _exec_template
    callable_(context, *args, **kwargs)
  File "data_table__dt_elements_html", line 133, in render_last_change


Thanks
Jamie
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sfconservancy.org/pipermail/kallithea-general/attachments/20250819/3cf85a57/attachment.html>


More information about the kallithea-general mailing list