By using pdb post mortem, I found out that the request.META dictionary
doesn't actually have 'REMOTE_ADDR' in it. Settings.INTERNAL_IPS is
'127.0.0.1'. So then get() returns None, and the error comes from
python trying to evaluate None in '127.0.0.1'. Should the test client
be setting this value? Is there something in my code or configuration
that needs to change to set that?

On Oct 23, 9:17 am, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> I found this problem while trying out the django test client:
>
> $ ./manage.py shell>>> from django.test.client import Client
> >>> c = Client()
> >>> c.get('/')
>
> Traceback (most recent call last):
>   File "<console>", line 1, in <module>
>   File "/var/lib/python-support/python2.5/django/test/client.py", line
> 265, in get
>     return self.request(**r)
>   File "/var/lib/python-support/python2.5/django/core/handlers/
> base.py", line 86, in get_response
>     response = callback(request, *callback_args, **callback_kwargs)
>   File "/path/to/website/views.py", line 12, in index
>     context_instance=RequestContext(request))
>   File "/var/lib/python-support/python2.5/django/template/context.py",
> line 105, in __init__
>     self.update(processor(request))
>   File "/var/lib/python-support/python2.5/django/core/
> context_processors.py", line 34, in debug
>     if settings.DEBUG and request.META.get('REMOTE_ADDR') in
> settings.INTERNAL_IPS:
> TypeError: 'in <string>' requires string as left operand
>
> This is probably a mistake in my configuration, but it may be a bug.
> It throws the same error regardless of which path I try to get, or if
> I use c.post instead. Can anyone figure this out?
--~--~---------~--~----~------------~-------~--~----~
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