Commit d656f635 authored by Arnaud Fontaine's avatar Arnaud Fontaine

pylint: Handle primitive types for no-name-in-module.

This fixes errors such as:
E: No name '_dtmldir' in module 'Products.ERP5Type' (no-name-in-module)

Where _dtmldir is 'PATH/TO/Products/ERP5Type/dtml/', dynamically added to
Products.ERP5Type module.
parent b29d164c
...@@ -210,11 +210,29 @@ def _getattr(self, name, *args, **kw): ...@@ -210,11 +210,29 @@ def _getattr(self, name, *args, **kw):
except AttributeError: except AttributeError:
raise e raise e
# XXX: What about int, str or bool not having __module__? # REQUEST object (or any object non acquisition-wrapped)
if (isinstance(attr, str) and
attr == '<Special Object Used to Force Acquisition>'):
raise e
try: try:
origin_module_name = attr.__module__ origin_module_name = attr.__module__
except AttributeError: except AttributeError:
from astroid import nodes
if isinstance(attr, dict):
ast = nodes.Dict(attr)
elif isinstance(attr, list):
ast = nodes.List(attr)
elif isinstance(attr, tuple):
ast = nodes.Tuple(attr)
elif isinstance(attr, set):
ast = nodes.Set(attr)
else:
try:
ast = nodes.Const(attr)
except Exception:
raise e raise e
else:
if self.name == origin_module_name: if self.name == origin_module_name:
raise raise
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment