From andrewm at object-craft.com.au Wed Mar 14 11:35:51 2007 From: andrewm at object-craft.com.au (Andrew McNamara) Date: Wed, 14 Mar 2007 11:35:51 +1100 Subject: [albatross-users] Auto list bug/issue... In-Reply-To: References: Message-ID: <20070314003551.32E035CCB04@longblack.object-craft.com.au> >I've come across a strang which is in 1.11+, maybe prior versions as >well but I didin't check them. > >Normally, if you try to have several form fields defined with the same >name, you either need to use the "list" argument on the tags, or make >the list in the page object/module. This is very nice, because >albatross doesn't pull an perl like bs of thinking for you, and letting >some bug creep into production because it never caused a problem when >testing. > >However, if you name several fields the same name, but they are >different types, you can get a field that will sometimes be a list, >sometime a string. To show this, here is a simple template that will >show the problem: Thanks for the report, Michael. I know it's been outstanding for a while! The problem is due to inputs that can appear multiple times, but return a single value (such as radio buttons and submit buttons). This simple example exhibits the problem also (it should raise an exception on load, but doesn't): I've checked a change in (r8871) that addresses this issue, and I hope to be able to put out a new release later in the week. -- Andrew McNamara, Senior Developer, Object Craft http://www.object-craft.com.au/ From andrewm at object-craft.com.au Wed Mar 14 11:54:46 2007 From: andrewm at object-craft.com.au (Andrew McNamara) Date: Wed, 14 Mar 2007 11:54:46 +1100 Subject: [albatross-users] validate_request in Albatross docstring In-Reply-To: <45671B9B.4040002@sauvages.be> References: <45671B9B.4040002@sauvages.be> Message-ID: <20070314005446.E270B5CCB04@longblack.object-craft.com.au> >However, I just lost some precious minutes because of the wrong >docstring for method > >validate_request in Albatross latest online doc >(http://object-craft.com.au/projects/albatross/albatross/pack-app.html#l2h-272) > >Could it be updated, so that it explains what it means to return 0, >and what it means to return 1? I've changed this to read: \begin{methoddesc}[Application]{validate_request}{ctx} Returns \code{TRUE}. You should override this method in your application object if you need to validate browser requests before processing them. Returning False will prevent the browser request being merged into the local namespace and the page_process logic will not be called (see also the description of the Albatross Application Model in \ref{app-model}). \end{methoddesc} The updated description will appear after the next Albatross release (hopefully this week). -- Andrew McNamara, Senior Developer, Object Craft http://www.object-craft.com.au/ From andrewm at object-craft.com.au Wed Mar 14 12:08:43 2007 From: andrewm at object-craft.com.au (Andrew McNamara) Date: Wed, 14 Mar 2007 12:08:43 +1100 Subject: [albatross-users] Documentation test case fails on amd64 In-Reply-To: <1160494844.5061.13.camel@localhost> References: <1160494844.5061.13.camel@localhost> Message-ID: <20070314010843.E50C25CC90E@longblack.object-craft.com.au> >I got a Debian bug report about the albatross build failing on amd64. >The build fails on a documentation test because the Python built-in >hash() function doesn't return the same value on all platforms: > >Testing "doctest/tags-value1" failed, Line 6: output does not match >example >Expected: >hash('spam') is 1626740519 > >Got: >hash('spam') is -1840390907728881881 Thanks for the report, Fabian. I've changed the example to the simpler: >>> import albatross >>> ctx = albatross.SimpleContext('.') >>> ctx.locals.items = ['pencil', 'eraser', 'lunchbox'] >>> albatross.Template(ctx, '', ''' ... There are items ... ''').to_html(ctx) >>> ctx.flush_content() There are 3 items -- Andrew McNamara, Senior Developer, Object Craft http://www.object-craft.com.au/ From unclezzzen at gmail.com Thu Mar 15 14:53:33 2007 From: unclezzzen at gmail.com (Uncle Zzzen) Date: Thu, 15 Mar 2007 05:53:33 +0200 Subject: [albatross-users] Problem with command-line parsing. Affects OpenID auth Message-ID: <24132b510703142053y1fbc0d0bvd96f5a844e683215@mail.gmail.com> Hi. I'm trying to write an Albatross wrapper for OpenID, and one of the phases of authentication is when the OpenID server redirects to something like: http://myserver/login_continue?openid.assoc_handle=%7BHMAC-SHA1%... Nothing I can do about it. OpenID is not MY standard openid.assoc_handle gets parsed and this raises an error: Traceback (most recent call last): File "/usr/lib/python2.4/site-packages/albatross/app.py", line 282, in run self.merge_request(ctx) File "/usr/lib/python2.4/site-packages/albatross/app.py", line 366, in merge_request ctx.merge_request() File "/usr/lib/python2.4/site-packages/albatross/context.py", line 332, in merge_request self.set_value(name, value) File "/usr/lib/python2.4/site-packages/albatross/context.py", line 418, in set_value parent = getattr(parent, elem) AttributeError: Vars instance has no attribute 'openid' in al-input field "openid.assoc_handle" I'm gonna patch the lib or something to make it work, but there should be a sane way to cope with OpenID Any help with tricks around this problem will be appreciated. Cheers, The Dod From unclezzzen at gmail.com Fri Mar 16 02:08:53 2007 From: unclezzzen at gmail.com (Uncle Zzzen) Date: Thu, 15 Mar 2007 17:08:53 +0200 Subject: [albatross-users] Easy to recreate the OpenID problem on object-craft site itself Message-ID: <24132b510703150808t478039b3u6c786b1d7a01d603@mail.gmail.com> try http://www.object-craft.com.au/cgi-bin/alsamp/form4/form.py?funny.field=2 and see the error you get. Maybe there's even a way to inject stuff into object this way. Have no time to check. Would rather write my app at the moment, but there are many kids out there ;) Cheers, The dod -- "The road tried to cross the chicken, but the chicken was faster" -- Abu-Zeresh gpg: http://zzzen.com/zzzen.asc fingerprint(0x7F1BCD50) = 0FEE 7BA9 6F1C 23F9 BACD 0F72 6434 F9A7 7F1B CD50 From andrewm at object-craft.com.au Fri Mar 16 10:04:08 2007 From: andrewm at object-craft.com.au (Andrew McNamara) Date: Fri, 16 Mar 2007 10:04:08 +1100 Subject: [albatross-users] Problem with command-line parsing. Affects OpenID auth In-Reply-To: <24132b510703142053y1fbc0d0bvd96f5a844e683215@mail.gmail.com> References: <24132b510703142053y1fbc0d0bvd96f5a844e683215@mail.gmail.com> Message-ID: <20070315230408.E49E76007B0@longblack.object-craft.com.au> >I'm trying to write an Albatross wrapper for OpenID, and one of the >phases of authentication is when the OpenID server redirects to >something like: >http://myserver/login_continue?openid.assoc_handle=%7BHMAC-SHA1%... >Nothing I can do about it. OpenID is not MY standard > >openid.assoc_handle gets parsed and this raises an error: > >Traceback (most recent call last): > File "/usr/lib/python2.4/site-packages/albatross/app.py", line 282, in run > self.merge_request(ctx) > File "/usr/lib/python2.4/site-packages/albatross/app.py", line 366, >in merge_request > ctx.merge_request() > File "/usr/lib/python2.4/site-packages/albatross/context.py", line >332, in merge_request > self.set_value(name, value) > File "/usr/lib/python2.4/site-packages/albatross/context.py", line >418, in set_value > parent = getattr(parent, elem) >AttributeError: Vars instance has no attribute 'openid' > in al-input field "openid.assoc_handle" > >I'm gonna patch the lib or something to make it work, but there should >be a sane way to cope with OpenID > >Any help with tricks around this problem will be appreciated. The simplest answer is to put an object called openid into ctx.locals. After the page loads, the dummy object will have an attribute "assoc_handle", and you can do with this what you please. -- Andrew McNamara, Senior Developer, Object Craft http://www.object-craft.com.au/ From andrewm at object-craft.com.au Fri Mar 16 11:47:24 2007 From: andrewm at object-craft.com.au (Andrew McNamara) Date: Fri, 16 Mar 2007 11:47:24 +1100 Subject: [albatross-users] Easy to recreate the OpenID problem on object-craft site itself In-Reply-To: <24132b510703150808t478039b3u6c786b1d7a01d603@mail.gmail.com> References: <24132b510703150808t478039b3u6c786b1d7a01d603@mail.gmail.com> Message-ID: <20070316004724.3E4D26007B0@longblack.object-craft.com.au> >try http://www.object-craft.com.au/cgi-bin/alsamp/form4/form.py?funny.field=2 >and see the error you get. > >Maybe there's even a way to inject stuff into object this way. Have no >time to check. Would rather write my app at the moment, but there are >many kids out there ;) This is how it's meant to work. I was hoping to point you at the section of the manual that talks about this, but it doesn't seem to exist, which is a bit unfortunate. The code that implements this is in context.py, NamespaceMixin.set_value. You will see there is a fairly complex state machine that emulates a subset of python expression parsing (. and []). -- Andrew McNamara, Senior Developer, Object Craft http://www.object-craft.com.au/ From unclezzzen at gmail.com Fri Mar 16 10:39:33 2007 From: unclezzzen at gmail.com (Uncle Zzzen) Date: Fri, 16 Mar 2007 01:39:33 +0200 Subject: [albatross-users] Re: Problem with command-line parsing. Affects OpenID auth In-Reply-To: <24132b510703151638k5b0f352csc9ab0ca29f2fc733@mail.gmail.com> References: <24132b510703142053y1fbc0d0bvd96f5a844e683215@mail.gmail.com> <20070315230408.E49E76007B0@longblack.object-craft.com.au> <24132b510703151638k5b0f352csc9ab0ca29f2fc733@mail.gmail.com> Message-ID: <24132b510703151639t71630816y109c8d4ffb223bc4@mail.gmail.com> On 3/16/07, Andrew McNamara wrote: > The simplest answer is to put an object called openid into ctx.locals. > After the page loads, the dummy object will have an attribute > "assoc_handle", and you can do with this what you please. It worked. I've subclassed the context and added self.locals.openid=albatros.context.Vars() at the end of __init__ Thanks. -- "What do you give a man who has everything? A condom, unless you also want to have what he's got" -- Um Zeresh gpg: http://zzzen.com/zzzen.asc fingerprint(0x7F1BCD50) = 0FEE 7BA9 6F1C 23F9 BACD 0F72 6434 F9A7 7F1B CD50 -- "What do you give a man who has everything? A condom, unless you also want to have what he's got" -- Um Zeresh gpg: http://zzzen.com/zzzen.asc fingerprint(0x7F1BCD50) = 0FEE 7BA9 6F1C 23F9 BACD 0F72 6434 F9A7 7F1B CD50 From andrewm at object-craft.com.au Mon Mar 19 17:01:08 2007 From: andrewm at object-craft.com.au (Andrew McNamara) Date: Mon, 19 Mar 2007 17:01:08 +1100 Subject: [albatross-users] Albatross 1.36 released Message-ID: <20070319060108.8D3581D404C@longblack.object-craft.com.au> OVERVIEW Albatross is a small toolkit for developing highly stateful web applications. The toolkit has been designed to take a lot of the pain out of constructing intranet applications although you can also use Albatross for deploying publicly accessed web applications. In slightly more than 5300 lines of Python (according to pycount) you get the following: * An extensible HTML templating system similar to DTML including tags for: - Conditional processing. - Macro definition and expansion. - Sequence iteration and pagination. - Tree browsing. - Lookup tables to translate Python values to arbitrary template text. * Application classes which offer the following features: - Optional server side or browser side sessions. - The ability to place Python code for each page in a dynamically loaded module, or to place all page processing code in a single mainline. * The ability to deploy applications as CGI, FastCGI, mod_python or a pure python HTTP server by changing less than 10 lines of code. The toolkit application functionality is defined by a collection of fine grained mixin classes. Nine different application types and six different execution contexts are prepackaged, you are able to define your own drop in replacements for any of the mixins to alter any aspect of the toolkit semantics. Application deployment is controlled by your choice of either cgi, FastCGI, mod_python, or BaseHTTPServer Request class. It should be possible to develop a Request class for Medusa or Twisted to allow applications to be deployed on those platforms with minimal changes. Albatross comes with over 180 pages of documentation. HTML and PDF formatted documentation is available from the toolkit homepage. The toolkit homepage: http://www.object-craft.com.au/projects/albatross/ The Albatross mailing list subscription and archives: http://object-craft.com.au/cgi-bin/mailman/listinfo/albatross-users CHANGES SINCE 1.35: ==================- New Features ------------ * A "vars" attribute has been added to - this inserts the iterator value into the local namespace. The iterator value was previously only accessible via the iterator value() method. * now loops over sequences using the iterator protocol by default. The previous behaviour of indexing the sequence is retained where pagination or columns are requested. * New tag which allows macros to define default values for their arguments (suggested by Greg Bond). * Macro expansion can now specify macro arguments via attributes on the tag (suggested by Greg Bond). * Added get_param() method to Request classes, which deployment method agnostic access to http "environment" variables. Functional Changes ------------------ * NameRecorderMixin no longer falls back to merging all request fields if no __albform__ field is present. Applications using the NameRecorderMixin and GET-style requests will need to explicitly merge relevent fields with the ctx.merge_vars(...) method. * Pickles embedded in hidden fields are now signed using the HMAC-SHA1 algorithm (was MD5). * The experimental FastCGI driver included in version 1.35 now becomes the default. The old driver has been renamed fcgiappold. This driver implements the FastCGI protocol itself, rather than depending on an external module. Bug Fixes --------- * If the tag was not immediately enclosed within an tag, it would be silently ignored. now works within containing flow control tags such as or , and supports attributes for dynamically setting value and label. * Communication with the session server has been made more robust. EINTR is handled, as are partial reads and writes, and requests are restarted if the socket closes. * Mixing radio inputs with other inputs of the same name did not raise an exception (reported by Michael Neel). * fixed FCGI_MAX_DATA, which was incorrect due to an operator precedence mistake. Found by Tom Limoncelli. Miscellaneous Changes --------------------- * Clean up and replace many pre-python 2.2 constructs. * Many new tests have been added, and existing tests restructured. -- Andrew McNamara, Senior Developer, Object Craft http://www.object-craft.com.au/