[Zope-CVS] CVS: Products/CompositePage - CHANGES.txt:1.4 README.txt:1.7 composite.py:1.21 slot.py:1.19 macro.py:NONE

Shane Hathaway shane at zope.com
Tue Apr 13 15:12:34 EDT 2004


Update of /cvs-repository/Products/CompositePage
In directory cvs.zope.org:/tmp/cvs-serv1892

Modified Files:
	CHANGES.txt README.txt composite.py slot.py 
Removed Files:
	macro.py 
Log Message:
Removed support for METAL-based slot definition syntax.

It broke in too many ways.  It has been replaced by a new TAL
expression type, "slot:".  See www/sample_template.zpt for an example.



=== Products/CompositePage/CHANGES.txt 1.3 => 1.4 ===
--- Products/CompositePage/CHANGES.txt:1.3	Sat Dec 27 23:33:08 2003
+++ Products/CompositePage/CHANGES.txt	Tue Apr 13 15:12:01 2004
@@ -9,7 +9,7 @@
 
   - The clipboard now works.
 
-  - You can now define slots in a template using standard METAL syntax.
+  - You can now define slots in a template using "slot:" expressions.
     This should make it easier to write templates.
 
   - The composite tool now checks copy/paste permissions before making


=== Products/CompositePage/README.txt 1.6 => 1.7 ===
--- Products/CompositePage/README.txt:1.6	Thu Feb 26 16:38:11 2004
+++ Products/CompositePage/README.txt	Tue Apr 13 15:12:01 2004
@@ -46,9 +46,8 @@
 - Create a Composite Tool instance in a central location, possibly the
 root folder.
 
-- Create a Composite object.  On the creation form, there is a radio
-button for creating a sample METAL-based template.  Leave the radio
-button selected.
+- Create a Composite object.  On the creation form, there is a
+checkbox for creating a sample template.  Leave the checkbox checked.
 
 - Visit the Composite object and select the "Design" tab.  You should
 see a three-column layout with blue dotted lines in the places where
@@ -57,11 +56,9 @@
 - Click just beneath one of the blue lines.  A context menu will pop
 up.  Select "Add...".
 
-- You will be directed to a slot (a folderish object.)  Using the
-standard "Add" drop-down menu, add something that will generate an
-HTML fragment (but not a whole HTML page) such as a script or
-template.  Don't put too much effort into this, since you'll delete
-the object later.
+- You will be directed to a slot (a folderish object.)  In slots, you
+can add composite elements.  Add a composite element that points to a
+script.
 
 - Find the composite created earlier and select the "Design" tab
 again.  Your new object should now show up in the slot.
@@ -69,7 +66,7 @@
 - Move the object to a different slot using drag and drop.  When the
 mouse cursor is hovering over a permitted target (the blue dotted
 lines are targets), the target will be highlighted.  Let go and watch
-your object appear in its new place.
+your object appear in the new place.
 
 - Right-click over your object and select "Delete" from the context
 menu.


=== Products/CompositePage/composite.py 1.20 => 1.21 ===
--- Products/CompositePage/composite.py:1.20	Thu Apr  1 18:20:37 2004
+++ Products/CompositePage/composite.py	Tue Apr 13 15:12:01 2004
@@ -30,7 +30,6 @@
 
 from interfaces import IComposite, ISlot, ISlotGenerator, CompositeError
 from slot import Slot, getIconURL, formatException
-from macro import renderMacro, getRootMacro
 import perm_names
 
 _www = os.path.join(os.path.dirname(__file__), "www")
@@ -140,14 +139,7 @@
         self._v_rendering = 1
         try:
             template = self.getTemplate()
-            macro = getRootMacro(template)
-            if macro:
-                # Since the template defines a macro at the root, use
-                # METAL-based slotting.
-                return renderMacro(template, macro, self)
-            else:
-                # Otherwise use TAL-based slotting.
-                return template(composite=self)
+            return template(composite=self)
         finally:
             self._v_rendering = 0
 
@@ -316,11 +308,6 @@
     title = 'Error'
 
 
-attributes_for_samples = {
-    "sample_template.zpt": {},
-    "metal_template.zpt": {},
-    }
-
 addCompositeForm = PageTemplateFile("addCompositeForm", _www)
 
 def manage_addComposite(dispatcher, id, title="", create_sample="",
@@ -332,17 +319,14 @@
     ob.title = string(title)
     dispatcher._setObject(ob.getId(), ob)
     if create_sample:
-        attrs = attributes_for_samples.get(create_sample)
-        if attrs is None:
-            raise ValueError("Not allowed: %s" % create_sample)
         ob = dispatcher.this()._getOb(ob.getId())
-        f = open(os.path.join(_www, create_sample), "rt")
+        f = open(os.path.join(_www, 'sample_template.zpt'), "rt")
         try:
             text = f.read()
         finally:
             f.close()
-        pt = ZopePageTemplate(id="template", text=text,
-                              content_type="text/html")
+        pt = ZopePageTemplate(
+            id="template", text=text, content_type="text/html")
         ob._setObject(pt.getId(), pt)
     if REQUEST is not None:
         return dispatcher.manage_main(dispatcher, REQUEST)


=== Products/CompositePage/slot.py 1.18 => 1.19 ===
--- Products/CompositePage/slot.py:1.18	Tue Mar  2 17:08:45 2004
+++ Products/CompositePage/slot.py	Tue Apr 13 15:12:01 2004
@@ -151,8 +151,10 @@
             myid = self.getId()
             if hasattr(self, 'portal_url'):
                 icon_base_url = self.portal_url()
-            else:
+            elif hasattr(self, 'REQUEST'):
                 icon_base_url = self.REQUEST['BASEPATH1']
+            else:
+                icon_base_url = '/'
         for index in range(len(items)):
             name, obj = items[index]
 

=== Removed File Products/CompositePage/macro.py ===




More information about the Zope-CVS mailing list