Heres a snip of DTML that adds a property to the parent if the property
doesn't exist.
If you create a ZClass with this, it will modify the parent folder when
called from
within a DTML document, if you do it as a DTML Method, it will modify the
parent document.

>>>
<dtml-if "hasProperty('z_count')">
   <dtml-call "REQUEST.set('z_count', z_count + 1)">
   <dtml-call "manage_changeProperties(REQUEST)">
<dtml-else>
   <dtml-call "manage_addProperty('z_count', 1, 'int' )">
</dtml-if>
<<<

Now, if you wanted to Take a variable in a form (or link), and make it a
property like in your example, you're method would look like this, Assuming
the form had fields to pass the values as 'NewName:string' and
'NewValue:tokens', or your calling link ends with
?NewName:string=foo&NewValue:tokens=mytokens

>>>
<dtml-if "hasProperty(NewName)">
   <dtml-call "REQUEST.set(NewName, NewValue)">
   <dtml-call "manage_changePRoperties(REQUEST)">
<dtml-else>
   <dtml-call "manage_addProperty(NewName, NewValue)">
</dtml-if>
<<<

I hope this helps!  Now if only someone could answer why the behaivor
changes between having it as a DTML method and a ZClass! (And how to fix
it!)

    Message: 5
    From: "Jason Cunliffe" <[EMAIL PROTECTED]>
    To: <[EMAIL PROTECTED]>
    Subject: [Zope] Adding a new property over http
    Date: Thu, 14 Sep 2000 15:00:41 -0400
    charset="iso-8859-1"
    
    Hello
    
    I asked this in longer form before, but it fell by the way I think..
    
    How to add a property to a containing folder.
    Looking for DTML or External Method way to do this.
    
    We need a Method to to add a new folder property assigning an 'Id' =
    <somename> adn 'type' = 'tokens'.
    We need to be able to do this by passing the variable <somename> over
http.
    
    thanks
    - Jason

_______________________________________________
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )

Reply via email to