/[glsr]/trunk/harmonious/_dispatcher.py
Gentoo

Diff of /trunk/harmonious/_dispatcher.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 108 Revision 109
32 32
33 self._harm.request.send_response(self._harm.response.status) 33 self._harm.request.send_response(self._harm.response.status)
34 34
35 if server.config.session['SessionEnable'] == True: 35 if server.config.session['SessionEnable'] == True:
36 36
37 if self._harm.session.is_modified():
38
37 # Save all changes to our session and send the cookie 39 # Save all changes to our session and send the cookie
38 for key in self._harm.session.attrs.keys(): 40 for key in self._harm.session.attrs.keys():
39 41
40 arg_dict = {key: self._harm.session.attrs[key]} 42 arg_dict = {key: self._harm.session.attrs[key]}
41 server._sessionStore.update_session(self._harm.session.get_id(), **arg_dict) 43 server._sessionStore.update_session(self._harm.session.get_id(), **arg_dict)
42 44
43 if self._harm.session.get_persistent() == True: 45 if self._harm.session.is_persistent() == True:
44 46
45 server._sessionStore.set_persistent(self._harm.session.get_id(), True) 47 server._sessionStore.set_persistent(self._harm.session.get_id(), True)
46 48
47 else: 49 else:
48 50
49 server._sessionStore.set_persistent(self._harm.session.get_id(), False) 51 server._sessionStore.set_persistent(self._harm.session.get_id(), False)
50 52
51 print self._harm.session.get_persistent()
52 print self._harm.session.get_id()
53 session_cookie = Cookie.SimpleCookie() 53 session_cookie = Cookie.SimpleCookie()
54 session_cookie[server.config.session['CookieName']] = self._harm.session.get_id() 54 session_cookie[server.config.session['CookieName']] = self._harm.session.get_id()
55 session_cookie[server.config.session['CookieName']]['path'] = '/' 55 session_cookie[server.config.session['CookieName']]['path'] = '/'
56 # Uncomment for release 56 # Uncomment for release
57 #session_cookie[server.config.session['CookieName']]['domain'] = self._harm.request.host 57 #session_cookie[server.config.session['CookieName']]['domain'] = self._harm.request.host
58 58
59 if self._harm.session.get_persistent() == False: 59 if self._harm.session.is_persistent() == False:
60 60
61 session_cookie[server.config.session['CookieName']]['max-age'] = server.config.session['Timeout'] * 60 61 session_cookie[server.config.session['CookieName']]['max-age'] = server.config.session['Timeout'] * 60
62 #exp_time = time.localtime(time.time() + (server.config.session['Timeout'] * 60))
63 #session_cookie[server.config.session['CookieName']]['expires'] = time.strftime("%a, %d-%b-%Y %H:%M:%S GMT", exp_time)
64 62
65 self._harm.response.add_header('Set-Cookie', session_cookie[server.config.session['CookieName']].OutputString()) 63 self._harm.response.add_header('Set-Cookie', session_cookie[server.config.session['CookieName']].OutputString())
66 64
67 self._harm.response.add_header('Content-Length', len(self._harm.response.body)) 65 self._harm.response.add_header('Content-Length', len(self._harm.response.body))
68 66
69 if self._harm.request.request_version in ('HTTP/1.1', 'HTTP/1.0'): 67 if self._harm.request.request_version in ('HTTP/1.1', 'HTTP/1.0'):
70 if not self._harm.request.keep_alive: 68 if not self._harm.request.keep_alive:
75 73
76 headers = self._harm.response.headers 74 headers = self._harm.response.headers
77 75
78 for key in headers.keys(): 76 for key in headers.keys():
79 77
80 #print "Sending header: ", key, headers[key] 78 print "Sending header: ", key, headers[key]
81 self._harm.request.send_header(key, headers[key]) 79 self._harm.request.send_header(key, headers[key])
82 80
83 self._harm.request.end_headers() 81 self._harm.request.end_headers()
84 #print "Headers sent" 82 #print "Headers sent"
85 83

Legend:
Removed from v.108  
changed lines
  Added in v.109

  ViewVC Help
Powered by ViewVC 1.1.20