paulb@1 | 1 | #!/usr/bin/env python |
paulb@1 | 2 | |
paulb@1 | 3 | """ |
paulb@1 | 4 | Twisted classes. |
paulb@403 | 5 | |
paulb@403 | 6 | Copyright (C) 2004, 2005 Paul Boddie <paul@boddie.org.uk> |
paulb@403 | 7 | |
paulb@403 | 8 | This library is free software; you can redistribute it and/or |
paulb@403 | 9 | modify it under the terms of the GNU Lesser General Public |
paulb@403 | 10 | License as published by the Free Software Foundation; either |
paulb@403 | 11 | version 2.1 of the License, or (at your option) any later version. |
paulb@403 | 12 | |
paulb@403 | 13 | This library is distributed in the hope that it will be useful, |
paulb@403 | 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
paulb@403 | 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
paulb@403 | 16 | Lesser General Public License for more details. |
paulb@403 | 17 | |
paulb@403 | 18 | You should have received a copy of the GNU Lesser General Public |
paulb@403 | 19 | License along with this library; if not, write to the Free Software |
paulb@403 | 20 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
paulb@1 | 21 | """ |
paulb@1 | 22 | |
paulb@1 | 23 | import Generic |
paulb@49 | 24 | from Helpers.Auth import UserInfo |
paulb@249 | 25 | from Helpers.Request import Cookie, get_body_field, filter_fields |
paulb@167 | 26 | from Helpers.Response import ConvertingStream |
paulb@239 | 27 | from Helpers.Session import SessionStore |
paulb@71 | 28 | from cgi import parse_qs |
paulb@1 | 29 | |
paulb@1 | 30 | class Transaction(Generic.Transaction): |
paulb@1 | 31 | |
paulb@1 | 32 | """ |
paulb@1 | 33 | Twisted transaction interface. |
paulb@1 | 34 | """ |
paulb@1 | 35 | |
paulb@1 | 36 | def __init__(self, trans): |
paulb@1 | 37 | |
paulb@1 | 38 | "Initialise the transaction using the Twisted transaction 'trans'." |
paulb@1 | 39 | |
paulb@1 | 40 | self.trans = trans |
paulb@311 | 41 | self.content_type = None |
paulb@128 | 42 | self.user = None |
paulb@311 | 43 | self.path_info = None |
paulb@1 | 44 | |
paulb@239 | 45 | # Special objects retained throughout the transaction. |
paulb@239 | 46 | |
paulb@239 | 47 | self.session_store = None |
paulb@239 | 48 | |
paulb@239 | 49 | def commit(self): |
paulb@239 | 50 | |
paulb@239 | 51 | """ |
paulb@239 | 52 | A special method, synchronising the transaction with framework-specific |
paulb@239 | 53 | objects. |
paulb@239 | 54 | """ |
paulb@239 | 55 | |
paulb@239 | 56 | # Close the session store. |
paulb@239 | 57 | |
paulb@239 | 58 | if self.session_store is not None: |
paulb@239 | 59 | self.session_store.close() |
paulb@239 | 60 | |
paulb@338 | 61 | # Server-related methods. |
paulb@338 | 62 | |
paulb@338 | 63 | def get_server_name(self): |
paulb@338 | 64 | |
paulb@338 | 65 | "Returns the server name." |
paulb@338 | 66 | |
paulb@338 | 67 | return self.trans.getRequestHostname() |
paulb@338 | 68 | |
paulb@338 | 69 | def get_server_port(self): |
paulb@338 | 70 | |
paulb@338 | 71 | "Returns the server port as a string." |
paulb@338 | 72 | |
paulb@345 | 73 | return str(self.trans.getHost()[2]) |
paulb@338 | 74 | |
paulb@1 | 75 | # Request-related methods. |
paulb@1 | 76 | |
paulb@1 | 77 | def get_request_stream(self): |
paulb@1 | 78 | |
paulb@1 | 79 | """ |
paulb@186 | 80 | Returns the request stream for the transaction. |
paulb@1 | 81 | """ |
paulb@1 | 82 | |
paulb@5 | 83 | return self.trans.content |
paulb@1 | 84 | |
paulb@1 | 85 | def get_request_method(self): |
paulb@1 | 86 | |
paulb@1 | 87 | """ |
paulb@186 | 88 | Returns the request method. |
paulb@1 | 89 | """ |
paulb@1 | 90 | |
paulb@1 | 91 | return self.trans.method |
paulb@1 | 92 | |
paulb@1 | 93 | def get_headers(self): |
paulb@1 | 94 | |
paulb@1 | 95 | """ |
paulb@186 | 96 | Returns all request headers as a dictionary-like object mapping header |
paulb@186 | 97 | names to values. |
paulb@186 | 98 | |
paulb@91 | 99 | NOTE: If duplicate header names are permitted, then this interface will |
paulb@91 | 100 | NOTE: need to change. |
paulb@1 | 101 | """ |
paulb@1 | 102 | |
paulb@65 | 103 | return self.trans.received_headers |
paulb@65 | 104 | |
paulb@65 | 105 | def get_header_values(self, key): |
paulb@1 | 106 | |
paulb@65 | 107 | """ |
paulb@186 | 108 | Returns a list of all request header values associated with the given |
paulb@186 | 109 | 'key'. Note that according to RFC 2616, 'key' is treated as a |
paulb@186 | 110 | case-insensitive string. |
paulb@65 | 111 | """ |
paulb@65 | 112 | |
paulb@65 | 113 | # Twisted does not convert the header key to lower case (which is the |
paulb@65 | 114 | # stored representation). |
paulb@65 | 115 | |
paulb@65 | 116 | return self.convert_to_list(self.trans.received_headers.get(key.lower())) |
paulb@1 | 117 | |
paulb@1 | 118 | def get_content_type(self): |
paulb@1 | 119 | |
paulb@1 | 120 | """ |
paulb@186 | 121 | Returns the content type specified on the request, along with the |
paulb@186 | 122 | charset employed. |
paulb@1 | 123 | """ |
paulb@1 | 124 | |
paulb@1 | 125 | return self.parse_content_type(self.trans.getHeader("Content-Type")) |
paulb@1 | 126 | |
paulb@1 | 127 | def get_content_charsets(self): |
paulb@1 | 128 | |
paulb@1 | 129 | """ |
paulb@1 | 130 | Returns the character set preferences. |
paulb@1 | 131 | """ |
paulb@1 | 132 | |
paulb@1 | 133 | return self.parse_content_preferences(self.trans.getHeader("Accept-Language")) |
paulb@1 | 134 | |
paulb@1 | 135 | def get_content_languages(self): |
paulb@1 | 136 | |
paulb@1 | 137 | """ |
paulb@186 | 138 | Returns extracted language information from the transaction. |
paulb@1 | 139 | """ |
paulb@1 | 140 | |
paulb@1 | 141 | return self.parse_content_preferences(self.trans.getHeader("Accept-Charset")) |
paulb@1 | 142 | |
paulb@434 | 143 | def get_path(self, encoding=None): |
paulb@5 | 144 | |
paulb@5 | 145 | """ |
paulb@434 | 146 | Returns the entire path from the request as a Unicode object. Any "URL |
paulb@434 | 147 | encoded" character values in the part of the path before the query |
paulb@434 | 148 | string will be decoded and presented as genuine characters; the query |
paulb@434 | 149 | string will remain "URL encoded", however. |
paulb@434 | 150 | |
paulb@434 | 151 | If the optional 'encoding' is set, use that in preference to the default |
paulb@434 | 152 | encoding to convert the path into a form not containing "URL encoded" |
paulb@434 | 153 | character values. |
paulb@5 | 154 | """ |
paulb@5 | 155 | |
paulb@434 | 156 | path = self.get_path_without_query(encoding) |
paulb@434 | 157 | qs = self.get_query_string() |
paulb@434 | 158 | if qs: |
paulb@434 | 159 | return path + "?" + qs |
paulb@434 | 160 | else: |
paulb@434 | 161 | return path |
paulb@5 | 162 | |
paulb@434 | 163 | def get_path_without_query(self, encoding=None): |
paulb@162 | 164 | |
paulb@162 | 165 | """ |
paulb@434 | 166 | Returns the entire path from the request minus the query string as a |
paulb@434 | 167 | Unicode object containing genuine characters (as opposed to "URL |
paulb@434 | 168 | encoded" character values). |
paulb@434 | 169 | |
paulb@434 | 170 | If the optional 'encoding' is set, use that in preference to the default |
paulb@434 | 171 | encoding to convert the path into a form not containing "URL encoded" |
paulb@434 | 172 | character values. |
paulb@162 | 173 | """ |
paulb@162 | 174 | |
paulb@434 | 175 | return self.decode_path(self.trans.uri.split("?")[0], encoding) |
paulb@162 | 176 | |
paulb@434 | 177 | def get_path_info(self, encoding=None): |
paulb@1 | 178 | |
paulb@1 | 179 | """ |
paulb@186 | 180 | Returns the "path info" (the part of the URL after the resource name |
paulb@434 | 181 | handling the current request) from the request as a Unicode object |
paulb@434 | 182 | containing genuine characters (as opposed to "URL encoded" character |
paulb@434 | 183 | values). |
paulb@434 | 184 | |
paulb@434 | 185 | If the optional 'encoding' is set, use that in preference to the default |
paulb@434 | 186 | encoding to convert the path into a form not containing "URL encoded" |
paulb@434 | 187 | character values. |
paulb@1 | 188 | """ |
paulb@1 | 189 | |
paulb@434 | 190 | return self.decode_path("/%s" % "/".join(self.trans.postpath), encoding) |
paulb@1 | 191 | |
paulb@69 | 192 | def get_query_string(self): |
paulb@69 | 193 | |
paulb@69 | 194 | """ |
paulb@186 | 195 | Returns the query string from the path in the request. |
paulb@69 | 196 | """ |
paulb@69 | 197 | |
paulb@434 | 198 | t = self.trans.uri.split("?") |
paulb@69 | 199 | if len(t) == 1: |
paulb@69 | 200 | return "" |
paulb@69 | 201 | else: |
paulb@69 | 202 | |
paulb@69 | 203 | # NOTE: Overlook erroneous usage of "?" characters in the path. |
paulb@69 | 204 | |
paulb@69 | 205 | return "?".join(t[1:]) |
paulb@69 | 206 | |
paulb@1 | 207 | # Higher level request-related methods. |
paulb@1 | 208 | |
paulb@430 | 209 | def get_fields_from_path(self, encoding=None): |
paulb@69 | 210 | |
paulb@69 | 211 | """ |
paulb@249 | 212 | Extracts fields (or request parameters) from the path specified in the |
paulb@249 | 213 | transaction. The underlying framework may refuse to supply fields from |
paulb@430 | 214 | the path if handling a POST transaction. The optional 'encoding' |
paulb@430 | 215 | parameter specifies the character encoding of the query string for cases |
paulb@430 | 216 | where the default encoding is to be overridden. |
paulb@69 | 217 | |
paulb@71 | 218 | Returns a dictionary mapping field names to lists of values (even if a |
paulb@71 | 219 | single value is associated with any given field name). |
paulb@69 | 220 | """ |
paulb@69 | 221 | |
paulb@249 | 222 | fields = {} |
paulb@249 | 223 | for name, values in parse_qs(self.get_query_string(), keep_blank_values=1).items(): |
paulb@430 | 224 | name = self.decode_path(name, encoding) |
paulb@249 | 225 | fields[name] = [] |
paulb@249 | 226 | for value in values: |
paulb@430 | 227 | value = self.decode_path(value, encoding) |
paulb@430 | 228 | fields[name].append(value) |
paulb@249 | 229 | return fields |
paulb@69 | 230 | |
paulb@167 | 231 | def get_fields_from_body(self, encoding=None): |
paulb@69 | 232 | |
paulb@69 | 233 | """ |
paulb@249 | 234 | Extracts fields (or request parameters) from the message body in the |
paulb@249 | 235 | transaction. The optional 'encoding' parameter specifies the character |
paulb@249 | 236 | encoding of the message body for cases where no such information is |
paulb@249 | 237 | available, but where the default encoding is to be overridden. |
paulb@69 | 238 | |
paulb@73 | 239 | Returns a dictionary mapping field names to lists of values (even if a |
paulb@193 | 240 | single value is associated with any given field name). Each value is |
paulb@193 | 241 | either a Unicode object (representing a simple form field, for example) |
paulb@198 | 242 | or a plain string (representing a file upload form field, for example). |
paulb@69 | 243 | """ |
paulb@69 | 244 | |
paulb@249 | 245 | # There may not be a reliable means of extracting only the fields |
paulb@249 | 246 | # the message body using the API. Remove fields originating from the |
paulb@249 | 247 | # path in the mixture provided by the API. |
paulb@228 | 248 | |
paulb@249 | 249 | all_fields = self._get_fields(encoding) |
paulb@228 | 250 | fields_from_path = self.get_fields_from_path() |
paulb@249 | 251 | return filter_fields(all_fields, fields_from_path) |
paulb@224 | 252 | |
paulb@249 | 253 | def _get_fields(self, encoding=None): |
paulb@224 | 254 | encoding = encoding or self.get_content_type().charset or self.default_charset |
paulb@167 | 255 | fields = {} |
paulb@167 | 256 | for field_name, field_values in self.trans.args.items(): |
paulb@228 | 257 | |
paulb@434 | 258 | # NOTE: Need to use the special path decoding method due to the |
paulb@434 | 259 | # NOTE: mixing of path and body fields within Twisted. |
paulb@434 | 260 | |
paulb@434 | 261 | field_name = self.decode_path(field_name, encoding) |
paulb@434 | 262 | |
paulb@228 | 263 | # Find the body values. |
paulb@228 | 264 | |
paulb@198 | 265 | if type(field_values) == type([]): |
paulb@198 | 266 | fields[field_name] = [] |
paulb@198 | 267 | |
paulb@198 | 268 | # Twisted stores plain strings. |
paulb@198 | 269 | |
paulb@198 | 270 | for field_str in field_values: |
paulb@249 | 271 | fields[field_name].append(get_body_field(field_str, encoding)) |
paulb@198 | 272 | else: |
paulb@249 | 273 | fields[field_name] = get_body_field(field_values, encoding) |
paulb@228 | 274 | |
paulb@167 | 275 | return fields |
paulb@1 | 276 | |
paulb@249 | 277 | def get_fields(self, encoding=None): |
paulb@249 | 278 | |
paulb@249 | 279 | """ |
paulb@249 | 280 | Extracts fields (or request parameters) from both the path specified in |
paulb@249 | 281 | the transaction as well as the message body. The optional 'encoding' |
paulb@249 | 282 | parameter specifies the character encoding of the message body for cases |
paulb@249 | 283 | where no such information is available, but where the default encoding |
paulb@249 | 284 | is to be overridden. |
paulb@249 | 285 | |
paulb@249 | 286 | Returns a dictionary mapping field names to lists of values (even if a |
paulb@249 | 287 | single value is associated with any given field name). Each value is |
paulb@249 | 288 | either a Unicode object (representing a simple form field, for example) |
paulb@249 | 289 | or a plain string (representing a file upload form field, for example). |
paulb@249 | 290 | |
paulb@249 | 291 | Where a given field name is used in both the path and message body to |
paulb@249 | 292 | specify values, the values from both sources will be combined into a |
paulb@249 | 293 | single list associated with that field name. |
paulb@249 | 294 | """ |
paulb@249 | 295 | |
paulb@249 | 296 | return self._get_fields(encoding) |
paulb@249 | 297 | |
paulb@45 | 298 | def get_user(self): |
paulb@1 | 299 | |
paulb@1 | 300 | """ |
paulb@186 | 301 | Extracts user information from the transaction. |
paulb@108 | 302 | |
paulb@108 | 303 | Returns a username as a string or None if no user is defined. |
paulb@1 | 304 | """ |
paulb@1 | 305 | |
paulb@128 | 306 | # Twisted makes headers lower case. |
paulb@128 | 307 | |
paulb@128 | 308 | if self.user is not None: |
paulb@128 | 309 | return self.user |
paulb@45 | 310 | |
paulb@49 | 311 | auth_header = self.get_headers().get("authorization") |
paulb@49 | 312 | if auth_header: |
paulb@49 | 313 | return UserInfo(auth_header).username |
paulb@49 | 314 | else: |
paulb@49 | 315 | return None |
paulb@1 | 316 | |
paulb@104 | 317 | def get_cookies(self): |
paulb@104 | 318 | |
paulb@104 | 319 | """ |
paulb@186 | 320 | Obtains cookie information from the request. |
paulb@104 | 321 | |
paulb@104 | 322 | Returns a dictionary mapping cookie names to cookie objects. |
paulb@104 | 323 | NOTE: Twisted does not seem to support this operation via methods. Thus, |
paulb@104 | 324 | NOTE: direct access has been employed to get the dictionary. |
paulb@104 | 325 | NOTE: Twisted also returns a plain string - a Cookie object is therefore |
paulb@104 | 326 | NOTE: introduced. |
paulb@104 | 327 | """ |
paulb@104 | 328 | |
paulb@258 | 329 | return self.process_cookies(self.trans.received_cookies, using_strings=1) |
paulb@104 | 330 | |
paulb@104 | 331 | def get_cookie(self, cookie_name): |
paulb@104 | 332 | |
paulb@104 | 333 | """ |
paulb@186 | 334 | Obtains cookie information from the request. |
paulb@104 | 335 | |
paulb@104 | 336 | Returns a cookie object for the given 'cookie_name' or None if no such |
paulb@104 | 337 | cookie exists. |
paulb@104 | 338 | NOTE: Twisted also returns a plain string - a Cookie object is therefore |
paulb@104 | 339 | NOTE: introduced. |
paulb@104 | 340 | """ |
paulb@104 | 341 | |
paulb@258 | 342 | value = self.trans.getCookie(self.encode_cookie_value(cookie_name)) |
paulb@258 | 343 | if value is not None: |
paulb@258 | 344 | return Cookie(cookie_name, self.decode_cookie_value(value)) |
paulb@258 | 345 | else: |
paulb@258 | 346 | return None |
paulb@104 | 347 | |
paulb@1 | 348 | # Response-related methods. |
paulb@1 | 349 | |
paulb@1 | 350 | def get_response_stream(self): |
paulb@1 | 351 | |
paulb@1 | 352 | """ |
paulb@186 | 353 | Returns the response stream for the transaction. |
paulb@1 | 354 | """ |
paulb@1 | 355 | |
paulb@224 | 356 | # Unicode can upset this operation. Using either the specified charset |
paulb@224 | 357 | # or a default encoding. |
paulb@167 | 358 | |
paulb@252 | 359 | encoding = self.get_response_stream_encoding() |
paulb@252 | 360 | return ConvertingStream(self.trans, encoding) |
paulb@252 | 361 | |
paulb@252 | 362 | def get_response_stream_encoding(self): |
paulb@252 | 363 | |
paulb@252 | 364 | """ |
paulb@252 | 365 | Returns the response stream encoding. |
paulb@252 | 366 | """ |
paulb@252 | 367 | |
paulb@167 | 368 | if self.content_type: |
paulb@224 | 369 | encoding = self.content_type.charset |
paulb@252 | 370 | else: |
paulb@252 | 371 | encoding = None |
paulb@252 | 372 | return encoding or self.default_charset |
paulb@1 | 373 | |
paulb@42 | 374 | def get_response_code(self): |
paulb@42 | 375 | |
paulb@42 | 376 | """ |
paulb@42 | 377 | Get the response code associated with the transaction. If no response |
paulb@42 | 378 | code is defined, None is returned. |
paulb@42 | 379 | """ |
paulb@42 | 380 | |
paulb@42 | 381 | # NOTE: Accessing the request attribute directly. |
paulb@42 | 382 | |
paulb@42 | 383 | return self.trans.code |
paulb@42 | 384 | |
paulb@42 | 385 | def set_response_code(self, response_code): |
paulb@42 | 386 | |
paulb@42 | 387 | """ |
paulb@42 | 388 | Set the 'response_code' using a numeric constant defined in the HTTP |
paulb@42 | 389 | specification. |
paulb@42 | 390 | """ |
paulb@42 | 391 | |
paulb@42 | 392 | self.trans.setResponseCode(response_code) |
paulb@42 | 393 | |
paulb@67 | 394 | def set_header_value(self, header, value): |
paulb@49 | 395 | |
paulb@49 | 396 | """ |
paulb@49 | 397 | Set the HTTP 'header' with the given 'value'. |
paulb@49 | 398 | """ |
paulb@49 | 399 | |
paulb@49 | 400 | self.trans.setHeader(self.format_header_value(header), self.format_header_value(value)) |
paulb@49 | 401 | |
paulb@1 | 402 | def set_content_type(self, content_type): |
paulb@1 | 403 | |
paulb@1 | 404 | """ |
paulb@186 | 405 | Sets the 'content_type' for the response. |
paulb@1 | 406 | """ |
paulb@1 | 407 | |
paulb@167 | 408 | # Remember the content type for encoding purposes later. |
paulb@167 | 409 | |
paulb@167 | 410 | self.content_type = content_type |
paulb@224 | 411 | self.trans.setHeader("Content-Type", str(content_type)) |
paulb@1 | 412 | |
paulb@104 | 413 | # Higher level response-related methods. |
paulb@104 | 414 | |
paulb@104 | 415 | def set_cookie(self, cookie): |
paulb@104 | 416 | |
paulb@104 | 417 | """ |
paulb@186 | 418 | Stores the given 'cookie' object in the response. |
paulb@104 | 419 | """ |
paulb@104 | 420 | |
paulb@258 | 421 | self.set_cookie_value(cookie.name, cookie.value, path=cookie.path, expires=cookie.expires) |
paulb@104 | 422 | |
paulb@104 | 423 | def set_cookie_value(self, name, value, path=None, expires=None): |
paulb@104 | 424 | |
paulb@104 | 425 | """ |
paulb@186 | 426 | Stores a cookie with the given 'name' and 'value' in the response. |
paulb@104 | 427 | |
paulb@104 | 428 | The optional 'path' is a string which specifies the scope of the cookie, |
paulb@104 | 429 | and the optional 'expires' parameter is a value compatible with the |
paulb@104 | 430 | time.time function, and indicates the expiry date/time of the cookie. |
paulb@104 | 431 | """ |
paulb@104 | 432 | |
paulb@258 | 433 | self.trans.addCookie(self.encode_cookie_value(name), |
paulb@258 | 434 | self.encode_cookie_value(value), expires=expires, path=path) |
paulb@104 | 435 | |
paulb@104 | 436 | def delete_cookie(self, cookie_name): |
paulb@104 | 437 | |
paulb@104 | 438 | """ |
paulb@186 | 439 | Adds to the response a request that the cookie with the given |
paulb@186 | 440 | 'cookie_name' be deleted/discarded by the client. |
paulb@104 | 441 | """ |
paulb@104 | 442 | |
paulb@108 | 443 | # Create a special cookie, given that we do not know whether the browser |
paulb@108 | 444 | # has been sent the cookie or not. |
paulb@108 | 445 | # NOTE: Magic discovered in Webware. |
paulb@108 | 446 | |
paulb@258 | 447 | self.trans.addCookie(self.encode_cookie_value(cookie_name), "", expires=0, path="/", max_age=0) |
paulb@104 | 448 | |
paulb@239 | 449 | # Session-related methods. |
paulb@239 | 450 | |
paulb@239 | 451 | def get_session(self, create=1): |
paulb@239 | 452 | |
paulb@239 | 453 | """ |
paulb@239 | 454 | Gets a session corresponding to an identifier supplied in the |
paulb@239 | 455 | transaction. |
paulb@239 | 456 | |
paulb@239 | 457 | If no session has yet been established according to information |
paulb@239 | 458 | provided in the transaction then the optional 'create' parameter |
paulb@239 | 459 | determines whether a new session will be established. |
paulb@239 | 460 | |
paulb@239 | 461 | Where no session has been established and where 'create' is set to 0 |
paulb@239 | 462 | then None is returned. In all other cases, a session object is created |
paulb@239 | 463 | (where appropriate) and returned. |
paulb@239 | 464 | """ |
paulb@239 | 465 | |
paulb@239 | 466 | # NOTE: Requires configuration. |
paulb@239 | 467 | |
paulb@239 | 468 | if self.session_store is None: |
paulb@239 | 469 | self.session_store = SessionStore(self, "WebStack-sessions") |
paulb@239 | 470 | return self.session_store.get_session(create) |
paulb@239 | 471 | |
paulb@239 | 472 | def expire_session(self): |
paulb@239 | 473 | |
paulb@239 | 474 | """ |
paulb@239 | 475 | Expires any session established according to information provided in the |
paulb@239 | 476 | transaction. |
paulb@239 | 477 | """ |
paulb@239 | 478 | |
paulb@239 | 479 | # NOTE: Requires configuration. |
paulb@239 | 480 | |
paulb@239 | 481 | if self.session_store is None: |
paulb@239 | 482 | self.session_store = SessionStore(self, "WebStack-sessions") |
paulb@239 | 483 | self.session_store.expire_session() |
paulb@239 | 484 | |
paulb@1 | 485 | # vim: tabstop=4 expandtab shiftwidth=4 |