[Zope-dev] RE:Catalog bug ZClass constructor

Jason Spisak webmaster@mtear.com
Fri, 14 Jan 2000 15:27:53 -0500


Brian,

Here is the code I have for the ZClass is was building when I found this
out.
Does any of this look like "custom code" that would account for a
leading slash?


<dtml-comment>
 Set a REQUEST object called 'id' as a unique number by 
 representing the current time as an integer, and then 
 convert that to a string.
</dtml-comment>

<dtml-call "REQUEST.set('id', _.str(_.int(ZopeTime())))">

<dtml-comment>
 Create an instance of the CompanyClass with the 'id' we 
 just set in the REQUEST.
</dtml-comment>

<dtml-with "CompanyClass.createInObjectManager(REQUEST['id'], REQUEST)">

<dtml-comment>
 Pack all of our for values and anything else in the REQUEST
 into the proerties of the CompanyClass instance we just 
 created.
</dtml-comment>

 <dtml-call
"propertysheets.Company_properties.manage_editProperties(REQUEST)">

<dtml-comment>
 Because the 'CreateInObjectManager' we called above indexes the object
 before we called 'manage_editProperties', all of the properties of our
 new Company are blank as far as the Catalog is concerned.
 Not Good!  So we tell the Ctalog to take another look, now that they 
 have values.
</dtml-comment>

 <dtml-call reindex_object>
</dtml-with>

<dtml-comment>
 Okay, now that we've created a Company, let's be nice and
 send the user into it.  We do this by redirecting the browser
 to a page inside our new object.  The URL2 tells us to chop off
 the last 'two' elements of the current URL and the the '+' adds
 on the id of the object we just created.  So they end up inside 
 the new Company!
</dtml-comment>

<dtml-call "RESPONSE.redirect(
            URL2 + '/' + REQUEST['id']
            )">


This is very basic stuff, so I was suprized to see a problem.  I am
calling something in a nold way that doesn't need to be?  Please let me
know.


-- 
Jason Spisak
webmaster@hiretechs.com