[Zope] Re: Adding a new property over http

Jon Franz jfranz@one.net
Fri, 15 Sep 2000 09:41:07 -0400

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-call "manage_addProperty('z_count', 1, 'int' )">

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

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

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

    Message: 5
    From: "Jason Cunliffe" <jasonic@nomadicsltd.com>
    To: <zope@zope.org>
    Subject: [Zope] Adding a new property over http
    Date: Thu, 14 Sep 2000 15:00:41 -0400
    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
    - Jason