[Zope-dev] ZPatterns goes crazy after ZClass change

Itai Tavor itai@optusnet.com.au
Wed, 21 Feb 2001 10:29:53 +1100


Steve Alexander wrote:

>Itai Tavor wrote:
>
>>Hi,
>>
>>I have a Rack which uses ZClass Company for storage. I renamed 
>>Company to CompanyX and created a new Company ZClass, giving it the 
>>same methods, propertysheets and properties as CompanyX. When I 
>>tried to view editInstanceForm_html of an instance of this class, I 
>>got the method stored in CompanyX. So I deleted CompanyX from the 
>>control panel. I still got the CompanyX method. I used the Rack's 
>>Storage tab to select another ZClass. Still got the method from 
>>CompanyX.
>>
>>when I click Remove Orphaned Slots on this Rack, I get:
>>
>>Any ideas how I can fix this without recreating the Rack and all my 
>>persistent data?
>
>Use the Zope Undo mechanism to return your application to the state 
>it was in before you renamed Company to CompanyX.
>
>Either that, or restore from one of your backups.
>
>Check things are working. Now, take another backup.
>
>
>Then, do the same renaming thing as you did before, but ensure that 
>you make the new Company ZClass have the same "Class Id" as the old 
>one had, and that the old Company ZClass (now CompanyX) has a 
>different "Class Id". You can find the "Class Id" field on the Basic 
>tab of a ZClass.
>
>This "Class Id" is how Zope works out what ZClass to use when it 
>comes across a ZClass instance.

Thanks for the advice! I really didn't want to go back to where I 
started and then have to redo all the changes I made to this class... 
but it turns out I didn't have to. I simply copied the class id from 
a backup into the new class, and everything's back to normal now.

I think I've severely misunderstood how Racks work. I thought 
persistent Racks just store properties, and then use the ZClass set 
in the Storage tab to wrap that data when providing it. Which means 
that I can change the class set for storage and all the objects in 
the Rack will be provided as the new class. But if changing the 
storage class doesn't change the object provided by the Rack, it 
means the actual ZClass instance is stored. Is this right?

Thanks again,

Itai
-- 
--
Itai Tavor                      -- "Je sautille, donc je suis."    --
itai@optusnet.com.au            --               - Kermit the Frog --
--                                                                 --
-- "If you haven't got your health, you haven't got anything"      --