paulb@28 | 1 | #!/usr/bin/env python |
paulb@28 | 2 | |
paulb@28 | 3 | """ |
paulb@28 | 4 | BaseHTTPRequestHandler classes. |
paulb@28 | 5 | """ |
paulb@28 | 6 | |
paulb@28 | 7 | import Generic |
paulb@258 | 8 | from Helpers.Request import MessageBodyStream, get_body_fields, get_storage_items, Cookie |
paulb@167 | 9 | from Helpers.Response import ConvertingStream |
paulb@49 | 10 | from Helpers.Auth import UserInfo |
paulb@239 | 11 | from Helpers.Session import SessionStore |
paulb@71 | 12 | from cgi import parse_qs, FieldStorage |
paulb@258 | 13 | from Cookie import SimpleCookie |
paulb@28 | 14 | from StringIO import StringIO |
paulb@28 | 15 | |
paulb@28 | 16 | class Transaction(Generic.Transaction): |
paulb@28 | 17 | |
paulb@28 | 18 | """ |
paulb@28 | 19 | BaseHTTPRequestHandler transaction interface. |
paulb@28 | 20 | """ |
paulb@28 | 21 | |
paulb@28 | 22 | def __init__(self, trans): |
paulb@28 | 23 | |
paulb@28 | 24 | """ |
paulb@28 | 25 | Initialise the transaction using the BaseHTTPRequestHandler instance |
paulb@28 | 26 | 'trans'. |
paulb@28 | 27 | """ |
paulb@28 | 28 | |
paulb@28 | 29 | self.trans = trans |
paulb@28 | 30 | |
paulb@28 | 31 | # Other attributes of interest in instances of this class. |
paulb@28 | 32 | |
paulb@28 | 33 | self.content_type = None |
paulb@45 | 34 | self.response_code = 200 |
paulb@28 | 35 | self.content = StringIO() |
paulb@115 | 36 | self.headers_out = {} |
paulb@258 | 37 | self.cookies_out = SimpleCookie() |
paulb@128 | 38 | self.user = None |
paulb@311 | 39 | self.path_info = None |
paulb@115 | 40 | |
paulb@115 | 41 | # Define the incoming cookies. |
paulb@115 | 42 | |
paulb@258 | 43 | self.cookies_in = SimpleCookie(self.get_headers().get("cookie")) |
paulb@28 | 44 | |
paulb@124 | 45 | # Cached information. |
paulb@124 | 46 | |
paulb@124 | 47 | self.storage_body = None |
paulb@124 | 48 | |
paulb@239 | 49 | # Special objects retained throughout the transaction. |
paulb@239 | 50 | |
paulb@239 | 51 | self.session_store = None |
paulb@239 | 52 | |
paulb@28 | 53 | def commit(self): |
paulb@28 | 54 | |
paulb@28 | 55 | """ |
paulb@28 | 56 | A special method, synchronising the transaction with framework-specific |
paulb@28 | 57 | objects. |
paulb@28 | 58 | """ |
paulb@28 | 59 | |
paulb@239 | 60 | # Close the session store. |
paulb@239 | 61 | |
paulb@239 | 62 | if self.session_store is not None: |
paulb@239 | 63 | self.session_store.close() |
paulb@239 | 64 | |
paulb@239 | 65 | # Prepare the response. |
paulb@239 | 66 | |
paulb@28 | 67 | self.trans.send_response(self.response_code) |
paulb@45 | 68 | if self.content_type is not None: |
paulb@224 | 69 | self.trans.send_header("Content-Type", str(self.content_type)) |
paulb@115 | 70 | |
paulb@115 | 71 | for header, value in self.headers_out.items(): |
paulb@49 | 72 | self.trans.send_header(self.format_header_value(header), self.format_header_value(value)) |
paulb@115 | 73 | |
paulb@115 | 74 | # NOTE: May not be using the appropriate method. |
paulb@115 | 75 | |
paulb@115 | 76 | for morsel in self.cookies_out.values(): |
paulb@115 | 77 | self.trans.send_header("Set-Cookie", morsel.OutputString()) |
paulb@115 | 78 | |
paulb@174 | 79 | # Add possibly missing content length information. |
paulb@174 | 80 | # NOTE: This is really inefficient, but we need to buffer things to |
paulb@174 | 81 | # NOTE: permit out of order header setting. |
paulb@174 | 82 | |
paulb@28 | 83 | self.content.seek(0) |
paulb@174 | 84 | content = self.content.read() |
paulb@174 | 85 | |
paulb@174 | 86 | if not self.headers_out.has_key("Content-Length"): |
paulb@174 | 87 | self.trans.send_header("Content-Length", str(len(content))) |
paulb@174 | 88 | |
paulb@174 | 89 | self.trans.end_headers() |
paulb@174 | 90 | self.trans.wfile.write(content) |
paulb@28 | 91 | |
paulb@338 | 92 | # Server-related methods. |
paulb@338 | 93 | |
paulb@338 | 94 | def get_server_name(self): |
paulb@338 | 95 | |
paulb@338 | 96 | "Returns the server name." |
paulb@338 | 97 | |
paulb@344 | 98 | # As ultimately found in SocketServer.BaseServer via SocketServer.BaseRequestHandler. |
paulb@344 | 99 | # NOTE: We assume that any usage of "" can be taken to mean "localhost". |
paulb@344 | 100 | |
paulb@344 | 101 | return self.trans.server.server_address[0] or "localhost" |
paulb@338 | 102 | |
paulb@338 | 103 | def get_server_port(self): |
paulb@338 | 104 | |
paulb@338 | 105 | "Returns the server port as a string." |
paulb@338 | 106 | |
paulb@344 | 107 | # As ultimately found in SocketServer.BaseServer via SocketServer.BaseRequestHandler. |
paulb@344 | 108 | |
paulb@344 | 109 | return str(self.trans.server.server_address[1]) |
paulb@338 | 110 | |
paulb@28 | 111 | # Request-related methods. |
paulb@28 | 112 | |
paulb@28 | 113 | def get_request_stream(self): |
paulb@28 | 114 | |
paulb@28 | 115 | """ |
paulb@186 | 116 | Returns the request stream for the transaction. |
paulb@28 | 117 | """ |
paulb@28 | 118 | |
paulb@45 | 119 | return MessageBodyStream(self.trans.rfile, self.get_headers()) |
paulb@28 | 120 | |
paulb@28 | 121 | def get_request_method(self): |
paulb@28 | 122 | |
paulb@28 | 123 | """ |
paulb@186 | 124 | Returns the request method. |
paulb@28 | 125 | """ |
paulb@28 | 126 | |
paulb@28 | 127 | return self.trans.command |
paulb@28 | 128 | |
paulb@28 | 129 | def get_headers(self): |
paulb@28 | 130 | |
paulb@28 | 131 | """ |
paulb@186 | 132 | Returns all request headers as a dictionary-like object mapping header |
paulb@186 | 133 | names to values. |
paulb@186 | 134 | |
paulb@91 | 135 | NOTE: If duplicate header names are permitted, then this interface will |
paulb@91 | 136 | NOTE: need to change. |
paulb@28 | 137 | """ |
paulb@28 | 138 | |
paulb@28 | 139 | return self.trans.headers |
paulb@28 | 140 | |
paulb@65 | 141 | def get_header_values(self, key): |
paulb@65 | 142 | |
paulb@65 | 143 | """ |
paulb@186 | 144 | Returns a list of all request header values associated with the given |
paulb@186 | 145 | 'key'. Note that according to RFC 2616, 'key' is treated as a |
paulb@186 | 146 | case-insensitive string. |
paulb@65 | 147 | """ |
paulb@65 | 148 | |
paulb@65 | 149 | return self.convert_to_list(self.trans.headers.get(key)) |
paulb@65 | 150 | |
paulb@28 | 151 | def get_content_type(self): |
paulb@28 | 152 | |
paulb@28 | 153 | """ |
paulb@186 | 154 | Returns the content type specified on the request, along with the |
paulb@186 | 155 | charset employed. |
paulb@28 | 156 | """ |
paulb@28 | 157 | |
paulb@115 | 158 | return self.parse_content_type(self.trans.headers.get("content-type")) |
paulb@28 | 159 | |
paulb@28 | 160 | def get_content_charsets(self): |
paulb@28 | 161 | |
paulb@28 | 162 | """ |
paulb@28 | 163 | Returns the character set preferences. |
paulb@28 | 164 | """ |
paulb@28 | 165 | |
paulb@115 | 166 | return self.parse_content_preferences(self.trans.headers.get("accept-charset")) |
paulb@28 | 167 | |
paulb@28 | 168 | def get_content_languages(self): |
paulb@28 | 169 | |
paulb@28 | 170 | """ |
paulb@186 | 171 | Returns extracted language information from the transaction. |
paulb@28 | 172 | """ |
paulb@28 | 173 | |
paulb@115 | 174 | return self.parse_content_preferences(self.trans.headers.get("accept-language")) |
paulb@28 | 175 | |
paulb@28 | 176 | def get_path(self): |
paulb@28 | 177 | |
paulb@28 | 178 | """ |
paulb@186 | 179 | Returns the entire path from the request. |
paulb@28 | 180 | """ |
paulb@28 | 181 | |
paulb@28 | 182 | return self.trans.path |
paulb@28 | 183 | |
paulb@162 | 184 | def get_path_without_query(self): |
paulb@162 | 185 | |
paulb@162 | 186 | """ |
paulb@186 | 187 | Returns the entire path from the request minus the query string. |
paulb@162 | 188 | """ |
paulb@162 | 189 | |
paulb@162 | 190 | # Remove the query string from the end of the path. |
paulb@162 | 191 | |
paulb@162 | 192 | return self.trans.path.split("?")[0] |
paulb@162 | 193 | |
paulb@28 | 194 | def get_path_info(self): |
paulb@28 | 195 | |
paulb@28 | 196 | """ |
paulb@186 | 197 | Returns the "path info" (the part of the URL after the resource name |
paulb@186 | 198 | handling the current request) from the request. |
paulb@28 | 199 | """ |
paulb@28 | 200 | |
paulb@316 | 201 | return self.get_path_without_query() |
paulb@28 | 202 | |
paulb@69 | 203 | def get_query_string(self): |
paulb@69 | 204 | |
paulb@69 | 205 | """ |
paulb@186 | 206 | Returns the query string from the path in the request. |
paulb@69 | 207 | """ |
paulb@69 | 208 | |
paulb@69 | 209 | t = self.trans.path.split("?") |
paulb@69 | 210 | if len(t) == 1: |
paulb@69 | 211 | return "" |
paulb@69 | 212 | else: |
paulb@69 | 213 | |
paulb@69 | 214 | # NOTE: Overlook erroneous usage of "?" characters in the path. |
paulb@69 | 215 | |
paulb@69 | 216 | return "?".join(t[1:]) |
paulb@69 | 217 | |
paulb@28 | 218 | # Higher level request-related methods. |
paulb@28 | 219 | |
paulb@69 | 220 | def get_fields_from_path(self): |
paulb@69 | 221 | |
paulb@69 | 222 | """ |
paulb@249 | 223 | Extracts fields (or request parameters) from the path specified in the |
paulb@249 | 224 | transaction. The underlying framework may refuse to supply fields from |
paulb@249 | 225 | the path if handling a POST transaction. |
paulb@69 | 226 | |
paulb@71 | 227 | Returns a dictionary mapping field names to lists of values (even if a |
paulb@71 | 228 | single value is associated with any given field name). |
paulb@69 | 229 | """ |
paulb@69 | 230 | |
paulb@249 | 231 | # NOTE: Support at best ISO-8859-1 values. |
paulb@249 | 232 | |
paulb@249 | 233 | fields = {} |
paulb@249 | 234 | for name, values in parse_qs(self.get_query_string(), keep_blank_values=1).items(): |
paulb@249 | 235 | fields[name] = [] |
paulb@249 | 236 | for value in values: |
paulb@249 | 237 | fields[name].append(unicode(value, "iso-8859-1")) |
paulb@249 | 238 | return fields |
paulb@69 | 239 | |
paulb@167 | 240 | def get_fields_from_body(self, encoding=None): |
paulb@69 | 241 | |
paulb@69 | 242 | """ |
paulb@249 | 243 | Extracts fields (or request parameters) from the message body in the |
paulb@249 | 244 | transaction. The optional 'encoding' parameter specifies the character |
paulb@249 | 245 | encoding of the message body for cases where no such information is |
paulb@249 | 246 | available, but where the default encoding is to be overridden. |
paulb@69 | 247 | |
paulb@73 | 248 | Returns a dictionary mapping field names to lists of values (even if a |
paulb@193 | 249 | single value is associated with any given field name). Each value is |
paulb@193 | 250 | either a Unicode object (representing a simple form field, for example) |
paulb@198 | 251 | or a plain string (representing a file upload form field, for example). |
paulb@69 | 252 | """ |
paulb@69 | 253 | |
paulb@224 | 254 | encoding = encoding or self.get_content_type().charset or self.default_charset |
paulb@167 | 255 | |
paulb@124 | 256 | if self.storage_body is None: |
paulb@124 | 257 | self.storage_body = FieldStorage(fp=self.get_request_stream(), headers=self.get_headers(), |
paulb@124 | 258 | environ={"REQUEST_METHOD" : self.get_request_method()}, keep_blank_values=1) |
paulb@69 | 259 | |
paulb@75 | 260 | # Avoid strange design issues with FieldStorage by checking the internal |
paulb@75 | 261 | # field list directly. |
paulb@28 | 262 | |
paulb@73 | 263 | fields = {} |
paulb@124 | 264 | if self.storage_body.list is not None: |
paulb@75 | 265 | |
paulb@75 | 266 | # Traverse the storage, finding each field value. |
paulb@75 | 267 | |
paulb@198 | 268 | fields = get_body_fields(get_storage_items(self.storage_body), encoding) |
paulb@198 | 269 | |
paulb@73 | 270 | return fields |
paulb@28 | 271 | |
paulb@249 | 272 | def get_fields(self, encoding=None): |
paulb@249 | 273 | |
paulb@249 | 274 | """ |
paulb@249 | 275 | Extracts fields (or request parameters) from both the path specified in |
paulb@249 | 276 | the transaction as well as the message body. The optional 'encoding' |
paulb@249 | 277 | parameter specifies the character encoding of the message body for cases |
paulb@249 | 278 | where no such information is available, but where the default encoding |
paulb@249 | 279 | is to be overridden. |
paulb@249 | 280 | |
paulb@249 | 281 | Returns a dictionary mapping field names to lists of values (even if a |
paulb@249 | 282 | single value is associated with any given field name). Each value is |
paulb@249 | 283 | either a Unicode object (representing a simple form field, for example) |
paulb@249 | 284 | or a plain string (representing a file upload form field, for example). |
paulb@249 | 285 | |
paulb@249 | 286 | Where a given field name is used in both the path and message body to |
paulb@249 | 287 | specify values, the values from both sources will be combined into a |
paulb@249 | 288 | single list associated with that field name. |
paulb@249 | 289 | """ |
paulb@249 | 290 | |
paulb@249 | 291 | # Combine the two sources. |
paulb@249 | 292 | |
paulb@249 | 293 | fields = {} |
paulb@249 | 294 | fields.update(self.get_fields_from_path()) |
paulb@249 | 295 | for name, values in self.get_fields_from_body(encoding).items(): |
paulb@249 | 296 | if not fields.has_key(name): |
paulb@249 | 297 | fields[name] = values |
paulb@249 | 298 | else: |
paulb@249 | 299 | fields[name] += values |
paulb@249 | 300 | return fields |
paulb@249 | 301 | |
paulb@45 | 302 | def get_user(self): |
paulb@28 | 303 | |
paulb@28 | 304 | """ |
paulb@186 | 305 | Extracts user information from the transaction. |
paulb@108 | 306 | |
paulb@108 | 307 | Returns a username as a string or None if no user is defined. |
paulb@28 | 308 | """ |
paulb@28 | 309 | |
paulb@128 | 310 | if self.user is not None: |
paulb@128 | 311 | return self.user |
paulb@128 | 312 | |
paulb@115 | 313 | auth_header = self.get_headers().get("authorization") |
paulb@49 | 314 | if auth_header: |
paulb@49 | 315 | return UserInfo(auth_header).username |
paulb@49 | 316 | else: |
paulb@49 | 317 | return None |
paulb@28 | 318 | |
paulb@115 | 319 | def get_cookies(self): |
paulb@115 | 320 | |
paulb@115 | 321 | """ |
paulb@186 | 322 | Obtains cookie information from the request. |
paulb@115 | 323 | |
paulb@115 | 324 | Returns a dictionary mapping cookie names to cookie objects. |
paulb@115 | 325 | """ |
paulb@115 | 326 | |
paulb@258 | 327 | return self.process_cookies(self.cookies_in) |
paulb@115 | 328 | |
paulb@115 | 329 | def get_cookie(self, cookie_name): |
paulb@115 | 330 | |
paulb@115 | 331 | """ |
paulb@186 | 332 | Obtains cookie information from the request. |
paulb@115 | 333 | |
paulb@115 | 334 | Returns a cookie object for the given 'cookie_name' or None if no such |
paulb@115 | 335 | cookie exists. |
paulb@115 | 336 | """ |
paulb@115 | 337 | |
paulb@258 | 338 | cookie = self.cookies_in.get(self.encode_cookie_value(cookie_name)) |
paulb@258 | 339 | if cookie is not None: |
paulb@258 | 340 | return Cookie(cookie_name, self.decode_cookie_value(cookie.value)) |
paulb@258 | 341 | else: |
paulb@258 | 342 | return None |
paulb@115 | 343 | |
paulb@28 | 344 | # Response-related methods. |
paulb@28 | 345 | |
paulb@28 | 346 | def get_response_stream(self): |
paulb@28 | 347 | |
paulb@28 | 348 | """ |
paulb@186 | 349 | Returns the response stream for the transaction. |
paulb@28 | 350 | """ |
paulb@28 | 351 | |
paulb@28 | 352 | # Return a stream which is later emptied into the real stream. |
paulb@224 | 353 | # Unicode can upset this operation. Using either the specified charset |
paulb@224 | 354 | # or a default encoding. |
paulb@28 | 355 | |
paulb@252 | 356 | encoding = self.get_response_stream_encoding() |
paulb@252 | 357 | return ConvertingStream(self.content, encoding) |
paulb@252 | 358 | |
paulb@252 | 359 | def get_response_stream_encoding(self): |
paulb@252 | 360 | |
paulb@252 | 361 | """ |
paulb@252 | 362 | Returns the response stream encoding. |
paulb@252 | 363 | """ |
paulb@252 | 364 | |
paulb@167 | 365 | if self.content_type: |
paulb@224 | 366 | encoding = self.content_type.charset |
paulb@252 | 367 | else: |
paulb@252 | 368 | encoding = None |
paulb@252 | 369 | return encoding or self.default_charset |
paulb@28 | 370 | |
paulb@42 | 371 | def get_response_code(self): |
paulb@42 | 372 | |
paulb@42 | 373 | """ |
paulb@42 | 374 | Get the response code associated with the transaction. If no response |
paulb@42 | 375 | code is defined, None is returned. |
paulb@42 | 376 | """ |
paulb@42 | 377 | |
paulb@42 | 378 | return self.response_code |
paulb@42 | 379 | |
paulb@42 | 380 | def set_response_code(self, response_code): |
paulb@42 | 381 | |
paulb@42 | 382 | """ |
paulb@42 | 383 | Set the 'response_code' using a numeric constant defined in the HTTP |
paulb@42 | 384 | specification. |
paulb@42 | 385 | """ |
paulb@42 | 386 | |
paulb@42 | 387 | self.response_code = response_code |
paulb@42 | 388 | |
paulb@67 | 389 | def set_header_value(self, header, value): |
paulb@49 | 390 | |
paulb@49 | 391 | """ |
paulb@49 | 392 | Set the HTTP 'header' with the given 'value'. |
paulb@49 | 393 | """ |
paulb@49 | 394 | |
paulb@49 | 395 | # The header is not written out immediately due to the buffering in use. |
paulb@49 | 396 | |
paulb@115 | 397 | self.headers_out[header] = value |
paulb@49 | 398 | |
paulb@28 | 399 | def set_content_type(self, content_type): |
paulb@28 | 400 | |
paulb@28 | 401 | """ |
paulb@186 | 402 | Sets the 'content_type' for the response. |
paulb@28 | 403 | """ |
paulb@28 | 404 | |
paulb@28 | 405 | # The content type has to be written as a header, before actual content, |
paulb@28 | 406 | # but after the response line. This means that some kind of buffering is |
paulb@28 | 407 | # required. Hence, we don't write the header out immediately. |
paulb@28 | 408 | |
paulb@28 | 409 | self.content_type = content_type |
paulb@28 | 410 | |
paulb@186 | 411 | # Higher level response-related methods. |
paulb@186 | 412 | |
paulb@115 | 413 | def set_cookie(self, cookie): |
paulb@115 | 414 | |
paulb@115 | 415 | """ |
paulb@186 | 416 | Stores the given 'cookie' object in the response. |
paulb@115 | 417 | """ |
paulb@115 | 418 | |
paulb@115 | 419 | # NOTE: If multiple cookies of the same name could be specified, this |
paulb@115 | 420 | # NOTE: could need changing. |
paulb@115 | 421 | |
paulb@258 | 422 | self.set_cookie_value(cookie.name, cookie.value) |
paulb@115 | 423 | |
paulb@115 | 424 | def set_cookie_value(self, name, value, path=None, expires=None): |
paulb@115 | 425 | |
paulb@115 | 426 | """ |
paulb@186 | 427 | Stores a cookie with the given 'name' and 'value' in the response. |
paulb@115 | 428 | |
paulb@115 | 429 | The optional 'path' is a string which specifies the scope of the cookie, |
paulb@115 | 430 | and the optional 'expires' parameter is a value compatible with the |
paulb@115 | 431 | time.time function, and indicates the expiry date/time of the cookie. |
paulb@115 | 432 | """ |
paulb@115 | 433 | |
paulb@258 | 434 | name = self.encode_cookie_value(name) |
paulb@258 | 435 | self.cookies_out[name] = self.encode_cookie_value(value) |
paulb@115 | 436 | if path is not None: |
paulb@115 | 437 | self.cookies_out[name]["path"] = path |
paulb@115 | 438 | if expires is not None: |
paulb@115 | 439 | self.cookies_out[name]["expires"] = expires |
paulb@115 | 440 | |
paulb@115 | 441 | def delete_cookie(self, cookie_name): |
paulb@115 | 442 | |
paulb@115 | 443 | """ |
paulb@186 | 444 | Adds to the response a request that the cookie with the given |
paulb@186 | 445 | 'cookie_name' be deleted/discarded by the client. |
paulb@115 | 446 | """ |
paulb@115 | 447 | |
paulb@115 | 448 | # Create a special cookie, given that we do not know whether the browser |
paulb@115 | 449 | # has been sent the cookie or not. |
paulb@115 | 450 | # NOTE: Magic discovered in Webware. |
paulb@115 | 451 | |
paulb@258 | 452 | name = self.encode_cookie_value(cookie_name) |
paulb@258 | 453 | self.cookies_out[name] = "" |
paulb@258 | 454 | self.cookies_out[name]["path"] = "/" |
paulb@258 | 455 | self.cookies_out[name]["expires"] = 0 |
paulb@258 | 456 | self.cookies_out[name]["max-age"] = 0 |
paulb@115 | 457 | |
paulb@239 | 458 | # Session-related methods. |
paulb@239 | 459 | |
paulb@239 | 460 | def get_session(self, create=1): |
paulb@239 | 461 | |
paulb@239 | 462 | """ |
paulb@239 | 463 | Gets a session corresponding to an identifier supplied in the |
paulb@239 | 464 | transaction. |
paulb@239 | 465 | |
paulb@239 | 466 | If no session has yet been established according to information |
paulb@239 | 467 | provided in the transaction then the optional 'create' parameter |
paulb@239 | 468 | determines whether a new session will be established. |
paulb@239 | 469 | |
paulb@239 | 470 | Where no session has been established and where 'create' is set to 0 |
paulb@239 | 471 | then None is returned. In all other cases, a session object is created |
paulb@239 | 472 | (where appropriate) and returned. |
paulb@239 | 473 | """ |
paulb@239 | 474 | |
paulb@239 | 475 | # NOTE: Requires configuration. |
paulb@239 | 476 | |
paulb@239 | 477 | if self.session_store is None: |
paulb@239 | 478 | self.session_store = SessionStore(self, "WebStack-sessions") |
paulb@239 | 479 | return self.session_store.get_session(create) |
paulb@239 | 480 | |
paulb@239 | 481 | def expire_session(self): |
paulb@239 | 482 | |
paulb@239 | 483 | """ |
paulb@239 | 484 | Expires any session established according to information provided in the |
paulb@239 | 485 | transaction. |
paulb@239 | 486 | """ |
paulb@239 | 487 | |
paulb@239 | 488 | # NOTE: Requires configuration. |
paulb@239 | 489 | |
paulb@239 | 490 | if self.session_store is None: |
paulb@239 | 491 | self.session_store = SessionStore(self, "WebStack-sessions") |
paulb@239 | 492 | self.session_store.expire_session() |
paulb@239 | 493 | |
paulb@28 | 494 | # vim: tabstop=4 expandtab shiftwidth=4 |