Tracking Object Additions, Deletions, and Moves
===============================================

Unique ID utilities track object add moves.  Let's look at an
example. First, we'll create a unique Id utility:

  (The first request is a bit weird.  It is part of the current
   tools UI.  It arranges for a tools site-management folder to be
   created.  We really need to rethink how we manage TTW utilities.)

  >>> print http(r"""
  ... GET /++etc++site/AddIIntIdsTool HTTP/1.1
  ... Authorization: Basic mgr:mgrpw
  ... Referer: http://localhost:8081/++etc++site/@@manageIIntIdsTool.html
  ... """)
  HTTP/1.1 200 Ok
  ...

  >>> print http(r"""
  ... POST /++etc++site/AddIIntIdsTool/action.html HTTP/1.1
  ... Authorization: Basic mgr:mgrpw
  ... Content-Length: 69
  ... Content-Type: application/x-www-form-urlencoded
  ... Referer: http://localhost:8081/++etc++site/AddIIntIdsTool
  ... 
  ... type_name=BrowserAdd__zope.app.intid.IntIds&id=&add=+Add+""")
  HTTP/1.1 303 See Other
  ...
  Location: ../@@manageIIntIdsTool.html
  ...

Now, we'll add a few folders:

  >>> print http(r"""
  ... POST /@@contents.html HTTP/1.1
  ... Authorization: Basic mgr:mgrpw
  ... Content-Length: 64
  ... Content-Type: application/x-www-form-urlencoded
  ... 
  ... type_name=BrowserAdd__zope.app.folder.folder.Folder&new_value=f1""")
  HTTP/1.1 303 See Other
  ...

  >>> print http(r"""
  ... POST /f1/@@contents.html HTTP/1.1
  ... Authorization: Basic mgr:mgrpw
  ... Content-Length: 64
  ... Content-Type: application/x-www-form-urlencoded
  ... 
  ... type_name=BrowserAdd__zope.app.folder.folder.Folder&new_value=f1""")
  HTTP/1.1 303 See Other
  ...

  >>> print http(r"""
  ... POST /f1/@@contents.html HTTP/1.1
  ... Authorization: Basic mgr:mgrpw
  ... Content-Length: 64
  ... Content-Type: application/x-www-form-urlencoded
  ... 
  ... type_name=BrowserAdd__zope.app.folder.folder.Folder&new_value=f2""")
  HTTP/1.1 303 See Other
  ...

  >>> print http(r"""
  ... POST /f1/f1/@@contents.html HTTP/1.1
  ... Authorization: Basic mgr:mgrpw
  ... Content-Length: 64
  ... Content-Type: application/x-www-form-urlencoded
  ... 
  ... type_name=BrowserAdd__zope.app.folder.folder.Folder&new_value=f1""")
  HTTP/1.1 303 See Other
  ...

Now, if we look at the index page for the unique id utility, we'll see
the objects we added:

  >>> print http(r"""
  ... GET /++etc++site/tools/IntIds/@@index.html HTTP/1.1
  ... Authorization: Basic mgr:mgrpw
  ... Referer: http://localhost:8081/++etc++site/tools/@@contents.html
  ... """)
  HTTP/1.1 200 Ok
  ...4 objects...
  .../f1...
  .../f1/f1...
  .../f1/f2...
  .../f1/f1/f1...

If we move the top object:

  >>> print http(r"""
  ... POST /@@contents.html HTTP/1.1
  ... Authorization: Basic mgr:mgrpw
  ... Content-Length: 40
  ... Content-Type: application/x-www-form-urlencoded
  ... Referer: http://localhost:8081/@@contents.html
  ... 
  ... new_value%3Alist=f2&rename_ids%3Alist=f1""")
  HTTP/1.1 303 See Other
  ...

We'll see that reflected in the utility:

  >>> print http(r"""
  ... GET /++etc++site/tools/IntIds/@@index.html HTTP/1.1
  ... Authorization: Basic mgr:mgrpw
  ... Referer: http://localhost:8081/++etc++site/tools/@@contents.html
  ... """)
  HTTP/1.1 200 Ok
  ...4 objects...
  .../f2...
  .../f2/f1...
  .../f2/f2...
  .../f2/f1/f1...

And if we delete the top object:

  >>> print http(r"""
  ... POST /@@contents.html HTTP/1.1
  ... Authorization: Basic mgr:mgrpw
  ... Content-Length: 44
  ... Content-Type: application/x-www-form-urlencoded
  ... Referer: http://localhost:8081/@@contents.html
  ... 
  ... ids%3Alist=f2&container_delete_button=Delete""")
  HTTP/1.1 303 See Other
  ...

all of the objects will go away:

  >>> print http(r"""
  ... GET /++etc++site/tools/IntIds/@@index.html HTTP/1.1
  ... Authorization: Basic mgr:mgrpw
  ... Referer: http://localhost:8081/++etc++site/tools/@@contents.html
  ... """)
  HTTP/1.1 200 Ok
  ...0 objects...
