On Wed, Feb 13, 2008 at 09:05:43PM -0600, Shawn Walker wrote:
> >From publish.py:
>
> 94 status, id = t.open(config, pargs[0])
> 95
> 96 if status / 100 == 4 or status / 100 == 5:
> 97 print >> sys.stderr, \
> 98 _("pkgsend: server failed (status %s)") % status
> 99 sys.exit(1)
>
> If I'm reading this right, this is "clever code" that says that if the
> response code returned is anything in the 400 or 500 range, it should
> be considered an error.
That's right.
> I was thinking of using a lambda to do a quasi-switch-case on the
> response codes that are valid.
What did you have in mind? I mean, I think it'd be fine if you moved the
two if-tests into a method if you want, but if you end up testing for each
of the enumerated, named 4xx and 5xx codes in httplib, then you'll end up
not catching other codes we might end up returning.
Danek
_______________________________________________
pkg-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/pkg-discuss