Re: check for request.META keys

2007-11-16 Thread Steve Potter
On Nov 16, 12:01 am, Matt McClanahan <[EMAIL PROTECTED]> wrote: > On Nov 15, 8:51 pm, Steve Potter <[EMAIL PROTECTED]> wrote: > > > It just seem that there should be a better way of doing this. I was > > thinking about a method that would perform the test for me and return > > either the

Re: check for request.META keys

2007-11-15 Thread Matt McClanahan
On Nov 15, 8:51 pm, Steve Potter <[EMAIL PROTECTED]> wrote: > It just seem that there should be a better way of doing this. I was > thinking about a method that would perform the test for me and return > either the contents or a blank string. Often times, when it seems like something should

check for request.META keys

2007-11-15 Thread Steve Potter
I'm working on a project that involves logging large amounts of information about each visitor to the site. I understand that the contents of request.META cannot be depended upon, but I would like to log things like REMOTE_ADDR and HTTP_REFERER. I am finding myself writing a lot of code that

Re: check for request.META keys

2007-11-15 Thread Eric Abrahamsen
>I am finding myself writing a lot of code that looks like this: > >if 'REMOTE_ADDR' in request.META: >remote_address = request.META['REMOTE_ADDR'] >else: >remote_address = '' You can slurp this into one line (though it's the same check) like so: remote_address =