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

Commit

Permalink
Require latest Zope release, adding charset to content type headers.
Browse files Browse the repository at this point in the history
  • Loading branch information
hannosch committed May 27, 2017
1 parent 3787b67 commit 0b69a32
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 18 deletions.
6 changes: 4 additions & 2 deletions setup.py
Expand Up @@ -14,9 +14,11 @@

from setuptools import setup, find_packages

__version__ = '4.0a3.dev0'

setup(
name='ZServer',
version='4.0a3.dev0',
version=__version__,

This comment has been minimized.

Copy link
@icemac

icemac May 27, 2017

Member

@hannosch What is your reason behind using __version__? I ask this because zest.releaser cannot update this style of version. It will quit with RuntimeError: Cannot set version.

This comment has been minimized.

Copy link
@hannosch

hannosch May 27, 2017

Author Contributor

Ah. I've never used a release tool like zest.releaser. I'm not sure anymore when I started using the __version__ idiom, now I tend to just use it out of habit.

The one advantage I see, is having a very clear git diff. I think I got annoyed by the diff, when merging a maintenance branch into a master branch, and both updated the version. And often enough one of them had some pep8 changes and re-indented the setup arguments. Both the four-space indentation seen here and the six-space indentation with name on the same line as setup(name=... are quite common.

All that said, the git diff argument is a weak one, so I'd be happy to stop using this pattern.

This comment has been minimized.

Copy link
@jamadden

jamadden May 27, 2017

Member

zest.releaser does support a version global variable, in addition to a string directly in the version kwarg, as well as a few other patters, such as a completely separate version.txt file beside setup.py. I've seen all three of those in zopefoundation projects I've worked on.

It also supports a __version__ variable found in a Python source file. If you wanted to configure it in setup.cfg I think you could probably also make it find that in setup.py, it just doesn't look for it by default. I haven't seen either of those in the zopefoundation projects I work on.

url='https://pypi.python.org/pypi/ZServer',
license='ZPL 2.1',
description="Zope 2 ZServer.",
Expand Down Expand Up @@ -58,7 +60,7 @@
'zope.processlifetime',
'zope.schema',
'zope.testing',
'Zope2 >= 4.0a2',
'Zope2 >= 4.0a5',
],
include_package_data=True,
zip_safe=False,
Expand Down
34 changes: 18 additions & 16 deletions src/ZServer/tests/test_responses.py
Expand Up @@ -231,14 +231,15 @@ def test_contentLength(self):
response._http_connection = 'keep-alive'
response.body = '123456789'
response.setHeader('Content-Type', 'text/plain')
self._assertResponsesAreEqual(str(response),
('HTTP/1.1 200 OK',
'Content-Length: 9',
'Content-Type: text/plain',
'Date: ...',
'Server: ...',
'',
'123456789'))
self._assertResponsesAreEqual(
str(response),
('HTTP/1.1 200 OK',
'Content-Length: 9',
'Content-Type: text/plain; charset=utf-8',
'Date: ...',
'Server: ...',
'',
'123456789'))

def test_emptyBody(self):
# Check that a response with an empty message body returns a
Expand All @@ -264,14 +265,15 @@ def test_HEAD(self):
response._http_connection = 'keep-alive'
response.setHeader('Content-Type', 'text/plain')
response.setHeader('Content-Length', 123)
self._assertResponsesAreEqual(str(response),
('HTTP/1.1 200 OK',
'Content-Length: 123',
'Content-Type: text/plain',
'Date: ...',
'Server: ...',
'',
''))
self._assertResponsesAreEqual(
str(response),
('HTTP/1.1 200 OK',
'Content-Length: 123',
'Content-Type: text/plain; charset=utf-8',
'Date: ...',
'Server: ...',
'',
''))

def test_uses_accumulated_headers_correctly(self):
response = self._makeOne()
Expand Down

0 comments on commit 0b69a32

Please sign in to comment.