[Checkins] SVN: zc.ngi/trunk/ - added missing "writelines" method to Lines adapter
Benji York
benji at zope.com
Wed Oct 28 10:21:47 EDT 2009
Log message for revision 105331:
- added missing "writelines" method to Lines adapter
- whitespace fixes
- small test coverage increase
Changed:
U zc.ngi/trunk/README.txt
U zc.ngi/trunk/src/zc/ngi/adapters.py
U zc.ngi/trunk/src/zc/ngi/adapters.txt
-=-
Modified: zc.ngi/trunk/README.txt
===================================================================
--- zc.ngi/trunk/README.txt 2009-10-28 14:17:43 UTC (rev 105330)
+++ zc.ngi/trunk/README.txt 2009-10-28 14:21:47 UTC (rev 105331)
@@ -17,13 +17,14 @@
*******
==================
-1.1.4 (2009-09-??)
+1.1.4 (2009-10-??)
==================
Bug fixed:
- Spurious warnings sometimes occurred due to a race condition in
setting up servers.
+- Added missing "writelines" method to zc.ngi.adapters.Lines.
==================
1.1.3 (2009-07-30)
Modified: zc.ngi/trunk/src/zc/ngi/adapters.py
===================================================================
--- zc.ngi/trunk/src/zc/ngi/adapters.py 2009-10-28 14:17:43 UTC (rev 105330)
+++ zc.ngi/trunk/src/zc/ngi/adapters.py 2009-10-28 14:21:47 UTC (rev 105331)
@@ -23,6 +23,7 @@
self.connection = connection
self.close = connection.close
self.write = connection.write
+ self.writelines = connection.writelines
def setHandler(self, handler):
self.handler = handler
Modified: zc.ngi/trunk/src/zc/ngi/adapters.txt
===================================================================
--- zc.ngi/trunk/src/zc/ngi/adapters.txt 2009-10-28 14:17:43 UTC (rev 105330)
+++ zc.ngi/trunk/src/zc/ngi/adapters.txt 2009-10-28 14:21:47 UTC (rev 105331)
@@ -18,7 +18,7 @@
>>> import zc.ngi.testing
>>> connection = zc.ngi.testing.Connection()
>>> handler = zc.ngi.testing.PrintingHandler(connection)
-
+
This handler is used by default as the peer
of testing connections:
@@ -53,6 +53,10 @@
>>> adapter.write('foo')
-> 'foo'
+ >>> adapter.writelines(['foo', 'bar'])
+ -> 'foo'
+ -> 'bar'
+
>>> connection.test_close('test')
-> CLOSE test
@@ -76,7 +80,7 @@
Now, we'll generate some input. We do so by providing (big-endian) sizes by
calling struct pack:
-
+
>>> import struct
>>> message1 = 'Hello\nWorld!\nHow are you?'
>>> message2 = 'This is message 2'
@@ -93,10 +97,10 @@
If we write a message, we can see that the message is preceded by the
message size:
- >>> adapter.write(message1)
+ >>> adapter.write(message1)
-> '\x00\x00\x00\x19'
-> 'Hello\nWorld!\nHow are you?'
-
+
Null messages
-------------
@@ -113,8 +117,10 @@
>>> connection.test_input('\xff\xff\xff\xff')
+Closing
+-------
-
+Closing works too.
-
-
+ >>> connection.test_close('test')
+ -> CLOSE test
More information about the checkins
mailing list