Skip to content
This repository has been archived by the owner on Feb 4, 2019. It is now read-only.

python no longer support headers with a colon #18

Merged
merged 1 commit into from Jun 22, 2016

Conversation

deniak
Copy link
Contributor

@deniak deniak commented Jun 22, 2016

https://bugs.python.org/issue25570
addheader should take 2 parameters (header name, value). The last python upgrade breaks the current code as it adds a header named 'header:value' with an empty value.
Unfortunately, the function passed to copyHeader now takes 2 arguments and are no longer compatible with sys.stdout.write

@dontcallmedom
Copy link
Owner

Thanks for report!

Instead of no longer outputting the headers, I suggest replacing the reference to sys.stdout.write by the lambda function lambda header, value: sys.stdout.write("%s": %s" %(header, value))

@deniak
Copy link
Contributor Author

deniak commented Jun 22, 2016

That's better indeed. Done @dontcallmedom

@@ -127,7 +127,8 @@ def serveRequest():
except WrongConfigurationException,e:
printError(output,doc, textoutputselected, "Could not run widlproc", str(e))
for header_name in ('Last-Modified', 'Expires'):
if copyHeader(sys.stdout.write, srcheaders, header_name):
f = lambda header, value: sys.stdout.write("%s: %s" %(header, value))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry to be picky, but if you're going to create a variable for this, you might as well create it outside of the for loop :)

@deniak
Copy link
Contributor Author

deniak commented Jun 22, 2016

@dontcallmedom what an idiot I am. Should be better.

@dontcallmedom dontcallmedom merged commit 564457b into dontcallmedom:master Jun 22, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants