From nsavch at gmail.com Sat May 15 04:50:05 2010 From: nsavch at gmail.com (Nickolay Savchenko) Date: Fri, 14 May 2010 21:50:05 +0300 Subject: [albatross-users] bug in RandomPageModuleMixin.load_page Message-ID: Hi all! 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. -- Best regards, Nickolay S. Savchenko -------------- next part -------------- A non-text attachment was scrubbed... Name: load_page.patch Type: text/x-patch Size: 466 bytes Desc: not available URL: From andrewm at object-craft.com.au Thu May 27 17:46:21 2010 From: andrewm at object-craft.com.au (Andrew McNamara) Date: Thu, 27 May 2010 17:46:21 +1000 Subject: [albatross-users] bug in RandomPageModuleMixin.load_page In-Reply-To: References: Message-ID: <1274946381.10296.11.camel@longblack> 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: From nsavch at gmail.com Thu May 27 21:18:26 2010 From: nsavch at gmail.com (Nickolay Savchenko) Date: Thu, 27 May 2010 14:18:26 +0300 Subject: [albatross-users] bug in RandomPageModuleMixin.load_page In-Reply-To: <1274946381.10296.11.camel@longblack> References: <1274946381.10296.11.camel@longblack> Message-ID: 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 : > 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 From andrewm at object-craft.com.au Thu May 27 22:44:50 2010 From: andrewm at object-craft.com.au (Andrew McNamara) Date: Thu, 27 May 2010 22:44:50 +1000 Subject: [albatross-users] bug in RandomPageModuleMixin.load_page In-Reply-To: References: <1274946381.10296.11.camel@longblack> Message-ID: <20100527124451.014472070E@longblack.object-craft.com.au> >Tested patch against 1.36, it works. But one test is failing now, below is fix: Ah, thanks! I'll also need to update the docs, and work out how to add a unittest for the problem you found. -- Andrew McNamara, Senior Developer, Object Craft http://www.object-craft.com.au/