code: def updateSession(self, request):
          
          # we actually need to copy some hardcoded constants from twisted :-(
  
          # Make sure we aren't creating a secure session on a non-secure page
          secure = request.isSecure()
  
          if not secure:
              cookieString = b"TWISTED_SESSION"
          else:
              cookieString = b"TWISTED_SECURE_SESSION"
  
          cookiename = b"_".join([cookieString] + request.sitepath)
          request.addCookie(cookiename, self.uid, path=b"/",
                            secure=secure)
docs: Update the cookie after session object was modified
          @param request: the request object which should get a new cookie