[albatross-users] bug in RandomPageModuleMixin.load_page

Andrew McNamara andrewm at object-craft.com.au
Thu May 27 17:46:21 EST 2010


On Fri, 2010-05-14 at 21:50 +0300, Nickolay Savchenko wrote:

> load_page method of RandomPageModuleMixin seems to have a bug. If URL
> has dots this method doesn't catch ApplicationError correctly, and
> server returns 500 error instead of 404.
> 
> Traceback is following:
> 
> 2010-04-07 17:37:32.215924: //phpMyAdmin/config/config.inc.php?c=uptime
> Traceback (most recent call last):
>   File "/var/www/ivi/website/modules/app.py", line 167, in run
>     self.load_page(ctx)
>   File "/usr/lib/python2.5/site-packages/albatross/randompage.py",
> line 29, in load_page
>     self.load_page_module(ctx, page)
>   File "/usr/lib/python2.5/site-packages/albatross/app.py", line 437,
> in load_page_module
>     raise ApplicationError('%s (in %s)' % (e, mod_dir))
> ApplicationError: No module named php (in
> /var/www/ivi/website/pages/config/config/inc)
> 
> This can be easily fixed with attached patch.

Thanks for the bug report! I've implemented a slightly different fix
that creates an ApplicationError subclass called PageNotFound and thus
avoids the need for searching in strings. Can you try this out and let
me know if it fixes the problem equally well (sorry, I haven't had a
chance to replicate it yet)?

-- 
Andrew McNamara, Senior Developer, Object Craft
http://www.object-craft.com.au/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: albatross-randompage-patch
Type: text/x-patch
Size: 1768 bytes
Desc: not available
URL: <http://www.object-craft.com.au/pipermail/albatross-users/attachments/20100527/8eb89b7a/attachment.bin>


More information about the Albatross-users mailing list