Malcolm, thanks for the answer. I should have better read src of
client.py.

default for query environment can be overridden like so:

c = Client(REMOTE_ADDR ='127.0.0.1') - this solves my problem!

> Work out which standards are relevant. If REMOTE_ADDR *must* be supplied
> by all web servers, then the test client is in error.
> If not, any code
> that cannot handle it being missing is in error.

I did not get this one: META['REMOTE_ADDR'] is implementation
specific, I thought ... so if you mention relevant standards, I do not
think that anything from HTTP RFCs applies here. (I might be
completely wrong ...)

Otherwise, REMOTE_ADDR in request is set either directly from
remote_ip/client_address or from HTTP_X_FORWARDED_FOR using specific
middleware.

Regards, Thomas



Malcolm Tredinnick wrote:
> On Fri, 2008-01-04 at 14:30 -0800, Thomas wrote:
> > I am testing django.contrib.comments with django.test.client that does
> > not provide request.META['REMOTE_ADDR'] and therefore dies at
> > http://code.djangoproject.com/browser/django/trunk/django/contrib/comments/views/comments.py#L252
> >
> > There has been a ticked #407 but that did not change all
> > request.META['REMOTE_ADDR'] to request.META.get()
> >
> > Question: what is the best way to fix this?
>
> Work out which standards are relevant. If REMOTE_ADDR *must* be supplied
> by all web servers, then the test client is in error. If not, any code
> that cannot handle it being missing is in error.
>
> Regards,
> Malcolm
>
> --
> Experience is something you don't get until just after you need it.
> http://www.pointy-stick.com/blog/
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to