Changeset 3900

Show
Ignore:
Timestamp:
01/12/08 17:18:42 (10 months ago)
Author:
faide
Message:

Applied fix to visit/api.py handling of the session cookie provided by Martin Schwamberger (mschw).

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.0/CHANGELOG.txt

    r3898 r3900  
    1616~~~~~ 
    1717 
     18* Fixed the visit cookie which was never resent to client until 
     19  it expired(#1652). 
    1820* Fixed teardown for SQLObject tables (#1674). 
    1921* Fixed VisitFilter when Identity is on and there are list parameters (#1622). 
     
    2628~~~~~~~~~~~~ 
    2729 
    28 Florent Aide, Toshio Kuratomi, Jan ONDREJ (SAL), Matt Wilson, Christoph Zwerschke. 
     30Florent Aide, Toshio Kuratomi, Jan ONDREJ (SAL),  Martin Schwamberger (mschw), 
     31Matt Wilson, Christoph Zwerschke. 
    2932 
    3033 
  • branches/1.0/turbogears/identity/tests/test_visit.py

    r3793 r3900  
    2828 
    2929    def tearDown(self): 
     30        turbogears.startup.stopTurboGears() 
    3031        turbogears.config.update({'visit.timeout': self._visit_timeout}) 
    3132        turbogears.config.update({'visit.on': self._visit_on}) 
     
    3940        # the test still passes without it, but exceptions are thrown later 
    4041        # once nose wants to quit. 
    41         turbogears.startup.stopTurboGears() 
    4242 
    4343    def test_new_visit(self): 
     
    4545        testutil.create_request("/") 
    4646        assert turbogears.visit.current().is_new 
    47         turbogears.startup.stopTurboGears() 
    4847 
    4948    def test_old_visit(self): 
     
    5453        testutil.create_request("/", headers=cookie_header(morsel)) 
    5554        assert not turbogears.visit.current().is_new 
    56         turbogears.startup.stopTurboGears() 
    5755 
    5856    def test_cookie_expires(self): 
     
    6866        assert turbogears.visit.current().is_new, \ 
    6967            'this should be a new visit, as the cookie has expired' 
    70         turbogears.startup.stopTurboGears() 
     68 
     69    def test_cookie_re_sent(self): 
     70        "Test whether the visit cookie is re-sent with new expiry time." 
     71        testutil.create_request('/') 
     72        morsel = cherrypy.response.simple_cookie[self.cookie_name] 
     73        exp1 = time.strptime(morsel['expires'], '%a, %d-%b-%Y %H:%M:%S GMT') 
     74        # sleep one second to ensure that we get a new expiry time. 
     75        time.sleep(1) 
     76        headers = {'Cookie': morsel.output(header='')[1:]} 
     77        testutil.create_request('/', headers=headers) 
     78        assert self.cookie_name in cherrypy.response.simple_cookie 
     79        morsel = cherrypy.response.simple_cookie[self.cookie_name] 
     80        exp2 = time.strptime(morsel['expires'], '%a, %d-%b-%Y %H:%M:%S GMT') 
     81        assert exp1 < exp2 
  • branches/1.0/turbogears/visit/api.py

    r3841 r3900  
    230230                visit_key = self._generate_key() 
    231231                visit = _manager.new_visit_with_key(visit_key) 
    232                 self.send_cookie(visit_key) 
     232 
     233            self.send_cookie(visit_key) 
    233234 
    234235            set_current(visit)