317 | | def set_cookie(self, key, value='', max_age=None, expires=None, path='/', domain=None, secure=None): |
| 317 | def set_cookie(self, key, value='', max_age=None, expires=None, path='/', domain=None, secure=False): |
319 | | for var in ('max_age', 'path', 'domain', 'secure', 'expires'): |
320 | | val = locals()[var] |
321 | | if val is not None: |
322 | | self.cookies[key][var.replace('_', '-')] = val |
| 319 | if max_age is not None: |
| 320 | self.cookies[key]['max-age'] = max_age |
| 321 | if expires is not None: |
| 322 | self.cookies[key]['expires'] = expires |
| 323 | if path is not None: |
| 324 | self.cookies[key]['path'] = path |
| 325 | if domain is not None: |
| 326 | self.cookies[key]['domain'] = domain |
| 327 | if secure: |
| 328 | self.cookies[key]['secure'] = True |