New publishing code for the publisher. · SufferProgrammer/mod_python@aa90ba2 · GitHub
Skip to content

Commit aa90ba2

Browse files
author
nlehuen
committed
New publishing code for the publisher.
- Solves MODPYTHON-15 "iterable return values should be corretly published" - Also takes care of selecting a proper encoding when the returned objects are Unicode strings. It parses the Content-Type header to select the encoding, or chooses UTF-8 if no encoding is given. - Returning nothing is now allowed. Nothing is returned to the client. Unit tests have been made to ensure that there was no regression.
1 parent 57cffb4 commit aa90ba2

4 files changed

Lines changed: 108 additions & 55 deletions

File tree

lib/python/mod_python/publisher.py

Lines changed: 73 additions & 53 deletions

src/include/mpversion.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#define MPV_MAJOR 3
22
#define MPV_MINOR 2
33
#define MPV_PATCH 0
4-
#define MPV_BUILD 20050519
5-
#define MPV_STRING "3.2.0-dev-20050620"
4+
#define MPV_BUILD 20050626
5+
#define MPV_STRING "3.2.0-dev-20050626"

test/htdocs/tests.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -835,6 +835,8 @@ def test_publisher(req):
835835
return "test ok, interpreter=%s" % req.interpreter
836836

837837
class OldStyleClassTest:
838+
def __init__(self):
839+
pass
838840
def __call__(self, req):
839841
return "test callable old-style instance ok"
840842
def traverse(self, req):
@@ -844,6 +846,15 @@ def traverse(self, req):
844846
test_dict = {1:1, 2:2, 3:3}
845847
test_dict_keys = test_dict.keys
846848

849+
def test_dict_iteration(req):
850+
return test_dict_keys()
851+
852+
def test_generator(req):
853+
c = 0
854+
while c < 10:
855+
yield c
856+
c += 1
857+
847858
class InstanceTest(object):
848859
def __call__(self, req):
849860
return "test callable instance ok"

test/test.py

Lines changed: 22 additions & 0 deletions

0 commit comments

Comments
 (0)