[Zope] How to change the properties of a ZClass instance

Jan Lentfer Jan@MountainbikeHQ.de
Tue, 19 Jun 2001 11:54:46 +0200


This is a multi-part message in MIME format.

------=_NextPart_000_0019_01C0F8B6.A27B9BC0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi everyone,

I am having a hard time changing the properties of an ZClass instance.

This is what I have done so far:

I created a producted called MTB_HQ. Within that product I created the =
ZClass "racedate". The ZClass has the a propertysheet called =
"date_properties".
The sheet contains the properties =
"date_day","date_month","date_year","date_sort","title","discipline","loc=
ation". All string type.

2nd I edited the "racedate_add" method as described in the "Searcheable =
Job Board"-How-To (unique timestamp ids, etc).

Then I made a html form in:

|
|--mtb_hq
        |
        |
      admin


The form calls the method "addracedate.dtml" in /mt_hq/admin/racedates. =
Here's the code:

****************************
"addracedate.dtml"
---------------------------

<dtml-call "REQUEST.set ('date_sort', year_html+month_html+day_html)">
<dtml-call "REQUEST.set ('title', location_html+' =
'+day_html+'.'+month_html+'.'+year_html)">
<dtml-call "REQUEST.set ('date_day', day_html)">
<dtml-call "REQUEST.set ('date_month', month_html)">
<dtml-call "REQUEST.set ('date_year', year_html)">
<dtml-call "REQUEST.set ('location', location_html)">
<dtml-call "REQUEST.set ('discipline', discipline_html)">

<dtml-with "manage_addProduct['MTB_HQ']">
  <dtml-call "racedate_add(_.None, _, NoRedir=3D1)">
</dtml-with>

<dtml-call "RESPONSE.redirect ('../index.htm')">

******************************



Ok, so now I have the instance with the new properties and I can display =
it and everything - fine!

But what do I do now when I want to change the properties of an existing =
ZClass instance through a web form?
I tried back and forth wit manage_changeProperties but I jsut can't get =
it to work. Believe me I searched through all the How-Tos and =
documentation available but couldn't find any hint that got me further.

My idea is to create a web form that is filled with the properties of =
existing ZClass. The you can make changes and the form calls a method =
that does the changing of the properties. But how do I do that?

My web form (very basic now, not formatted in any way) right now looks =
like this:

***************
"editracedates_form.htm"
---------------------------------------
<dtml-with racedates>
<dtml-in "Catalog(id=3Dobj_id)">

<form method=3D"post" action=3D"racedates/changeRaceDate.dtml">
  <p>
    Day     <input type=3D"text" name=3D"day_html" value =3D"<dtml-var =
date_day>">
    Month  <input type=3D"text" name=3D"month_html" value =3D"<dtml-var =
date_month>">
    Year    <input type=3D"text" name=3D"year_html" value =3D "<dtml-var =
date_year>">
    </p>
  <p>=20
    <input type=3D"text" name=3D"location_html" value =3D"<dtml-var =
location>">
    location&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
    <input type=3D"text" name=3D"discipline_html" value =3D"discipline">
    discipline </p>
   =20
  <p>
    <input type=3D"submit" name=3D"Button" value=3D"Abschicken">
  </p>
  </form>

  </dtml-in>
 </dtml-with>
****************


How should the dtml-method "changeracedate.dtml" look like? Or could one =
of you guys point my nose at the right doc or how-to?
I have really been playing around with this quite a while and just can't =
figure out how to use mange_changeProperties right!

Many, many thanks in advance and sorry for this quite lenghty posting.


Jan Lentfer



------=_NextPart_000_0019_01C0F8B6.A27B9BC0
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 5.50.4522.1800" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hi everyone,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I am having a hard time changing the =
properties of=20
an ZClass instance.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>This is what I have done so =
far:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I created a producted called MTB_HQ. =
Within that=20
product I created the ZClass "racedate". The ZClass has the a =
propertysheet=20
called "date_properties".</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>The sheet contains the properties=20
"date_day","date_month","date_year","date_sort","title","discipline","loc=
ation".=20
All string type.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>2nd I edited the "racedate_add" method =
as described=20
in the "Searcheable Job Board"-How-To (unique timestamp ids, =
etc).</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Then I made a html form =
in:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>|</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>|--mtb_hq</FONT></DIV>
<DIV><FONT face=3DArial =
size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
|</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;=20
|</FONT></DIV>
<DIV><FONT face=3DArial=20
size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;admin</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>The form calls the method =
"addracedate.dtml" in=20
/mt_hq/admin/racedates. Here's the code:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial =
size=3D2>****************************</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>"addracedate.dtml"</FONT></DIV>
<DIV><FONT face=3DArial =
size=3D2>---------------------------</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&lt;dtml-call "REQUEST.set =
('date_sort',=20
year_html+month_html+day_html)"&gt;<BR>&lt;dtml-call "REQUEST.set =
('title',=20
location_html+' =
'+day_html+'.'+month_html+'.'+year_html)"&gt;<BR>&lt;dtml-call=20
"REQUEST.set ('date_day', day_html)"&gt;<BR>&lt;dtml-call "REQUEST.set=20
('date_month', month_html)"&gt;<BR>&lt;dtml-call "REQUEST.set =
('date_year',=20
year_html)"&gt;<BR>&lt;dtml-call "REQUEST.set ('location',=20
location_html)"&gt;<BR>&lt;dtml-call "REQUEST.set ('discipline',=20
discipline_html)"&gt;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&lt;dtml-with=20
"manage_addProduct['MTB_HQ']"&gt;<BR>&nbsp; &lt;dtml-call =
"racedate_add(_.None,=20
_, NoRedir=3D1)"&gt;<BR>&lt;/dtml-with&gt;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&lt;dtml-call "RESPONSE.redirect=20
('../index.htm')"&gt;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial =
size=3D2>******************************</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Ok, so now I have the instance with the =
new=20
properties and I can display it and everything - fine!</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>But what do I do now when I want to =
change the=20
properties of an existing ZClass instance through a web =
form?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I tried back and forth wit =
manage_changeProperties=20
but I jsut can't get&nbsp;it to work. Believe me I searched through all =
the=20
How-Tos and documentation available but couldn't find any hint that got =
me=20
further.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>My idea is to create a web form that is =
filled with=20
the properties of existing ZClass. The you can make changes and the form =
calls a=20
method that does the changing of the properties. But how do I do=20
that?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>My web form (very basic now, not =
formatted in any=20
way) right now looks like this:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>***************</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>"editracedates_form.htm"</FONT></DIV>
<DIV><FONT face=3DArial=20
size=3D2>---------------------------------------</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&lt;dtml-with =
racedates&gt;<BR>&lt;dtml-in=20
"Catalog(id=3Dobj_id)"&gt;<BR></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&lt;form method=3D"post"=20
action=3D"racedates/changeRaceDate.dtml"&gt;<BR>&nbsp;=20
&lt;p&gt;<BR>&nbsp;&nbsp;&nbsp; Day&nbsp;&nbsp;&nbsp;&nbsp; &lt;input=20
type=3D"text" name=3D"day_html" value =3D"&lt;dtml-var=20
date_day&gt;"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;Month&nbsp; &lt;input =
type=3D"text"=20
name=3D"month_html" value =3D"&lt;dtml-var=20
date_month&gt;"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;Year&nbsp;&nbsp;&nbsp; =
&lt;input=20
type=3D"text" name=3D"year_html" value =3D "&lt;dtml-var=20
date_year&gt;"&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;/p&gt;<BR>&nbsp; &lt;p&gt;=20
<BR>&nbsp;&nbsp;&nbsp; &lt;input type=3D"text" name=3D"location_html" =
value=20
=3D"&lt;dtml-var location&gt;"&gt;<BR>&nbsp;&nbsp;&nbsp;=20
location&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;=
nbsp;=20
<BR>&nbsp;&nbsp;&nbsp; &lt;input type=3D"text" name=3D"discipline_html" =
value=20
=3D"discipline"&gt;<BR>&nbsp;&nbsp;&nbsp; discipline=20
&lt;/p&gt;<BR>&nbsp;&nbsp;&nbsp; <BR>&nbsp; =
&lt;p&gt;<BR>&nbsp;&nbsp;&nbsp;=20
&lt;input type=3D"submit" name=3D"Button" =
value=3D"Abschicken"&gt;<BR>&nbsp;=20
&lt;/p&gt;<BR>&nbsp; &lt;/form&gt;<BR></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;=20
&lt;/dtml-in&gt;<BR>&nbsp;&lt;/dtml-with&gt;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>****************</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>How should the dtml-method =
"changeracedate.dtml"=20
look like? Or could one of you guys point my nose at the right doc or=20
how-to?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I have really been playing around with =
this quite a=20
while and just can't figure out how to use mange_changeProperties=20
right!</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Many, many thanks in advance and sorry =
for this=20
quite lenghty posting.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Jan Lentfer</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV></BODY></HTML>

------=_NextPart_000_0019_01C0F8B6.A27B9BC0--