Edgewall Software

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):  
    341341        if (not inm or inm != etag):
    342342            self.send_header('ETag', etag)
    343343        else:
     344            self.session.save()
    344345            self.send_response(304)
    345346            self.send_header('Content-Length', 0)
    346347            self.end_headers()
    class Request(object):  
    402403        self.send(data, content_type, status)
    403404
    404405    def send(self, content, content_type='text/html', status=200):
     406        self.session.save()
    405407        self.send_response(status)
    406408        self.send_header('Cache-Control', 'must-revalidate')
    407409        self.send_header('Content-Type', content_type + ';charset=utf-8')
    class Request(object):  
    477479        mtime = datetime.fromtimestamp(stat.st_mtime, localtz)
    478480        last_modified = http_date(mtime)
    479481        if last_modified == self.get_header('If-Modified-Since'):
     482            self.session.save()
    480483            self.send_response(304)
    481484            self.send_header('Content-Length', 0)
    482485            self.end_headers()
    class Request(object):  
    486489            mimetype = mimetypes.guess_type(path)[0] or \
    487490                       'application/octet-stream'
    488491
     492        self.session.save()
    489493        self.send_response(200)
    490494        self.send_header('Content-Type', mimetype)
    491495        self.send_header('Content-Length', stat.st_size)

Change History (0)

Note: See TracTickets for help on using tickets.