web/request.py
changeset 10305 937deb71a681
parent 10304 b6c55274135a
child 10331 6f25c7e4f19b
equal deleted inserted replaced
10304:b6c55274135a 10305:937deb71a681
    43 from cubicweb.uilib import remove_html_tags, js
    43 from cubicweb.uilib import remove_html_tags, js
    44 from cubicweb.utils import SizeConstrainedList, HTMLHead, make_uid
    44 from cubicweb.utils import SizeConstrainedList, HTMLHead, make_uid
    45 from cubicweb.view import TRANSITIONAL_DOCTYPE_NOEXT
    45 from cubicweb.view import TRANSITIONAL_DOCTYPE_NOEXT
    46 from cubicweb.web import (INTERNAL_FIELD_VALUE, LOGGER, NothingToEdit,
    46 from cubicweb.web import (INTERNAL_FIELD_VALUE, LOGGER, NothingToEdit,
    47                           RequestError, StatusResponse)
    47                           RequestError, StatusResponse)
    48 from cubicweb.web.httpcache import GMTOFFSET, get_validators
    48 from cubicweb.web.httpcache import get_validators
    49 from cubicweb.web.http_headers import Headers, Cookie, parseDateTime
    49 from cubicweb.web.http_headers import Headers, Cookie, parseDateTime
    50 
    50 
    51 _MARKER = object()
    51 _MARKER = object()
    52 
    52 
    53 def build_cb_uid(seed):
    53 def build_cb_uid(seed):
   534             expires = maxage + time.time()
   534             expires = maxage + time.time()
   535         elif expires:
   535         elif expires:
   536             # we don't want to handle times before the EPOCH (cause bug on
   536             # we don't want to handle times before the EPOCH (cause bug on
   537             # windows). Also use > and not >= else expires == 0 and Cookie think
   537             # windows). Also use > and not >= else expires == 0 and Cookie think
   538             # that means no expire...
   538             # that means no expire...
   539             assert expires + GMTOFFSET > date(1970, 1, 1)
   539             assert expires > date(1970, 1, 1)
   540             expires = timegm((expires + GMTOFFSET).timetuple())
   540             expires = timegm(expires.timetuple())
   541         else:
   541         else:
   542             expires = None
   542             expires = None
   543         # make sure cookie is set on the correct path
   543         # make sure cookie is set on the correct path
   544         cookie = Cookie(str(name), str(value), self.base_url_path(),
   544         cookie = Cookie(str(name), str(value), self.base_url_path(),
   545                         expires=expires, secure=secure, httponly=httponly)
   545                         expires=expires, secure=secure, httponly=httponly)