Permalink
Browse files

Merge pull request #1 from chaoflow/master

just docs/comments, closes: http://projects.plone.org/browse/DC-27
  • Loading branch information...
2 parents cc0021d + 25361a7 commit 6996db352d0c7460e7a7e7deda230b18c8895f8f sjoerdve committed Sep 26, 2011
Showing with 18 additions and 27 deletions.
  1. +0 −5 README.txt
  2. +3 −5 plone/app/tiles/drafting.py
  3. +15 −17 plone/app/tiles/tests.py
View
@@ -30,11 +30,6 @@ This package contains the following things:
``oldParent`` attribute will be the tile's context, and the ``oldName``
attribute will be the tile's id.
-* An interface ``ITileBookeeping``. Adapt a content object to this interface
- to obtain information about the tiles which have been added in that context.
- Event handlers for ``IObjectAddedEvent`` and ``IObjectRemovedEvent`` keep
- the bookkeeping information in sync as tiles are added and removed.
-
The default add and edit forms should suffice for most use cases. You can use
`plone.autoform <http://pypi.python.org/pypi/plone.autoform>`_ to configure
alternative widgets, either by hand or via `plone.directives.form
@@ -22,9 +22,8 @@
@implementer(ITileDataContext)
@adapter(Interface, IDrafting, ITile)
def draftingTileDataContext(context, request, tile):
- """If we are drafting a content item, record tile data and book-keeping
- information to the draft, but read existing data from the underlying
- object.
+ """If we are drafting a content item, record tile data information
+ to the draft, but read existing data from the underlying object.
"""
draft = getCurrentDraft(request, create=True)
@@ -35,8 +34,7 @@ def draftingTileDataContext(context, request, tile):
class TileDataDraftSyncer(object):
- """Copy draft persistent tile data and book-keeping information to the
- real object on save
+ """Copy draft persistent tile data to the real object on save
"""
implements(IDraftSyncer)
View
@@ -39,7 +39,7 @@ def test_transient_lifecycle(self):
app = self.layer['app']
browser = Browser(app)
browser.handleErrors = False
-
+
browser.addHeader('Authorization',
'Basic %s:%s' % \
(SITE_OWNER_NAME, SITE_OWNER_PASSWORD,))
@@ -228,7 +228,7 @@ def test_persistent_drafting(self):
app = self.layer['app']
browser = Browser(app)
browser.handleErrors = False
-
+
folderAnnotations = IAnnotations(portal)
annotationsKey = "%s.tile-1" % ANNOTATIONS_KEY_PREFIX
@@ -281,7 +281,7 @@ def test_persistent_drafting(self):
browser.getControl(label='Save').click()
# We should now have a draft for this item with the relevant
- # annotations and book-keeping info
+ # annotations
draftName = urllib.unquote(cookies['plone.app.drafts.draftName'] \
.replace('"', ''))
@@ -342,11 +342,11 @@ def test_persistent_drafting(self):
# The cookies should now have all expired
cookies = browser.cookies.forURL(baseURL)
-
+
self.assertFalse(TARGET_KEY in cookies)
self.assertFalse(DRAFT_NAME_KEY in cookies)
self.assertFalse(PATH_KEY in cookies)
-
+
# The draft should have disappeared
self.assertEquals(None, drafts.getDraft(SITE_OWNER_NAME, targetKey,
@@ -355,7 +355,7 @@ def test_persistent_drafting(self):
#
# Step 2 - Edit the content object and a tile, but cancel
#
-
+
baseURL = browser.url
editFormURL = baseURL + '/edit'
@@ -398,13 +398,11 @@ def test_persistent_drafting(self):
self.assertEquals('Third message',
draftAnnotations[annotationsKey]['message'])
self.assertEquals(1, draftAnnotations[annotationsKey]['counter'])
- # The draft book-keeping information is not re-saved since we didn't
- # add or remove any tiles
self.assertEquals('Test message',
contextAnnotations[annotationsKey]['message'])
self.assertEquals(1, contextAnnotations[annotationsKey]['counter'])
-
+
# Cancel editing
# XXX: works around testbrowser/AT cancel button integration bug
@@ -420,14 +418,14 @@ def test_persistent_drafting(self):
self.assertEquals('Test message',
contextAnnotations[annotationsKey]['message'])
self.assertEquals(1, contextAnnotations[annotationsKey]['counter'])
-
+
# The draft should be discarded, too
cookies = browser.cookies.forURL(baseURL)
self.assertFalse(TARGET_KEY in cookies)
self.assertFalse(DRAFT_NAME_KEY in cookies)
self.assertFalse(PATH_KEY in cookies)
-
+
self.assertEquals(0,
len(drafts.getDrafts(SITE_OWNER_NAME, targetKey)))
@@ -482,11 +480,11 @@ def test_persistent_drafting(self):
# The draft should have been discarded as well
cookies = browser.cookies.forURL(baseURL)
-
+
self.assertFalse(TARGET_KEY in cookies)
self.assertFalse(DRAFT_NAME_KEY in cookies)
self.assertFalse(PATH_KEY in cookies)
-
+
self.assertEquals(0,
len(drafts.getDrafts(SITE_OWNER_NAME, targetKey)))
@@ -552,11 +550,11 @@ def test_persistent_drafting(self):
# The draft should have been discarded as well
cookies = browser.cookies.forURL(baseURL)
-
+
self.assertFalse(TARGET_KEY in cookies)
self.assertFalse(DRAFT_NAME_KEY in cookies)
self.assertFalse(PATH_KEY in cookies)
-
+
self.assertEquals(0,
len(drafts.getDrafts(SITE_OWNER_NAME, targetKey)))
@@ -618,11 +616,11 @@ def test_persistent_drafting(self):
# The draft should have been discarded as well
cookies = browser.cookies.forURL(baseURL)
-
+
self.assertFalse(TARGET_KEY in cookies)
self.assertFalse(DRAFT_NAME_KEY in cookies)
self.assertFalse(PATH_KEY in cookies)
-
+
self.assertEquals(0,
len(drafts.getDrafts(SITE_OWNER_NAME, targetKey)))

0 comments on commit 6996db3

Please sign in to comment.