Commit e12dabf1 authored by Florent Guillaume's avatar Florent Guillaume

Updated to Five 1.3b4.

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