On 5/3/07, Daniel Gackle danielgackle@gmail.com wrote:
I'm curious: when you say "there are other ways to do it," what do you have in mind?
Dan
With this ugly bit of code. The debug-value macro is still nicer though :-)
(let ((saved-process-request #'hunchentoot::process-request) last-request last-session)
(defun request-sniffer (request) (setf last-request request last-session *session*) (values))
(defun enable-debug-mode () (push #'request-sniffer *dispatch-table*) (setf (fdefinition 'hunchentoot::process-request) #'(lambda (&rest args) (prog1 (apply saved-process-request args) (setq *request* last-request *session* last-session)))))
(defun disable-debug-mode () (makunbound '*request*) (makunbound '*session*) (setf last-request nil last-session nil *dispatch-table* (delete #'request-sniffer *dispatch-table*) (fdefinition 'hunchentoot::process-request) saved-process-request)))