Shawn Walker wrote:
> Danek Duvall wrote:
>> On Mon, Aug 18, 2008 at 02:47:19PM -0500, Shawn Walker wrote:
>>
>>>> Perhaps the except statement should be more specific?  (IndexError,
>>>> IllegalDotSequence, IllegalVersion)
>>> I initially took that approach, but abandoned it for reasons I explain 
>>> later.
>> I don't mean in order to be able to send a 400 instead of a 404, just so
>> that you don't inadvertently catch KeyboardInterrupt or SystemExit.  I'm
>> always wary of a bare except statement.
> 
> Fair enough.  I've fixed that then and I'll putback soon once I retest.
> 
> I had to add AssertionError as well since modules/fmri.py does the 
> "assert self.version != None".

For those curious:
diff -r 35a1d8f614bc src/modules/server/repository.py
--- a/src/modules/server/repository.py  Mon Aug 18 16:36:16 2008 -0500
+++ b/src/modules/server/repository.py  Mon Aug 18 16:45:37 2008 -0500
@@ -48,6 +48,7 @@
  import pkg.fmri as fmri
  import pkg.manifest as manifest
  import pkg.misc as misc
+import pkg.version as version

  import pkg.server.face as face
  import pkg.server.repositoryconfig as rc
@@ -284,7 +285,8 @@
                          pfmri = tokens[0]
                          f = fmri.PkgFmri(pfmri, None)
                          fpath = f.get_dir_path()
-                except:
+                except (IndexError, AssertionError, 
version.IllegalDotSequence,
+                    version.IllegalVersion):
                          raise cherrypy.HTTPError(httplib.NOT_FOUND)

                  # send manifest

Cheers,
-- 
Shawn Walker | [EMAIL PROTECTED] | blogs.sun.com/srw
_______________________________________________
pkg-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/pkg-discuss

Reply via email to