You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description of the problem, including code/CLI snippet
gitlab event list fails in v4/cli.py#l.38 with AttributeError: 'NoneType' object has no attribute 'lower'.
Specifications
python-gitlab version: 1.8.0
API version you are using (v3/v4): na
Gitlab server version (or gitlab.com): na
Cause
The error is caused by the EventManager class in objects.py, because one of _list_filters is called "action". This name collides with the args attribute action, and one of them is probably overwritten. When renaming "action" in _list_filters to something else, gitlab event list continues further (and fails with another similar error).
File "c:\program files\python27\lib\site-packages\gitlab\v4\cli.py", line 364, in display
value = value.replace('\r', '').replace('\n', ' ')
AttributeError: 'NoneType' object has no attribute 'replace'
It is caused by that some events on my gilab server do not have "target_title" filled in. Actually, the do not have filled in any relevant attribute, for some reason.
Fix
Fix of the subsequent (NOT the original error):
--- cli.py.orig 2019-02-24 17:37:53.000000000 +0100
+++ cli.py 2019-02-27 19:17:56.045767100 +0100
@@ -357,7 +358,7 @@
id = getattr(obj, obj._id_attr)
print('%s: %s' % (obj._id_attr.replace('_', '-'), id))
if hasattr(obj, '_short_print_attr'):
- value = getattr(obj, obj._short_print_attr)
+ value = getattr(obj, obj._short_print_attr) or 'None'
value = value.replace('\r', '').replace('\n', ' ')
# If the attribute is a note (ProjectCommitComment) then we do
# some modifications to fit everything on one line
Activity
xarx00 commentedon Feb 27, 2019
The subsequent error mentioned above is
It is caused by that some events on my gilab server do not have "target_title" filled in. Actually, the do not have filled in any relevant attribute, for some reason.
Fix
Fix of the subsequent (NOT the original error):
xarx00 commentedon Feb 27, 2019
Fix
In order to fix the primary error of this issue, I had to rename the "action" attribute:
fix.diff.zip
[-]gitlab event list fails on None[/-][+]CLI event list fails on None[/+]gpocentek commentedon Mar 3, 2019
Hi @xarx00
Could you create a pull request with this change? Thanks.
Fix for python-gitlab#717: Rename of conflicting 'action' attribute; …
fix(cli): don't fail when the short print attr value is None