[Checkins] SVN: zodbdocs/trunk/zodbguide/ add download link to chatter.py; add transaction abort to conflict handling

Laurence Rowe l at lrowe.co.uk
Thu Nov 26 15:11:57 EST 2009


Log message for revision 106045:
  add download link to chatter.py; add transaction abort to conflict handling

Changed:
  U   zodbdocs/trunk/zodbguide/chatter.py
  U   zodbdocs/trunk/zodbguide/zeo.rst

-=-
Modified: zodbdocs/trunk/zodbguide/chatter.py
===================================================================
--- zodbdocs/trunk/zodbguide/chatter.py	2009-11-26 18:53:19 UTC (rev 106044)
+++ zodbdocs/trunk/zodbguide/chatter.py	2009-11-26 20:11:57 UTC (rev 106045)
@@ -62,10 +62,10 @@
                 self._messages[ now ] = message
                 transaction.commit()
             except ConflictError:
-                # Conflict occurred; this process should pause and
+                # Conflict occurred; this process should abort,
                 # wait for a little bit, then try again.
+                transaction.abort()
                 time.sleep(.2)
-                pass
             else:
                 # No ConflictError exception raised, so break
                 # out of the enclosing while loop.

Modified: zodbdocs/trunk/zodbguide/zeo.rst
===================================================================
--- zodbdocs/trunk/zodbguide/zeo.rst	2009-11-26 18:53:19 UTC (rev 106044)
+++ zodbdocs/trunk/zodbguide/zeo.rst	2009-11-26 20:11:57 UTC (rev 106045)
@@ -155,11 +155,10 @@
 
 For an example application, we'll build a little chat application. What's
 interesting is that none of the application's code deals with network
-programming at all; instead, an object will hold chat messages, and be magically
-shared between all the clients through ZEO. I won't present the complete script
-here; it's included in my ZODB distribution, and you can download it from
-`<http://www.amk.ca/zodb/demos/>`_.  Only the interesting portions of the code
-will be covered here.
+programming at all; instead, an object will hold chat messages, and be
+magically shared between all the clients through ZEO. I won't present the
+complete script here; you can download it from :download:`chatter.py
+<chatter.py>`. Only the interesting portions of the code will be covered here.
 
 The basic data structure is the :class:`ChatSession` object, which provides an
 :meth:`add_message` method that adds a message, and a :meth:`new_messages`
@@ -197,10 +196,10 @@
                self._messages[now] = message
                get_transaction().commit()
            except ConflictError:
-               # Conflict occurred; this process should pause and
+               # Conflict occurred; this process should abort,
                # wait for a little bit, then try again.
+               transaction.abort()
                time.sleep(.2)
-               pass
            else:
                # No ConflictError exception raised, so break
                # out of the enclosing while loop.



More information about the checkins mailing list