Opened 14 years ago
Last modified 12 years ago
#9453 closed defect
[PATCH] The session does not be saved with `req.send()` — at Initial Version
Reported by: | Jun Omae | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | 1.0 |
Component: | general | Version: | 0.11 |
Severity: | normal | Keywords: | |
Cc: | leho@…, Thijs Triemstra, osimons | Branch: | |
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
When the session is modified and response with req.send()
, the session does not be saved.
The patch adds self.session.save()
to check_modified
, send
and send_file
excluding send_error
.
Trac 0.12 and Trac 0.11-stable have the same issue.
-
trac/web/api.py
diff --git a/trac/web/api.py b/trac/web/api.py index df6d9ac..b3becbd 100644
a b class Request(object): 341 341 if (not inm or inm != etag): 342 342 self.send_header('ETag', etag) 343 343 else: 344 self.session.save() 344 345 self.send_response(304) 345 346 self.send_header('Content-Length', 0) 346 347 self.end_headers() … … class Request(object): 402 403 self.send(data, content_type, status) 403 404 404 405 def send(self, content, content_type='text/html', status=200): 406 self.session.save() 405 407 self.send_response(status) 406 408 self.send_header('Cache-Control', 'must-revalidate') 407 409 self.send_header('Content-Type', content_type + ';charset=utf-8') … … class Request(object): 477 479 mtime = datetime.fromtimestamp(stat.st_mtime, localtz) 478 480 last_modified = http_date(mtime) 479 481 if last_modified == self.get_header('If-Modified-Since'): 482 self.session.save() 480 483 self.send_response(304) 481 484 self.send_header('Content-Length', 0) 482 485 self.end_headers() … … class Request(object): 486 489 mimetype = mimetypes.guess_type(path)[0] or \ 487 490 'application/octet-stream' 488 491 492 self.session.save() 489 493 self.send_response(200) 490 494 self.send_header('Content-Type', mimetype) 491 495 self.send_header('Content-Length', stat.st_size)
Note:
See TracTickets
for help on using tickets.