Hi Jim!
On Thu, 22 Dec 2005 07:11:18 -0700 (MST), Jim Prewett download@hpc.unm.edu wrote:
I've been pumping my co-worker, Jared, for information on dynamic websites. Jared is the primary author of our trouble-ticket/accounting/inventory/testing/everything-but-the-kitchen-sink web application called AIRS. AIRS is a Perl/Mason/MySQL based application. (its on Sourceforge if you ever something like that FWIW)
Jared was telling me that in AIRS, one of the tricks they do to ensure that a user is logged in with a valid session is to have what Jared calls a "default handler" which is invoked with every page (by Mason apparently). I guess it serves to validate anything you need validated before a page is displayed; Jared notes that it can be used to temporarily "hijack" the functionality of the page (so, in AIRS's case, the list-ticket page will display the list of tickets to a logged in user, but a user without a valid session will be sent to the login page and after being successfully logged in, she will be shown the list of tickets).
Does TBNL support anything like this "out of the box"? If not, do you have any thoughts on how one might implement such a feature? Would you, maybe, define a macro like (with-valid-session ... ) that would be called inside of each function that spits back a webpage?
I like the idea, but i'm not necessarily after a 1:1 mapping to the concepts in Mason, I just want to implement the general idea.
Generally, I think that questions like these are better asked on the TBNL mailing list (on Cc now, you need to be subscribed to post something). Other users might already have a solution for this and people who have similar questions can later scan the archives.
No, TBNL doesn't have this out of the box but it should be flexible enough to add whatever scheme you like. I myself usually use macros like WITH-VALID-SESSION, yes.
Cheers, Edi.
On Thu, 22 Dec 2005 07:11:18 -0700 (MST), Jim Prewett download@hpc.unm.edu wrote:
Jared was telling me that in AIRS, one of the tricks they do to ensure that a user is logged in with a valid session is to have what Jared calls a "default handler" which is invoked with every page (by Mason apparently). I guess it serves to validate anything you need
You could use a dispatch function as the first entry in the tbnl:*dispatch-table* When everything is OK it should return NIL and the other dispatchers can see if they have work to do.
Regards, Stefan
On 2005-12-22 19:06:55, Stefan Scholl wrote:
You could use a dispatch function as the first entry in the tbnl:*dispatch-table* When everything is OK it should return NIL and the other dispatchers can see if they have work to do.
By the way: This could be used to initialize a database connection for CLSQL. When you call CLSQL:CONNECT CLSQL:*DEFAULT-DATABASE* should be set in the _current_ process/thread in most of the sensible implementations, am I right?
Background: You can't share a connection across multiple processes/threads.
On Tue, 27 Dec 2005 19:10:27 +0100, Stefan Scholl stesch@no-spoon.de wrote:
By the way: This could be used to initialize a database connection for CLSQL. When you call CLSQL:CONNECT CLSQL:*DEFAULT-DATABASE* should be set in the _current_ process/thread in most of the sensible implementations, am I right?
Background: You can't share a connection across multiple processes/threads.
Yeah, I think you are right. You could use CLSQL's pools or locks.
Cheers, Edi.