PyCharm IDE does not recognize global objects (request, auth, etc)

13 views
Skip to first unread message

Carlos Correia

unread,
Mar 5, 2026, 7:45:02 AM (2 days ago) Mar 5
to web2py-users
Hi,


After upgrading to pycharm 2025.3 pycharm stopped recognizing global objects
(request, auth, etc), marking them as errors.

in attachment goes a screenshot illustrating the issue.

Any idea on how to solve this problem?


Thanks,


Carlos
pycharm-errors.png

Nico de Groot

unread,
Mar 6, 2026, 4:40:57 AM (20 hours ago) Mar 6
to web2py-users
I use explicit imports combined with the use of the 'current'  object.

in the model files:

from gluon import (
current, DAL, redirect,
URL,
Field,
LABEL,
DIV,
SPAN,
HTTP,
P,
CAT,
H3,
XML,
IS_EMAIL,
IS_DATE,
IS_DATETIME,
IS_LENGTH,
IS_IN_DB,
# IS_NOT_IN_DB,
IS_NOT_EMPTY,
IS_EMPTY_OR,
IS_LOWER,
IS_EXPR,
IS_UPPER,
IS_IN_SET,
IS_INT_IN_RANGE,
IS_FLOAT_IN_RANGE,
)
from gluon.sqlhtml import SQLFORM
from gluon.storage import Storage

request = current.request
response = current.response
session = current.session
cache = current.cache
settings = current.app.settings
T = current.T
...
# after creating the db using db = DAL()
current.app.db = db
# same for the Auth() instance (and a settings object)
current.app.auth = auth


In a controller:

from gluon import (
current,
SQLFORM,
Field,
IS_IN_SET,
IS_NOT_EMPTY,
IS_INT_IN_RANGE,
IS_UPLOAD_FILENAME,
redirect,
URL,
TEXTAREA,
A,
UL,
LI,
P,
B,
SPAN,
PRE,
DIV,
INPUT,
FORM,
TABLE,
TH,
TR,
TD,
)

# from gluon.sqlhtml import SQLTABLE
from gluon.storage import Storage

db = current.app.db
request = current.request
response = current.response
session = current.session
cache = current.cache
page = current.page
scheduler = current.app.scheduler
T = current.T

Nico
Reply all
Reply to author
Forward
0 new messages