On 11/20/2013 02:05 AM, Chris Angelico wrote:
On Wed, Nov 20, 2013 at 1:14 PM, Logan wrote:

That is genius. Thank you!
Then it works? Awesome!! (Permit me an evil laugh. Muahahahaaaa!)

This is why I love working with open source languages. Even if you
don't end up actually changing anything, you can go and snoop the code
and see what happens - sometimes you can tweak your code based on that
knowledge. And hey. This is duck typing at its best!

Not exactly as written, but close enough to get me working. At one
point the following code is executed, turning the value into a string to
be "title"d next time it is called:

     name = name.title()

So, I worked around it with the following class, adapted from yours:

     class CaseSensitiveHeader(object):
          def __init__(self, name):
              self.name = name

          def capitalize(self):
              return self

          def title(self):
              return self

          def lower(self):
              return self.name

          def encode(self, encoding):
     return self.name.encode(encoding)

With that, I am now able to post a case sensitive HTTP header.

-- Logan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20131120/41f95e93/attachment-0001.html>

Search Discussions

Discussion Posts


Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 5 of 6 | next ›
Discussion Overview
grouppython-list @
postedNov 18, '13 at 2:25p
activeNov 21, '13 at 12:49a

2 users in discussion

Chris Angelico: 3 posts Logan: 3 posts



site design / logo © 2022 Grokbase