[Zope-CMF] updatePredicate arguments?

marc lindahl marc@bowery.com
Mon, 10 Sep 2001 19:01:33 -0400


After blowing a day on this, I answered my own question.  Here it is so
noone else has to blow a day.  Bottom line?  'Record' is an obscure class in
HTTPRequest.py, of questionable value (why didn't they use a dictionary??)

To use it with updatePredicate, first you need to import it:

from ZPublisher.HTTPRequest import record

Then instantiate it and fill it with the appropriate values.  That varies
given the type of predicate.  This example is for the major/minor type:

    predicate = record()
    predicate.id = 'audio'
    predicate.major = 'audio'
    predicate.minor = ''
    registry.updatePredicate('audio', predicate, 'Audio')

...obviously, from an install script for CMFAudio...

> From: marc lindahl <marc@bowery.com>
> Date: Mon, 10 Sep 2001 14:52:12 -0400
> To: <zope-cmf@zope.org>
> Subject: [Zope-CMF] updatePredicate arguments?
> 
> Hi,
> I'm trying to make an install script, and call updatePredicate from it
> (python)
> 
> I'm lost, as to the second argument:
> 
> def updatePredicate( self, predicate_id, predicate, typeObjectName ):
> 
> 
> predicate_id is the ID you want to access in the content_type_registry
> typeObjectName is the portal_type id you want to associate it with
> 
> but WTF is the format for predicate?
> 
> as far as I can dig, it's dependant on the type - I'm interested in
> major/minor... it seems that 'predicate' expects a dictionary, but I can't
> decipher what's supposed to be in it - and it's not documented *anywhere*..
> 
> 
> help!!!
> 
> 
> _______________________________________________
> Zope-CMF maillist  -  Zope-CMF@zope.org
> http://lists.zope.org/mailman/listinfo/zope-cmf
> 
> See http://www.zope.org/Products/PTK/Tracker for bug reports and feature
> requests