equal
deleted
inserted
replaced
538 name, value = value, name[value].value |
538 name, value = value, name[value].value |
539 if maxage: # don't check is None, 0 may be specified |
539 if maxage: # don't check is None, 0 may be specified |
540 assert expires is None, 'both max age and expires cant be specified' |
540 assert expires is None, 'both max age and expires cant be specified' |
541 expires = maxage + time.time() |
541 expires = maxage + time.time() |
542 elif expires: |
542 elif expires: |
|
543 # we don't want to handle times before the EPOCH (cause bug on |
|
544 # windows). Also use > and not >= else expires == 0 and Cookie think |
|
545 # that means no expire... |
|
546 assert expires + GMTOFFSET > date(1970, 1, 1) |
543 expires = timegm((expires + GMTOFFSET).timetuple()) |
547 expires = timegm((expires + GMTOFFSET).timetuple()) |
544 else: |
548 else: |
545 expires = None |
549 expires = None |
546 # make sure cookie is set on the correct path |
550 # make sure cookie is set on the correct path |
547 cookie = Cookie(str(name), str(value), self.base_url_path(), |
551 cookie = Cookie(str(name), str(value), self.base_url_path(), |
552 """remove a cookie by expiring it""" |
556 """remove a cookie by expiring it""" |
553 if bwcompat is not None: |
557 if bwcompat is not None: |
554 warn('[3.13] remove_cookie now take only a name as argument', |
558 warn('[3.13] remove_cookie now take only a name as argument', |
555 DeprecationWarning, stacklevel=2) |
559 DeprecationWarning, stacklevel=2) |
556 name = bwcompat |
560 name = bwcompat |
557 self.set_cookie(name, '', maxage=0, |
561 self.set_cookie(name, '', maxage=0, expires=date(2000, 1, 1)) |
558 # substracting GMTOFFSET because set_cookie |
|
559 # expects a localtime and we don't want to |
|
560 # handle times before the EPOCH |
|
561 expires=date(1970, 1, 1) - GMTOFFSET) |
|
562 |
562 |
563 def set_content_type(self, content_type, filename=None, encoding=None): |
563 def set_content_type(self, content_type, filename=None, encoding=None): |
564 """set output content type for this request. An optional filename |
564 """set output content type for this request. An optional filename |
565 may be given |
565 may be given |
566 """ |
566 """ |