[Zope-dev] Incorrect Padding?
Martijn Pieters
mj@digicool.com
Wed, 26 Jul 2000 10:56:21 +0200
On Mon, Jul 24, 2000 at 09:36:53PM +0100, Steve Alexander wrote:
> Martijn Pieters wrote:
> > Would it be a good idea to add the header?
>
> I don't quite follow.
Add the non-compliant Basic Auth header to the error message, to aid in
debugging the client.
> > And let's make that a less generic
> > except clause, we don't want to mask Zope bugs =)
>
> Ok.
>
> I was thinking of just using HTTPResponse.badRequestError().
> However, it has a "name" argument, and I don't quite understand how it
> is meant to be used.
>
> def badRequestError(self,name):
> self.setStatus(400)
> if regex.match('^[A-Z_0-9]+$',name) >= 0:
> raise 'InternalError', self._error_html(
> "Internal Error",
> "Sorry, an internal error occurred in this Zope
> resource.")
>
> raise 'BadRequest',self._error_html(
> "Invalid request",
> "The parameter, <em>%s</em>, " % name +
> "was omitted from the request.<p>" +
> "Make sure to specify all required parameters, " +
> "and try the request again."
> )
>
> So, any of name="FOO", name="123", name="FOO123", name="" produces an
> internal error; name="foo", name="Foo", name="foo123" produces a bad
> request.
>
> What's the rationale?
>
>
> Should I just use this, then?
>
> request.response.badRequestError(name="0") # internal error
I have no idea. I liked your first solution better, as the message was far
more informative.
--
Martijn Pieters
| Software Engineer mailto:mj@digicool.com
| Digital Creations http://www.digicool.com/
| Creators of Zope http://www.zope.org/
| ZopeStudio: http://www.zope.org/Products/ZopeStudio
-----------------------------------------------------