Skip to content

fix: add stacklevel to datetime without timezone warning

Changes the warning at the beginning of CW from:

-> database for instance instance created and necessary extensions installed.                                                                                                                                                                                                               
                                                                                                                                                                                                                                                                                            
                                                                                                                                                                                                                                                                                            
Initializing the system database                                                                                                                                                                                                                                                            
--------------------------------                                                                                                                                                                                                                                                            
-> creating tables  [====================]                                                                                                                                                                                                                                                  
-> inserting default user and default groups.                                                                                                                                                                                                                                               
2023-01-27 16:40:50 - (cubicweb.appobject) WARNING: can't find any workflow for CWUser                                                                                                                                                                                                      
-> storing the schema in the database  [====================]                                                                                                                                                                                                                               
/home/cubicweb/.local/lib/python3.9/site-packages/cubicweb/server/querier.py:644: DeprecationWarning: Passing a datetime without timezone is deprecated and will be disallowed in version 1.0.0. For now, datetime without timezone are considered as UTC                                   
  results = plan.execute()                                                                                                                                                                                                                                                                  
/home/cubicweb/.local/lib/python3.9/site-packages/cubicweb/server/session.py:672: DeprecationWarning: Passing a datetime without timezone is deprecated and will be disallowed in version 1.0.0. For now, datetime without timezone are considered as UTC                                   
  rset = self._execute(self, rql, kwargs, build_descr)                                                                                                                                                                                                                                      
-> database for instance instance initialized.

To

-> database for instance instance created and necessary extensions installed.


Initializing the system database
--------------------------------
-> creating tables  [====================]
-> inserting default user and default groups.
2023-01-27 16:44:53 - (cubicweb.appobject) WARNING: can't find any workflow for CWUser
-> storing the schema in the database  [====================]
/home/cubicweb/.local/lib/python3.9/site-packages/cubicweb/server/session.py:156: DeprecationWarning: Passing a datetime without timezone is deprecated and will be disallowed in version 1.0.0. For now, datetime without timezone are considered as UTC
  return func(cnx, *args, **kwargs)
/home/cubicweb/.local/lib/python3.9/site-packages/cubicweb/hooks/workflow.py:343: DeprecationWarning: Passing a datetime without timezone is deprecated and will be disallowed in version 1.0.0. For now, datetime without timezone are considered as UTC
  entity.cw_set(modification_date=datetime.utcnow())
-> database for instance instance initialized.

It's not that great but it's already better than what we have for now

Merge request reports

Loading