[Zope] Question about possible Data.fs corruption

Ira Sher ira at angel.net
Wed Mar 10 11:39:59 EST 2004


Chris,
Ack. Thanks for the feedback. The site was written long ago in Zope 
1.x, and has been nosed along to it's current state, when the last of 
the developers didn't have time to take care of it. It's too large (and 
the client too nonprofit) to overhaul the whole thing, but it looks 
like I'll be pulling apart bits of it as it breaks to rewrite. Didn't 
know there was such a strong feeling about using dtml request (having 
worked with zope/python for all of a month).
regards,
ira

On Mar 10, 2004, at 9:10 AM, Chris Withers wrote:

> Hi Ira,
>
> Ira Sher wrote:
>
> This is truly horrible code, and a good example of why DTML sux so bad:
>> <dtml-in "Catalog.searchResults(meta_type='Book',sie='on')">
>> and the dtml script writing the data is writing:
>> <dtml-call "REQUEST.set('id','readers_guide')">
>> <dtml-call "REQUEST.set('sie','on')">
>> <dtml-with "Readers_Guide.createInObjectManager(REQUEST['id'], 
>> REQUEST)">
>>  <dtml-call "propertysheets.Basic.manage_editProperties(REQUEST)">
>>  <dtml-call 
>> "aq_parent.propertysheets.Basic.manage_changeProperties(REQUEST)">
>>  <dtml-call "reindex_object()">
>>  <dtml-call "aq_parent.reindex_object()">
>> </dtml-with>
>
> Lets try the above again in a Script (Python):
>
> REQUEST = context.REQUEST
> # NB: no REQUEST polution from the following...
> id = 'readers_guide'
> sie = 'on'
> for brain in Catalog.searchResults(meta_type='Book',sie='on'):
>    # dunno what else you have in REQUEST, so leaving as is...
>    rg = brain.Readers_Guide.createInObjectManager(id, REQUEST)
>    # you're using ZClasses and editProperties - ouch!
>    # I hope this method is
>    # getting called from a web form which shows ALL the properties...
>    rg.propertysheets.Basic.manage_editProperties(REQUEST)
>    rg_container = rg.aq_parent
>    # The following line makes no sense, what's it trying to change?
>    rg_container.propertysheets.Basic.manage_changeProperties(REQUEST)
>    rg.reindex_object()
>    rg_container.reindex_object()
>
> ...which is still pretty croaky, but at least debuggable now.
> I'd really want to get ride of those REQUEST's as arguments to 
> createInObjectManager and the property changers...
>
>> which would seem to set sie as "on", the newer records return sie as 
>> True rather than "on", and so fail.
>
> Using the REQUEST in the way the above do is pretty dodgy...
>
>> The version of python was updated on the live server. Could this have 
>> caused the problem?
>
> Yes, if the properties are of type Boolean and you upgraded Zope as 
> well..
>
>> How can I be more explicit in the call to ensure that "on" is 
>> preserved rather than converted to True?
>
> Don't use ZClasses? ;-) Well, look at the property sheets, see what 
> version fo Zope was and is in use, etc...
>
> cheers,
>
> Chris - nothing beats a badly written Zope app (or perl) for pain and 
> suffering.
>
> -- 
> Simplistix - Content Management, Zope & Python Consulting
>            - http://www.simplistix.co.uk
>




More information about the Zope mailing list