Commit e12dabf1 authored by Florent Guillaume's avatar Florent Guillaume

Updated to Five 1.3b4.

parent ce4c64ac
......@@ -2,6 +2,16 @@
Five Changes
============
Five 1.3b4 (2005-11-25)
=======================
Restructuring
-------------
* Cleaned up security test.
* Made Five send a ContainerModifiedEvent when appropriate.
Five 1.3b3 (2005-11-19)
=======================
......
......@@ -13,13 +13,17 @@
##############################################################################
"""Initialize the Five product
$Id: __init__.py 12884 2005-05-30 13:10:41Z philikon $
$Id: __init__.py 20254 2005-11-25 18:45:08Z efge $
"""
import Acquisition
from Globals import INSTANCE_HOME
import monkey # BBB: goes away when Zope 3.2 >= r40368 is stiched in
import zcml
# trigger monkey patches
monkey.monkeyPatch()
# public API provided by Five
# usage: from Products.Five import <something>
from browser import BrowserView
......
......@@ -105,6 +105,7 @@ called, but with a deprecation warning::
ObjectWillBeAddedEvent sub
ObjectAddedEvent sub
old manage_afterAdd sub sub folder
ContainerModifiedEvent folder
'sub'
>>> sub = folder.sub
>>> ob = MyContent('dog')
......@@ -112,6 +113,7 @@ called, but with a deprecation warning::
ObjectWillBeAddedEvent dog
ObjectAddedEvent dog
old manage_afterAdd dog dog sub
ContainerModifiedEvent sub
'dog'
And when we rename the subfolder, manage_beforeDelete is also called
......@@ -126,6 +128,7 @@ bottom-up and events are sent::
old manage_afterAdd marine marine folder
ObjectMovedEvent dog
old manage_afterAdd dog marine folder
ContainerModifiedEvent folder
Same thing for clone::
......@@ -137,6 +140,7 @@ Same thing for clone::
old manage_afterAdd tank tank folder
ObjectAddedEvent dog
old manage_afterAdd dog tank folder
ContainerModifiedEvent folder
ObjectClonedEvent tank
old manage_afterClone tank tank
ObjectClonedEvent dog
......@@ -161,6 +165,7 @@ called correctly::
ObjectWillBeAddedEvent lassie
ObjectAddedEvent lassie
old manage_afterAdd lassie lassie folder
ContainerModifiedEvent folder
'lassie'
And when we delete the object, manage_beforeDelete is also called and
......@@ -170,6 +175,7 @@ events are sent::
ObjectWillBeRemovedEvent lassie
old manage_beforeDelete lassie lassie folder
ObjectRemovedEvent lassie
ContainerModifiedEvent folder
The old behavior happens for a move or a copy, with events too.
For a move::
......@@ -179,6 +185,7 @@ For a move::
ObjectWillBeAddedEvent blueberry
ObjectAddedEvent blueberry
old manage_afterAdd blueberry blueberry folder
ContainerModifiedEvent folder
'blueberry'
>>> cp = folder.manage_cutObjects('blueberry')
>>> folder.manage_pasteObjects(cp)
......@@ -186,6 +193,7 @@ For a move::
old manage_beforeDelete blueberry blueberry folder
ObjectMovedEvent blueberry
old manage_afterAdd blueberry blueberry folder
ContainerModifiedEvent folder
[{'new_id': 'blueberry', 'id': 'blueberry'}]
Old behavior with events for a copy::
......@@ -196,6 +204,7 @@ Old behavior with events for a copy::
ObjectWillBeAddedEvent copy_of_blueberry
ObjectAddedEvent copy_of_blueberry
old manage_afterAdd copy_of_blueberry copy_of_blueberry folder
ContainerModifiedEvent folder
ObjectClonedEvent copy_of_blueberry
old manage_afterClone copy_of_blueberry copy_of_blueberry
[{'new_id': 'copy_of_blueberry', 'id': 'blueberry'}]
......@@ -207,6 +216,7 @@ Old behavior with events for a renaming::
old manage_beforeDelete copy_of_blueberry copy_of_blueberry folder
ObjectMovedEvent myrtille
old manage_afterAdd myrtille myrtille folder
ContainerModifiedEvent folder
Old behavior with events for a clone::
......@@ -215,6 +225,7 @@ Old behavior with events for a clone::
ObjectWillBeAddedEvent strawberry
ObjectAddedEvent strawberry
old manage_afterAdd strawberry strawberry folder
ContainerModifiedEvent folder
ObjectClonedEvent strawberry
old manage_afterClone strawberry strawberry
>>> res.getId()
......@@ -227,12 +238,14 @@ Events are also sent when we work with a BTreeFolder::
ObjectWillBeAddedEvent luckyluke
ObjectAddedEvent luckyluke
old manage_afterAdd luckyluke luckyluke btfolder
ContainerModifiedEvent btfolder
'luckyluke'
>>> btfolder.manage_delObjects('luckyluke')
ObjectWillBeRemovedEvent luckyluke
old manage_beforeDelete luckyluke luckyluke btfolder
ObjectRemovedEvent luckyluke
ContainerModifiedEvent btfolder
Here is what happens for a tree of objects. Let's create a simple one::
......@@ -241,6 +254,7 @@ Here is what happens for a tree of objects. Let's create a simple one::
ObjectWillBeAddedEvent subfolder
ObjectAddedEvent subfolder
old manage_afterAdd subfolder subfolder folder
ContainerModifiedEvent folder
'subfolder'
>>> subfolder = folder.subfolder
>>> ob = MyContent('donald')
......@@ -248,6 +262,7 @@ Here is what happens for a tree of objects. Let's create a simple one::
ObjectWillBeAddedEvent donald
ObjectAddedEvent donald
old manage_afterAdd donald donald subfolder
ContainerModifiedEvent subfolder
'donald'
Renaming a tree of objects. Note that manage_beforeDelete is called
......@@ -262,6 +277,7 @@ bottom-up::
old manage_afterAdd pluto pluto folder
ObjectMovedEvent donald
old manage_afterAdd donald pluto folder
ContainerModifiedEvent folder
Cloning a tree of objects::
......@@ -273,6 +289,7 @@ Cloning a tree of objects::
old manage_afterAdd mickey mickey folder
ObjectAddedEvent donald
old manage_afterAdd donald mickey folder
ContainerModifiedEvent folder
ObjectClonedEvent mickey
old manage_afterClone mickey mickey
ObjectClonedEvent donald
......@@ -290,9 +307,10 @@ everything happens correctly::
>>> app = MyApp('')
>>> root['app'] = app
>>> folder = MyNewFolder('folder')
>>> app._setObject('folder', folder)
>>> app._setObject('folder', folder) # doctest: +NORMALIZE_WHITESPACE
ObjectWillBeAddedEvent folder
ObjectAddedEvent folder
ContainerModifiedEvent
'folder'
>>> folder = app.folder
......@@ -300,10 +318,12 @@ everything happens correctly::
>>> folder._setObject('dogbert', ob)
ObjectWillBeAddedEvent dogbert
ObjectAddedEvent dogbert
ContainerModifiedEvent folder
'dogbert'
>>> folder.manage_delObjects('dogbert')
ObjectWillBeRemovedEvent dogbert
ObjectRemovedEvent dogbert
ContainerModifiedEvent folder
Now move::
......@@ -311,11 +331,13 @@ Now move::
>>> folder._setObject('dilbert', ob)
ObjectWillBeAddedEvent dilbert
ObjectAddedEvent dilbert
ContainerModifiedEvent folder
'dilbert'
>>> cp = folder.manage_cutObjects('dilbert')
>>> folder.manage_pasteObjects(cp)
ObjectWillBeMovedEvent dilbert
ObjectMovedEvent dilbert
ContainerModifiedEvent folder
[{'new_id': 'dilbert', 'id': 'dilbert'}]
And copy::
......@@ -325,6 +347,7 @@ And copy::
ObjectCopiedEvent copy_of_dilbert
ObjectWillBeAddedEvent copy_of_dilbert
ObjectAddedEvent copy_of_dilbert
ContainerModifiedEvent folder
ObjectClonedEvent copy_of_dilbert
[{'new_id': 'copy_of_dilbert', 'id': 'dilbert'}]
......@@ -333,6 +356,7 @@ Then rename::
>>> folder.manage_renameObject('copy_of_dilbert', 'wally')
ObjectWillBeMovedEvent copy_of_dilbert
ObjectMovedEvent wally
ContainerModifiedEvent folder
Or copy using manage_clone::
......@@ -340,6 +364,7 @@ Or copy using manage_clone::
ObjectCopiedEvent phb
ObjectWillBeAddedEvent phb
ObjectAddedEvent phb
ContainerModifiedEvent folder
ObjectClonedEvent phb
>>> res.getId()
'phb'
......@@ -350,13 +375,16 @@ Also on a BTreeFolder::
>>> btfolder._setObject('alice', ob)
ObjectWillBeAddedEvent alice
ObjectAddedEvent alice
ContainerModifiedEvent btfolder
'alice'
>>> btfolder.manage_renameObject('alice', 'rabbit')
ObjectWillBeMovedEvent alice
ObjectMovedEvent rabbit
ContainerModifiedEvent btfolder
>>> btfolder.manage_delObjects('rabbit')
ObjectWillBeRemovedEvent rabbit
ObjectRemovedEvent rabbit
ContainerModifiedEvent btfolder
Now for a tree of objects. Let's create a simple one::
......@@ -364,12 +392,14 @@ Now for a tree of objects. Let's create a simple one::
>>> folder._setObject('subfolder', subfolder)
ObjectWillBeAddedEvent subfolder
ObjectAddedEvent subfolder
ContainerModifiedEvent folder
'subfolder'
>>> subfolder = folder.subfolder
>>> ob = MyNewContent('mel')
>>> subfolder._setObject('mel', ob)
ObjectWillBeAddedEvent mel
ObjectAddedEvent mel
ContainerModifiedEvent subfolder
'mel'
Renaming a tree of objects::
......@@ -379,6 +409,7 @@ Renaming a tree of objects::
ObjectWillBeMovedEvent mel
ObjectMovedEvent firefly
ObjectMovedEvent mel
ContainerModifiedEvent folder
Cloning a tree of objects::
......@@ -388,6 +419,7 @@ Cloning a tree of objects::
ObjectWillBeAddedEvent mel
ObjectAddedEvent serenity
ObjectAddedEvent mel
ContainerModifiedEvent folder
ObjectClonedEvent serenity
ObjectClonedEvent mel
>>> res.getId()
......@@ -400,23 +432,34 @@ OrderedFolder has the same renaming behavior than before::
ObjectWillBeAddedEvent ofolder
ObjectAddedEvent ofolder
old manage_afterAdd ofolder ofolder
ContainerModifiedEvent
'ofolder'
>>> ob1 = MyNewContent('ob1')
>>> ofolder._setObject('ob1', ob1)
ObjectWillBeAddedEvent ob1
ObjectAddedEvent ob1
ContainerModifiedEvent ofolder
'ob1'
>>> ob2 = MyNewContent('ob2')
>>> ofolder._setObject('ob2', ob2)
ObjectWillBeAddedEvent ob2
ObjectAddedEvent ob2
ContainerModifiedEvent ofolder
'ob2'
>>> ofolder.manage_renameObject('ob1', 'ob4')
ObjectWillBeMovedEvent ob1
ObjectMovedEvent ob4
ContainerModifiedEvent ofolder
>>> ofolder.objectIds()
['ob4', 'ob2']
When subobjects are reordered, an event about the container is sent::
>>> ofolder.moveObjectsUp('ob2')
ContainerModifiedEvent ofolder
1
>>> ofolder.objectIds()
['ob2', 'ob4']
Now cleanup::
......
......@@ -95,38 +95,35 @@ def test_security_equivalence():
Now we look at the individual permissions:
>>> bar_roles1 = getattr(Dummy1, 'bar__roles__').__of__(Dummy1)
>>> bar_roles1.__of__(Dummy1)
>>> from AccessControl.ZopeSecurityPolicy import getRoles
>>> from AccessControl import ACCESS_PUBLIC
>>> from AccessControl import ACCESS_PRIVATE
>>> dummy1 = Dummy1()
>>> getRoles(dummy1, 'bar', dummy1.bar, ('Def',))
('Manager',)
>>> keg_roles1 = getattr(Dummy1, 'keg__roles__').__of__(Dummy1)
>>> keg_roles1.__of__(Dummy1)
>>> getRoles(dummy1, 'keg', dummy1.keg, ('Def',))
('Manager',)
>>> foo_roles1 = getattr(Dummy1, 'foo__roles__')
>>> foo_roles1 is None
>>> getRoles(dummy1, 'foo', dummy1.foo, ('Def',)) is ACCESS_PUBLIC
True
>>> # XXX Not yet supported.
>>> # baz_roles1 = getattr(Dummy1, 'baz__roles__')
>>> # baz_roles1
()
#>>> getRoles(dummy1, 'baz', dummy1.baz, ('Def',)) is ACCESS_PRIVATE
#True XXX Not yet supported.
>>> bar_roles2 = getattr(Dummy2, 'bar__roles__').__of__(Dummy2)
>>> bar_roles2.__of__(Dummy2)
>>> dummy2 = Dummy2()
>>> getRoles(dummy2, 'bar', dummy2.bar, ('Def',))
('Manager',)
>>> keg_roles2 = getattr(Dummy2, 'keg__roles__').__of__(Dummy2)
>>> keg_roles2.__of__(Dummy2)
>>> getRoles(dummy2, 'keg', dummy2.keg, ('Def',))
('Manager',)
>>> foo_roles2 = getattr(Dummy2, 'foo__roles__')
>>> foo_roles2 is None
>>> getRoles(dummy2, 'foo', dummy2.foo, ('Def',)) is ACCESS_PUBLIC
True
>>> baz_roles2 = getattr(Dummy2, 'baz__roles__')
>>> baz_roles2
()
>>> getRoles(dummy2, 'baz', dummy2.baz, ('Def',)) is ACCESS_PRIVATE
True
Before we end we should clean up after ourselves:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment