1

Topic: after upgrading user-edit reports "dict' object is not callable"

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 0.9.9
- Deployed with iRedMail Easy or the downloadable installer? installer
- Linux/BSD distribution name and version: debian v7
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): mysql
- Web server (Apache or Nginx): apache
- Manage mail accounts with iRedAdmin-Pro? yes
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====

log error-message not available, sorry, clicking on a user account in the web gui reports:
Fehler: TypeError("'dict' object is not callable",)

and I have no clue here.

2 (edited by hk@ 2019-11-01 11:50:25)

Re: after upgrading user-edit reports "dict' object is not callable"

well, it seems we are related to this one https://forum.iredmail.org/topic14143-m … start.html

compared the api_auth_tokens on the mlm-side to the iredadmin-pro mlmmjadmin_api_auth_token it is fine, though we end up with things like:
Fehler: ConnectionError(MaxRetryError("HTTPConnectionPool(host='127.0.0.1', port=7790): Max retries exceeded with url: /api/subscriber/user@domain.name/subscribed?query_all_lists=no&email_only=yes",),)

-> learning: this error happens if the mlmmjadmin-service is not available on port 7790 (aka service during restarting etc)

3

Re: after upgrading user-edit reports "dict' object is not callable"

and for the fun of it:
python mlmmjadmin.py
http://127.0.0.1:7790/
127.0.0.1:53548 - - [01/Nov/2019 01:10:17] "HTTP/1.1 GET /api/subscriber/user@domain.name/subscribed" - 200 OK
127.0.0.1:53864 - - [01/Nov/2019 01:10:32] "HTTP/1.1 GET /api/subscriber/user@domain.name/subscribed" - 200 OK


in other words mlmmjadmin is working fine, but iredadmin-pro reports back for any useraccount:

TypeError("'dict' object is not callable",)

4

Re: after upgrading user-edit reports "dict' object is not callable"

well, as we already know about the mlm connection here, now this for some creative debugging:

:/opt/mlmmjadmin/tools# python maillist_admin.py info mlm@domain.name
Traceback (most recent call last):
  File "maillist_admin.py", line 119, in <module>
    _json = r.json()
TypeError: 'dict' object is not callable

it seems we are at least consistent in terms of the error raised.

5

Re: after upgrading user-edit reports "dict' object is not callable"

so - if I ask mlmmjadmin for any nonexisting mailinglist like this:

python maillist_admin_test.py info mail@domain.name

the plain text response is like this:
<Response [200]>

either invoking r.json() or doing a full json.loads(r) results in either the object is not callable or in some extended version doing the json.loads:
    _json = json.loads(r)
  File "/usr/lib/python2.7/json/__init__.py", line 326, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python2.7/json/decoder.py", line 365, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
TypeError: expected string or buffer


now I guess I need help on how to fix this...

6

Re: after upgrading user-edit reports "dict' object is not callable"

this is "fun"

the (original) code does throw exceptions:
_json = r.json()

(although this seems totally fine frome a code point of view)

now - when I replace this line with this:
_json = json.loads(r.text)

all seems well...

now before I rewrite all code I'd be happy for any python or whatever ideas and pointers to see how this could be fixed on a more global level...

7

Re: after upgrading user-edit reports "dict' object is not callable"

so I tried the unthinkable:

_json = r.json

(yeah I know)

but hey, this also seems to load the _json data well and raises no dict objections.

as python is not my native language I'd be happy to learn which is now the correct way.

8

Re: after upgrading user-edit reports "dict' object is not callable"

hk@ wrote:

log error-message not available, sorry, clicking on a user account in the web gui reports:
Fehler: TypeError("'dict' object is not callable",)

Does this error happen to all mail user? or just few of them?

----

Does my reply help a little? How about buying me a cup of coffee ($5) as an encouragement?

buy me a cup of coffee

9

Re: after upgrading user-edit reports "dict' object is not callable"

ZhangHuangbin wrote:
hk@ wrote:

log error-message not available, sorry, clicking on a user account in the web gui reports:
Fehler: TypeError("'dict' object is not callable",)

Does this error happen to all mail user? or just few of them?

happens to all, as I changed the code from .json() to .json - now this is fixed for us.

10

Re: after upgrading user-edit reports "dict' object is not callable"

Could you please show me command output?

check /etc/iredmail-release
ls -l /opt
ls -l /usr/share/apache2/

----

Does my reply help a little? How about buying me a cup of coffee ($5) as an encouragement?

buy me a cup of coffee