Kallithea issues archive

Issue #335: WebApp Error: AttributeError: 'bool' object has no attribute 'configitems'

Reported by: Brandon Jones
State: resolved
Created on: 2019-03-18 13:59
Updated on: 2019-03-26 21:32

Description

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

Attachments

Comments

Comment by Brandon Jones, on 2019-03-18 14:21

More information - it appears that this occurs when pushing changes.

Comment by Brandon Jones, on 2019-03-18 14:38

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?

Comment by Brandon Jones, on 2019-03-18 14:49

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)

Comment by Brandon Jones, on 2019-03-18 14:50

Comment by Mads Kiilerich, on 2019-03-18 15:05

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

Comment by Thomas De Schampheleire, on 2019-03-18 19:28

This problem was introduced in commit 89c30b145bb8a4151c1154c42c4e9ec23ff442f8 and previously reported on the mailing list: https://lists.sfconservancy.org/pipermail/kallithea-general/2018q3/002691.html

but it seems we did not follow up correctly. Thanks for reporting it here.

@kiilerix: will you create and apply the fix?

Comment by Mads Kiilerich, on 2019-03-19 02:50

Comment by Thomas De Schampheleire, on 2019-03-19 19:26

Fixed by 927b7934b86706b9acdb16bd2a67b825f0ef3830

Thanks for reporting!

Comment by Thomas De Schampheleire, on 2019-03-26 21:32