fix: fix 'protected-access' for pylint
This commit is contained in:
parent
ab35847f23
commit
e38f7ba293
6 changed files with 19 additions and 20 deletions
|
@ -11,7 +11,6 @@ disable=fixme,
|
||||||
missing-function-docstring,
|
missing-function-docstring,
|
||||||
missing-module-docstring,
|
missing-module-docstring,
|
||||||
no-member,
|
no-member,
|
||||||
protected-access,
|
|
||||||
redefined-outer-name,
|
redefined-outer-name,
|
||||||
simplifiable-if-expression,
|
simplifiable-if-expression,
|
||||||
singleton-comparison,
|
singleton-comparison,
|
||||||
|
|
|
@ -1087,8 +1087,8 @@ class Grid: # pylint: disable=too-many-instance-attributes,too-many-public-meth
|
||||||
# TODO: this should be improved; is needed in tailbone for
|
# TODO: this should be improved; is needed in tailbone for
|
||||||
# multi-column sorting with sqlalchemy queries
|
# multi-column sorting with sqlalchemy queries
|
||||||
if model_property:
|
if model_property:
|
||||||
sorter._class = model_class
|
sorter._class = model_class # pylint: disable=protected-access
|
||||||
sorter._column = model_property
|
sorter._column = model_property # pylint: disable=protected-access
|
||||||
|
|
||||||
return sorter
|
return sorter
|
||||||
|
|
||||||
|
|
|
@ -159,20 +159,20 @@ def new_request(event):
|
||||||
Register a Vue 3 component, so the base template knows to
|
Register a Vue 3 component, so the base template knows to
|
||||||
declare it for use within the app (page).
|
declare it for use within the app (page).
|
||||||
"""
|
"""
|
||||||
if not hasattr(request, "_wuttaweb_registered_components"):
|
if not hasattr(request, "wuttaweb_registered_components"):
|
||||||
request._wuttaweb_registered_components = OrderedDict()
|
request.wuttaweb_registered_components = OrderedDict()
|
||||||
|
|
||||||
if tagname in request._wuttaweb_registered_components:
|
if tagname in request.wuttaweb_registered_components:
|
||||||
log.warning(
|
log.warning(
|
||||||
"component with tagname '%s' already registered "
|
"component with tagname '%s' already registered "
|
||||||
"with class '%s' but we are replacing that "
|
"with class '%s' but we are replacing that "
|
||||||
"with class '%s'",
|
"with class '%s'",
|
||||||
tagname,
|
tagname,
|
||||||
request._wuttaweb_registered_components[tagname],
|
request.wuttaweb_registered_components[tagname],
|
||||||
classname,
|
classname,
|
||||||
)
|
)
|
||||||
|
|
||||||
request._wuttaweb_registered_components[tagname] = classname
|
request.wuttaweb_registered_components[tagname] = classname
|
||||||
|
|
||||||
request.register_component = register_component
|
request.register_component = register_component
|
||||||
|
|
||||||
|
|
|
@ -58,8 +58,8 @@
|
||||||
const app = createApp()
|
const app = createApp()
|
||||||
app.component('vue-fontawesome', FontAwesomeIcon)
|
app.component('vue-fontawesome', FontAwesomeIcon)
|
||||||
|
|
||||||
% if hasattr(request, '_wuttaweb_registered_components'):
|
% if hasattr(request, 'wuttaweb_registered_components'):
|
||||||
% for tagname, classname in request._wuttaweb_registered_components.items():
|
% for tagname, classname in request.wuttaweb_registered_components.items():
|
||||||
app.component('${tagname}', ${classname})
|
app.component('${tagname}', ${classname})
|
||||||
% endfor
|
% endfor
|
||||||
% endif
|
% endif
|
||||||
|
|
|
@ -757,14 +757,14 @@ def set_app_theme(request, theme, session=None):
|
||||||
|
|
||||||
# there's only one global template lookup; can get to it via any renderer
|
# there's only one global template lookup; can get to it via any renderer
|
||||||
# but should *not* use /base.mako since that one is about to get volatile
|
# but should *not* use /base.mako since that one is about to get volatile
|
||||||
renderer = get_renderer("/menu.mako")
|
renderer = get_renderer("/page.mako")
|
||||||
lookup = renderer.lookup
|
lookup = renderer.lookup
|
||||||
|
|
||||||
# overwrite first entry in lookup's directory list
|
# overwrite first entry in lookup's directory list
|
||||||
lookup.directories[0] = theme_path
|
lookup.directories[0] = theme_path
|
||||||
|
|
||||||
# clear template cache for lookup object, so it will reload each (as needed)
|
# clear template cache for lookup object, so it will reload each (as needed)
|
||||||
lookup._collection.clear()
|
lookup._collection.clear() # pylint: disable=protected-access
|
||||||
|
|
||||||
# persist current theme in db settings
|
# persist current theme in db settings
|
||||||
with app.short_session(session=session) as s:
|
with app.short_session(session=session) as s:
|
||||||
|
|
|
@ -76,23 +76,23 @@ class TestNewRequest(TestCase):
|
||||||
subscribers.new_request(event)
|
subscribers.new_request(event)
|
||||||
|
|
||||||
# component tracking dict is missing at first
|
# component tracking dict is missing at first
|
||||||
self.assertFalse(hasattr(self.request, "_wuttaweb_registered_components"))
|
self.assertFalse(hasattr(self.request, "wuttaweb_registered_components"))
|
||||||
|
|
||||||
# registering a component
|
# registering a component
|
||||||
self.request.register_component("foo-example", "FooExample")
|
self.request.register_component("foo-example", "FooExample")
|
||||||
self.assertTrue(hasattr(self.request, "_wuttaweb_registered_components"))
|
self.assertTrue(hasattr(self.request, "wuttaweb_registered_components"))
|
||||||
self.assertEqual(len(self.request._wuttaweb_registered_components), 1)
|
self.assertEqual(len(self.request.wuttaweb_registered_components), 1)
|
||||||
self.assertIn("foo-example", self.request._wuttaweb_registered_components)
|
self.assertIn("foo-example", self.request.wuttaweb_registered_components)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
self.request._wuttaweb_registered_components["foo-example"], "FooExample"
|
self.request.wuttaweb_registered_components["foo-example"], "FooExample"
|
||||||
)
|
)
|
||||||
|
|
||||||
# re-registering same name
|
# re-registering same name
|
||||||
self.request.register_component("foo-example", "FooExample")
|
self.request.register_component("foo-example", "FooExample")
|
||||||
self.assertEqual(len(self.request._wuttaweb_registered_components), 1)
|
self.assertEqual(len(self.request.wuttaweb_registered_components), 1)
|
||||||
self.assertIn("foo-example", self.request._wuttaweb_registered_components)
|
self.assertIn("foo-example", self.request.wuttaweb_registered_components)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
self.request._wuttaweb_registered_components["foo-example"], "FooExample"
|
self.request.wuttaweb_registered_components["foo-example"], "FooExample"
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_get_referrer(self):
|
def test_get_referrer(self):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue