Admin / Repos: WebApp Error: <type 'exceptions.TypeError'>: can't compare datetime.datetime to NoneType

Issue #731 resolved
Mihai Nica created an issue

I've udpdate from 1.5.1 to 1.5.2 (as discribed in the update document), and i'm getting this error:

URL: https://localhost/_admin/repos
Module weberror.errormiddleware:162 in __call__
>>  app_iter = self.application(environ, sr_checker)
Module beaker.middleware:155 in __call__
>>  return self.wrap_app(environ, session_start_response)
Module routes.middleware:131 in __call__
>>  response = self.app(environ, start_response)
Module pylons.wsgiapp:107 in __call__
>>  response = self.dispatch(controller, environ, start_response)
Module pylons.wsgiapp:312 in dispatch
>>  return controller(environ, start_response)
Module rhodecode.lib.base:300 in __call__
>>  return WSGIController.__call__(self, environ, start_response)
Module pylons.controllers.core:211 in __call__
>>  response = self._dispatch_call()
Module pylons.controllers.core:162 in _dispatch_call
>>  response = self._inspect_call(func)
Module pylons.controllers.core:105 in _inspect_call
>>  result = self._perform_call(func, args)
Module pylons.controllers.core:57 in _perform_call
>>  return func(**args)
Module rhodecode.controllers.admin.repos:2 in index
Module rhodecode.lib.auth:583 in __wrapper
>>  return func(*fargs, **fkwargs)
Module rhodecode.controllers.admin.repos:139 in index
>>  admin=True)
Module rhodecode.model.repo:197 in get_repos_as_dict
>>  "last_change": last_change(repo.last_db_change),
Module rhodecode.model.repo:157 in last_change
>>  return _render("last_change", last_change)
Module rhodecode.model.repo:144 in _render_datatable
>>  return tmpl.render(*args, **kwargs)
Module mako.template:412 in render
>>  return runtime._render(self, self.callable_, args, data)
Module mako.runtime:766 in _render
>>  **_kwargs_for_callable(callable_, data))
Module mako.runtime:802 in _render_context
>>  _exec_template(callable_, context, args=args, kwargs=kwargs)
Module mako.runtime:819 in _exec_template
>>  _render_error(template, context, e)
Module mako.runtime:828 in _render_error
>>  result = template.error_handler(context, error)
Module mako.runtime:817 in _exec_template
>>  callable_(context, *args, **kwargs)
Module data_table__dt_elements_html:394 in render_last_change
>>  __M_writer(escape(h.age(last_change)))
Module rhodecode.lib.helpers:365 in <lambda>
>>  age = lambda x: _age(x)
Module rhodecode.lib.utils2:367 in age
>>  if prevdate > now:
TypeError: can't compare datetime.datetime to NoneType
CGI Variables
CONNECTION_TYPE     'close'
CONTENT_TYPE    '; charset="utf-8"'
HTTP_ACCEPT     'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'
HTTP_ACCEPT_ENCODING    'gzip, deflate'
HTTP_ACCEPT_LANGUAGE    'en-gb,en;q=0.5'
HTTP_COOKIE     '__utma=179355810.1621617552.1336759439.1336825967.1357833390.3; __utmz=179355810.1357833390.3.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utmc=179355810; rhodecode=e1119d1602624a23af6ad802f4bf7fba'
HTTP_HOST   'localhost'
HTTP_PROXY_HOST     'localhost:5000'
HTTP_REFERER    'https://localhost/_admin/settings'
HTTP_USER_AGENT     'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:18.0) Gecko/20100101 Firefox/18.0'
HTTP_X_FORWARDED_FOR    '10.0.0.1'
HTTP_X_HOST     'localhost'
HTTP_X_REAL_IP  '10.0.0.1'
HTTP_X_URL_SCHEME   'https'
PATH_INFO   '/_admin/repos'
REMOTE_ADDR     '10.0.0.10'
REQUEST_METHOD  'GET'
SERVER_NAME     'localhost'
SERVER_PORT     '5000'
SERVER_PROTOCOL     'HTTP/1.0'
SERVER_SOFTWARE     'waitress'
WSGI Variables
application     <beaker.middleware.SessionMiddleware object at 0x39ed910>
beaker.get_session  <bound method SessionMiddleware._get_session of <beaker.middleware.SessionMiddleware object at 0x39ed910>>
beaker.session  {'_authentication_token': 'ff66c1c2a828363f51889c64as2a9c745b8cb0db', 'rhodecode_user': {'username': u'user', 'is_authenticated': True, 'user_id': 2L}, '_accessed_time': 1358781660.054055, '_creation_time': 1358511042.313532}
paste.registry  <paste.registry.Registry object at 0x7f70c071ab10>
paste.throw_errors  True
pylons.action_method    <bound method ReposController.index of <rhodecode.controllers.admin.repos.ReposController object at 0x7f70c071aa90>>
pylons.controller   <rhodecode.controllers.admin.repos.ReposController object at 0x7f70c071aa90>
pylons.environ_config   {'session': 'beaker.session', 'cache': 'beaker.cache'}
pylons.pylons   <pylons.util.PylonsContext object at 0x7f70c071acd0>
pylons.routes_dict  {'action': u'index', 'controller': u'admin/repos'}
routes.route    <routes.route.Route object at 0x3471b90>
routes.url  <routes.util.URLGenerator object at 0x7f70c071afd0>
webob._parsed_query_vars    (GET([]), '')
webob.adhoc_attrs   {'user': <AuthUser('id:2:user|True')>, 'language': 'en-us'}
wsgi process    'Multithreaded'
wsgi._org_proto     'https'
wsgi.file_wrapper   <class 'waitress.buffers.ReadOnlyFileBasedBuffer'>
wsgiorg.routing_args    (<routes.util.URLGenerator object at 0x7f70c071afd0>, {'action': u'index', 'controller': u'admin/repos'})

It's a problem with my database schema I guess, but I did run the update db command.

Comments (8)

  1. Marcin Kuzminski repo owner

    That should been filled in an by upgrade command, try to do

    paster update-repoinfo <yourini.ini>
    
  2. Mihai Nica reporter

    Found a workaround:

    UPDATE `repositories` SET `updated_on` = CURRENT_TIMESTAMP WHERE `updated_on` IS NULL;
    

    I had two NULL values in the updated_on column.

  3. maugustin

    Thank you. You saved my day.

    In Rhodecode 1.5.2 the problem was still not solved with "paster update-repoinfo" command, but the SQL-command to update "repositories" table helped.

    Thanks for the tip @redecs and this create software and perfect support @marcinkuzminski .

  4. Log in to comment