cybertools/z2/intid/tracking.txt
helmutm d1110c410e include slightly modified copy of five.intid
git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@3685 fd906abe-77d9-0310-91a1-e0d9ade77398
2010-01-14 12:12:30 +00:00

168 lines
5.2 KiB
Text

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:
>>> print http(r"""
... POST /++etc++site/default/@@contents.html HTTP/1.1
... Authorization: Basic mgr:mgrpw
... Referer: http://localhost:8081/++etc++site/default/@@contents.html
...
... type_name=BrowserAdd__zope.app.intid.IntIds&new_value=""")
HTTP/1.1 303 See Other
...
Location: http://localhost/++etc++site/default/IntIds/@@registration.html
...
>>> print http(r"""
... POST /++etc++site/default/IntIds/addRegistration.html HTTP/1.1
... Authorization: Basic mgr:mgrpw
... Referer: http://localhost:8081/++etc++site/default/IntIds/
... Content-Type: multipart/form-data; boundary=----------CedQTrEQIEPbgfYhvcITAhQi2aJdgu3tYfJ0WYQmkpLQTt6OTOpd5GJ
...
... ------------CedQTrEQIEPbgfYhvcITAhQi2aJdgu3tYfJ0WYQmkpLQTt6OTOpd5GJ
... Content-Disposition: form-data; name="field.name"
...
... IntIds
... ------------CedQTrEQIEPbgfYhvcITAhQi2aJdgu3tYfJ0WYQmkpLQTt6OTOpd5GJ
... Content-Disposition: form-data; name="field.provided"
...
... zope.app.intid.interfaces.IIntIds
... ------------CedQTrEQIEPbgfYhvcITAhQi2aJdgu3tYfJ0WYQmkpLQTt6OTOpd5GJ
... Content-Disposition: form-data; name="field.provided-empty-marker"
...
... 1
... ------------CedQTrEQIEPbgfYhvcITAhQi2aJdgu3tYfJ0WYQmkpLQTt6OTOpd5GJ
... Content-Disposition: form-data; name="field.status"
...
... Active
... ------------CedQTrEQIEPbgfYhvcITAhQi2aJdgu3tYfJ0WYQmkpLQTt6OTOpd5GJ
... Content-Disposition: form-data; name="field.status-empty-marker"
...
... 1
... ------------CedQTrEQIEPbgfYhvcITAhQi2aJdgu3tYfJ0WYQmkpLQTt6OTOpd5GJ
... Content-Disposition: form-data; name="field.permission"
...
...
... ------------CedQTrEQIEPbgfYhvcITAhQi2aJdgu3tYfJ0WYQmkpLQTt6OTOpd5GJ
... Content-Disposition: form-data; name="field.permission-empty-marker"
...
... 1
... ------------CedQTrEQIEPbgfYhvcITAhQi2aJdgu3tYfJ0WYQmkpLQTt6OTOpd5GJ
... Content-Disposition: form-data; name="UPDATE_SUBMIT"
...
... Add
... ------------CedQTrEQIEPbgfYhvcITAhQi2aJdgu3tYfJ0WYQmkpLQTt6OTOpd5GJ--
... """)
HTTP/1.1 303 See Other
...
Location: @@SelectedManagementView.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/default/IntIds/@@index.html?testing=1 HTTP/1.1
... Authorization: Basic mgr:mgrpw
... Referer: http://localhost:8081/++etc++site/default/@@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/default/IntIds/@@index.html?testing=1 HTTP/1.1
... Authorization: Basic mgr:mgrpw
... Referer: http://localhost:8081/++etc++site/default/@@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/default/IntIds/@@index.html?testing=1 HTTP/1.1
... Authorization: Basic mgr:mgrpw
... Referer: http://localhost:8081/++etc++site/default/@@contents.html
... """)
HTTP/1.1 200 Ok
...0 objects...