On 10/25/22 17:08, cold00water@gmail.com wrote:
Hey.
Looking at other code, "subject" is a method.
I fixed it by correcting the code. is this a bug? python version issue?
- /opt/mailman/venv/lib/python3.10/site-packages/hyperkitty/views/thread.py
411 @check_mlist_private 412 def reattach_suggest(request, mlist_fqdn, threadid): 413 mlist = get_object_or_404(MailingList, name=mlist_fqdn) 414 thread = get_object_or_404(Thread, mailinglist=mlist, thread_id=threadid) 415 416 default_search_query = stripped_subject( # change: thread.subject to thread.subject() 417 mlist, thread.subject()).lower().replace("re:", "")
- /opt/mailman/venv/lib/python3.10/site-packages/hyperkitty/models/thread.py
69 def __str__(self): # change: thread.subject to thread.subject() 70 return self.subject()
Did you test this?, How? I.e. where you able to produce the error without your change and then verify that your change fixed it?
The existing code works in all but rare situations, and I think those are due to the thread object being instantiated with missing arguments.
In any case, your changes cause the ReattachTestCase.test_suggestions test in hyperkitty/tests/views/test_thread.py to fail as follows.
hyperkitty/tests/views/test_thread.py:66: in test_suggestions
response = self.client.get(reverse('hk_thread_reattach_suggest',
.tox/py39-django32/lib/python3.9/site-packages/django/test/client.py:742:
in get
response = super().get(path, data=data, secure=secure, **extra)
.tox/py39-django32/lib/python3.9/site-packages/django/test/client.py:396:
in get
return self.generic('GET', path, secure=secure, **{
.tox/py39-django32/lib/python3.9/site-packages/django/test/client.py:473:
in generic
return self.request(**r)
.tox/py39-django32/lib/python3.9/site-packages/django/test/client.py:719:
in request
self.check_exception(response)
.tox/py39-django32/lib/python3.9/site-packages/django/test/client.py:580:
in check_exception
raise exc_value
.tox/py39-django32/lib/python3.9/site-packages/django/core/handlers/exception.py:47:
in inner
response = get_response(request)
.tox/py39-django32/lib/python3.9/site-packages/django/core/handlers/base.py:181:
in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
hyperkitty/lib/view_helpers.py:137: in inner
return func(request, *args, **kwargs)
hyperkitty/views/thread.py:445: in reattach_suggest
mlist, thread.subject()).lower().replace("re:", "")
E TypeError: 'str' object is not callable
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan