<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Re: [Zope] setting Zclass instance id based on propert</TITLE>
<META content="text/html; charset=iso-8859-1" http-equiv=Content-Type>
<STYLE type=text/css></STYLE>

<META content="MSHTML 5.00.3314.2100" name=GENERATOR></HEAD>
<BODY background="" bgColor=#ffffff>
<DIV><FONT size=2>Charlie wrote:</FONT></DIV>
<DIV><BR><FONT size=2>I'm trying to create a context-based id based on the 
properties.<BR><BR>There must be a way to customize the python constructor such 
that instead of two steps there is a third step that reassigns the value of the 
id based on properties *after* they are assigned.<BR><BR>I'm a designer, not a 
programmer - can somebody help me out here?<BR><BR>I'm looking for someone to 
fill in the third blank:<BR><BR>(1) Add a new instance of the ZClass<BR>request 
= context.REQUEST<BR>instance = 
container.MyZClass.createInObjectManager(request['id'], request)<BR><BR>(2) 
update a property sheet from the form 
values<BR>instance.propertysheets.MyZClassProperties.manage_editProperties(request)<BR><BR>(3) 
set id to be equal several properties (such as 
section-chapter-book)<BR><BR><BR></FONT></DIV>
<DIV><FONT size=2>There is a manage_rename routine.&nbsp; I have never used it 
myself (other than indirectly by clicking on the 'Rename' button on the ZMI 
display) so I don't know the parameters required.&nbsp; I would guess it would 
be something like:</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=2>&lt;dtml-call "manage_rename(old_id, new_id)"&gt;</FONT></DIV>
<DIV><FONT size=2>or</FONT></DIV>
<DIV><FONT size=2>&lt;dtml-call "old_id.manage_rename(new_id)"&gt;</FONT></DIV>
<DIV><FONT size=2>or</FONT></DIV>
<DIV><FONT size=2>&lt;dtml-call "old_id.manage_rename(id=new_id)</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=2>If these don't work, try looking at the source or maybe 
someone else on the mailing list has some experience with it.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=2>HTH</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=2>Jonathan</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=2>Jonathan</FONT></DIV>
<DIV>&nbsp;</DIV></BODY></HTML>