From e74e1fd67746e37a630a1c9f8251467ba4254508 Mon Sep 17 00:00:00 2001 From: "Kevin M. Rosenberg" Date: Wed, 16 Jul 2003 20:40:43 +0000 Subject: [PATCH] r5318: *** empty log message *** --- project.lisp | 22 ++++++++++------------ sessions.lisp | 26 +++++++++++++++----------- 2 files changed, 25 insertions(+), 23 deletions(-) diff --git a/project.lisp b/project.lisp index ac0e5a8..cc26b27 100644 --- a/project.lisp +++ b/project.lisp @@ -7,7 +7,7 @@ ;;;; Programmer: Kevin M. Rosenberg ;;;; Date Started: July 2003 ;;;; -;;;; $Id: project.lisp,v 1.1 2003/07/16 16:02:21 kevin Exp $ +;;;; $Id: project.lisp,v 1.2 2003/07/16 20:40:43 kevin Exp $ ;;;; ;;;; This file and Wol are Copyright (c) 2001-2003 by Kevin M. Rosenberg ;;;; ************************************************************************* @@ -90,16 +90,17 @@ (string= (request-raw-uri req) (project-prefix (entity-project ent)))) +(defun redirect-entity (page ent) + (redirect-to-location + (format nil "~A~A" (project-prefix (entity-project ent)) page))) + (defun dispatch-request (req) (let ((ent (find-entity-for-request req))) (when ent (let ((proj (entity-project ent))) (if (is-index-request req ent) (progn - (redirect-to-location - (format nil "~A~A" - (project-prefix proj) - (project-index proj))) + (redirect-entity (project-index proj) ent) t) (progn (request-decompile-uri req ent) @@ -133,9 +134,6 @@ (nth-value 0 (gethash (request-page req) (project-hash-map (entity-project ent))))) -(defun action-redirect (page req ent) - (cmsg "redirect to ~A" page)) - (defun handle-request (handler req ent) (typecase handler (null @@ -145,14 +143,14 @@ (not (fboundp handler))) (cmsg "handler given a symbol without a function ~S" handler) (return-from handle-request nil)) - (let ((res (funcall handler req ent))) - (typecase res + (let ((next-page (funcall handler req ent))) + (typecase next-page (string - (action-redirect res req ent)) + (redirect-entity next-page ent)) (null t) (t - (cmsg "handler should return nil or a string")))) + (cmsg "handler should return nil or a string, not ~S" next-page)))) t) (string (cmsg "string handler not supported: ~A" handler) diff --git a/sessions.lisp b/sessions.lisp index b5bc559..045d0dd 100644 --- a/sessions.lisp +++ b/sessions.lisp @@ -7,7 +7,7 @@ ;;;; Programmer: Kevin M. Rosenberg ;;;; Date Started: July 2003 ;;;; -;;;; $Id: sessions.lisp,v 1.2 2003/07/16 16:40:35 kevin Exp $ +;;;; $Id: sessions.lisp,v 1.3 2003/07/16 20:40:43 kevin Exp $ ;;;; ;;;; This file and Wol are Copyright (c) 2003 by Kevin M. Rosenberg ;;;; ************************************************************************* @@ -22,7 +22,7 @@ "Find or make websession for key" (let ((sessions (sessions (session-master (entity-project ent))))) ;; if sessions doesn't exist, then project is not session enabled - (when session + (when sessions (cond ((null key) (make-websession req ent method)) @@ -76,15 +76,19 @@ collect s)) (defun all-sessions (&aux s) - (dolist (p *active-projects* s) - (let ((sm (session-master p)) - (sessions (when sm (sessions sm)))) - (when sessions - (maphash - (lambda (k v) - (declare (ignore k)) - (push (cons v p) s)) - sessions))))) + (maphash + (lambda (name proj) + (declare (ignore name)) + (let* ((sm (session-master proj)) + (sessions (when sm (sessions sm)))) + (when sessions + (maphash + (lambda (k v) + (declare (ignore k)) + (push (cons v proj) s)) + sessions)))) + *active-projects*) + s) (defmethod flush-expired (s) (let ((sessions (sessions (session-master (cdr s))))) -- 2.34.1