예제 #1
0
 def format(self, request):
     from quixote import get_session_manager
     get_session_manager().revoke_session_cookie(request)
     msg = PublishError.format(self, request)
     if self.session_id:
         msg = msg + ": " + self.session_id
     return msg
예제 #2
0
파일: altdemo.py 프로젝트: zhou0/quixote
 def logout(self):
     if get_user():
         content = htmltext('<p>Goodbye, %s.</p>') % get_user()
     else:
         content = htmltext('<p>That would be redundant.</p>')
     content += href("..", "start over")
     get_session_manager().expire_session()  # This is the important part.
     return format_page("Quixote Session Demo: Logout", content)
예제 #3
0
파일: altdemo.py 프로젝트: pganti/micheles
 def logout(self):
     if get_user():
         content = htmltext('<p>Goodbye, %s.</p>') % get_user()
     else:
         content = htmltext('<p>That would be redundant.</p>')
     content += href("..", "start over")
     get_session_manager().expire_session() # This is the important part.
     return format_page("Quixote Session Demo: Logout", content)
예제 #4
0
파일: logout.py 프로젝트: jackfrued/code-1
def _q_index(request):
    user = request.user
    if request.method == 'POST':
        if user:
            continue_url = request.get_form_var(
                'continue', '') or request.get_form_var('Referer', '')
            get_session_manager().expire_session(request)
        return request.redirect(continue_url or '/')
    context = {}
    context['current_user'] = user
    return st('logout.html', **context)
예제 #5
0
파일: altdemo.py 프로젝트: zhou0/quixote
 def _q_index(self):
     content = htmltext('')
     if not get_user():
         content += htmltext('<p>%s</p>' % href('login', 'login'))
     else:
         content += htmltext('<p>Hello, %s.</p>') % get_user()
         content += htmltext('<p>%s</p>' % href('logout', 'logout'))
     sessions = sorted([(s.id, s) for s in get_session_manager()])
     if sessions:
         content += htmltext('<table><tr>'
                             '<th></th>'
                             '<th>Session</th>'
                             '<th>User</th>'
                             '<th>Number of Requests</th>'
                             '</tr>')
         this_session = get_session()
         for index, (id, session) in enumerate(sessions):
             if session is this_session:
                 formatted_id = htmltext(
                     '<span style="font-weight:bold">%s</span>' % id)
             else:
                 formatted_id = id
             content += htmltext(
                 '<tr><td>%s</td><td>%s</td><td>%s</td><td>%d</td>' %
                 (index, formatted_id, session.user
                  or htmltext("<em>None</em>"), session.num_requests))
         content += htmltext('</table>')
     return format_page("Quixote Session Management Demo", content)
예제 #6
0
    def logout(self):
        # expire session
        session_manager = get_session_manager()
        session_manager.expire_session()

        # redirect to index page.
        return redirect(get_path(1) + '/')
예제 #7
0
    def logout(self):
        # expire session
        session_manager = get_session_manager()
        session_manager.expire_session()

        # redirect to index page.
        return redirect(get_path(1) + '/')
예제 #8
0
파일: altdemo.py 프로젝트: pganti/micheles
 def _q_index(self):
     content = htmltext('')
     if not get_user():
         content += htmltext('<p>%s</p>' % href('login', 'login'))
     else:
         content += htmltext(
             '<p>Hello, %s.</p>') % get_user()
         content += htmltext('<p>%s</p>' % href('logout', 'logout'))
     sessions = get_session_manager().items()
     if sessions:
         sessions.sort()
         content += htmltext('<table><tr>'
                             '<th></th>'
                             '<th>Session</th>'
                             '<th>User</th>'
                             '<th>Number of Requests</th>'
                             '</tr>')
         this_session = get_session()
         for index, (id, session) in enumerate(sessions):
             if session is this_session:
                 formatted_id = htmltext(
                     '<span style="font-weight:bold">%s</span>' % id)
             else:
                 formatted_id = id
             content += htmltext(
                 '<tr><td>%s</td><td>%s</td><td>%s</td><td>%d</td>' % (
                 index,
                 formatted_id,
                 session.user or htmltext("<em>None</em>"),
                 session.num_requests))
         content += htmltext('</table>')
     return format_page("Quixote Session Management Demo", content)
예제 #9
0
    def logoutfail(self):
        """
        Expire the session, raise PublishException.

        Effect: no log out.
        """
        session_manager = get_session_manager()
        session_manager.expire_session()
        raise Exception("oops.")
예제 #10
0
    def logout(self):
        """
        Expire the session, redirect back to index page.
        """
        # expire session
        session_manager = get_session_manager()
        session_manager.expire_session()

        # redirect to index page.
        return redirect(get_path(1) + '/')
예제 #11
0
파일: kind.py 프로젝트: AZRMAK/AZRMAK
 def logout(self):
     get_response().expire_cookie('user',path='/')
     get_session_manager().expire_session()
     body = Template.Kind_Body % (Template.Kind_Top,"Has logout!","")
     html = Template.HTML % ("Logout",body)
     return html