[Checkins] SVN: zope.app.container/trunk/ Merge from the trunk:
Philipp von Weitershausen
philikon at philikon.de
Fri Nov 9 14:28:02 EST 2007
Log message for revision 81660:
Merge from the trunk:
------------------------------------------------------------------------
r81655 | philikon | 2007-11-09 20:18:03 +0100 (Fri, 09 Nov 2007) | 6 lines
Send ``IObjectModifiedEvent`` when changing the title through the
``@@contents.html`` view.
This fixes https://bugs.edge.launchpad.net/zope3/+bug/98483.
Changed:
U zope.app.container/trunk/CHANGES.txt
U zope.app.container/trunk/src/zope/app/container/browser/contents.py
U zope.app.container/trunk/src/zope/app/container/browser/tests/test_contents.py
-=-
Modified: zope.app.container/trunk/CHANGES.txt
===================================================================
--- zope.app.container/trunk/CHANGES.txt 2007-11-09 19:23:14 UTC (rev 81659)
+++ zope.app.container/trunk/CHANGES.txt 2007-11-09 19:28:02 UTC (rev 81660)
@@ -2,6 +2,14 @@
CHANGES
=======
+3.5.3 (2007-11-09)
+------------------
+
+- Send ``IObjectModifiedEvent`` when changing the title through the
+ ``@@contents.html`` view.
+
+ This fixes https://bugs.edge.launchpad.net/zope3/+bug/98483.
+
3.5.2 (2007-11-01)
------------------
Modified: zope.app.container/trunk/src/zope/app/container/browser/contents.py
===================================================================
--- zope.app.container/trunk/src/zope/app/container/browser/contents.py 2007-11-09 19:23:14 UTC (rev 81659)
+++ zope.app.container/trunk/src/zope/app/container/browser/contents.py 2007-11-09 19:28:02 UTC (rev 81660)
@@ -19,6 +19,7 @@
import urllib
+from zope.event import notify
from zope.exceptions.interfaces import UserError
from zope.security.interfaces import Unauthorized
from zope.security import canWrite
@@ -31,6 +32,7 @@
from zope.copypastemove.interfaces import IObjectCopier, IObjectMover
from zope.copypastemove.interfaces import IContainerItemRenamer
from zope.annotation.interfaces import IAnnotations
+from zope.lifecycleevent import ObjectModifiedEvent, Attributes
from zope.app import zapi
from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile
@@ -218,7 +220,8 @@
item = self.context[id]
dc = IDCDescriptiveProperties(item)
dc.title = new
-
+ notify(ObjectModifiedEvent(item, Attributes(IZopeDublinCore, 'title')))
+
def hasAdding(self):
"""Returns true if an adding view is available."""
adding = zapi.queryMultiAdapter((self.context, self.request), name="+")
Modified: zope.app.container/trunk/src/zope/app/container/browser/tests/test_contents.py
===================================================================
--- zope.app.container/trunk/src/zope/app/container/browser/tests/test_contents.py 2007-11-09 19:23:14 UTC (rev 81659)
+++ zope.app.container/trunk/src/zope/app/container/browser/tests/test_contents.py 2007-11-09 19:28:02 UTC (rev 81660)
@@ -20,6 +20,9 @@
from zope.interface import Interface, implements
from zope.security import checker
from zope.traversing.api import traverse
+
+from zope.component.eventtesting import getEvents
+
from zope.annotation.interfaces import IAnnotations
from zope.copypastemove import ContainerItemRenamer
from zope.copypastemove import ObjectMover, ObjectCopier
@@ -158,6 +161,45 @@
urls = map(lambda x: x['url'], info_list)
self.assert_('subcontainer' in urls)
+ def testChangeTitle(self):
+ container = self._TestView__newContext()
+ document = Document()
+ container['document'] = document
+
+ from zope.dublincore.interfaces import IDCDescriptiveProperties
+ class FauxDCDescriptiveProperties(object):
+ implements(IDCDescriptiveProperties)
+
+ __Security_checker__ = checker.Checker(
+ {"title": "zope.Public",
+ },
+ {"title": "zope.app.dublincore.change"})
+
+ def __init__(self, context):
+ self.context = context
+
+ def setTitle(self, title):
+ self.context.title = title
+
+ def getTitle(self):
+ return self.context.title
+
+ title = property(getTitle, setTitle)
+
+ ztapi.provideAdapter(IDocument, IDCDescriptiveProperties, FauxDCDescriptiveProperties)
+
+ fc = self._TestView__newView(container)
+
+ dc = IDCDescriptiveProperties(document)
+
+ fc.request.form.update({'retitle_id': 'document', 'new_value': 'new'})
+ fc.changeTitle()
+ events = getEvents()
+ self.assertEquals(dc.title, 'new')
+ self.failIf('title' not in events[-1].descriptions[0].attributes)
+
+
+
class IDocument(Interface):
pass
More information about the Checkins
mailing list