view MANIFEST.in @ 8163:24e1099e4f29

py3: make get_current_authuser handle missing tg context consistently and explicitly tg context handling ends up using tg.support.registry.StackedObjectProxy._current_obj for attribute access ... which if no context has been pushed will end up in: raise TypeError( 'No object (name: %s) has been registered for this ' 'thread' % self.____name__) utils2.get_current_authuser used code like: if hasattr(tg.tmpl_context, 'authuser'): Python 2 hasattr will call __getattr__ and return False if it throws any exception. (It would thus catch the TypeError and silently fall through to use the default user None.) This hasattr behavior is confusing and hard to use correctly. Here, it was used incorrectly. It has been common practice to work around by using something like: getattr(x, y, None) is not None Python 3 hasattr fixed this flaw and only catches AttributeError. The TypeError would thus (rightfully) be propagated. That is a change that must be handled when introducing py3 support. The get_current_authuser code could more clearly and simple and py3-compatible be written as: return getattr(tmpl_context, 'authuser', None) - but then we also have to handle the TypeError explicitly ... which we are happy to do.
author Mads Kiilerich <mads@kiilerich.com>
date Fri, 31 Jan 2020 18:48:15 +0100
parents ddfecf9fe7f2
children 97c5e6ac5c75
line wrap: on
line source

include           .coveragerc
include           Apache-License-2.0.txt
include           CONTRIBUTORS
include           COPYING
include           Jenkinsfile
include           LICENSE-MERGELY.html
include           LICENSE.md
include           MIT-Permissive-License.txt
include           README.rst
include           conftest.py
include           dev_requirements.txt
include           development.ini
include           pytest.ini
include           requirements.txt
include           tox.ini
recursive-include docs *
recursive-include init.d *
recursive-include kallithea/alembic *
include           kallithea/bin/ldap_sync.conf
include           kallithea/lib/paster_commands/template.ini.mako
recursive-include kallithea/front-end *
recursive-include kallithea/i18n *
recursive-include kallithea/public *
recursive-include kallithea/templates *
recursive-include kallithea/tests/fixtures *
recursive-include kallithea/tests/scripts *
include           kallithea/tests/models/test_dump_html_mails.ref.html
include           kallithea/tests/performance/test_vcs.py
include           kallithea/tests/vcs/aconfig
recursive-include scripts *