[Zope] Object adding strangeness

Geoffrey L. Wright gwright@integritysi.com
13 Dec 2000 16:55:24 -0900


So I've created a simple little product to dynamically manage CSS.  It
consists of three ZClasses and the arrangement looks something like
this:
 
   STYLEn_containerClass
             \
              \--> STYLEn_styleClass
                              \
                               \--> STYLEn_stylePropertyClass
 
The STYLEn_containerClass can contain a variable number of styles
which can, in turn, contain a variable number of properties.

I've also hacked the add method for the STYLEn_containerClass so that
it creates a number of default styles.  So far, this has all worked
swimmingly, but I have run into one really strange issue that I can't
figure out for the life of me.  Basicly, the folder that contains the
STYLEn_containerClass somehow(?) manages to aquire the title of the
last instance of STYLEn_styleClass that gets created.  So in the
follow example, the title of the containing folder get renamed to
"Header style" from whatever it happened to be before.

Does anybody have an idea of why this might be happening?   TIA for 
any answers or leads.

My code is below:
 
 ---
 
<dtml-comment>Create the "STYLEn" container.</dtml-comment>
 
<dtml-with "STYLEn_containerClass.createInObjectManager('STYLEn',REQUEST)">

  <dtml-call "propertysheets.STYLEn_containerClassPropertySheet.manage_editProperties(REQUEST)">
  <dtml-call "manage_editProperties(REQUEST)">
 
 
  <dtml-comment>Create header style</dtml-comment>
 
  <dtml-call "REQUEST.set('ts', ZopeTime())">
  <dtml-call "REQUEST.set('id',_.str(_.int(ts)) + '-1')">
  <dtml-call "REQUEST.set('title','Header style')">
  <dtml-with "STYLEn_styleClass.createInObjectManager(REQUEST['id'], REQUEST)">
    <dtml-call "REQUEST.set('element','h1')">
    <dtml-call "REQUEST.set('style','header')">
    <dtml-call "propertysheets.STYLEn_styleClassPropertySheet.manage_editProperties(REQUEST)">
    <dtml-call "manage_editProperties(REQUEST)">
    <dtml-with "STYLEn_stylePropertyClass.createInObjectManager('font-family', REQUEST)">
      <dtml-call "REQUEST.set('value','arial, sans-serif')">
      <dtml-call "propertysheets.STYLEn_stylePropertyClassPropertySheet.manage_editProperties(REQUEST)">
      <dtml-call "manage_editProperties(REQUEST)">
    </dtml-with>
    <dtml-with "STYLEn_stylePropertyClass.createInObjectManager('font-size', REQUEST)">
      <dtml-call "REQUEST.set('value','16pt')">
      <dtml-call "propertysheets.STYLEn_stylePropertyClassPropertySheet.manage_editProperties(REQUEST)">
      <dtml-call "manage_editProperties(REQUEST)">
    </dtml-with>
    <dtml-with "STYLEn_stylePropertyClass.createInObjectManager('font-style', REQUEST)">
      <dtml-call "REQUEST.set('value','normal')">
      <dtml-call "propertysheets.STYLEn_stylePropertyClassPropertySheet.manage_editProperties(REQUEST)">
      <dtml-call "manage_editProperties(REQUEST)">
    </dtml-with>
    <dtml-with "STYLEn_stylePropertyClass.createInObjectManager('font-weight', REQUEST)">
      <dtml-call "REQUEST.set('value','bold')">
      <dtml-call "propertysheets.STYLEn_stylePropertyClassPropertySheet.manage_editProperties(REQUEST)">
      <dtml-call "manage_editProperties(REQUEST)">
    </dtml-with>
    <dtml-with "STYLEn_stylePropertyClass.createInObjectManager('color', REQUEST)">
      <dtml-call "REQUEST.set('value','#000000')">
      <dtml-call "propertysheets.STYLEn_stylePropertyClassPropertySheet.manage_editProperties(REQUEST)">
      <dtml-call "manage_editProperties(REQUEST)">
    </dtml-with>
  </dtml-with>

</dtml-with>

<dtml-comment>
  Now we need to return something.  We do this via a redirect so that the URL is correct.

  Unfortunately, the way we do this depends on whether we live in a product or in a class.  If we live in a 
  product, we need to use DestinationURL to decide where to go. If we live in a class, DestinationURL won't 
  be available, so we use URL2.
</dtml-comment>

<dtml-if DestinationURL>

  <dtml-call "RESPONSE.redirect(DestinationURL+'/manage_workspace')">

<dtml-else>

  <dtml-call "RESPONSE.redirect(URL2+'/manage_workspace')">

</dtml-if>

</body></html>

 ---



-- 
Geoffrey L. Wright
Developer / Systems Administrator

(907) 563-2721 ex. 4900
http://www.integritysi.com