Skip to content

Commit 4a36fc9

Browse files
authored
[FIX] queue_job: repoint default_env to SUPERUSER in runjob
runjob is declared auth="none", so _auth_method_none pins request.env and transaction.default_env to a uid=None env. `env = http.request.env( user=SUPERUSER_ID)` only creates a local superuser env, leaving the default_env as uid=None. Any flush that goes through Transaction.flush() -> default_env.flush_all() then recomputes stored fields as uid=None and fails on anything dereferencing self.env.user. `http.request.update_env(user=SUPERUSER_ID)` additionally sets transaction.default_env to the superuser env. Closes #922
1 parent 52acb9d commit 4a36fc9

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

queue_job/controllers/main.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,8 @@ def _get_failure_values(cls, job, traceback_txt, orig_exception):
215215
)
216216
def runjob(self, db, job_uuid, **kw):
217217
http.request.session.db = db
218-
env = http.request.env(user=SUPERUSER_ID)
218+
http.request.update_env(user=SUPERUSER_ID)
219+
env = http.request.env
219220
job = self._acquire_job(env, job_uuid)
220221
if not job:
221222
return ""

0 commit comments

Comments
 (0)