[Zope-CVS] CVS: Products/CompositePage - composite.py:1.18
Shane Hathaway
shane at zope.com
Thu Mar 25 15:33:50 EST 2004
Update of /cvs-repository/Products/CompositePage
In directory cvs.zope.org:/tmp/cvs-serv28203
Modified Files:
composite.py
Log Message:
Always persist slots in editing mode.
This way, the slots a designer sees are created just before they are used.
The older method often didn't work.
=== Products/CompositePage/composite.py 1.17 => 1.18 ===
--- Products/CompositePage/composite.py:1.17 Fri Mar 12 13:46:16 2004
+++ Products/CompositePage/composite.py Thu Mar 25 15:33:49 2004
@@ -64,13 +64,10 @@
except (KeyError, AttributeError):
# Generate a new slot.
s = self._slot_class(name)
- if composite._v_generating:
- # Persist the slot immediately.
+ if composite.isEditing():
+ # Persist the slot.
slots._setObject(s.getId(), s)
- else:
- # Persist automatically if the slot changes
- jar = AddOnChangeJar(slots)
- s._p_jar = jar
+ # else don't persist the slot.
return s.__of__(slots)
__getitem__ = get
@@ -128,11 +125,11 @@
def generateSlots(self):
"""Creates the slots defined by the template.
"""
- self._v_generating = 1
+ self._v_editing = 1
try:
self()
finally:
- self._v_generating = 0
+ self._v_editing = 0
security.declareProtected(perm_names.view, "__call__")
def __call__(self):
@@ -314,18 +311,6 @@
icon = 'p_/broken'
id = 'error'
title = 'Error'
-
-
-class AddOnChangeJar:
- """Adds an object to a folder if the object changes.
- """
-
- def __init__(self, parent):
- self.parent = parent
-
- def register(self, obj):
- obj._p_jar = None
- self.parent._setObject(obj.getId(), obj)
attributes_for_samples = {
More information about the Zope-CVS
mailing list