2010/10/6 Łukasz Rekucki <lreku...@gmail.com>:
> Hi,
>
> I'm getting a whole bunch of errors related to logging on Python 2.4::
>
> ERROR: Missing templates are correctly reported by test client
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>  File 
> "/home/lrekucki/projekty/django/django_trunk/tests/regressiontests/test_client_regress/models.py",
> line 583, in test_no_404_template
>    response = self.client.get("/no_such_view/")
>  File "/home/lrekucki/projekty/django/django_trunk/django/test/client.py",
> line 298, in get
>    response = self.request(**r)
>  File "/home/lrekucki/projekty/django/django_trunk/django/test/client.py",
> line 238, in request
>    response = self.handler(environ)
>  File "/home/lrekucki/projekty/django/django_trunk/django/test/client.py",
> line 79, in __call__
>    response = self.get_response(request)
>  File 
> "/home/lrekucki/projekty/django/django_trunk/django/core/handlers/base.py",
> line 139, in get_response
>    return self.handle_uncaught_exception(request, resolver, sys.exc_info())
>  File 
> "/home/lrekucki/projekty/django/django_trunk/django/core/handlers/base.py",
> line 182, in handle_uncaught_exception
>    extra={
>  File "/home/lrekucki/python/plain2.4//lib/python2.4/logging/__init__.py",
> line 999, in error
>    apply(self._log, (ERROR, msg, args), kwargs)
> TypeError: _log() got an unexpected keyword argument 'extra'
>
> Sadly, it's true - log functions don't have extra=* in Python 2.4[1].
> Possible solutions I can see right now:
>
>  * revert the logging patch (that would be quite bad)
>  * try to do some ugly monkey patching to the logging module
>  * drop Python 2.4 support
>
> Opinions ?

I shall now sing a selection of arias from the opera I have written,
entitled "Oh crap and buggery".

:-)

Dropping Python 2.4 would be the easiest solution, but as I've
commented previously, it really isn't an option. I really don't want
to revert logging -- the set of cases where it's useful vastly exceeds
the cases where it isn't.

Monkeypatching isn't a particularly attractive option.

A fourth option would be to include Python's logging module, much as
we do with doctest, simpleJSON, and we're about to do with unittest2.
It's a heavyweight option, but it would do the job. We could remove
the inclusion once we drop Python 2.4 support (possibly in Django
1.4).

A fifth option would be to catch the error cases and wrap them in
backwards compatibility:

try:

except TypeError:
    logging.errro('error message')

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-develop...@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.

Reply via email to