def createSession(self, ctx, segments):

        request = inevow.IRequest(ctx)

        newCookie = _sessionCookie()
        if self.useCookies:
            if self.secureCookies and request.isSecure():
                secure = True
            else:
                secure = False
            if self.persistentCookies and self.sessionLifetime:
                expires = http.datetimeToString(time.time() + self.sessionLifetime)
            else:
                expires = None
            request.addCookie(self.cookieKey, newCookie,
                              path="/%s" % '/'.join(request.prepath),
                              secure=secure, expires=expires,
                              domain=self.cookieDomainForRequest(request))
        sz = self.sessions[newCookie] = self.sessionFactory(self, newCookie)
        sz.args = request.args
        sz.fields = request.fields
        sz.method = request.method
        sz._requestHeaders = request.requestHeaders
        sz.checkExpired()
        return urlToChild(ctx, SESSION_KEY+newCookie, *segments)
Create a new session for this request, and redirect back to the path
dataset/ETHPy150Open twisted/nevow/nevow/guard.py/SessionWrapper.createSession