WebApp Error: AttributeError: 'bool' object has no attribute 'configitems'

Issue #335 resolved
Brandon Jones
created an issue

I recently upgraded from Kallithea 0.3.2 to Kallithea 0.4.0rc1 and, every so often, I am getting an error email with the following traceback and error info (I've removed some environment info for security purposes).

TRACEBACK:
Traceback (most recent call last):
  File "c:\kallithea\env\lib\site-packages\kallithea\lib\base.py", line 363, in __call__
    return self._handle_request(environ, start_response)
  File "c:\kallithea\env\lib\site-packages\kallithea\lib\middleware\simplegit.py", line 68, in _handle_request
    return self.application(environ, start_response)
  File "c:\kallithea\env\lib\site-packages\kallithea\lib\base.py", line 363, in __call__
    return self._handle_request(environ, start_response)
  File "c:\kallithea\env\lib\site-packages\kallithea\lib\middleware\simplehg.py", line 162, in _handle_request
    self._augment_hgrc(repo_path, baseui)
  File "c:\kallithea\env\lib\site-packages\kallithea\lib\middleware\simplehg.py", line 285, in _augment_hgrc
    for k, v in repoui.configitems(section):
AttributeError: 'bool' object has no attribute 'configitems'

ENVIRON:
        AUTH_TYPE: 'basic'
        HTTP_ACCEPT: 'application/mercurial-0.1'
        HTTP_ACCEPT_ENCODING: 'identity'
        HTTP_CONNECTION: 'close'
        HTTP_PROXY_HOST: '127.0.0.1:5005'
        HTTP_USER_AGENT: 'mercurial/proto-1.0 (Mercurial 4.0)'
        HTTP_X_URL_SCHEME: 'https'
        PATH_INFO: '/Halla-Mechatronics-MANDO/Automated-TRC-Dyno-Software/Automated-TRC-Source'
        QUERY_STRING: 'cmd=capabilities'
        REMOTE_ADDR: '127.0.0.1'
        REQUEST_METHOD: 'GET'
        SCRIPT_NAME: ''
        SERVER_PORT: '5005'
        SERVER_PROTOCOL: 'HTTP/1.0'
        SERVER_SOFTWARE: 'waitress'


WSGI:
        paste.registry: <tg.support.registry.Registry object at 0x0000000006210668>
        pylons.status_code_redirect: True
        wsgi.errors: <gearbox.commands.serve.LazyWriter object at 0x0000000001BB0DA0>
        wsgi.file_wrapper: <class 'waitress.buffers.ReadOnlyFileBasedBuffer'>
        wsgi.input: <_io.BytesIO object at 0x000000000670F620>
        wsgi.multiprocess: False
        wsgi.multithread: True
        wsgi.run_once: False
        wsgi.url_scheme: 'http'
        wsgi.version: (1, 0)


REQUEST:
        None

Comments (9)

  1. Brandon Jones reporter

    It appears that this error is occurring because an hgrc file is not found in a majority of the repositories. Therefore, it is returning False, which explains the AttributeError.

    I am on a Windows environment. I believe when creating a repo, by default, a hgrc file is not added. What should the functionality be if this file is not found?

  2. Brandon Jones reporter

    I applied a "hotfix" just to keep my company going with HG operations for now. I am just doing a check on repoui before trying to access its config items, as most of our repos don't have an hgrc file.

        def _augment_hgrc(self, repo_path, baseui):
            """Augment baseui with config settings from the repo_path repo"""
            hgrc = os.path.join(repo_path, '.hg', 'hgrc')
            repoui = make_ui('file', hgrc)
            if repoui != False:
                for section in ui_sections:
                    for k, v in repoui.configitems(section):
                        baseui.setconfig(section, k, v)
    
  3. Mads Kiilerich

    Yeah. I noticed some odd things in this area. I'm pretty sure it is
    fixed by refactorings that I plan to land after 0.4 ... but it seems
    like an actual problem, so we will have to fix it now ...

    I think I would suggest a simpler temporary workaround of:

    if not repoui:
                return

    /Mads

  4. Log in to comment