From sheila at thinkspot.net Mon May 12 13:32:34 2003 From: sheila at thinkspot.net (Sheila King) Date: Sun, 11 May 2003 20:32:34 -0700 Subject: [albatross-users] popview example from documentation Message-ID: <777814017.1052685154@localhost> Hello, I'm just familiarizing myself with Albatross. I've finished reading a large part of the documentation, and have tried out some of the examples. I have a question about the POPview1 example from the documentation. I don't completely get why it is using an image tag for the link to the "details" page for viewing individual messages...but getting past that... I am able to view the individual messages just fine with IE 5.0. In Mozilla 1.3 it does't work at all. Clicking on the image link to view the individual messages just returns me to the list page, repeatedly. Has anyone else encountered this behavior? It concerns me, as I will soon be working on a project which requires session management and login authentication, and cross-browser compatibility is very important. So, I'd like to understand what is going on here... -- Sheila King http://www.thinkspot.net/sheila/ http://www.k12groups.org From gnb at itga.com.au Mon May 12 13:38:16 2003 From: gnb at itga.com.au (Gregory Bond) Date: Mon, 12 May 2003 13:38:16 +1000 Subject: [albatross-users] popview example from documentation In-Reply-To: Your message of Sun, 11 May 2003 20:32:34 -0700. Message-ID: <200305120338.NAA24175@lightning.itga.com.au> > In Mozilla 1.3 it does't work at all. Clicking on the image link to view > the individual messages just returns me to the list page, repeatedly. I've seen something like this a few times, it usually happens after an Albatross application has raised an exception. Sometimes Mozilla gets very attached to a cookie, and will continue to return the old cookie on all subsequent requests even if the application asks to set a new cookie. This causes the app to continually go back to the top page. I've seen it happen on Netscape 6 as well. Closing and restarting the browser seems to fix it, assuming you are using the default session-only cookies (i.e. haven't set an expire time on them). Greg. From sheila at thinkspot.net Mon May 12 14:26:18 2003 From: sheila at thinkspot.net (Sheila King) Date: Sun, 11 May 2003 21:26:18 -0700 Subject: [albatross-users] popview example from documentation In-Reply-To: <200305120338.NAA24175@lightning.itga.com.au> References: <200305120338.NAA24175@lightning.itga.com.au> Message-ID: <781038413.1052688378@goddess> Thanks for the reply Greg... --On Monday, May 12, 2003 1:38 PM +1000 Gregory Bond wrote: >> In Mozilla 1.3 it does't work at all. Clicking on the image link to view >> the individual messages just returns me to the list page, repeatedly. > > I've seen something like this a few times, it usually happens after an > Albatross application has raised an exception. Sometimes Mozilla gets > very attached to a cookie, and will continue to return the old cookie on > all subsequent requests even if the application asks to set a new cookie. > This causes the app to continually go back to the top page. I've seen it > happen on Netscape 6 as well. > > Closing and restarting the browser seems to fix it, assuming you are > using the default session-only cookies (i.e. haven't set an expire time > on them). > > Greg. Well, the popview1 example uses the SimpleApp and SimpleAppContext mixins with the HiddenField sessions, and I haven't modified the example at all, except for paths to my executable and my pop server's name. So far as I am able to determine (but I'm new to Albatross), this example is using the default sessions without setting a default time out. I closed down all instances of my Mozilla 1.3 browser and went to my popview1 example on my server, and logged in. (The previous time I'd tried this I got the password wrong on the first attempt, so your examplanation about having an exception that then, for the rest of the session causes problems, made sense...but these last two times I've tried this, I've made my log ins error-free...?) I open a fresh browser instance, with no previous instances running. I go to the popview.py script. I log in without errors. I view the message list. I click on a "View" img tag to go to the individual message. No dice. Just keeps returning me to the list page. I open the "Edit Preferences" menu in Mozilla and look at my "Manage Cookies" option. Nowhere in there can I find any evidence of a cookie corresponding to this session. Even immediately after clicking the "view details" img/link. Also, no cookie in evidence even immediately after completing a successful log in screen. I also tried in mozilla 1.0. Same results. I guess I am going to have to try to figure out how to do some sort of logging or debugging output, as at this moment I'm not getting any information from the process as to what is causing this problem. :\ Since sessions and stateful apps and cookies are fairly unfamiliar territory for me (in practice, not in concept), I would appreciate any additional feedback that anyone might have. BTW, I'm using Win2K on both of the computers (clients) that I have tried this on, if that makes any difference. Python 2.2.2 on the Linux (RH) server and when I installed Albatross and ran the test, it gave me all (was it 83 or 81?) tests back with no errors. -- Sheila King http://www.thinkspot.net/sheila/ http://www.k12groups.org From djc at object-craft.com.au Mon May 12 15:02:26 2003 From: djc at object-craft.com.au (Dave Cole) Date: 12 May 2003 15:02:26 +1000 Subject: [albatross-users] popview example from documentation In-Reply-To: <777814017.1052685154@localhost> References: <777814017.1052685154@localhost> Message-ID: >>>>> "Sheila" == Sheila King writes: Sheila> Hello, I'm just familiarizing myself with Albatross. I've Sheila> finished reading a large part of the documentation, and have Sheila> tried out some of the examples. Sheila> I have a question about the POPview1 example from the Sheila> documentation. Sheila> I don't completely get why it is using an image tag for the Sheila> link to the "details" page for viewing individual Sheila> messages...but getting past that... Since the session is purely client side we need the client to send the session when a message is selected. The cheap trick used in the example is to place each message in the list in a form. When the image input is clicked the __albstate__ will be sent as part of the browser submission. This could have been done with some Javascript: View Sheila> I am able to view the individual messages just fine with IE Sheila> 5.0. Sheila> In Mozilla 1.3 it does't work at all. Clicking on the image Sheila> link to view the individual messages just returns me to the Sheila> list page, repeatedly. Odd. The only time I have ever seen this is when I fiddled around with the application and started using an Application/Execution context class that assumed the session was somewhere else. Sheila> Has anyone else encountered this behavior? It concerns me, as Sheila> I will soon be working on a project which requires session Sheila> management and login authentication, and cross-browser Sheila> compatibility is very important. So, I'd like to understand Sheila> what is going on here... Make sure that you place important values in underscore prefixed variables. The request merging will refuse to place browser supplied values prefixed by '_' in ctx.locals. - Dave -- http://www.object-craft.com.au From sheila at thinkspot.net Tue May 13 05:48:32 2003 From: sheila at thinkspot.net (Sheila King) Date: Mon, 12 May 2003 12:48:32 -0700 Subject: [albatross-users] popview example from documentation In-Reply-To: References: <777814017.1052685154@localhost> Message-ID: <836372560.1052743712@goddess> --On Monday, May 12, 2003 3:02 PM +1000 Dave Cole wrote: >>>>>> "Sheila" == Sheila King writes: > Sheila> I am able to view the individual messages just fine with IE > Sheila> 5.0. > > Sheila> In Mozilla 1.3 it does't work at all. Clicking on the image > Sheila> link to view the individual messages just returns me to the > Sheila> list page, repeatedly. > > Odd. The only time I have ever seen this is when I fiddled around > with the application and started using an Application/Execution > context class that assumed the session was somewhere else. After thinking about this a bit more last night, it occurs to me that there should be no "stored sessions" except in the Hidden input fields in the forms? i.e. no cookies are used in example 1 of popview.py, it uses the Hidden input form fields for maintaining state information? So, if that is the case, how could the sessions be stored "somewhere else"? I will work on this a bit more today and see what I can figure out. :\ > Sheila> Has anyone else encountered this behavior? It concerns me, as > Sheila> I will soon be working on a project which requires session > Sheila> management and login authentication, and cross-browser > Sheila> compatibility is very important. So, I'd like to understand > Sheila> what is going on here... > > Make sure that you place important values in underscore prefixed > variables. The request merging will refuse to place browser supplied > values prefixed by '_' in ctx.locals. > > - Dave Great. Thanks for the additional tips. I will keep them in mind. -- Sheila King http://www.thinkspot.net/sheila/ http://www.k12groups.org From djc at object-craft.com.au Tue May 13 09:26:41 2003 From: djc at object-craft.com.au (Dave Cole) Date: 13 May 2003 09:26:41 +1000 Subject: [albatross-users] popview example from documentation In-Reply-To: <836372560.1052743712@goddess> References: <777814017.1052685154@localhost> <836372560.1052743712@goddess> Message-ID: >>>>> "Sheila" == Sheila King writes: Sheila> In Mozilla 1.3 it does't work at all. Clicking on the image Sheila> link to view the individual messages just returns me to the Sheila> list page, repeatedly. >> Odd. The only time I have ever seen this is when I fiddled around >> with the application and started using an Application/Execution >> context class that assumed the session was somewhere else. Sheila> After thinking about this a bit more last night, it occurs to Sheila> me that there should be no "stored sessions" except in the Sheila> Hidden input fields in the forms? i.e. no cookies are used in Sheila> example 1 of popview.py, it uses the Hidden input form fields Sheila> for maintaining state information? That is correct. The cookies are used for server side sessions. Sheila> So, if that is the case, how could the sessions be stored Sheila> "somewhere else"? Sheila> I will work on this a bit more today and see what I can figure Sheila> out. :\ Another of the (probably infinite) ways to make things not work is to do this:
Since the __albstate__ functionality is implemented in the tag your client side sessions will never make it to the browser. - Dave -- http://www.object-craft.com.au From andrewm at object-craft.com.au Tue May 13 10:35:02 2003 From: andrewm at object-craft.com.au (Andrew McNamara) Date: Tue, 13 May 2003 10:35:02 +1000 Subject: [albatross-users] popview example from documentation In-Reply-To: Message from Dave Cole of "12 May 2003 15:02:26 +1000." References: <777814017.1052685154@localhost> Message-ID: <20030513003502.D3D463C045@coffee.object-craft.com.au> >Sheila> I don't completely get why it is using an image tag for the >Sheila> link to the "details" page for viewing individual >Sheila> messages...but getting past that... > >Since the session is purely client side we need the client to send the >session when a message is selected. The cheap trick used in the >example is to place each message in the list in a form. When the >image input is clicked the __albstate__ will be sent as part of the >browser submission. > >This could have been done with some Javascript: > > > View > > To elaborate, the user session context (their pop username and password) are saved in a hidden field in the form. This means that we need to have the browser submit the form, or we'd lose the session context. A normal tag doesn't submit the form - so we used an . We could have used an , but the image button tends to look better. BTW, popview1 places the inside an - this means the hidden session fields get repeated for every message in the mailbox (have a look at the generated source). You probably wouldn't want to do this in a real application (although for small/simple applications it's okay). Instead, you might use the "nameexpr" attribute (rather than "name") to give each button a unique name. >Sheila> In Mozilla 1.3 it does't work at all. Clicking on the image >Sheila> link to view the individual messages just returns me to the >Sheila> list page, repeatedly. > >Odd. The only time I have ever seen this is when I fiddled around >with the application and started using an Application/Execution >context class that assumed the session was somewhere else. The trick would be to see what the browser is actually submitting to albatross. If you look at the Request class in albatross's cgiapp.py, you'll see it uses Python's cgi.FieldStorage class - you could add some debug to Request.__init__ to dump the contents of self.__fields to stderr. >Sheila> Has anyone else encountered this behavior? It concerns me, as >Sheila> I will soon be working on a project which requires session >Sheila> management and login authentication, and cross-browser >Sheila> compatibility is very important. So, I'd like to understand >Sheila> what is going on here... Yes - we'd also be interested in what's going on... 8-) >Make sure that you place important values in underscore prefixed >variables. The request merging will refuse to place browser supplied >values prefixed by '_' in ctx.locals. What Dave is saying here is that ctx.locals contains both the user session data as well as fields from submitted forms. You'll quickly realise that a hacker could alter variables other than those you intended by hand crafting a fake form submission. To counter this, any form field that starts with an underscore is not merged into ctx.locals, meaning that if you give any security critical session variables a leading underscore, they can't be overwritten by the form fields. -- Andrew McNamara, Senior Developer, Object Craft http://www.object-craft.com.au/ From sheila at thinkspot.net Tue May 13 11:36:27 2003 From: sheila at thinkspot.net (Sheila King) Date: Mon, 12 May 2003 18:36:27 -0700 Subject: [albatross-users] popview example from documentation In-Reply-To: <20030513003502.D3D463C045@coffee.object-craft.com.au> References: <777814017.1052685154@localhost> <20030513003502.D3D463C045@coffee.object-craft.com.au> Message-ID: <857247106.1052764587@goddess> First of all, I want to thank Andrew for the additional elaboration provided. That helps a great deal. --On Tuesday, May 13, 2003 10:35 AM +1000 Andrew McNamara wrote: >> Sheila> In Mozilla 1.3 it does't work at all. Clicking on the image >> Sheila> link to view the individual messages just returns me to the >> Sheila> list page, repeatedly. >> >> Odd. The only time I have ever seen this is when I fiddled around >> with the application and started using an Application/Execution >> context class that assumed the session was somewhere else. > > The trick would be to see what the browser is actually submitting to > albatross. If you look at the Request class in albatross's cgiapp.py, > you'll see it uses Python's cgi.FieldStorage class - you could add some > debug to Request.__init__ to dump the contents of self.__fields to stderr. I'm working on collecting such information. However, in the meantime, examining the error logs for the site, I see the following error in the error logs: [Mon May 12 21:31:17 2003] [error] [client x.x.x.x] File does not exist: /big/dom/xexample/www/icons/generic.gif I'm guessing that this is why it isn't working. Will stew over it a bit more. > -- > Andrew McNamara, Senior Developer, Object Craft > http://www.object-craft.com.au/ -- Sheila King http://www.thinkspot.net/sheila/ http://www.k12groups.org From sheila at thinkspot.net Tue May 13 11:40:19 2003 From: sheila at thinkspot.net (Sheila King) Date: Mon, 12 May 2003 18:40:19 -0700 Subject: [albatross-users] popview example from documentation In-Reply-To: <857247106.1052764587@goddess> References: <777814017.1052685154@localhost> <20030513003502.D3D463C045@coffee.object-craft.com.au> <857247106.1052764587@goddess> Message-ID: <857479740.1052764819@goddess> --On Monday, May 12, 2003 6:36 PM -0700 Sheila King wrote: > --On Tuesday, May 13, 2003 10:35 AM +1000 Andrew McNamara > wrote: > >>> Sheila> In Mozilla 1.3 it does't work at all. Clicking on the image >>> Sheila> link to view the individual messages just returns me to the >>> Sheila> list page, repeatedly. >>> >>> Odd. The only time I have ever seen this is when I fiddled around >>> with the application and started using an Application/Execution >>> context class that assumed the session was somewhere else. >> >> The trick would be to see what the browser is actually submitting to >> albatross. If you look at the Request class in albatross's cgiapp.py, >> you'll see it uses Python's cgi.FieldStorage class - you could add some >> debug to Request.__init__ to dump the contents of self.__fields to >> stderr. > > I'm working on collecting such information. However, in the meantime, > examining the error logs for the site, I see the following error in the > error logs: > > [Mon May 12 21:31:17 2003] [error] [client x.x.x.x] File does not exist: > /big/dom/xexample/www/icons/generic.gif > > I'm guessing that this is why it isn't working. Will stew over it a bit > more. For additional elaboration, here is a sample of one of the forms from the list page:
> -- > Sheila King > http://www.thinkspot.net/sheila/ > http://www.k12groups.org > > _______________________________________________ > Albatross-users mailing list > Albatross-users at object-craft.com.au > https://www.object-craft.com.au/cgi-bin/mailman/listinfo/albatross-users > -- Sheila King http://www.thinkspot.net/sheila/ http://www.k12groups.org From sheila at thinkspot.net Tue May 13 12:29:19 2003 From: sheila at thinkspot.net (Sheila King) Date: Mon, 12 May 2003 19:29:19 -0700 Subject: [albatross-users] popview example from documentation In-Reply-To: <857479740.1052764819@goddess> References: <777814017.1052685154@localhost> <20030513003502.D3D463C045@coffee.object-craft.com.au> <857247106.1052764587@goddess> <857479740.1052764819@goddess> Message-ID: <860419918.1052767759@goddess> Problem Solved. Explanation below... --On Monday, May 12, 2003 6:40 PM -0700 Sheila King wrote: > --On Monday, May 12, 2003 6:36 PM -0700 Sheila King > wrote: > >> --On Tuesday, May 13, 2003 10:35 AM +1000 Andrew McNamara >> wrote: >> >>>> Sheila> In Mozilla 1.3 it does't work at all. Clicking on the image >>>> Sheila> link to view the individual messages just returns me to the >>>> Sheila> list page, repeatedly. >>>> >>>> Odd. The only time I have ever seen this is when I fiddled around >>>> with the application and started using an Application/Execution >>>> context class that assumed the session was somewhere else. >>> >>> The trick would be to see what the browser is actually submitting to >>> albatross. If you look at the Request class in albatross's cgiapp.py, >>> you'll see it uses Python's cgi.FieldStorage class - you could add some >>> debug to Request.__init__ to dump the contents of self.__fields to >>> stderr. >> >> I'm working on collecting such information. However, in the meantime, >> examining the error logs for the site, I see the following error in the >> error logs: >> >> [Mon May 12 21:31:17 2003] [error] [client x.x.x.x] File does not exist: >> /big/dom/xexample/www/icons/generic.gif >> >> I'm guessing that this is why it isn't working. Will stew over it a bit >> more. To solve this problem, I simply replaced the image src path/file in the form tag with an image path/file that actually exists on my server. After doing this, the application worked properly. Skimming through the documentation for this example, I do not see any caution about this problem. Is this something that is obvious and I should have known? (I did know to adjust the shebang line path to my executable python binary, and I did know to change the pop host to an actual pop host.) Since no one mentioned this possibility, it makes me think this is the first time it has come up on the list. Apparently the 404 error for the non-existent image file doesn't bother IE at all, but for Mozilla, it causes the process to fail. Kind of important?? -- Sheila King http://www.thinkspot.net/sheila/ http://www.k12groups.org > For additional elaboration, here is a sample of one of the forms from the > list page: > >
type="image" src="/icons/generic.gif" border="0" name="detail"> type="hidden" name="msgnum" value="2"> name="__albform__" > value="eJwL5XC/zO23v5j3efSGTJVF/bWFjBqhbLnF6XmluYVM3gyhbCmpJYmZOYXM3gyleg > CN GQ+3 > "> > value="eJzb7Ti99+MbwciK1Yd2zj86t7y2kFEjlKO0OLUoLzE3tZAplCU3sSSjkDmUIz6+ID > E9 NT6+kCWU > JSezuKSQNZStILG4uDylkC2UE6TKKD3fpLSQvVQPAO5xH+o= > "> >
> >> -- >> Sheila King >> http://www.thinkspot.net/sheila/ >> http://www.k12groups.org From andrewm at object-craft.com.au Wed May 14 16:33:48 2003 From: andrewm at object-craft.com.au (Andrew McNamara) Date: Wed, 14 May 2003 16:33:48 +1000 Subject: [albatross-users] popview example from documentation In-Reply-To: Message from Sheila King of "Mon, 12 May 2003 19:29:19 MST." <860419918.1052767759@goddess> References: <777814017.1052685154@localhost> <20030513003502.D3D463C045@coffee.object-craft.com.au> <857247106.1052764587@goddess> <857479740.1052764819@goddess> <860419918.1052767759@goddess> Message-ID: <20030514063348.568FB3C045@coffee.object-craft.com.au> >To solve this problem, I simply replaced the image src path/file in the >form tag with an image path/file that actually exists on my server. After >doing this, the application worked properly. Certainly a strange effect. >Skimming through the documentation for this example, I do not see any >caution about this problem. Is this something that is obvious and I should >have known? No - it's a bug in the samples installation process that we need to fix. Thanks for spending the time to track it down. >(I did know to adjust the shebang line path to my executable >python binary, and I did know to change the pop host to an actual pop >host.) In an ideal world, you shouldn't have had to do that either. If distutils can get it right, then so should our installer. >Since no one mentioned this possibility, it makes me think this is >the first time it has come up on the list. Apparently the 404 error for the >non-existent image file doesn't bother IE at all, but for Mozilla, it >causes the process to fail. Kind of important?? It smells like a browser bug to me, but obviously we should be installing the image. -- Andrew McNamara, Senior Developer, Object Craft http://www.object-craft.com.au/ From sheila at thinkspot.net Thu May 15 10:01:03 2003 From: sheila at thinkspot.net (Sheila King) Date: Wed, 14 May 2003 17:01:03 -0700 Subject: [albatross-users] popview example from documentation In-Reply-To: <20030514063348.568FB3C045@coffee.object-craft.com.au> References: <777814017.1052685154@localhost> <20030513003502.D3D463C045@coffee.object-craft.com.au> <857247106.1052764587@goddess> <857479740.1052764819@goddess> <860419918.1052767759@goddess> <20030514063348.568FB3C045@coffee.object-craft.com.au> Message-ID: <9101327.1052931663@SHEILA-LAPTOP> --On Wednesday, May 14, 2003 4:33 PM +1000 Andrew McNamara wrote: >> To solve this problem, I simply replaced the image src path/file in the >> form tag with an image path/file that actually exists on my server. >> After doing this, the application worked properly. > > Certainly a strange effect. > >> Skimming through the documentation for this example, I do not see any >> caution about this problem. Is this something that is obvious and I >> should have known? > > No - it's a bug in the samples installation process that we need to fix. > Thanks for spending the time to track it down. No problem. >> (I did know to adjust the shebang line path to my executable >> python binary, and I did know to change the pop host to an actual pop >> host.) > > In an ideal world, you shouldn't have had to do that either. If distutils > can get it right, then so should our installer. Although I used disutils to install the albatross package, I have not used the Installer programs for installing the various examples, but have instead placed them manually into the directories where I would like to run them. I have an innate distrust of installer processes that don't ask me specifically where I want the stuff installed. Anyhow, I did search the entire /samples directory, and no generic.gif file is included in the samples...(as you know) Additionally, figuring out how to place the files manually has also helped me to understand to some extent the way the whole albatross package works. >> Since no one mentioned this possibility, it makes me think this is >> the first time it has come up on the list. Apparently the 404 error for >> the non-existent image file doesn't bother IE at all, but for Mozilla, >> it causes the process to fail. Kind of important?? > > It smells like a browser bug to me, but obviously we should be installing > the image. OK, I will keep that in mind. Thanks for the support and feedback. -- Sheila King http://www.thinkspot.net/sheila/ http://www.k12groups.org > -- > Andrew McNamara, Senior Developer, Object Craft > http://www.object-craft.com.au/ From fabbe at paniq.net Sat May 17 03:35:26 2003 From: fabbe at paniq.net (Fabian Fagerholm) Date: 16 May 2003 20:35:26 +0300 Subject: [albatross-users] Debian package of Albatross Message-ID: <1053106526.25320.4.camel@kernel> Hi everyone! I've packaged Albatross for Debian. The packaging is still very preliminary, but if you'd like to try it out, the (unofficial) .deb files are downloadable from http://people.paniq.net/~fabbe/debian/albatross/ Cheers, -- Fabian Fagerholm paniq.net From sheila at thinkspot.net Mon May 19 16:59:51 2003 From: sheila at thinkspot.net (Sheila King) Date: Sun, 18 May 2003 23:59:51 -0700 Subject: [albatross-users] Exception: set_page() passing wrong number of parameters to page_enter()? Message-ID: <1395112215.1053302391@goddess> Hello...so I am making further progress. Do have the most skeletal example of my own sometimes running. Here is the main application code, at the moment: ------------(begin code)-------------- #!/big/dom/xexample/bin/python from albatross import RandomModularSessionFileApp, SessionFileAppContext from albatross.cgiapp import Request class QAcontext(SessionFileAppContext): pass class QAapp(RandomModularSessionFileApp): def __init__(self): RandomModularSessionFileApp.__init__(self, base_url = 'adminmgr.py', page_path = '.', start_page = 'login', secret = 'secret', session_appid = 'myapp', session_dir = './sessions') def create_context(self): return QAcontext(self) if __name__ == '__main__': app = QAapp() app.run(Request()) ------------(end code)-------------- I really only have one page working right now, which is the start page (login) but was trying to add more pages to the app and this is when I encountered my problems. So long as the login.py module looks like this: ------------(begin code)-------------- def page_display(ctx): ctx.load_template('qaheader.html') ctx.run_template('login.html') def page_process(ctx): #ctx.set_page('myaccount') pass ------------(end code)-------------- The application will at least run and take me to the start page. However, if I move the comment symbol, and comment out the 'pass' statement, and try to enable the set_page statement, I get the following traceback: Template traceback (most recent call last): Traceback (most recent call last): File "/big/dom/xexample/lib/python2.2/site-packages/albatross/app.py", line 146, in run self.process_request(ctx) File "/big/dom/xexample/lib/python2.2/site-packages/albatross/randompage.py", line 61, in process_request return PageModuleMixin.process_request(self, ctx) File "/big/dom/xexample/lib/python2.2/site-packages/albatross/app.py", line 298, in process_request func(ctx) File "login.py", line 6, in page_process ctx.set_page('myaccount') File "/big/dom/xexample/lib/python2.2/site-packages/albatross/app.py", line 87, in set_page self.app.page_enter(self, args) TypeError: page_enter() takes exactly 2 arguments (3 given) I am completely at a loss as to how I could be passing the wrong number of parameters, as I have reviewed all of the set_page statements in the sample code included with the Albatross package, and they all have the same syntax. Sure would appreciate a clue here. Thanks, -- Sheila King http://www.thinkspot.net/sheila/ http://www.k12groups.org From sheila at thinkspot.net Tue May 20 06:10:37 2003 From: sheila at thinkspot.net (Sheila King) Date: Mon, 19 May 2003 13:10:37 -0700 Subject: [albatross-users] Exception: set_page() passing wrong number of parameters to page_enter()? In-Reply-To: <1395112215.1053302391@goddess> References: <1395112215.1053302391@goddess> Message-ID: <1901374.1053349837@SHEILA-LAPTOP> --On Sunday, May 18, 2003 11:59 PM -0700 Sheila King wrote: ...... > However, if I move the comment symbol, and comment out the 'pass' > statement, and try to enable the set_page statement, I get the following > traceback: > > Template traceback (most recent call last): > > Traceback (most recent call last): > File "/big/dom/xexample/lib/python2.2/site-packages/albatross/app.py", > line 146, in run > self.process_request(ctx) > File > "/big/dom/xexample/lib/python2.2/site-packages/albatross/randompage.py", > line 61, in process_request > return PageModuleMixin.process_request(self, ctx) > File "/big/dom/xexample/lib/python2.2/site-packages/albatross/app.py", > line 298, in process_request > func(ctx) > File "login.py", line 6, in page_process > ctx.set_page('myaccount') > File "/big/dom/xexample/lib/python2.2/site-packages/albatross/app.py", > line 87, in set_page > self.app.page_enter(self, args) > TypeError: page_enter() takes exactly 2 arguments (3 given) > > I am completely at a loss as to how I could be passing the wrong number > of parameters, as I have reviewed all of the set_page statements in the > sample code included with the Albatross package, and they all have the > same syntax. Trying to do SOMETHING to close in on this error message, I made the following modifications to the app.py file, just before line 87 where the error was occurring when the call to page_enter occurs: def set_page(self, name, *args): if self.locals.__page__ \ and self.locals.__page__ != name: self.app.load_page(self) self.app.page_leave(self) self.locals.__page__ = name self.app.load_page(self) ######## debugging code ######### f = open("alb-debug.txt", "w") f.write("*args is %s" % str(args)) f.close() ####### end debugging code ####### self.app.page_enter(self, args) Then I look in the alb-debug.txt file after running the application and getting the same traceback. Contents of the file are as follows: *args is () exactly, mind you. No leading or trailing whitespace of any type. Now the call where this occurs is: self.app.page_enter(self, args) so the only way I can see three parameters being passed here, is if the page_enter function is interpreting '(' as one argument, and ')' as a second argument. This is very bizarre. :\ -- Sheila King http://www.thinkspot.net/sheila/ http://www.k12groups.org From danb at champonline.com Tue May 20 06:46:04 2003 From: danb at champonline.com (Dan Bergan) Date: Mon, 19 May 2003 15:46:04 -0500 Subject: [albatross-users] Exception: set_page() passing wrong number of parameters to page_enter()? In-Reply-To: <1395112215.1053302391@goddess> References: <1395112215.1053302391@goddess> Message-ID: <3EC9428C.6050702@champonline.com> Sheila King wrote: > def page_process(ctx): > #ctx.set_page('myaccount') > pass Sheila, I seem to remember having a similar problem when I was trying to use RandomModularSessionFileApp. It's been a while, but I think instead of using "ctx.set_page()" you should be using "ctx.redirect()". I'm sure you will get a more detailed explanation from one of the experts, but in the meantime give the redirect a try! Dan Bergan From gnb at itga.com.au Tue May 20 09:29:11 2003 From: gnb at itga.com.au (Gregory Bond) Date: Tue, 20 May 2003 09:29:11 +1000 Subject: [albatross-users] Exception: set_page() passing wrong number of parameters to page_enter()? In-Reply-To: Your message of Mon, 19 May 2003 13:10:37 -0700. Message-ID: <200305192329.JAA24753@lightning.itga.com.au> > self.app.page_enter(self, args) You are forgetting the implicit hidden "self" argument that all member functions get. So this is a call to the page_enter() routine of the app object. The args are the app object, an app_context object ("self" in the above code) and the empty tuple () in args. [This is a python-ism, not an albatross-ism.] Which doesn't help to explain your unexpected exception, tho. I've not used Random apps nor Modular apps, let alone RandomModular apps! Are you sure you are using a ModularApp and not a SimpleApp? Are you using the correct AppContext type? From andrewm at object-craft.com.au Tue May 20 10:07:18 2003 From: andrewm at object-craft.com.au (Andrew McNamara) Date: Tue, 20 May 2003 10:07:18 +1000 Subject: [albatross-users] Exception: set_page() passing wrong number of parameters to page_enter()? In-Reply-To: Message from Dan Bergan of "Mon, 19 May 2003 15:46:04 EST." <3EC9428C.6050702@champonline.com> References: <1395112215.1053302391@goddess> <3EC9428C.6050702@champonline.com> Message-ID: <20030520000718.8A3B93C045@coffee.object-craft.com.au> >> def page_process(ctx): >> #ctx.set_page('myaccount') >> pass > >I seem to remember having a similar problem when I was trying to use >RandomModularSessionFileApp. It's been a while, but I think instead of >using "ctx.set_page()" you should be using "ctx.redirect()". I'm sure >you will get a more detailed explanation from one of the experts, but in >the meantime give the redirect a try! I think Dan's right. There's a bug in RandomPageModuleMixin.page_enter, but ctx.redirect() is the only way to move around a RandomePage app currently. RandomPageModuleMixin.page_enter should be expecting a third argument, the tulple of optional args to set_page. -- Andrew McNamara, Senior Developer, Object Craft http://www.object-craft.com.au/ From djc at object-craft.com.au Tue May 20 11:44:44 2003 From: djc at object-craft.com.au (Dave Cole) Date: 20 May 2003 11:44:44 +1000 Subject: [albatross-users] Exception: set_page() passing wrong number of parameters to page_enter()? In-Reply-To: <20030520000718.8A3B93C045@coffee.object-craft.com.au> References: <1395112215.1053302391@goddess> <3EC9428C.6050702@champonline.com> <20030520000718.8A3B93C045@coffee.object-craft.com.au> Message-ID: >>>>> "Andrew" == Andrew McNamara writes: >>> def page_process(ctx): #ctx.set_page('myaccount') pass >> I seem to remember having a similar problem when I was trying to >> use RandomModularSessionFileApp. It's been a while, but I think >> instead of using "ctx.set_page()" you should be using >> "ctx.redirect()". I'm sure you will get a more detailed >> explanation from one of the experts, but in the meantime give the >> redirect a try! Andrew> I think Dan's right. There's a bug in Andrew> RandomPageModuleMixin.page_enter, but ctx.redirect() is the Andrew> only way to move around a RandomePage app currently. The page_enter() method should probably be renamed as it is not intended to be called via ctx.set_page(). In a RandomPage application the browser controls which page the application will display. The application just obeys the browser and loads the requested page. ctx.set_page() does not make sense in this type of application. http://www.object-craft.com.au/projects/albatross/albatross/mixin-randpage-module.html For RandomPageModuleMixin the page_enter() gets called every time a page module is loaded. For non-random page application, the page_enter() function is called when the application changes to a new page via ctx.set_page() http://www.object-craft.com.au/projects/albatross/albatross/mixin-page-module.html Andrew> RandomPageModuleMixin.page_enter should be expecting a third Andrew> argument, the tulple of optional args to set_page. I think we should solve the confusion by renaming the current page_enter() method to something like page_load(). Then we would change page_enter() to raise an exception telling you not to use ctx.set_page() for random page applications. - Dave -- http://www.object-craft.com.au From djc at object-craft.com.au Tue May 20 11:45:57 2003 From: djc at object-craft.com.au (Dave Cole) Date: 20 May 2003 11:45:57 +1000 Subject: [albatross-users] Re: Debian package of Albatross In-Reply-To: <1053106526.25320.4.camel@kernel> References: <1053106526.25320.4.camel@kernel> Message-ID: >>>>> "Fabian" == Fabian Fagerholm writes: Fabian> Hi everyone! I've packaged Albatross for Debian. The Fabian> packaging is still very preliminary, but if you'd like to try Fabian> it out, the (unofficial) .deb files are downloadable from Fabian> http://people.paniq.net/~fabbe/debian/albatross/ That is excellent! It would be cool to get Albatross into Debian. - Dave -- http://www.object-craft.com.au From sheila at thinkspot.net Tue May 20 17:01:38 2003 From: sheila at thinkspot.net (Sheila King) Date: Tue, 20 May 2003 00:01:38 -0700 Subject: [albatross-users] Exception: set_page() passing wrong number of parameters to page_enter()? In-Reply-To: <3EC9428C.6050702@champonline.com> References: <1395112215.1053302391@goddess> <3EC9428C.6050702@champonline.com> Message-ID: <40962571.1053388898@SHEILA-LAPTOP> --On Monday, May 19, 2003 3:46 PM -0500 Dan Bergan wrote: > Sheila King wrote: > >> def page_process(ctx): >> # ctx.set_page('myaccount') >> pass > > Sheila, > > I seem to remember having a similar problem when I was trying to use > RandomModularSessionFileApp. It's been a while, but I think instead of > using "ctx.set_page()" you should be using "ctx.redirect()". I'm sure > you will get a more detailed explanation from one of the experts, but in > the meantime give the redirect a try! > OK, thanks Dan. I do see that on page 58 of the pdf manual, they are showing ctx.redirect for page processing in an example with a RandomPage module. OK, I have tried that now (it bothers me a bit, though, as I don't really want to be sending a 301 code to the browser for what is merely the results of processing a cgi request. :/ ). OK, so I have in the login.py page module the following: def page_display(ctx): ctx.load_template('commonmacros.html') ctx.run_template('login.html') def page_process(ctx): ctx.redirect_url('myaccount') (Mind you, that in a later version there will be much more to the page_process function, but for now I am merely trying to test out some things so keeping it simple.) And in the myaccount.py module I have this: def page_display(ctx): ctx.load_template('commonmacros.html') ctx.run_template('myaccount.html') And the app has login as the "start" page. But now when I go to the application, it jumps straight the the "myaccount" page, which I do not understand, as that is supposed to be called on "page_process" for login (the start page), and I figured that required using the submit button. But I never even get an opportunity to view the login page now, and press the submit button. It just jumps me straight to the myaccount page. Here is what I want to do: (1) I want "login" to be the start page. Whenever someone starts a new session or doesn't specify a page in the URL, they should end up there, at the "login" page. (I had this much working before I tried to add a second page.) (2) When the form on the "login" page is submitted, some processing will occur and if the login request is valid (which I will test for) then they will need to go to the "myaccount" page. Seemed to me that this needed to be in the page_process function for "login" module? Am I incorrect there? I was also having some macro errors with the myaccount page, but I just took the macros out, eventually, and put plain HTML into the myaccount.html page, to reduce at least one of the errors for now. -- Sheila King http://www.thinkspot.net/sheila/ http://www.k12groups.org From sheila at thinkspot.net Tue May 20 17:08:28 2003 From: sheila at thinkspot.net (Sheila King) Date: Tue, 20 May 2003 00:08:28 -0700 Subject: [albatross-users] Exception: set_page() passing wrong number of parameters to page_enter()? In-Reply-To: <200305192329.JAA24753@lightning.itga.com.au> References: <200305192329.JAA24753@lightning.itga.com.au> Message-ID: <41372019.1053389308@SHEILA-LAPTOP> --On Tuesday, May 20, 2003 9:29 AM +1000 Gregory Bond wrote: >> self.app.page_enter(self, args) > > You are forgetting the implicit hidden "self" argument that all member > functions get. Not at all. Please review the error message given. Two arguments expected. Three given. self = #1 if () represented a tuple, then that was only a second argument, and not three given. If ( ) represented two separate arguments (a '(' and a ')') then that was two arguments. I know it makes no sense for () to represent two arguments, but the error message made no sense to me so...grasping at anything. > So this is a call to the page_enter() routine of the app > object. The args are the app object, an app_context object ("self" in > the above code) and the empty tuple () in args. > > [This is a python-ism, not an albatross-ism.] Right. I'm aware of how class functions work. Course, I'm certainly capable of making a goof-up and forgetting about self. I just didn't this time. > > Which doesn't help to explain your unexpected exception, tho. I've not > used Random apps nor Modular apps, let alone RandomModular apps! > > Are you sure you are using a ModularApp and not a SimpleApp? Are you > using the correct AppContext type? Yes. I showed the complete app in the originating post in this thread. I am using the correct class app and context (I believe). At least, no one else has called me on it in this discussion. -- Sheila King http://www.thinkspot.net/sheila/ http://www.k12groups.org From sheila at thinkspot.net Tue May 20 17:23:48 2003 From: sheila at thinkspot.net (Sheila King) Date: Tue, 20 May 2003 00:23:48 -0700 Subject: [albatross-users] Exception: set_page() passing wrong number of parameters to page_enter()? In-Reply-To: References: <1395112215.1053302391@goddess> <3EC9428C.6050702@champonline.com> <20030520000718.8A3B93C045@coffee.object-craft.com.au> Message-ID: <42292563.1053390228@SHEILA-LAPTOP> --On Tuesday, May 20, 2003 11:44 AM +1000 Dave Cole wrote: > In a RandomPage application the browser controls which page the > application will display. The application just obeys the browser and > loads the requested page. ctx.set_page() does not make sense in this > type of application. I understand what you are saying here...except that it seems to me that there is an exception. When someone submits a form, and makes a cgi request to my application, then as part of the cgi process, I get to determine the output to the browser. I may well choose to have a particular page of my application be the output of the cgi process. In that case, set_page seems to make plenty of sense to me? Although I'm certainly willing to go along with, and understand that, this simply isn't the way the Random page modules work. However, I'm having problems with almost any method I try. Please see my other post to this list tonight, on how the ctx.redirect('name') isn't working so hot for me. Or maybe I'm just confused. I thought I understood that page_display() was what got called when a page was simply requested in the URL, and page_process() was used when a cgi form was submitted. But it doesn't seem to be working that way for me. -- Sheila King http://www.thinkspot.net/sheila/ http://www.k12groups.org From gnb at itga.com.au Tue May 20 17:43:41 2003 From: gnb at itga.com.au (Gregory Bond) Date: Tue, 20 May 2003 17:43:41 +1000 Subject: [albatross-users] Exception: set_page() passing wrong number of parameters to page_enter()? In-Reply-To: Your message of Tue, 20 May 2003 00:23:48 -0700. Message-ID: <200305200743.RAA24855@lightning.itga.com.au> > output to the browser. I may well choose to have a particular page of my > application be the output of the cgi process. In that case, set_page seems > to make plenty of sense to me? Random apps are quite different from the non-Random versions, and require a different application structure. If your application really does make more sense using set_page(), perhaps you might consider changing from a RandomApp to a SimpleApp? (The examples and documentation are really heavily skewed towards the non-Random versions as well, so it can be hard to adjust to the idiosyncrasies of a Random application.) From djc at object-craft.com.au Tue May 20 20:25:01 2003 From: djc at object-craft.com.au (Dave Cole) Date: 20 May 2003 20:25:01 +1000 Subject: [albatross-users] Exception: set_page() passing wrong number of parameters to page_enter()? In-Reply-To: <42292563.1053390228@SHEILA-LAPTOP> References: <1395112215.1053302391@goddess> <3EC9428C.6050702@champonline.com> <20030520000718.8A3B93C045@coffee.object-craft.com.au> <42292563.1053390228@SHEILA-LAPTOP> Message-ID: >>>>> "Sheila" == Sheila King writes: Sheila> I understand what you are saying here...except that it seems Sheila> to me that there is an exception. When someone submits a form, Sheila> and makes a cgi request to my application, then as part of the Sheila> cgi process, I get to determine the output to the browser. I Sheila> may well choose to have a particular page of my application be Sheila> the output of the cgi process. In that case, set_page seems to Sheila> make plenty of sense to me? I see where you are coming from. The problem is that the set_page() pretends that the server is in control of the transition from one page to another. What might make more sense is to do something like this in every page module. Place all of the application logic in the display function. Let a common module check the state of the session and have it force global behaviour if necessary. Something as simple as this should do the trick. import myapp def page_display(ctx): if myapp.check_session(ctx): ctx.run_template('this-page-template.html') Then in the myapp module you just need to something like. def check_session(ctx): if ctx.locals._user: return 1 if ctx.req_equals('login'): if user_is_valid(ctx.locals.user, ctx.locals.passwd): ctx.locals._user = ctx.locals.user ctx.add_session_vars('_user') return 1 ctx.run_template('login.html') return 0 Sheila> Although I'm certainly willing to go along with, and Sheila> understand that, this simply isn't the way the Random page Sheila> modules work. However, I'm having problems with almost any Sheila> method I try. Please see my other post to this list tonight, Sheila> on how the ctx.redirect('name') isn't working so hot for Sheila> me. Or maybe I'm just confused. It is certainly easy to get confused with this stuff. Sheila> I thought I understood that page_display() was what got called Sheila> when a page was simply requested in the URL, and Sheila> page_process() was used when a cgi form was submitted. But it Sheila> doesn't seem to be working that way for me. It is really up to you where you place your code. They page_enter(), page_process(), and page_display() are just convenient hooks in the Application.run() processing sequence. ctx = self.create_context() ctx.set_request(req) self.load_session(ctx) self.load_page(ctx) # calls page_enter() if self.validate_request(ctx): self.merge_request(ctx) self.process_request(ctx) # calls page_process() self.display_response(ctx) # calls page_display() self.save_session(ctx) The sequence is described here: http://www.object-craft.com.au/projects/albatross/albatross/fig-presimpexec.html - Dave -- http://www.object-craft.com.au From matt at pollenation.net Wed May 21 05:24:17 2003 From: matt at pollenation.net (Matt Goodall) Date: 20 May 2003 20:24:17 +0100 Subject: [albatross-users] Exception: set_page() passing wrong number of parameters to page_enter()? In-Reply-To: References: <1395112215.1053302391@goddess> <3EC9428C.6050702@champonline.com> <20030520000718.8A3B93C045@coffee.object-craft.com.au> <42292563.1053390228@SHEILA-LAPTOP> Message-ID: <1053458656.995.18.camel@localhost> On Tue, 2003-05-20 at 11:25, Dave Cole wrote: > >>>>> "Sheila" == Sheila King writes: > > Sheila> I understand what you are saying here...except that it seems > Sheila> to me that there is an exception. When someone submits a form, > Sheila> and makes a cgi request to my application, then as part of the > Sheila> cgi process, I get to determine the output to the browser. I > Sheila> may well choose to have a particular page of my application be > Sheila> the output of the cgi process. In that case, set_page seems to > Sheila> make plenty of sense to me? > > I see where you are coming from. The problem is that the set_page() > pretends that the server is in control of the transition from one page > to another. > > What might make more sense is to do something like this in every page > module. Place all of the application logic in the display function. > Let a common module check the state of the session and have it force > global behaviour if necessary. > > Something as simple as this should do the trick. > > import myapp > > def page_display(ctx): > if myapp.check_session(ctx): > ctx.run_template('this-page-template.html') > > Then in the myapp module you just need to something like. > > def check_session(ctx): > if ctx.locals._user: > return 1 > if ctx.req_equals('login'): > if user_is_valid(ctx.locals.user, ctx.locals.passwd): > ctx.locals._user = ctx.locals.user > ctx.add_session_vars('_user') > return 1 > ctx.run_template('login.html') > return 0 > > Sheila> Although I'm certainly willing to go along with, and > Sheila> understand that, this simply isn't the way the Random page > Sheila> modules work. However, I'm having problems with almost any > Sheila> method I try. Please see my other post to this list tonight, > Sheila> on how the ctx.redirect('name') isn't working so hot for > Sheila> me. Or maybe I'm just confused. > > It is certainly easy to get confused with this stuff. > > Sheila> I thought I understood that page_display() was what got called > Sheila> when a page was simply requested in the URL, and > Sheila> page_process() was used when a cgi form was submitted. But it > Sheila> doesn't seem to be working that way for me. > > It is really up to you where you place your code. They page_enter(), > page_process(), and page_display() are just convenient hooks in the > Application.run() processing sequence. As a general rule you can probably ignore page_enter() for random apps. As Dave already mentioned in this thread, page_enter() is called immediately after the page module is loaded. Something that is not clear (without looking through the code) is that page_enter() is called **before** the request is merged into the context, i.e. none of the request parameters are available in the ctx.locals yet. That makes it pretty useless for typical page processing. > > ctx = self.create_context() > ctx.set_request(req) > self.load_session(ctx) > self.load_page(ctx) # calls page_enter() > if self.validate_request(ctx): > self.merge_request(ctx) > self.process_request(ctx) # calls page_process() > self.display_response(ctx) # calls page_display() > self.save_session(ctx) > > The sequence is described here: > > http://www.object-craft.com.au/projects/albatross/albatross/fig-presimpexec.html > > - Dave From sheila at thinkspot.net Wed May 21 05:28:12 2003 From: sheila at thinkspot.net (Sheila King) Date: Tue, 20 May 2003 12:28:12 -0700 Subject: [albatross-users] Exception: set_page() passing wrong number of parameters to page_enter()? In-Reply-To: References: <1395112215.1053302391@goddess> <3EC9428C.6050702@champonline.com> <20030520000718.8A3B93C045@coffee.object-craft.com.au> <42292563.1053390228@SHEILA-LAPTOP> Message-ID: <1030391.1053433692@SHEILA-LAPTOP> --On Tuesday, May 20, 2003 8:25 PM +1000 Dave Cole wrote: >>>>>> "Sheila" == Sheila King writes: > > I see where you are coming from. The problem is that the set_page() > pretends that the server is in control of the transition from one page > to another. > > What might make more sense is to do something like this in every page > module. Place all of the application logic in the display function. > Let a common module check the state of the session and have it force > global behaviour if necessary. > > Something as simple as this should do the trick. ...... Dave, thank you *very* much for the additional clarifications and examples. Much appreciated and I'm ready to take another whack at the whole thing and try molding my brain to fit around Albatross a bit better. > > Sheila> I thought I understood that page_display() was what got called > Sheila> when a page was simply requested in the URL, and > Sheila> page_process() was used when a cgi form was submitted. But it > Sheila> doesn't seem to be working that way for me. > > It is really up to you where you place your code. They page_enter(), > page_process(), and page_display() are just convenient hooks in the > Application.run() processing sequence. > > ctx = self.create_context() > ctx.set_request(req) > self.load_session(ctx) > self.load_page(ctx) # calls page_enter() > if self.validate_request(ctx): > self.merge_request(ctx) > self.process_request(ctx) # calls page_process() > self.display_response(ctx) # calls page_display() > self.save_session(ctx) > > The sequence is described here: > > > http://www.object-craft.com.au/projects/albatross/albatross/fig-presimpex > ec.html > You know, I have read pages 36 and 37 of the pdf manual several times, but the comments you added above do not appear there (nor on the html doc page you linked). I find them QUITE helpful, and have hand-notated them into my printed copy of the docs. Although the comment information is presented elsewhere in the manual, cross-correlating is quite a chore for the newbie attempting to just familiarize themselves with and use the package. I've printed the entire 138 page manual, bound it in a report cover, and read it several times, it sometimes helps to have someone more familiar with the documentation rub your nose on a particular page or snippet. Seriously. Thanks, -- Sheila King http://www.thinkspot.net/sheila/ http://www.k12groups.org From djc at object-craft.com.au Wed May 21 09:04:01 2003 From: djc at object-craft.com.au (Dave Cole) Date: 21 May 2003 09:04:01 +1000 Subject: [albatross-users] Exception: set_page() passing wrong number of parameters to page_enter()? In-Reply-To: <1030391.1053433692@SHEILA-LAPTOP> References: <1395112215.1053302391@goddess> <3EC9428C.6050702@champonline.com> <20030520000718.8A3B93C045@coffee.object-craft.com.au> <42292563.1053390228@SHEILA-LAPTOP> <1030391.1053433692@SHEILA-LAPTOP> Message-ID: >>>>> "Sheila" == Sheila King writes: Sheila> Dave, thank you *very* much for the additional clarifications Sheila> and examples. Much appreciated and I'm ready to take another Sheila> whack at the whole thing and try molding my brain to fit Sheila> around Albatross a bit better. The manual needs a lot more work. Sheila> You know, I have read pages 36 and 37 of the pdf manual Sheila> several times, but the comments you added above do not appear Sheila> there (nor on the html doc page you linked). I find them QUITE Sheila> helpful, and have hand-notated them into my printed copy of Sheila> the docs. Although the comment information is presented Sheila> elsewhere in the manual, cross-correlating is quite a chore Sheila> for the newbie attempting to just familiarize themselves with Sheila> and use the package. You are not alone in finding the manual less than helpful as a reference. I have been (slowly) working on improving this. Sheila> I've printed the entire 138 page manual, bound it in a report Sheila> cover, and read it several times, it sometimes helps to have Sheila> someone more familiar with the documentation rub your nose on Sheila> a particular page or snippet. Seriously. If you have any suggestions about improving the manual, now is the time to tell me. I cannot guarantee that I will be able to fix everything, but some things will be possible. - Dave -- http://www.object-craft.com.au From sheila at thinkspot.net Thu May 22 19:11:41 2003 From: sheila at thinkspot.net (Sheila King) Date: Thu, 22 May 2003 02:11:41 -0700 Subject: [albatross-users] Authentication/Login example for RandomModules Message-ID: <62685807.1053569501@SHEILA-LAPTOP> OK, I have finally got a working example (rudimentary/proof-of-concept type of thing) of using RandomModularSessionFileApp for an authentication login type of system. Example has four possible pages: login myaccount logout expired where the login page has the possibility of displaying error messages also. Upon successful login, session is initiated and is valid for up to five minutes of inactivity. Successful login takes you to the 'myaccount' page. Because it is a random modular app, it is possible to go directly to any of the pages with a specific URL. However, I've made it so that valid sessions redirect to the myaccount page, regardless of the URL. If you log out or allow the session to expire, attempts to access the myaccount page by URL take you to a "session expired" page. To maintain a valid session for as long as you like (prevent it from expiring) just keep reloading the myaccount page or revisiting the login page (which will redirect to myaccount if session is still valid). I have a live example here: http://www.mathxy.com/cgi-bin/authex/myapp.py a valid username/password is guest/guest I'll leave it up for a little while. Code, in zipped format, is available here: and all the files for the project are in .txt format in that same directory. http://mathxy.com/authex/ (If anyone wants my debug version, with all my inane debugging statements that print out to a file, tracing all through the execution path...you can ask in private email.) I would welcome commentary and review of the code. I'm still not pleased with the 301 codes returned by the redirect statements, but I will think about how to deal with that later. I really don't like returning a code that says something "moved permanently" when nothing of the sort has happened. In Message-ID: Dave Cole wrote: > What might make more sense is to do something like this in every page > module. Place all of the application logic in the display function. > Let a common module check the state of the session and have it force > global behaviour if necessary. > Something as simple as this should do the trick. > import myapp > def page_display(ctx): > if myapp.check_session(ctx): > ctx.run_template('this-page-template.html') > Then in the myapp module you just need to something like. > def check_session(ctx): > if ctx.locals._user: > return 1 > if ctx.req_equals('login'): > if user_is_valid(ctx.locals.user, ctx.locals.passwd): > ctx.locals._user = ctx.locals.user > ctx.add_session_vars('_user') > return 1 > ctx.run_template('login.html') > return 0 Actually, what I found to work best for me was the following: Put the code for testing validity and possible redirection in page_process() and then put the display only in page_display(). One of the things that had me tearing my hair out, was that when I initially put validation tests and redirects in page_display, it would not redirect to the new page. That's because (I believe) it was already at the point where it was displaying the page. Too late to redirect. FWIW, this is also the method used for the Random Page example in section 4.8 of the documentation. Just took me a while to get it all sorted out (was having trouble with my logic process on authentication methods at the same time). In Message-ID: Dave Cole wrote: > Sheila> the docs. Although the comment information is presented > Sheila> elsewhere in the manual, cross-correlating is quite a chore > Sheila> for the newbie attempting to just familiarize themselves with > Sheila> and use the package. > You are not alone in finding the manual less than helpful as a > reference. I have been (slowly) working on improving this. Not at all. I think the manual is impressive. RoundUp and Albatross are some of the most well-documented free software projects I've seen. Actually, even compared to commercial software. In fact, that is one of the reasons I selected Albatross to work with. (Not that there isn't room for improvement.) I think that for some people, reading docs isn't enough, and you actually need to toss it back and forth with someone else a few times for it to "gel". At least, that sure helps me! Dave continues, in the same message: > If you have any suggestions about improving the manual, now is the > time to tell me. I cannot guarantee that I will be able to fix > everything, but some things will be possible. One thing that I would find helpful: consider alphabetizing the lists of functions/attributes in the places where the manual lists them all out for a particular class or module. In some of the diagrams I had to scan the list three times to convince myself that a certain function wasn't part of that class, as opposed to me just not seeing it there. Figure 8.16 is mislabled. i.e. the "caption" is incorrect. The manual would benefit from more examples of Random Page apps. You are welcome to use my example, or adapt it, if you think it would be useful. If I think of anything else, I'll let you know. By the way, I'm sure I will still be around. I hope I haven't worn out my welcome or used up my quota of questions. ;) -- Sheila King http://www.thinkspot.net/sheila/ http://www.k12groups.org From djc at object-craft.com.au Thu May 22 21:13:55 2003 From: djc at object-craft.com.au (Dave Cole) Date: 22 May 2003 21:13:55 +1000 Subject: [albatross-users] Authentication/Login example for RandomModules In-Reply-To: <62685807.1053569501@SHEILA-LAPTOP> References: <62685807.1053569501@SHEILA-LAPTOP> Message-ID: >>>>> "Sheila" == Sheila King writes: Sheila> the docs. Although the comment information is presented Sheila> elsewhere in the manual, cross-correlating is quite a chore Sheila> for the newbie attempting to just familiarize themselves with Sheila> and use the package. >> You are not alone in finding the manual less than helpful as a >> reference. I have been (slowly) working on improving this. Sheila> Not at all. I think the manual is impressive. RoundUp and Sheila> Albatross are some of the most well-documented free software Sheila> projects I've seen. Actually, even compared to commercial Sheila> software. Thanks. Shiela> In fact, that is one of the reasons I selected Sheila> Albatross to work with. (Not that there isn't room for Sheila> improvement.) I was going to delay this message until I had finished reworking the entire templates reference chapter. Andrew has been quite positive in his reaction to the work done so far, so I am pressing on. For the people that are interested, you can have a look at the format that I have settled on by looking here. http://www.object-craft.com.au/~djc/albatross/tag-ref.html It is only worth looking through until section 5.2.2.12 (because that is where I am up to). I am trying to increase the granularity and level of cross referencing in order to make information easier to locate. It is still first pass so I will be placing more detail in some of the sub-sub-sections. Some of the formatting is not right - finding directives that make latex2html and LaTeX do the same thing is a bit hard at times. >> If you have any suggestions about improving the manual, now is the >> time to tell me. I cannot guarantee that I will be able to fix >> everything, but some things will be possible. I would greatly appreciate positive or negative comments on the structure in the templates reference. I don't want to spend the rest of my life trying to get this ready for the next release, but I do want to make a substantial improvement. Sheila> One thing that I would find helpful: consider alphabetizing Sheila> the lists of functions/attributes in the places where the Sheila> manual lists them all out for a particular class or module. Sheila> In some of the diagrams I had to scan the list three times to Sheila> convince myself that a certain function wasn't part of that Sheila> class, as opposed to me just not seeing it there. At one point I was considering placing a table like the one for SimpleContext http://www.object-craft.com.au/~djc/albatross/pack-simplecontext.html for all prepackaged classes in chapter 8. Maybe the rows in the table should be sorted by method name. Sheila> Figure 8.16 is mislabled. i.e. the "caption" is incorrect. Thanks for that. Have fixed it in CVS. Sheila> The manual would benefit from more examples of Random Page Sheila> apps. You are welcome to use my example, or adapt it, if you Sheila> think it would be useful. Thanks. I am going to concentrate on finishing off the documentation for the release. I will try to resist distractions... Andrew, are you able to have a look at the application? Without seeing what you have done I think that it would be worth either cutting back the silly little popview application, or just adding a complete new application to the Application Guide that uses a random page structure. Sheila> If I think of anything else, I'll let you know. Sheila> By the way, I'm sure I will still be around. I hope I haven't Sheila> worn out my welcome or used up my quota of questions. ;) It is pretty hit and miss at times :-) - Dave -- http://www.object-craft.com.au From matt at pollenation.net Fri May 23 01:21:49 2003 From: matt at pollenation.net (Matt Goodall) Date: 22 May 2003 16:21:49 +0100 Subject: [albatross-users] Authentication/Login example for RandomModules In-Reply-To: References: <62685807.1053569501@SHEILA-LAPTOP> Message-ID: <1053616909.16712.72.camel@localhost> On Thu, 2003-05-22 at 12:13, Dave Cole wrote: > >>>>> "Sheila" == Sheila King writes: > > Sheila> the docs. Although the comment information is presented > Sheila> elsewhere in the manual, cross-correlating is quite a chore > Sheila> for the newbie attempting to just familiarize themselves with > Sheila> and use the package. > > >> You are not alone in finding the manual less than helpful as a > >> reference. I have been (slowly) working on improving this. > > Sheila> Not at all. I think the manual is impressive. RoundUp and > Sheila> Albatross are some of the most well-documented free software > Sheila> projects I've seen. Actually, even compared to commercial > Sheila> software. I also find the Albatross documentation extremely useful! In fact, I'm ashamed that I have not said so before :(. Most of the information you need is in there and as Sheila says, it's considerably better than an awful lot of other OS and commercial documentation. There are always ways to improve things but the documentation you provide is an incredibly good start. I guess the only real criticism I have is that it doesn't cover random apps in as much detail as stateful. I've had to dive into the code quite a few times to make sure I understood what's going on, especially regarding the page lifecycle. I realise stateful is the main focus for Albatross but the random app mode is critical for public facing sites where bookmarking pages must be possible. > > Thanks. > > Shiela> In fact, that is one of the reasons I selected > Sheila> Albatross to work with. (Not that there isn't room for > Sheila> improvement.) > > I was going to delay this message until I had finished reworking the > entire templates reference chapter. Andrew has been quite positive in > his reaction to the work done so far, so I am pressing on. For the > people that are interested, you can have a look at the format that I > have settled on by looking here. > > http://www.object-craft.com.au/~djc/albatross/tag-ref.html > > It is only worth looking through until section 5.2.2.12 (because that > is where I am up to). I am trying to increase the granularity and > level of cross referencing in order to make information easier to > locate. It is still first pass so I will be placing more detail in > some of the sub-sub-sections. Thanks for making that available, I will try to find time to look through. > > Some of the formatting is not right - finding directives that make > latex2html and LaTeX do the same thing is a bit hard at times. It's probably a bit late - a lot of documentation already exists - but could reST and docutils make life easier? > Sheila> The manual would benefit from more examples of Random Page > Sheila> apps. You are welcome to use my example, or adapt it, if you > Sheila> think it would be useful. > > Thanks. I am going to concentrate on finishing off the documentation > for the release. I will try to resist distractions... Andrew, are > you able to have a look at the application? Without seeing what you > have done I think that it would be worth either cutting back the silly > little popview application, or just adding a complete new application > to the Application Guide that uses a random page structure. I haven't looked at Sheila's app yet (there's never enough time is there!). I've actually got a small(ish) test aplication where I've been experimenting with using various aspects of Albatross. In particular it does: * Simple loops, where the CSS class is changed per row using a lookup. * Paging through data sets. * Display a tree (it's a actually a site-map to the other pages in the application). * Simple session use. * Using macros to keep pages simple. * Custom tags - One wraps the content in a nicely coloured box, choosing appropriate colours; the other caches the content to disk for a user-defined period of time. * ... and probably some other bits that I can't think of right now. It's really trivial stuff (thanks to Albatross!) but if it's any use you are welcome to that too. Cheers, Matt From fabbe at paniq.net Sat May 24 05:59:37 2003 From: fabbe at paniq.net (Fabian Fagerholm) Date: 23 May 2003 22:59:37 +0300 Subject: [albatross-users] Re: Debian package of Albatross In-Reply-To: References: <1053106526.25320.4.camel@kernel> Message-ID: <1053719977.5167.21.camel@kernel> On Tue, 2003-05-20 at 04:45, Dave Cole wrote: > It would be cool to get Albatross into Debian. This is a future goal and I have started making the appropriate arrangements. However, the package must first reach a certain level of quality so the main focus right now is on the packaging. Currently, I'm having trouble with the generation of the Albatross documentation; the HTML docs in particular. The provided Makefile in the doc directory uses a tool called mkhowto, apparently distributed with Python, to generate the docs. I've pulled mkhowto from the Debian Python2.2 packages, but I can't seem to make it work. Do you have any pointers? How do you manage to generate the nicely formatted HTML using what's in the Albatross tarball? :) -- Fabian Fagerholm paniq.net From sheila at thinkspot.net Sun May 25 01:50:18 2003 From: sheila at thinkspot.net (Sheila King) Date: Sat, 24 May 2003 08:50:18 -0700 Subject: [albatross-users] Authentication/Login example for RandomModules In-Reply-To: References: <62685807.1053569501@SHEILA-LAPTOP> Message-ID: <7519322.1053766218@SHEILA-LAPTOP> --On Thursday, May 22, 2003 9:13 PM +1000 Dave Cole wrote: >>>>>> "Sheila" == Sheila King writes: > For the > people that are interested, you can have a look at the format that I > have settled on by looking here. > > http://www.object-craft.com.au/~djc/albatross/tag-ref.html > > It is only worth looking through until section 5.2.2.12 (because that > is where I am up to). I will try to take a look at it sometime in the next few days. > At one point I was considering placing a table like the one for > SimpleContext > > > http://www.object-craft.com.au/~djc/albatross/pack-simplecontext.html > > for all prepackaged classes in chapter 8. Maybe the rows in the table > should be sorted by method name. Since the methods are grouped by Mixin in the diagram, it would make more sense to have them sorted alphabetically in the table. That way you have two ways of searching. By Mixin (diagram) or Alpha (table). > Sheila> The manual would benefit from more examples of Random Page > Sheila> apps. You are welcome to use my example, or adapt it, if you > Sheila> think it would be useful. > > Thanks. I am going to concentrate on finishing off the documentation > for the release. I will try to resist distractions... Andrew, are > you able to have a look at the application? Without seeing what you > have done I think that it would be worth either cutting back the silly > little popview application, or just adding a complete new application > to the Application Guide that uses a random page structure. I liked the POP View application. I suppose it could be because I am an email Freak, however it seemed a somewhat meaningful, albeit simple, example that most readers should be able to grasp. Even if you've never worked with the rfc822 classes and the like, the concept of how an email box works, listing messages and then clicking to read particular ones, is a very familiar concept for most people. Anyhow, here is a vote to keep the popview example. On a different note: I noticed something about my app the other night, that I didn't like: If I log out and then use the browser's Back button, it takes me back to the Main Account page. This is because the page is cached. However, I would prefer if it were not possible to do that. So...right now I'm trying to create my own class that will not cache the pages. I changed the CachingTemplateLoaderMixin to just the TemplateLoaderMixin, but this was not enough to prevent caching. So, now I guess I am really going to have to dig in and see how to send "no-cache" directives to the browsers, and probably override the page_display method in the RandomPageModuleMixin. -- Sheila King http://www.thinkspot.net/sheila/ http://www.k12groups.org From sheila at thinkspot.net Sun May 25 01:56:50 2003 From: sheila at thinkspot.net (Sheila King) Date: Sat, 24 May 2003 08:56:50 -0700 Subject: [albatross-users] Authentication/Login example for RandomModules In-Reply-To: <1053616909.16712.72.camel@localhost> References: <62685807.1053569501@SHEILA-LAPTOP> <1053616909.16712.72.camel@localhost> Message-ID: <7911546.1053766610@SHEILA-LAPTOP> --On Thursday, May 22, 2003 4:21 PM +0100 Matt Goodall wrote: > On Thu, 2003-05-22 at 12:13, Dave Cole wrote: >> >>>>> "Sheila" == Sheila King writes: > I guess the only real criticism I have is that it doesn't cover random > apps in as much detail as stateful. I've had to dive into the code quite > a few times to make sure I understood what's going on, especially > regarding the page lifecycle. I realise stateful is the main focus for > Albatross but the random app mode is critical for public facing sites > where bookmarking pages must be possible. Yes, this is why I *have* to use a RandomPage application. I'm making an account manager of sorts which clients will be using. Our experience on the support desk indicates that when giving clients directions (which are always sent via email) on how to accomplish certain web-related tasks, that we MUST be able to provide URLs that take them directly to the pages where the directions apply. Otherwise, there is too much confusion. > I haven't looked at Sheila's app yet (there's never enough time is > there!). > > I've actually got a small(ish) test aplication where I've been > experimenting with using various aspects of Albatross. In particular it > does: > > * Simple loops, where the CSS class is changed per row using a > lookup. > * Paging through data sets. > * Display a tree (it's a actually a site-map to the other pages in > the application). > * Simple session use. > * Using macros to keep pages simple. > * Custom tags - One wraps the content in a nicely coloured box, > choosing appropriate colours; the other caches the content to > disk for a user-defined period of time. > * ... and probably some other bits that I can't think of right > now. > > It's really trivial stuff (thanks to Albatross!) but if it's any use you > are welcome to that too. I don't know whether Dave is interested in it, but *I* would certainly like to see it. The more examples, the better. Would you mind making it available? -- Sheila King http://www.thinkspot.net/sheila/ http://www.k12groups.org From tchur at optushome.com.au Sun May 25 08:13:17 2003 From: tchur at optushome.com.au (Tim Churches) Date: 25 May 2003 08:13:17 +1000 Subject: [albatross-users] Authentication/Login example for RandomModules In-Reply-To: <7911546.1053766610@SHEILA-LAPTOP> References: <62685807.1053569501@SHEILA-LAPTOP> <1053616909.16712.72.camel@localhost> <7911546.1053766610@SHEILA-LAPTOP> Message-ID: <1053814398.2537.22.camel@amihan> On Sun, 2003-05-25 at 01:56, Sheila King wrote: > > I've actually got a small(ish) test aplication where I've been > > experimenting with using various aspects of Albatross. In particular it > > does: > > > > * Simple loops, where the CSS class is changed per row using a > > lookup. > > * Paging through data sets. > > * Display a tree (it's a actually a site-map to the other pages in > > the application). > > * Simple session use. > > * Using macros to keep pages simple. > > * Custom tags - One wraps the content in a nicely coloured box, > > choosing appropriate colours; the other caches the content to > > disk for a user-defined period of time. > > * ... and probably some other bits that I can't think of right > > now. > > > > It's really trivial stuff (thanks to Albatross!) but if it's any use you > > are welcome to that too. > > I don't know whether Dave is interested in it, but *I* would certainly like > to see it. The more examples, the better. Would you mind making it > available? Dave and Andrew were muttering about setting up either a page of links to third-party Albatross example code, or hosting the examples on teh Object Craft site (better in my opinion). I'm very keen to see the example code you mention. Hopefully the (Albatross) stuff Andrew and I are working on will also soon see the light of day. Some of our previous work has already resulted in improvements to Albatross eg the lazy-loading ellipsis tree was developed for one of our applications. So, yes, anything which fosters a community of Albatross users is good. -- >From the Manila desk of Tim C From tchur at optushome.com.au Sun May 25 08:25:36 2003 From: tchur at optushome.com.au (Tim Churches) Date: 25 May 2003 08:25:36 +1000 Subject: [albatross-users] Authentication/Login example for RandomModules In-Reply-To: <7519322.1053766218@SHEILA-LAPTOP> References: <62685807.1053569501@SHEILA-LAPTOP> <7519322.1053766218@SHEILA-LAPTOP> Message-ID: <1053815136.2537.27.camel@amihan> On Sun, 2003-05-25 at 01:50, Sheila King wrote: > I liked the POP View application. I suppose it could be because I am an > email Freak, however it seemed a somewhat meaningful, albeit simple, > example that most readers should be able to grasp. Even if you've never > worked with the rfc822 classes and the like, the concept of how an email > box works, listing messages and then clicking to read particular ones, is > a very familiar concept for most people. > > Anyhow, here is a vote to keep the popview example. You should see the enhanced version of popview which Andrew uses to read his email - very slick, complete with spam filters configured by a nifty Web interface. -- >From the Manila desk of Tim C From sheila at thinkspot.net Sun May 25 08:28:49 2003 From: sheila at thinkspot.net (Sheila King) Date: Sat, 24 May 2003 15:28:49 -0700 Subject: [albatross-users] Authentication/Login example for RandomModules In-Reply-To: <1053814398.2537.22.camel@amihan> References: <62685807.1053569501@SHEILA-LAPTOP> <1053616909.16712.72.camel@localhost> <7911546.1053766610@SHEILA-LAPTOP> <1053814398.2537.22.camel@amihan> Message-ID: <31429833.1053790129@SHEILA-LAPTOP> --On Sunday, May 25, 2003 8:13 AM +1000 Tim Churches wrote: > On Sun, 2003-05-25 at 01:56, Sheila King wrote: I want to make it clear that Matt Goodall wrote the below-described app. The attributions do not make that clear. -- Sheila King http://www.thinkspot.net/sheila/ http://www.k12groups.org >> > I've actually got a small(ish) test aplication where I've been >> > experimenting with using various aspects of Albatross. In particular it >> > does: >> > >> > * Simple loops, where the CSS class is changed per row using a >> > lookup. >> > * Paging through data sets. >> > * Display a tree (it's a actually a site-map to the other pages >> > in the application). >> > * Simple session use. >> > * Using macros to keep pages simple. >> > * Custom tags - One wraps the content in a nicely coloured box, >> > choosing appropriate colours; the other caches the content to >> > disk for a user-defined period of time. >> > * ... and probably some other bits that I can't think of right >> > now. >> > >> > It's really trivial stuff (thanks to Albatross!) but if it's any use >> > you are welcome to that too. >> >> I don't know whether Dave is interested in it, but *I* would certainly >> like to see it. The more examples, the better. Would you mind making it >> available? > > Dave and Andrew were muttering about setting up either a page of links > to third-party Albatross example code, or hosting the examples on teh > Object Craft site (better in my opinion). I'm very keen to see the > example code you mention. Hopefully the (Albatross) stuff Andrew and I > are working on will also soon see the light of day. Some of our previous > work has already resulted in improvements to Albatross eg the > lazy-loading ellipsis tree was developed for one of our applications. > So, yes, anything which fosters a community of Albatross users is good. > -- > From the Manila desk of Tim C From matt at pollenation.net Sun May 25 11:40:13 2003 From: matt at pollenation.net (Matt Goodall) Date: 25 May 2003 02:40:13 +0100 Subject: [albatross-users] Authentication/Login example for RandomModules In-Reply-To: <7911546.1053766610@SHEILA-LAPTOP> References: <62685807.1053569501@SHEILA-LAPTOP> <1053616909.16712.72.camel@localhost> <7911546.1053766610@SHEILA-LAPTOP> Message-ID: <1053826812.18665.54.camel@localhost> On Sat, 2003-05-24 at 16:56, Sheila King wrote: > --On Thursday, May 22, 2003 4:21 PM +0100 Matt Goodall > wrote: > > > On Thu, 2003-05-22 at 12:13, Dave Cole wrote: > >> >>>>> "Sheila" == Sheila King writes: > > > I guess the only real criticism I have is that it doesn't cover random > > apps in as much detail as stateful. I've had to dive into the code quite > > a few times to make sure I understood what's going on, especially > > regarding the page lifecycle. I realise stateful is the main focus for > > Albatross but the random app mode is critical for public facing sites > > where bookmarking pages must be possible. > > Yes, this is why I *have* to use a RandomPage application. I'm making an > account manager of sorts which clients will be using. Our experience on the > support desk indicates that when giving clients directions (which are always > sent via email) on how to accomplish certain web-related tasks, that we > MUST be able to provide URLs that take them directly to the pages where > the directions apply. Otherwise, there is too much confusion. Actually, thnking about this properly I realise that the _real_ reason that I am interested in random apps is that they are search engine friendly. The ability to bookmark a page is a useful side effect. If/when I get to use Albatross for a client's site I plan to use both modes: random for the public site and stateful for the administrative back end (where state if often more important than search engines and bookmarking). > > > I haven't looked at Sheila's app yet (there's never enough time is > > there!). > > > > I've actually got a small(ish) test aplication where I've been > > experimenting with using various aspects of Albatross. In particular it > > does: > > > > * Simple loops, where the CSS class is changed per row using a > > lookup. > > * Paging through data sets. > > * Display a tree (it's a actually a site-map to the other pages in > > the application). > > * Simple session use. > > * Using macros to keep pages simple. > > * Custom tags - One wraps the content in a nicely coloured box, > > choosing appropriate colours; the other caches the content to > > disk for a user-defined period of time. > > * ... and probably some other bits that I can't think of right > > now. > > > > It's really trivial stuff (thanks to Albatross!) but if it's any use you > > are welcome to that too. > > I don't know whether Dave is interested in it, but *I* would certainly like > to see it. The more examples, the better. Would you mind making it > available? No problem. I will tidy things up and post the code somewhere, hopefully in the next few days. - Matt From sheila at thinkspot.net Sun May 25 17:29:32 2003 From: sheila at thinkspot.net (Sheila King) Date: Sun, 25 May 2003 00:29:32 -0700 Subject: [albatross-users] Question about session variables Message-ID: <63873084.1053822572@SHEILA-LAPTOP> OK, I'm working on some session type of stuff tonight, and am experiencing more than the usual amount of confusion, so...in order to try to clarify things for myself I have to ask: Suppose on one request-cycle I do: ctx.add_session_vars('blah') Then on the next request-cycle, if I do not also save 'blah' as a session variable, is it removed from the session? Do I have to save whichever variables I want to have access to later each and every time I go through a request-cycle? Thanks, -- Sheila King http://www.thinkspot.net/sheila/ http://www.k12groups.org From sheila at thinkspot.net Mon May 26 08:21:59 2003 From: sheila at thinkspot.net (Sheila King) Date: Sun, 25 May 2003 15:21:59 -0700 Subject: [albatross-users] Question about session variables In-Reply-To: <63873084.1053822572@SHEILA-LAPTOP> References: <63873084.1053822572@SHEILA-LAPTOP> Message-ID: <30626809.1053876119@SHEILA-LAPTOP> --On Sunday, May 25, 2003 12:29 AM -0700 Sheila King wrote: > OK, I'm working on some session type of stuff tonight, and am > experiencing more than the usual amount of confusion, so...in order to > try to clarify things for myself I have to ask: > > Suppose on one request-cycle I do: > > ctx.add_session_vars('blah') > > Then on the next request-cycle, if I do not also save 'blah' as a session > variable, is it removed from the session? > > Do I have to save whichever variables I want to have access to later each > and every time I go through a request-cycle? OK, first of all, I've decided that the above statements must be true. Except for one thing. It seems that I am losing the session variables if a bad url is called. This means that if an authenticated user enters a bad URL, they lose their authentication, and have to go back to the login page and login again. (As a reminder: I'm using RandomPage modules with SessionFiles.) I see that the load_badurl_template is called in the display_response function in the RandomPageModuleMixin. Here is that function: def display_response(self, ctx): if self.__page_found: return PageModuleMixin.display_response(self, ctx) else: # Display error page ctx.write_headers() templ = self.load_badurl_template(ctx) ctx.set_globals(_caller_globals(3)) templ.to_html(ctx) ctx.flush_content() return None And the PageModuleMixin.display_response looks like this: def display_response(self, ctx): if hasattr(ctx.page, 'page_display'): ctx.write_headers() ctx.request.end_headers() func = getattr(ctx.page, 'page_display') func(ctx) ctx.flush_content() So what I'm trying to figure out, is why is the session data being lost when the load_badurl_template function is called? What is my best way around this? Thanks, -- Sheila King http://www.thinkspot.net/sheila/ http://www.k12groups.org From sheila at thinkspot.net Mon May 26 09:32:35 2003 From: sheila at thinkspot.net (Sheila King) Date: Sun, 25 May 2003 16:32:35 -0700 Subject: [albatross-users] Overriding load_badurl_template in RandomPage modules Message-ID: <34863601.1053880355@SHEILA-LAPTOP> OK, I wanted to override the load_badurl_template function. Actually, I did. However, it wasn't working quite the way I wanted, as it was losing session variables for some reason. In trying to work around that, I thought I might write my own load_page function. However, I get into problems with the private self.__page_found attribute, as I cannot access it from my main program. Essentially I have to either override all the functions that use that variable, or write my own Mixin class, or muck with the Albatross RandomPageModule Mixin class. Just a bit annoying, to be unable to override only one of those functions. :/ -- Sheila King http://www.thinkspot.net/sheila/ http://www.k12groups.org From gnb at itga.com.au Mon May 26 10:26:05 2003 From: gnb at itga.com.au (Gregory Bond) Date: Mon, 26 May 2003 10:26:05 +1000 Subject: [albatross-users] Authentication/Login example for RandomModules In-Reply-To: Your message of Sat, 24 May 2003 08:50:18 -0700. Message-ID: <200305260026.KAA27728@lightning.itga.com.au> > I noticed something about my app the other night, that I didn't like: > If I log out and then use the browser's Back button, it takes me back > to the Main Account page. This is because the page is cached. However, > I would prefer if it were not possible to do that. Back buttons are the bane of stateful Web apps, no matter how they are implemented. I've not found any easy answer to this, apart from train the users to "don't do that!" (Easy for me, only a handful of users....) I'd love a better answer. (I'm using SessionFileApp and Page Objects.) From sheila at thinkspot.net Mon May 26 14:01:04 2003 From: sheila at thinkspot.net (Sheila King) Date: Sun, 25 May 2003 21:01:04 -0700 Subject: [albatross-users] Authentication/Login example for RandomModules In-Reply-To: <200305260026.KAA27728@lightning.itga.com.au> References: <200305260026.KAA27728@lightning.itga.com.au> Message-ID: <1989305690.1053896464@goddess> --On Monday, May 26, 2003 10:26 AM +1000 Gregory Bond wrote: >> I noticed something about my app the other night, that I didn't like: >> If I log out and then use the browser's Back button, it takes me back >> to the Main Account page. This is because the page is cached. However, >> I would prefer if it were not possible to do that. > > Back buttons are the bane of stateful Web apps, no matter how they are > implemented. I've not found any easy answer to this, apart from train > the users to "don't do that!" (Easy for me, only a handful of users....) > > I'd love a better answer. (I'm using SessionFileApp and Page Objects.) > I have something that seems to be working pretty well for me right now. A live version will be temporarily available here: http://www.mathxy.com/cgi-bi/temp/myapp.py The code is (temporarily) in this directory: http://www.mathxy.com/temp/ It does have lots of debugging statements and stuff. Code is really not cleaned up for publication. But anyhow... If I log in with valid username/password (one such login is guest/guest), it takes me to main account page. If I log out and then do back button, it is giving me the Expired session page, as I desire, instead of the 'myaccount' page as it did in the version I previously published. I've accomplished this by overriding the write_headers() function as follows: def write_headers(self): SessionFileAppContext.write_headers(self) self.request.write_header('Expires', 'Thu, 19 Nov 1981 08:52:00 GMT') self.request.write_header('Cache-Control', \ 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0') I just copied these headers from another login page that I sometimes visit which I know defeats the back-button thing for revisiting your account page after you've logged out. The one weird thing about it that I just noticed... In Mozilla 1.3 it seems to behave for me as I expect. However in IE 5.0, it continues to always display the 'myaccount' URL in spite of the fact that I've called a 'redirect' in the code to expired or login or the like. I will review it on IE 6.0 later, when I use a different computer. I haven't tested it in any 4.x or older browsers, nor Opera, nor any *nix browsers (I only have Windows machines at home, and only access to Linux by telnet). Anyhow, FWIW... -- Sheila King http://www.thinkspot.net/sheila/ http://www.k12groups.org From sheila at thinkspot.net Mon May 26 15:02:04 2003 From: sheila at thinkspot.net (Sheila King) Date: Sun, 25 May 2003 22:02:04 -0700 Subject: [albatross-users] Overriding load_badurl_template in RandomPage modules In-Reply-To: <34863601.1053880355@SHEILA-LAPTOP> References: <34863601.1053880355@SHEILA-LAPTOP> Message-ID: <1992966464.1053900124@goddess> --On Sunday, May 25, 2003 4:32 PM -0700 Sheila King wrote: > OK, I wanted to override the load_badurl_template function. ...... > However, it wasn't working quite the way I wanted, as it was losing > session variables for some reason. I wanted to follow this up to say, actually, I have an idea what may be "going wrong" here as far as the session state and the badurl function... I think what is actually happening is that I was checking for authentication values in the local context's local namespace before the session variables have been merged. I am still studying it some more... -- Sheila King http://www.thinkspot.net/sheila/ http://www.k12groups.org From sheila at thinkspot.net Tue May 27 19:36:12 2003 From: sheila at thinkspot.net (Sheila King) Date: Tue, 27 May 2003 02:36:12 -0700 Subject: [albatross-users] Summary of Auth App Example Message-ID: <41903453.1054002972@SHEILA-LAPTOP> Hello, I want to summarize all my blathering on this list from this past weekend. First of all, thank you to Gregory Bond who sent me a private email in response to my questions in Message-ID: <63873084.1053822572 at SHEILA-LAPTOP> and told me that I had not drawn the correct conclusions about session variables. Here is what I think I now understand about session variables: Once you save a session variable, unless you explicitly remove it from the session, it is updated automatically with the current value that it has in the context's local namespace at the end of the request cycle. A variable can be updated more than once in the local namespace during a request cycle. Whatever its last value before the session is saved, that is the value that will be saved in the session. Hmm, just now that made me wonder...if the variable is not in the local namespace when the session is saved, does that mean the session variable will store a value of "none" or not be updated? I do not know the answer to that one. If the session is removed, the app will redirect to the "start page" on the next request cycle. I've put an updated copy of my practice app here: http://www.mathxy.com/cgi-bin/enhauth/myapp.py with the source files and a zip archive located in this directory: http://www.mathxy.com/www/enhauth/ I wouldn't probably even bother with my earlier example. I should go back and look at that code again...it probably could use some re-writing. Anyhow, in this last version, I have successfully over-ridden the load_badurl_template. My problems with that were most likely a result of my poor understanding of the local name space and other scoping issues related to the use of albatross tags in .html templates. I've also over-ridden the write_headers function so that once logged out, using the back button to return to the main account page redirects to an expired session page. I've tested on three different browsers so far, and seems to work. Of course, it will need more testing. Thanks to everyone for the help. I feel ready to tackle other parts of my project, now. :) -- Sheila King http://www.thinkspot.net/sheila/ http://www.k12groups.org From sheila at thinkspot.net Wed May 28 00:59:09 2003 From: sheila at thinkspot.net (Sheila King) Date: Tue, 27 May 2003 07:59:09 -0700 Subject: [albatross-users] Summary of Auth App Example In-Reply-To: <41903453.1054002972@SHEILA-LAPTOP> References: <41903453.1054002972@SHEILA-LAPTOP> Message-ID: <2115191224.1054022349@goddess> Error Correction: --On Tuesday, May 27, 2003 2:36 AM -0700 Sheila King wrote: > I've put an updated copy of my practice app here: > http://www.mathxy.com/cgi-bin/enhauth/myapp.py > > with the source files and a zip archive located in this directory: > http://www.mathxy.com/www/enhauth/ > I posted the wrong URL for the source. It is actually here: -- Sheila King http://www.thinkspot.net/sheila/ http://www.k12groups.org From sheila at thinkspot.net Sat May 31 07:28:34 2003 From: sheila at thinkspot.net (Sheila King) Date: Fri, 30 May 2003 14:28:34 -0700 Subject: [albatross-users] Problem with Macro Expand/Usearg Message-ID: <15518654.1054304914@SHEILA-LAPTOP> I'm having a problem with a Macro, where as far as I can see, I've set everything properly, but an arg I've set (actually two out of three) for this macro do not get substituted. I'm baffled. Here is the page display function: def page_display(ctx): if ctx.has_value('_errmssg'): ctx.run_template('loginerr.html') ctx.clear_locals() return ctx.load_template('commonmacros.html') ctx.run_template('login.html') authlib.update_session(ctx) The "commonmacros.html" file contains this macro: --------------------------------------------------- <al-usearg name="page_title"> leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 bgcolor="#FFFFFF" text="#000000">
[CompanyName] [Help] [About]
--------------------------------------------------- As you can see, there are three tags, with names: page_title js_scripts body_tags And here is where the macro is called in the login.html file: --------------------------------------------------- Login onLoad="focusField();" --------------------------------------------------- So, I am passing all three arguments to the macro. I have studied this and I DO have closing tags for everything. Yet, when I run the page, only the page_title argument gets passed to the output. the js_scripts and body_tags arguments do not get touched at all, for some reason. Here is the output HTML page (the portion that applies): --------------------------------------------------- Login leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 bgcolor="#FFFFFF" text="#000000">
[CompanyName] [Help] [About]
--------------------------------------------------- What am I doing wrong? Why won't the macro substitute the last two user args? Thanks for your help, -- Sheila King http://www.thinkspot.net/sheila/ http://www.k12groups.org From sheila at thinkspot.net Sat May 31 08:03:23 2003 From: sheila at thinkspot.net (Sheila King) Date: Fri, 30 May 2003 15:03:23 -0700 Subject: [albatross-users] Problem with Macro Expand/Usearg In-Reply-To: <15518654.1054304914@SHEILA-LAPTOP> References: <15518654.1054304914@SHEILA-LAPTOP> Message-ID: <17606907.1054307003@SHEILA-LAPTOP> ARRRGGG. Never mind. It *would* work, if I put the name="js_scripts" attribute and name="body_tags" attribute in the set-arg tags. How embarrassing. I don't know why I didn't see that before, with all the staring I did. -- Sheila King http://www.thinkspot.net/sheila/ http://www.k12groups.org --On Friday, May 30, 2003 2:28 PM -0700 Sheila King wrote: > I'm having a problem with a Macro, where as far as I can see, I've set > everything properly, but an arg I've set (actually two out of three) for > this macro do not get substituted. > > I'm baffled. > > Here is the page display function: > > def page_display(ctx): > if ctx.has_value('_errmssg'): > ctx.run_template('loginerr.html') > ctx.clear_locals() > return > ctx.load_template('commonmacros.html') > ctx.run_template('login.html') > authlib.update_session(ctx) > > The "commonmacros.html" file contains this macro: > > --------------------------------------------------- > > > > <al-usearg name="page_title"> > > > > > leftmargin=0 topmargin=0 marginwidth=0 > marginheight=0 bgcolor="#FFFFFF" text="#000000"> > > height="30"> > > >
> [CompanyName] [Help] [About]
> > > > >
height="50" align="left" vspace="0" hspace="0"> src="/qaimg/qalogo.gif" width="200" height="40" vspace="8" > hspace="5"> vspace="5" hspace="25">
> >
> --------------------------------------------------- > > As you can see, there are three tags, with names: > > page_title > js_scripts > body_tags > > And here is where the macro is called in the login.html file: > > --------------------------------------------------- > > > > Login > > onLoad="focusField();" > > > > --------------------------------------------------- > > So, I am passing all three arguments to the macro. I have studied this > and I DO have closing tags for everything. > > Yet, when I run the page, only the page_title argument gets passed to the > output. the js_scripts and body_tags arguments do not get touched at all, > for some reason. > > Here is the output HTML page (the portion that applies): > > --------------------------------------------------- > > > > > Login > > > > > leftmargin=0 topmargin=0 marginwidth=0 > marginheight=0 bgcolor="#FFFFFF" text="#000000"> > > height="30"> > > >
> > [CompanyName] [Help] [About]
> > > > >
height="50" align="left" vspace="0" hspace="0"> src="/qaimg/qalogo.gif" width="200" height="40" vspace="8" > hspace="5"> vspace="5" hspace="25">
> > > --------------------------------------------------- > > What am I doing wrong? Why won't the macro substitute the last two user > args? > > Thanks for your help, > From fabbe at paniq.net Sat May 31 20:45:37 2003 From: fabbe at paniq.net (Fabian Fagerholm) Date: 31 May 2003 13:45:37 +0300 Subject: [albatross-users] Update: Albatross Debian packages Message-ID: <1054377937.1093.35.camel@kernel> Hello everyone, The Debian packages of Albatross have been updated. The new packages now include the session server as an optional package. I'm hoping to include the packages into Debian unstable soon. If you find the packages useful, I would appreciate feedback from you! The packages are available at http://people.paniq.net/~fabbe/debian/albatross/ Some outstanding issues remain; I'm still having trouble generating the HTML documentation. However, I think I may have found the cause for this. The next update of the packages will probably fix this issue. -- Fabian Fagerholm paniq.net