On Aug 8, 2010, at 4:57 PM, Victor wrote:

> Hi,
> 
> I have a running site based on TurboGears2.  In real world, you can't
> expect how people use your site, for knowing what errors appear in the
> application, I set the error emailing report middleware up.
> Unfortunately, some people or web-spider add some strange arguments at
> the tail of URL, as the result, I will get a "got an unexpected
> keyword argument" error mail.  Most of them are useless and annoying,
> but I can't turn the error report off, otherwise I might lost
> important error messages.
> 
> I know that I can add a **kwargs to every method of controllers, e.g.
> 
> def foo(self, arg1, arg2, **kwargs):
>    # ....
>    return dict()
> 
> It's not too difficult to do, and it works, but it is hateful to check
> all exposed method that has a **kwargs in arguments.  I'd like to
> know, is that possible to ignore the error globally?  That would do me
> a big favor.

Not that I'm aware of. But you can simply add a 3-line middleware that catches 
the TypeError, checks if there was  a HTTP_REFERRER header in the environ, and 
if not, simply render a 500 or 404.

Diez

-- 
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en.

Reply via email to