You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When pghistory.middleware.HistoryMiddleware is installed as a django middleware ... any usage of with pghistory.context() within the django app throws throws AttributeError: 'NoneType' object has no attribute 'nextset'
here is the last of the error
File ~/src/#####/venv/lib64/python3.9/site-packages/pghistory/runtime.py:89, in _inject_history_context(execute, sql, params, many, context)
83 sql = (
84 "SELECT set_config('pghistory.context_id', %s, true), "
85 "set_config('pghistory.context_metadata', %s, true); "
86 ) + sql
87 params = [str(_tracker.value.id), serialized_metadata, *(params or ())]
---> 89 return _execute_wrapper(execute(sql, params, many, context))
File ~/src/#####/venv/lib64/python3.9/site-packages/pghistory/runtime.py:72, in _execute_wrapper(execute_result)
70 def _execute_wrapper(execute_result):
71 if utils.psycopg_maj_version == 3:
---> 72 while execute_result.nextset():
73 pass
74 return execute_result
AttributeError: 'NoneType' object has no attribute 'nextset'
looks like we need a check on execute_result before calling nextset().
pghistory/runtime.py#70
def _execute_wrapper(execute_result):
if utils.psycopg_maj_version == 3:
if execute_result:
while execute_result.nextset():
pass
return execute_result
seems to fix though I am clueless about the 'big picture'
The text was updated successfully, but these errors were encountered:
When pghistory.middleware.HistoryMiddleware is installed as a django middleware ... any usage of with pghistory.context() within the django app throws throws AttributeError: 'NoneType' object has no attribute 'nextset'
here is the last of the error
looks like we need a check on execute_result before calling nextset().
pghistory/runtime.py#70
seems to fix though I am clueless about the 'big picture'
The text was updated successfully, but these errors were encountered: