'Assert username. May raise redirect, or return True if request handled.'

def do_check(self):

    sess = cherrypy.session
    request = cherrypy.serving.request
    response = cherrypy.serving.response
    username = sess.get(self.session_key)
    if (not username):
        sess[self.session_key] = username = self.anonymous()
        if self.debug:
            cherrypy.log('No    session[username],    trying    anonymous', 'TOOLS.SESSAUTH')
    if (not username):
        url = cherrypy.url(qs=request.query_string)
        if self.debug:
            cherrypy.log(('No    username,    routing    to    login_screen    with    from_page    %r' % url), 'TOOLS.SESSAUTH')
        response.body = self.login_screen(url)
        if ('Content-Length' in response.headers):
            del response.headers['Content-Length']
        return True
    if self.debug:
        cherrypy.log(('Setting    request.login    to    %r' % username), 'TOOLS.SESSAUTH')
    request.login = username
    self.on_check(username)
