Case insensitive exists()?

Larry Martell larry.martell at gmail.com
Thu Jan 23 14:02:24 EST 2014


On Wed, Jan 22, 2014 at 9:29 PM, Chris Angelico <rosuav at gmail.com> wrote:
> On Thu, Jan 23, 2014 at 3:24 PM, Larry Martell <larry.martell at gmail.com> wrote:
>> I am writing something that is part of a django app, that based on
>> some web entry from the user, I run a query, get back a list of files
>> and have to go receive them and serve them up back to the browser. My
>> script is all done and seem to be working, then today I was informed
>> it was not serving up all the images. Debugging revealed that it was
>> this case issue - I was matching with exists(). As I've said, coding a
>> solution is easy, but I fear it will be too slow. Speed is important
>> in web apps - users have high expectations. Guess I'll just have to
>> try it and see.
>
> Would it be a problem to rename all the files? Then you could simply
> lower() the input name and it'll be correct.

So it turned out that in the django model definition for this object
there was code that was doing some character mapping that was causing
this. That code was added to 'fix' another problem, but the mapping
strings were not qualified enough and it was doing some unintended
mapping. Changing those strings to be more specific fixed my problem.

Thanks to all for the replies.



More information about the Python-list mailing list