[GH-ISSUE #3154] AttributeError 'NoneType' object has no attribute 'parameters' #1781

Closed
opened 2026-02-27 11:19:05 +03:00 by kerem · 9 comments
Owner

Originally created by @sleepingforest1024 on GitHub (Jan 2, 2024).
Original GitHub issue: https://github.com/modoboa/modoboa/issues/3154

Impacted versions

  • OS Type: Debian/Ubuntu
  • OS Version: 22.04.1
  • Database Type: PostgreSQL
  • Database version: 14.10
  • Modoboa: 2.2.3
  • installer used: Yes
  • Webserver: Nginx

Steps to reproduce

Clean installed 2 times on Ubuntu Server with the commands below

git clone https://github.com/modoboa/modoboa-installer
cd modoboa-installer
sudo python3 run.py myweb.com

and 1 time clean install with the instructions as shown in the LinuxBabe tutorial

Current behavior

After logging in, it shows...

AttributeError at /accounts/login/
'NoneType' object has no attribute 'parameters'
Request Method:	POST
Request URL:	https://mail.myweb.com/accounts/login/
Django Version:	4.2.8
Exception Type:	AttributeError
Exception Value:	
'NoneType' object has no attribute 'parameters'
Exception Location:	/srv/modoboa/env/lib/python3.10/site-packages/modoboa/parameters/tools.py, line 258, in get_global_parameter
Raised during:	modoboa.core.views.auth.dologin
Python Executable:	/usr/bin/uwsgi-core
Python Version:	3.10.12
Python Path:	
['.',
 '',
 '/usr/lib/python310.zip',
 '/usr/lib/python3.10',
 '/usr/lib/python3.10/lib-dynload',
 '/srv/modoboa/env/lib/python3.10/site-packages']
Server time:	Tue, 02 Jan 2024 07:09:03 +0100

If we click on "Forgot Password", then it will display this error:

AttributeError at /accounts/password_reset/
'NoneType' object has no attribute 'parameters'
Request Method:	GET
Request URL:	https://mail.myweb.com/accounts/password_reset/
Django Version:	4.2.8
Exception Type:	AttributeError
Exception Value:	
'NoneType' object has no attribute 'parameters'
Exception Location:	/srv/modoboa/env/lib/python3.10/site-packages/modoboa/core/views/auth.py, line 150, in setup
Raised during:	modoboa.core.views.auth.PasswordResetView
Python Executable:	/usr/bin/uwsgi-core
Python Version:	3.10.12
Python Path:	
['.',
 '',
 '/usr/lib/python310.zip',
 '/usr/lib/python3.10',
 '/usr/lib/python3.10/lib-dynload',
 '/srv/modoboa/env/lib/python3.10/site-packages']
Server time:	Tue, 02 Jan 2024 07:11:12 +0100

We've tried to alter the settings below without success

sudo nano /srv/modoboa/instance/instance/settings.py
USE_TZ = False
sudo systemctl restart uwsgi

Expected behavior

Work like a charm!

Video/Screenshot link (optional)

Originally created by @sleepingforest1024 on GitHub (Jan 2, 2024). Original GitHub issue: https://github.com/modoboa/modoboa/issues/3154 # Impacted versions * OS Type: Debian/Ubuntu * OS Version: 22.04.1 * Database Type: PostgreSQL * Database version: 14.10 * Modoboa: 2.2.3 * installer used: Yes * Webserver: Nginx # Steps to reproduce Clean installed 2 times on Ubuntu Server with the commands below ``` git clone https://github.com/modoboa/modoboa-installer cd modoboa-installer sudo python3 run.py myweb.com ``` and 1 time clean install with the instructions as shown in the [LinuxBabe tutorial](https://www.linuxbabe.com/mail-server/modoboa-email-server-ubuntu-20-04) # Current behavior After logging in, it shows... ``` AttributeError at /accounts/login/ 'NoneType' object has no attribute 'parameters' Request Method: POST Request URL: https://mail.myweb.com/accounts/login/ Django Version: 4.2.8 Exception Type: AttributeError Exception Value: 'NoneType' object has no attribute 'parameters' Exception Location: /srv/modoboa/env/lib/python3.10/site-packages/modoboa/parameters/tools.py, line 258, in get_global_parameter Raised during: modoboa.core.views.auth.dologin Python Executable: /usr/bin/uwsgi-core Python Version: 3.10.12 Python Path: ['.', '', '/usr/lib/python310.zip', '/usr/lib/python3.10', '/usr/lib/python3.10/lib-dynload', '/srv/modoboa/env/lib/python3.10/site-packages'] Server time: Tue, 02 Jan 2024 07:09:03 +0100 ``` If we click on "Forgot Password", then it will display this error: ``` AttributeError at /accounts/password_reset/ 'NoneType' object has no attribute 'parameters' Request Method: GET Request URL: https://mail.myweb.com/accounts/password_reset/ Django Version: 4.2.8 Exception Type: AttributeError Exception Value: 'NoneType' object has no attribute 'parameters' Exception Location: /srv/modoboa/env/lib/python3.10/site-packages/modoboa/core/views/auth.py, line 150, in setup Raised during: modoboa.core.views.auth.PasswordResetView Python Executable: /usr/bin/uwsgi-core Python Version: 3.10.12 Python Path: ['.', '', '/usr/lib/python310.zip', '/usr/lib/python3.10', '/usr/lib/python3.10/lib-dynload', '/srv/modoboa/env/lib/python3.10/site-packages'] Server time: Tue, 02 Jan 2024 07:11:12 +0100 ``` We've tried to alter the settings below without success ``` sudo nano /srv/modoboa/instance/instance/settings.py USE_TZ = False sudo systemctl restart uwsgi ``` # Expected behavior Work like a charm! # Video/Screenshot link (optional)
kerem 2026-02-27 11:19:05 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@HansHM commented on GitHub (Jan 4, 2024):

Here to.
Installed in various containers, Debian Ubuntu and also VM's.
All the time, the same error is reported.

Version 2.1.0 also

<!-- gh-comment-id:1877333831 --> @HansHM commented on GitHub (Jan 4, 2024): Here to. Installed in various containers, Debian Ubuntu and also VM's. All the time, the same error is reported. Version 2.1.0 also
Author
Owner

@HansHM commented on GitHub (Jan 7, 2024):

I did some digging.

tools.py line 258 in def get_global_parameter is calling guess_extension_name() in sysutils.py. This is because the app parameter is empty when calling get_global_parameter.

The problem is when def guess_extension_name() can't find a anything, he also returns None.

So from def guess_extension_name()

modname = inspect.getmodule(inspect.stack()[2][0]).__name__
match = re.match(r"(?:modoboa\.)?(?:extensions\.)?([^\.$]+)", modname)

if match is not None:
    return match.group(1)
return None

I am not a python programmer, so ik don't know how to debug if modname is set or anything.

<!-- gh-comment-id:1879998350 --> @HansHM commented on GitHub (Jan 7, 2024): I did some digging. tools.py line 258 in def get_global_parameter is calling guess_extension_name() in sysutils.py. This is because the app parameter is empty when calling get_global_parameter. The problem is when def guess_extension_name() can't find a anything, he also returns None. So from def guess_extension_name() modname = inspect.getmodule(inspect.stack()[2][0]).__name__ match = re.match(r"(?:modoboa\.)?(?:extensions\.)?([^\.$]+)", modname) if match is not None: return match.group(1) return None I am not a python programmer, so ik don't know how to debug if modname is set or anything.
Author
Owner

@Spitfireap commented on GitHub (Jan 7, 2024):

Okay, thank you for the investigation. Could you post the list of the installed extensions in your venv ? /srv/modoboa/env/bin/pip list

<!-- gh-comment-id:1880013468 --> @Spitfireap commented on GitHub (Jan 7, 2024): Okay, thank you for the investigation. Could you post the list of the installed extensions in your venv ? `/srv/modoboa/env/bin/pip list`
Author
Owner

@HansHM commented on GitHub (Jan 7, 2024):

Hello Spitfireap,

aiosmtplib 3.0.1
asgiref 3.7.2
async-timeout 4.0.3
attrs 23.2.0
bcrypt 4.1.2
caldav 1.3.6
certifi 2023.11.17
cffi 1.16.0
chardet 5.2.0
charset-normalizer 3.3.2
click 8.1.7
cryptography 41.0.7
defusedxml 0.7.1
dj-database-url 2.1.0
Django 4.2.9
django-ckeditor 6.7.0
django-filter 23.2
django-js-asset 2.2.0
django-otp 1.3.0
django-phonenumber-field 7.2.0
django-rename-app 0.1.5
django-reversion 5.0.9
django-rq 2.10.1
django-webpack-loader 2.0.1
django-xforwardedfor-middleware 2.0
djangorestframework 3.14.0
djangorestframework-simplejwt 5.3.1
dnspython 2.4.2
drf-nested-routers 0.93.5
drf-spectacular 0.27.0
feedparser 6.0.11
filelock 3.13.1
gevent 23.9.1
greenlet 3.0.3
html2text 2020.1.16
icalendar 5.0.11
idna 3.6
inflection 0.5.1
jsonschema 4.20.0
jsonschema-specifications 2023.12.1
lxml 5.0.0
modoboa 2.2.3
modoboa-amavis 1.5.1
modoboa-contacts 1.0.0
modoboa-postfix-autoreply 1.8.0
modoboa-radicale 1.7.0
modoboa-sievefilters 1.7.0
modoboa-webmail 1.9.0
oath 1.4.4
ovh 1.1.0
passlib 1.7.4
phonenumbers 8.13.27
pillow 10.2.0
pip 23.3.2
pkg_resources 0.0.0
progressbar33 2.4
psycopg 3.1.16
psycopg-binary 3.1.16
pycparser 2.21
PyJWT 2.8.0
pypng 0.20220715.0
python-dateutil 2.8.2
python-magic 0.4.27
pytz 2023.3.post1
PyYAML 6.0.1
qrcode 7.4.2
recurring-ical-events 2.1.2
redis 5.1.0b1
referencing 0.32.0
reportlab 4.0.8
requests 2.31.0
requests-file 1.5.1
rpds-py 0.16.2
rq 1.15.1
rrdtool 0.1.16
setuptools 57.5.0
sgmllib3k 1.0.0
sievelib 1.2.1
six 1.16.0
sqlparse 0.4.4
tldextract 5.1.1
typing_extensions 4.9.0
tzlocal 5.2
uritemplate 4.1.1
urllib3 2.1.0
vobject 0.9.6.1
x-wr-timezone 0.0.6
zope.event 5.0
zope.interface 6.1

<!-- gh-comment-id:1880015596 --> @HansHM commented on GitHub (Jan 7, 2024): Hello Spitfireap, aiosmtplib 3.0.1 asgiref 3.7.2 async-timeout 4.0.3 attrs 23.2.0 bcrypt 4.1.2 caldav 1.3.6 certifi 2023.11.17 cffi 1.16.0 chardet 5.2.0 charset-normalizer 3.3.2 click 8.1.7 cryptography 41.0.7 defusedxml 0.7.1 dj-database-url 2.1.0 Django 4.2.9 django-ckeditor 6.7.0 django-filter 23.2 django-js-asset 2.2.0 django-otp 1.3.0 django-phonenumber-field 7.2.0 django-rename-app 0.1.5 django-reversion 5.0.9 django-rq 2.10.1 django-webpack-loader 2.0.1 django-xforwardedfor-middleware 2.0 djangorestframework 3.14.0 djangorestframework-simplejwt 5.3.1 dnspython 2.4.2 drf-nested-routers 0.93.5 drf-spectacular 0.27.0 feedparser 6.0.11 filelock 3.13.1 gevent 23.9.1 greenlet 3.0.3 html2text 2020.1.16 icalendar 5.0.11 idna 3.6 inflection 0.5.1 jsonschema 4.20.0 jsonschema-specifications 2023.12.1 lxml 5.0.0 modoboa 2.2.3 modoboa-amavis 1.5.1 modoboa-contacts 1.0.0 modoboa-postfix-autoreply 1.8.0 modoboa-radicale 1.7.0 modoboa-sievefilters 1.7.0 modoboa-webmail 1.9.0 oath 1.4.4 ovh 1.1.0 passlib 1.7.4 phonenumbers 8.13.27 pillow 10.2.0 pip 23.3.2 pkg_resources 0.0.0 progressbar33 2.4 psycopg 3.1.16 psycopg-binary 3.1.16 pycparser 2.21 PyJWT 2.8.0 pypng 0.20220715.0 python-dateutil 2.8.2 python-magic 0.4.27 pytz 2023.3.post1 PyYAML 6.0.1 qrcode 7.4.2 recurring-ical-events 2.1.2 redis 5.1.0b1 referencing 0.32.0 reportlab 4.0.8 requests 2.31.0 requests-file 1.5.1 rpds-py 0.16.2 rq 1.15.1 rrdtool 0.1.16 setuptools 57.5.0 sgmllib3k 1.0.0 sievelib 1.2.1 six 1.16.0 sqlparse 0.4.4 tldextract 5.1.1 typing_extensions 4.9.0 tzlocal 5.2 uritemplate 4.1.1 urllib3 2.1.0 vobject 0.9.6.1 x-wr-timezone 0.0.6 zope.event 5.0 zope.interface 6.1
Author
Owner

@Spitfireap commented on GitHub (Jan 7, 2024):

Thanks ! Could switch DEBUG to True in /srv/modoboa/instance/instance/settings.py then systemctl restart uwsgi and reload the page ? If you see an error, could you please post the whole trace back ?

<!-- gh-comment-id:1880024664 --> @Spitfireap commented on GitHub (Jan 7, 2024): Thanks ! Could switch DEBUG to True in /srv/modoboa/instance/instance/settings.py then `systemctl restart uwsgi` and reload the page ? If you see an error, could you please post the whole trace back ?
Author
Owner

@HansHM commented on GitHub (Jan 7, 2024):

Hello Spitfireap,

here it is
AttributeError at accounts_login.pdf

<!-- gh-comment-id:1880059978 --> @HansHM commented on GitHub (Jan 7, 2024): Hello Spitfireap, here it is [AttributeError at _accounts_login_.pdf](https://github.com/modoboa/modoboa/files/13853575/AttributeError.at._accounts_login_.pdf)
Author
Owner

@Spitfireap commented on GitHub (Jan 7, 2024):

Thank you ! I'm not sure where the issue comes from. Could you post the output of this command ?

sudo -u postgres -i psql -d modoboa -c "COPY (SELECT * FROM core_localconfig) TO '/tmp/localconfig.csv' WITH CSV DELIMITER ';' HEADER;" && cat /tmp/localconfig.csv

<!-- gh-comment-id:1880062830 --> @Spitfireap commented on GitHub (Jan 7, 2024): Thank you ! I'm not sure where the issue comes from. Could you post the output of this command ? ```sudo -u postgres -i psql -d modoboa -c "COPY (SELECT * FROM core_localconfig) TO '/tmp/localconfig.csv' WITH CSV DELIMITER ';' HEADER;" && cat /tmp/localconfig.csv```
Author
Owner

@HansHM commented on GitHub (Jan 7, 2024):

root@mail:~# sudo -u postgres -i psql -d modoboa -c "COPY (SELECT * FROM core_localconfig) TO '/tmp/localconfig.csv' WITH CSV DELIMITER ';' HEADER;" && cat /tmp/localconfig.csv
COPY 0
id;api_pk;api_versions;site_id;_parameters;need_dovecot_update

<!-- gh-comment-id:1880069922 --> @HansHM commented on GitHub (Jan 7, 2024): root@mail:~# sudo -u postgres -i psql -d modoboa -c "COPY (SELECT * FROM core_localconfig) TO '/tmp/localconfig.csv' WITH CSV DELIMITER ';' HEADER;" && cat /tmp/localconfig.csv COPY 0 id;api_pk;api_versions;site_id;_parameters;need_dovecot_update
Author
Owner

@HansHM commented on GitHub (Jan 8, 2024):

Hello Spitfireap,

I installed al versions on a new Linux install. Always dovecot was already installed and modoboa asked every time if the folder vmail existed, and it was.

I did run a update and upgrade of the system. Now the output that you asked gave a need_dovecot_update. So i removed dovecot and reinstall modoboa.

Now i can login and don't see any error.

<!-- gh-comment-id:1880531307 --> @HansHM commented on GitHub (Jan 8, 2024): Hello Spitfireap, I installed al versions on a new Linux install. Always dovecot was already installed and modoboa asked every time if the folder vmail existed, and it was. I did run a update and upgrade of the system. Now the output that you asked gave a need_dovecot_update. So i removed dovecot and reinstall modoboa. Now i can login and don't see any error.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/modoboa-modoboa#1781
No description provided.