From esj at harvee.org Wed Oct 1 00:08:06 2003 From: esj at harvee.org (Eric S. Johansson) Date: Tue, 30 Sep 2003 10:08:06 -0400 Subject: [albatross-users] trying Login Message-ID: <3F798E46.1060300@harvee.org> the more I dive into integrating the login code with albatross, the waters become murkier. On the surface, it should be relatively simple. I just can't find the way to the solution. in implementing the login sequence, I decided to implement it as a separate albatross application. The reason for this is simple encapsulation. I don't want anything in the login sequence to become part of the application except for perhaps a small bit of user specific data. I also want to isolate the application from different types of authentication systems. given a simple environment with a generic application and the login application, control between the two is passed via the method Application.login_validation. This method is overridden with an actual test for authentication credentials. If the authentication credentials are not valid, then the login application should start otherwise controls returned to the current application. In theory, this should not be a problem. In practice it is. The current problem is transferring control to the login application and returning control. The current push code only pushes known or registered pages. The pop code pops to only known or registered pages. With my current knowledge of albatross, this means that the login code needs to know about every single page that calls it. This is not a high probability event for a couple reasons. so, my question is, how can I do a push/pop sequence to the login code and return the calling application if these two applications are independent. From neel at mediapulse.com Wed Oct 1 00:12:12 2003 From: neel at mediapulse.com (Michael C. Neel) Date: Tue, 30 Sep 2003 10:12:12 -0400 Subject: [albatross-users] Having trouble implementing pagination Message-ID: I'm, not %100 on this, but yoo should be able to pass the fetchall() straight to the al-for. I do this all the time with MySQLdb, using the normal cursor but that should make no difference here. A: ..should work ok. I say should because I don't use the dict cursor, but iirc it returns a tuple of dicts, which should be just fine with the Iterator class of albatross. The gothca here is that the query will be preformed for every page (which you can work around) and the entire result set will be stored in the session (which you can't work around). One of my goals is to create a SQLIterator class to use in my AXE module that makes uses of LIMIT in MySQL to only query what is shown. That and add first, last, and goto_page to optios along nexppage and prevpage. Just a matter of getting the time ;) Mike > -----Original Message----- > From: Sheila King [mailto:sheila at thinkspot.net] > Sent: Tuesday, September 30, 2003 3:40 AM > To: albatross-users at object-craft.com.au > Subject: [albatross-users] Having trouble implementing pagination > > > OK, I'm tearing my hair out and am about to give up for > tonight and go to > bed. LOL. Should have probably done that a couple of hours > ago. Oh, well. > > I just can't seem to get pagination with the al-for tag to work. > > I understand that I need some sort of sequence type that has > both __len__ > and __getitem__ methods. > > I'm returning a result of several rows in a MySQLdb object using the > Dictionary Cursor types. > > A typical query result, after using fetchall() to get all the > results, > would be something like this: > > mydicts = ({'a': 1}, {'b': 2}) > > I have a class, that I use on individual dictionaries, such > as the result > of a fetchone() command, that works really nicely. That class > works fine by > itself. > > However, today I tried to make some kind of a class that is a > list of those > dictionary objects, because I want to iterate over them and > use pagination. > But I am totally unable to have any kind of success at this. > > I tried this: > > class myclass(list): > def __getitem__(self, x): > return self[x] > > But the above TOTALLY does not work and just recurses like > mad until I hit > the maximum recursion level. > > I tried a bunch of other stuff too. > > If someone can toss me a hint, I'd sure appreciate it. > > Thanks, > > -- > 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/albat ross-users From neel at mediapulse.com Wed Oct 1 00:19:15 2003 From: neel at mediapulse.com (Michael C. Neel) Date: Tue, 30 Sep 2003 10:19:15 -0400 Subject: [albatross-users] trying Login Message-ID: Not to send you on yet another exploration of login code methods and albatross, as it's getting painful to read about at this point *but*; have you considered sub classing the app class, adding in your login code, and then creating your app from this new class? This way the login code is with the app, so it can know about all pages the app does but is also separate enough that the real app doesn't have to care about auth code and it portable to other apps. This approach may even yeild a login class generic enough that it can be included in the toolkit at some point, saving others from having to recreate this wheel. Mike > -----Original Message----- > From: Eric S. Johansson [mailto:esj at harvee.org] > Sent: Tuesday, September 30, 2003 10:08 AM > To: albatross-users > Subject: [albatross-users] trying Login > > > the more I dive into integrating the login code with > albatross, the waters > become murkier. On the surface, it should be relatively > simple. I just can't > find the way to the solution. > > in implementing the login sequence, I decided to implement it > as a separate > albatross application. The reason for this is simple > encapsulation. I don't > want anything in the login sequence to become part of the > application except for > perhaps a small bit of user specific data. I also want to > isolate the > application from different types of authentication systems. > > given a simple environment with a generic application and the > login application, > control between the two is passed via the method > Application.login_validation. > This method is overridden with an actual test for > authentication credentials. > If the authentication credentials are not valid, then the > login application > should start otherwise controls returned to the current application. > > In theory, this should not be a problem. In practice it is. > > The current problem is transferring control to the login > application and > returning control. The current push code only pushes known > or registered pages. > The pop code pops to only known or registered pages. With > my current > knowledge of albatross, this means that the login code needs > to know about every > single page that calls it. This is not a high probability > event for a couple > reasons. > > so, my question is, how can I do a push/pop sequence to the > login code and > return the calling application if these two applications are > independent. > > > _______________________________________________ > Albatross-users mailing list > Albatross-users at object-craft.com.au > https://www.object-craft.com.au/cgi-bin/mailman/listinfo/albat ross-users From alb-users at repose.cx Wed Oct 1 00:24:44 2003 From: alb-users at repose.cx (Damien Elmes) Date: Wed, 01 Oct 2003 00:24:44 +1000 Subject: [albatross-users] Having trouble implementing pagination In-Reply-To: ("Michael C. Neel"'s message of "Tue, 30 Sep 2003 10:12:12 -0400") References: Message-ID: <86u16us6ab.fsf@mobile.repose.cx> "Michael C. Neel" writes: > > > A: > > > ..should work ok. I say should because I don't use the dict cursor, but > iirc it returns a tuple of dicts, which should be just fine with the > Iterator class of albatross. > > The gothca here is that the query will be preformed for every page > (which you can work around) and the entire result set will be stored in > the session (which you can't work around). Really? I was under the impression assigning to a variable in locals will only change the context during that page display. I haven't played with the persistent implementations like mod_python, but I think a new context is created for each service (with any session variables being imported each time). Cheers, -- Damien Elmes From neel at mediapulse.com Wed Oct 1 00:39:14 2003 From: neel at mediapulse.com (Michael C. Neel) Date: Tue, 30 Sep 2003 10:39:14 -0400 Subject: [albatross-users] Having trouble implementing pagination Message-ID: > Really? I was under the impression assigning to a variable in locals > will only change the context during that page display. I haven't > played with the persistent implementations like mod_python, but I > think a new context is created for each service (with any session > variables being imported each time). > When it comes to bd connection and cursors, it's harder to hide the true nature of the web app. Yes you can have a cursor objest in a session, but that cursor will not be active next time though a request, that connection may have been closed after the first request or you might be under a different apache child the next request with a different database connection. The work around for this is in using page_enter, and not calling c.fetchall() directly: page_enter(self, ctx): .... ctx.locals._results = c.fetchall() That doesn't solve the other problem though, that being if there are 2000 records returned, we are storing 1980 records in the session that are not displayed. 2000 might still be doable, but if it jumps to 20,000 we could be in trouble - definatly rules out cookie based session, lol! Mike From esj at harvee.org Wed Oct 1 00:51:12 2003 From: esj at harvee.org (Eric S. Johansson) Date: Tue, 30 Sep 2003 10:51:12 -0400 Subject: [albatross-users] trying Login In-Reply-To: References: Message-ID: <3F799860.6040906@harvee.org> Michael C. Neel explained: > Not to send you on yet another exploration of login code methods and > albatross, as it's getting painful to read about at this point *but*; if it is painful to write, it should be painful to read (about)... > have you considered sub classing the app class, adding in your login > code, and then creating your app from this new class? This way the > login code is with the app, so it can know about all pages the app does > but is also separate enough that the real app doesn't have to care about > auth code and it portable to other apps. because there is no win in futher complicating an already complex set of interfaces. the login class is well encapsulated and Application already exports an interface that I can (and do) overload. one of my points is that login application needs to know nothing about *any* application and any application should know *nothing* about authentication. > This approach may even yeild a login class generic enough that it can be > included in the toolkit at some point, saving others from having to > recreate this wheel. the base class is already generic enough as is the simple password database. what's needed is a transfer mechanism between contexts. Otherwise, you'll need to build login classes for every single type of application context found in albatross. ---eric From sheila at thinkspot.net Wed Oct 1 05:59:15 2003 From: sheila at thinkspot.net (Sheila King) Date: Tue, 30 Sep 2003 12:59:15 -0700 Subject: [albatross-users] Having trouble implementing pagination In-Reply-To: <86r81yu304.fsf@mobile.repose.cx> References: <689528469.1064882415@localhost> <86r81yu304.fsf@mobile.repose.cx> Message-ID: <733867595.1064926755@localhost> --On Tuesday, September 30, 2003 5:47 PM +1000 Damien Elmes wrote: > If you were only creating a custom class for the purposes of > providing those methods, you can probably skip it and just use a > standard list (but I haven't played with albatross's pagination > support before). OK, I tried this again today (this afternoon) and it seems to be working fine for me now. Don't know why it didn't work last night. :/ Thanks to everyone who replied with comments, tips and suggestions. Much appreciated. -- Sheila King http://www.thinkspot.net/sheila/ http://www.k12groups.org From sheila at thinkspot.net Wed Oct 1 06:05:03 2003 From: sheila at thinkspot.net (Sheila King) Date: Tue, 30 Sep 2003 13:05:03 -0700 Subject: [albatross-users] al-textarea not escaping '"' character Message-ID: <734216477.1064927103@localhost> Using a somewhat patched version of 1.10 If I include a " character in an al-textarea element and submit, it is not being escapted to " when the data is retrieved. It's weird, cuz < > are being escaped, but not " I noticed this because I'm trying to insert this data into a MySQL db and am getting errors like this: ProgrammingError: (1064, 'You have an error in your SQL syntax near \'quoted" reply...", 1, NOW())\' at line 2') Where the query statement is: result = c.execute("""INSERT INTO replies (postid, content, authorid, timestamp) VALUES (%s, "%s", %s, NOW());""" % \ (postid, content, authorid)) It's the content field which is the textarea and holds, of course, the content of a reply. If I escape the characters myself, I can successfully insert them into the MySQL database. Of course, displaying them later, after retrieved, they look ... uh... wrong. Guess I am going to have to re-escape them back to the original " character for displaying on the web page? Recommendations? Suggestions? Anyhow, I'm just puzzled that Albatross is not escaping the character. I looked at the tags.py file and see for the al-textarea object, that it is supposed to call the "escape" function defined near the top of tags.py. I am not using the "noescape" attribute on my al-textarea field. -- Sheila King http://www.thinkspot.net/sheila/ http://www.k12groups.org From neel at mediapulse.com Wed Oct 1 07:28:46 2003 From: neel at mediapulse.com (Michael C. Neel) Date: Tue, 30 Sep 2003 17:28:46 -0400 Subject: [albatross-users] al-textarea not escaping '"' character Message-ID: Albatross escapes on disply, not on input. in fact, it converts the input from the url encoding the broswer done. That aside, you should be writing: result = c.execute("""INSERT INTO replies (postid, content, authorid, timestamp) VALUES (%s, %s, %s, NOW());""", (postid, content, authorid)) This uses a placeholder, which has the effect of the cursor escaping for you. Notice you don't need the quotes either, nor will you need %d, %f, etc. - the database decideds based on the field. This is a lot safer than you trying to parse and strip out bad characters; the database knows what it doesn't want to see and this code has been strongly tested (assuming you're not using some off the wall db, lol). Mike > -----Original Message----- > From: Sheila King [mailto:sheila at thinkspot.net] > Sent: Tuesday, September 30, 2003 4:05 PM > To: albatross-users at object-craft.com.au > Subject: [albatross-users] al-textarea not escaping '"' character > > > Using a somewhat patched version of 1.10 > > If I include a " character in an al-textarea element and > submit, it is not > being escapted to " when the data is retrieved. It's > weird, cuz < > > are being escaped, but not " > > I noticed this because I'm trying to insert this data into a > MySQL db and > am getting errors like this: > > ProgrammingError: (1064, 'You have an error in your SQL syntax near > \'quoted" reply...", 1, NOW())\' at line 2') > > Where the query statement is: > > result = c.execute("""INSERT INTO replies (postid, content, authorid, > timestamp) VALUES (%s, "%s", > %s, NOW());""" > % \ > (postid, content, authorid)) > > It's the content field which is the textarea and holds, of > course, the > content of a reply. > > If I escape the characters myself, I can successfully insert > them into the > MySQL database. Of course, displaying them later, after > retrieved, they > look ... uh... wrong. Guess I am going to have to re-escape > them back to > the original " character for displaying on the web page? > > Recommendations? Suggestions? > > Anyhow, I'm just puzzled that Albatross is not escaping the > character. I > looked at the tags.py file and see for the al-textarea > object, that it is > supposed to call the "escape" function defined near the top > of tags.py. I > am not using the "noescape" attribute on my al-textarea field. > > -- > 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/albat ross-users From matt at pollenation.net Wed Oct 1 07:28:57 2003 From: matt at pollenation.net (Matt Goodall) Date: Tue, 30 Sep 2003 22:28:57 +0100 Subject: [albatross-users] Having trouble implementing pagination In-Reply-To: References: Message-ID: <3F79F599.8030106@pollenation.net> Michael C. Neel wrote: >I'm, not %100 on this, but yoo should be able to pass the fetchall() >straight to the al-for. I do this all the time with MySQLdb, using the >normal cursor but that should make no difference here. > > > > A: > > >..should work ok. I say should because I don't use the dict cursor, but >iirc it returns a tuple of dicts, which should be just fine with the >Iterator class of albatross. > >The gothca here is that the query will be preformed for every page >(which you can work around) and the entire result set will be stored in >the session (which you can't work around). > The query will be performed each request but the result set shouldn't be stored in the session with the above code ... unless I'm missing something. The only parts of row (the ListIterator object) that are stored in the session are the current start index and the pagesize. Cheers, Matt -- Matt Goodall, Pollenation Internet Ltd w: http://www.pollenation.net e: matt at pollenation.net t: +44 (0)113 2252500 From alb-users at repose.cx Wed Oct 1 09:32:59 2003 From: alb-users at repose.cx (Damien Elmes) Date: Wed, 01 Oct 2003 09:32:59 +1000 Subject: [albatross-users] Having trouble implementing pagination In-Reply-To: <3F79F599.8030106@pollenation.net> (Matt Goodall's message of "Tue, 30 Sep 2003 22:28:57 +0100") References: <3F79F599.8030106@pollenation.net> Message-ID: <86oex1svh0.fsf@mobile.repose.cx> Matt Goodall writes: > The query will be performed each request but the result set shouldn't > be stored in the session with the above code ... unless I'm missing > something. The only parts of row (the ListIterator object) that are > stored in the session are the current start index and the pagesize. Sorry, I misunderstood. I thought you were saying that the resultset was being stored as a session variable, not the auxiliary variables for paging over it. Cheers, -- Damien Elmes From djc at object-craft.com.au Fri Oct 3 14:58:42 2003 From: djc at object-craft.com.au (Dave Cole) Date: 03 Oct 2003 14:58:42 +1000 Subject: [albatross-users] Albatross 1.11 pre2 released In-Reply-To: References: Message-ID: I have just packaged up the 1.11pre2 release of Albatross. As this is a pre-release the announcement is only being sent to this list. The documentation has been updated. You can see a list of the changes here. http://www.object-craft.com.au/projects/albatross/albatross/changes.html This release is intended to be fully compatible with the 1.10 release. A lot of minor reorganisation of the samples has been performed to enable the samples to be executed via the al-httpd program. al-httpd is a very useful tool for testing during development. For example, the tree1 sample can be executed like this: $ cd samples/tree2/ $ al-httpd tree.app 8080 /alsamp/images ../images/ You can now point your browser at http://localhost:8080/ to try the example. al-httpd allows pairs of URI to filesystem path prefix translations to be specified on the command line. This allows static resources to be served by al-httpd. The only difference between this release and the 1.11pre1 release is a small patch that Andrew found to make the tag generate the name and value attributes via the EvalAttribMixin class. The patch should not cause any problems to any existing code. If there are no complaints about this pre release I turn it into 1.11 next week. - Dave -- http://www.object-craft.com.au From djc at object-craft.com.au Fri Oct 3 15:14:05 2003 From: djc at object-craft.com.au (Dave Cole) Date: 03 Oct 2003 15:14:05 +1000 Subject: [albatross-users] pushing and popping In-Reply-To: <3F7668FC.70205@harvee.org> References: <3F7668FC.70205@harvee.org> Message-ID: > following some ofthe suggestions I received, I restructured how I'm > handling login. for example: > > def login_validation(self,context): > > # check for authentication > authentication = login_authentication() > > if hasattr(context,'_albatross_authentication') and \ > authentication.validate_token(context._albatross_authentication): > # token is there and validates. Return to calling context > return 1 > > syslog.syslog("let's go to authentication") > #need to go off and do login authentication > context.push_page('login') > > > Application.validate_request=login_validation > > > overwrites Application.validate_request's method with my code > login_validation. It's cool and that my code transfers controlled to > my login page, I enter my username and password and then, on > submission nothing happens except and error message telling me I > have premature end of script headers. It's not clear what's going > on because neither of my two display objects appear to get executed. > I suspect I have some form of fault happening very early on and I am > puzzling on how to get a handle on the error. Any suggestions? > Running the script by hand at the command line and paying attention > to network dumps aren't helping. > > On the other hand, maybe getting some sleep might help (up to early, > up too late, Mars is beautiful and has been all this opposition). Off the top of my head and completely untested... def login_validation(self, ctx): # check for authentication authentication = login_authentication() if (ctx.locals.__page__ == 'login' or (hasattr(ctx,'_albatross_authentication') and authentication.validate_token(ctx._albatross_authentication))): # token is there and validates. Return to calling context return 1 syslog.syslog("let's go to authentication") # need to go off and do login authentication ctx.push_page('login') You need to process the browser requests that are made from the login page. - Dave -- http://www.object-craft.com.au From tchur at optushome.com.au Sat Oct 4 10:44:33 2003 From: tchur at optushome.com.au (Tim Churches) Date: 04 Oct 2003 10:44:33 +1000 Subject: [albatross-users] Powered by Albatross? In-Reply-To: References: Message-ID: <1065228273.1184.32.camel@emilio> I wonder if Object Craft (or anyone else) could come up with a nice little "Albatross Powered" logo to put on Web pages next to a "PYTHON Powered" logo (i.e. the one which appears at the bottom of the left-hand sidebar on http://www.python.org/ - or cuter, the one at the foot of http://www.kantoormeubelland.nl/information.asp ) and a "PostgreSQL Powered" logo like the one at the foot of http://www.freshports.org/about.php - plus the obligatory "Powered by Linux" logo, of course. I think it is important to advertise the fact that open source software has been used, and in the case of commercial firms like Object Craft (or Red Hat etc), give them a bit of free advertising - even if it is only on your intranet. -- Tim C PGP/GnuPG Key 1024D/EAF993D0 available from keyservers everywhere or at http://members.optushome.com.au/tchur/pubkey.asc Key fingerprint = 8C22 BF76 33BA B3B5 1D5B EB37 7891 46A9 EAF9 93D0 -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part URL: From paulhart at redchocolate.ca Sat Oct 11 07:31:21 2003 From: paulhart at redchocolate.ca (Paul Hart) Date: Fri, 10 Oct 2003 17:31:21 -0400 Subject: [albatross-users] al-form, __albform__, and XHTML validation Message-ID: <17395E90-FB69-11D7-8E32-000393CC268A@redchocolate.ca> Hi all, I'm developing a web application, and one of the requirements is that the app must be XHTML 1.1 compliant. I've downloaded and installed Albatross 1.11pre2, and that has helped to fix a few of the problems I've seen before (I was running 1.10 previously). Currently there is a single issue remaining. Albatross apparently requires the automagically created __albform__ hidden input field to make it work correctly. The problem is that XHTML requires a container tag (one of "ins", "del", "h1", "h2", "h3", "h4", "h5", "h6", "p", "div", "address", or "fieldset") between the form tags and the input tags. For example, this would be valid:
Email Address:
Password:
But what we get right now is:
Email Address:
Password:
And that is invalid XHTML 1.1. The quick fix is to alter the code that builds the __albform__ tag to enclose it in a div that is hidden. In context.py, the code would be: self.write_content('
\n') The code is such that the div will not be displayed in any browser, and so the effect is hidden. Of course, that's just my attempt at fixing this, if anyone has any better suggestions, I'd love to hear them :) Thanks, Paul Hart From sheila at thinkspot.net Sun Oct 19 04:28:05 2003 From: sheila at thinkspot.net (Sheila King) Date: Sat, 18 Oct 2003 11:28:05 -0700 Subject: [albatross-users] al-comment tags Message-ID: <480872347.1066476485@localhost> Hello, Something I wanted to share that just occurred in code I was working on... I'm using Albatross 1.10 with various patches that have been distributed to the list... I have an html template page that I was coding various options using al-if structures... After working on this page for a couple of days, I decided to cut back the functionality for the time being, and just present simple options and possibly expand to some of the more complex stuff at a later date (scheduling concerns...) So I go to add al-comment tags to my code and get errors on the parse. Error says: File "/usr/lib/python2.2/site-packages/albatross/template.py", line 302, in __init__ raise ApplicationError('%s:%s: "%s"; expected "%s" end tag' % (filename, line_num, part, parent.name)) ApplicationError: ./templates/setquestion.html:36: "/al-comment"; expected "al-if" end tag (last part of the traceback) Anyhow, the structure is something like this: more stuff here Some content in here more stuff..yadda So, I try to figure out what's wrong, and reading the docs for al-comment, I find the following: "5.3.2 This tag suppresses the execution and output of any contained content, although the contained content must be syntactically correct. " I'm guessing my code is failing at the end of the first closing al-comment tag (the line number of the error corresponds to the first tag) because I have no inside of that comment block. But that's because the closing tag is later down the page and is within a comment block of it's own. I have never worked with a programming language before that required stuff within commented blocks to be syntactically correct. I'm quite surprised at this behavior, as I cannot understand the reasoning for it, and it certainly doesn't allow me to use comments as I normally would. Disappointed that I can't use comments as I would like to... -- Sheila King http://www.thinkspot.net/sheila/ http://www.k12groups.org From matt at pollenation.net Sun Oct 19 20:02:43 2003 From: matt at pollenation.net (Matt Goodall) Date: Sun, 19 Oct 2003 11:02:43 +0100 Subject: [albatross-users] al-comment tags In-Reply-To: <480872347.1066476485@localhost> References: <480872347.1066476485@localhost> Message-ID: <3F926143.7070703@pollenation.net> Sheila King wrote: > I have never worked with a programming language before that required > stuff within commented blocks to be syntactically correct. I'm quite > surprised at this behavior, as I cannot understand the reasoning for > it, and it certainly doesn't allow me to use comments as I normally > would. I agree it's a bit strange and I think I remember being caught by this too. However, I suspect it has more to do with keeping the template parser simple than a deliberate decision to enforce correct syntax within comment blocks. IIRC, the parser is implemented using a regex to spot al- and alx- tags (the only prefixes that the are recognised). My guess is that this was simply the easiest solution and avoids resorting to a DOM tree or parsing the template code into a tree of tokens as true language parsers tend to do. Cheers, Matt -- Matt Goodall, Pollenation Internet Ltd w: http://www.pollenation.net e: matt at pollenation.net From sheila at thinkspot.net Sun Oct 19 08:19:12 2003 From: sheila at thinkspot.net (Sheila King) Date: Sat, 18 Oct 2003 15:19:12 -0700 Subject: [albatross-users] al-comment tags In-Reply-To: <3F926143.7070703@pollenation.net> References: <480872347.1066476485@localhost> <3F926143.7070703@pollenation.net> Message-ID: <494739537.1066490352@localhost> --On Sunday, October 19, 2003 11:02 AM +0100 Matt Goodall wrote: > I agree it's a bit strange and I think I remember being caught by this > too. However, I suspect it has more to do with keeping the template > parser simple than a deliberate decision to enforce correct syntax > within comment blocks. I absolutely supposed the above to be true, and did not think I indicated otherwise in my original post. I understand there are design trade-offs in any type of decision such as this one. Nevertheless, I am disappointed that I am unable to use al-comments as *true* comments. I'm not really able to comment on whether this behavior should be changed or not, as I do not understand all of the implications and consequences of the change, except that I'm sure it requires more processing and the code may be more difficult to write and therefore more prone to parsing errors. -- Sheila King http://www.thinkspot.net/sheila/ http://www.k12groups.org From djc at object-craft.com.au Sun Oct 19 21:47:56 2003 From: djc at object-craft.com.au (Dave Cole) Date: 19 Oct 2003 21:47:56 +1000 Subject: [albatross-users] al-comment tags In-Reply-To: <494739537.1066490352@localhost> References: <480872347.1066476485@localhost> <3F926143.7070703@pollenation.net> <494739537.1066490352@localhost> Message-ID: >>>>> "Sheila" == Sheila King writes: Sheila> --On Sunday, October 19, 2003 11:02 AM +0100 Matt Goodall Sheila> wrote: >> I agree it's a bit strange and I think I remember being caught by >> this too. However, I suspect it has more to do with keeping the >> template parser simple than a deliberate decision to enforce >> correct syntax within comment blocks. Sheila> I absolutely supposed the above to be true, and did not think Sheila> I indicated otherwise in my original post. I understand there Sheila> are design trade-offs in any type of decision such as this Sheila> one. Sheila> Nevertheless, I am disappointed that I am unable to use Sheila> al-comments as *true* comments. I'm not really able to comment Sheila> on whether this behavior should be changed or not, as I do not Sheila> understand all of the implications and consequences of the Sheila> change, except that I'm sure it requires more processing and Sheila> the code may be more difficult to write and therefore more Sheila> prone to parsing errors. All Albatross tags are parsed into a tree like structure before they are executed. The al-comment tag only behaves like a comment because when it executes it does not execute any of the tree nodes below it. The upshot of this is the tags must still be structured as a tree in the template. Think in terms of the Albatross tags forming an XML syntax (sort of). - Dave -- http://www.object-craft.com.au From michael_hartl at yahoo.com Sun Oct 26 16:59:58 2003 From: michael_hartl at yahoo.com (Michael Hartl) Date: Sat, 25 Oct 2003 22:59:58 -0700 (PDT) Subject: [albatross-users] Login, authentication, and sessions: Popview application problems Message-ID: <20031026055958.70130.qmail@web10502.mail.yahoo.com> I'm trying to learn how to use Albatross to do login, authentication, and sessions. The documentation says that this is possible, but I can't figure out how to do it. The Popview example is a case in point. If I begin at popview1/popview.py, I am immediately confronted with username/password fields, but I can't find the appropriate login information anywhere in the Albatross manual. Furthermore, if I type in a random guess, the result is an exception (reproduced after this message). I've had no luck with any of the popview2-4 either. The examples at, say, http://www.object-craft.com.au/cgi-bin/alsamp/popview4/popview.py also don't work; entering a username/password pair and submitting the login form appears to do nothing. I should note that the errors I'm finding seem to be the same whether the Albatross application server is running or not. Also, in case it's relevant, I'm running Apache 2.0.47 and Python 2.2 on Red Hat Linux 9.0. The errors appear using both Albatross 1.10 and 1.11pre2. I'm in the alpha stage of building a commercial website, and I'm trying to use Python in preference to PHP, but functional and well-documented support for Python web programming (especially login/authentication and session management) is scarce. Please tell me Albatross is the answer I've been looking for! Thanks, Michael http://localhost/cgi-bin/alsamp/popview1/popview.py gives Template traceback (most recent call last): Traceback (most recent call last): File "/usr/lib/python2.2/site-packages/albatross/app.py", line 251, in run self.process_request(ctx) File "/usr/lib/python2.2/site-packages/albatross/app.py", line 460, in process_request func(ctx) File "/usr/local/apache2/cgi-bin/alsamp/popview1/popview.py", line 16, in page_process ctx.open_mbox() File "/usr/local/apache2/cgi-bin/alsamp/popview1/popview.py", line 58, in open_mbox self.locals.mbox = popviewlib.Mbox(self.locals.username, self.locals.passwd) File "/usr/local/apache2/cgi-bin/alsamp/popview1/popviewlib.py", line 67, in __init__ self.mbox = poplib.POP3(pophost) File "/usr/lib/python2.2/poplib.py", line 80, in __init__ for res in socket.getaddrinfo(self.host, self.port, 0, socket.SOCK_STREAM): gaierror: (-2, 'Name or service not known') ===== Michael Hartl http://www.michaelhartl.com/ __________________________________ Do you Yahoo!? Exclusive Video Premiere - Britney Spears http://launch.yahoo.com/promos/britneyspears/ From matt at pollenation.net Mon Oct 27 01:27:42 2003 From: matt at pollenation.net (Matt Goodall) Date: Sun, 26 Oct 2003 14:27:42 +0000 Subject: [albatross-users] Login, authentication, and sessions: Popview application problems In-Reply-To: <20031026055958.70130.qmail@web10502.mail.yahoo.com> References: <20031026055958.70130.qmail@web10502.mail.yahoo.com> Message-ID: <3F9BD9DE.1010301@pollenation.net> Michael Hartl wrote: >I'm trying to learn how to use Albatross to do login, >authentication, and sessions. The documentation says >that this is possible, but I can't figure out how to >do it. > >The Popview example is a case in point. If I begin at >popview1/popview.py, I am immediately confronted with >username/password fields, but I can't find the >appropriate login information anywhere in the >Albatross manual. > That's because the popview examples authenticate aginst a POP3 server, it has nothing to do with Albatross itself. Each of the popview examples contains a popviewlib module. You need to change the pophost variable at the top to your pop3 server and log in using your normal username/password. If that's not documented in the manual then it probably should be. On yeah, for some reason login.html restricts the length of username and password to 10 characters which was too small for me but may be fine for you. Just edit login.html if necessary. >Furthermore, if I type in a random >guess, the result is an exception (reproduced after >this message). > Yep, that exception says that the exception happened inside Python 2.2's standard poplib module. If you look back up the stack (i.e. starting at the bottom) the first bit of Albatross/popview code you see is line 67 of popviewlib.py which tries to open the connection to the POP3 server. Admittedly, it's not that easy to decode but tracebacks never really are. They do generally contain a wealth of information about where to start looking though. >I've had no luck with any of the >popview2-4 either. The examples at, say, >http://www.object-craft.com.au/cgi-bin/alsamp/popview4/popview.py >also don't work; entering a username/password pair and >submitting the login form appears to do nothing. > > This is all the same problem as above. >I should note that the errors I'm finding seem to be >the same whether the Albatross application server is >running or not. Also, in case it's relevant, I'm >running Apache 2.0.47 and Python 2.2 on Red Hat Linux >9.0. The errors appear using both Albatross 1.10 and >1.11pre2. > >I'm in the alpha stage of building a commercial >website, and I'm trying to use Python in preference to >PHP, but functional and well-documented support for >Python web programming (especially >login/authentication and session management) is >scarce. Please tell me Albatross is the answer I've >been looking for! > > Python is a fantastic choice for web development, I strongly recommend it. Whether Albatross is a good match for your requirements is a different matter. If you post some more details about what you are trying to achieve there are various people on the list who may be able to offer some advice. Cheers, Matt -- Matt Goodall, Pollenation Internet Ltd w: http://www.pollenation.net e: matt at pollenation.net