[albatross-users] bug in RandomPageModuleMixin.load_page
Nickolay Savchenko
nsavch at gmail.com
Thu May 27 21:18:26 EST 2010
Tested patch against 1.36, it works. But one test is failing now, below is fix:
Index: test/misc/pagemodule.py
===================================================================
--- test/misc/pagemodule.py (revision 7516)
+++ test/misc/pagemodule.py (working copy)
@@ -67,7 +67,7 @@
def missing_module(self):
self._mod_regexp('nonexistent_module',
- 'ApplicationError: No module named')
+ 'PageNotFound: No module named')
def simple_page_module(self):
self._mod_result('simple_module', '')
2010/5/27 Andrew McNamara <andrewm at object-craft.com.au>:
> 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/
>
>
--
Best regards,
Nickolay S. Savchenko
More information about the Albatross-users
mailing list