[Zope] Re: Problem Augmented assignment

julian jules12af at aol.com
Mon Jun 4 12:07:20 EDT 2007


In fact it's a problem of AdvancedQuery :
            TypeError: Augmented assignment to And objects is not allowed
            in untrusted code

If I don't write query = And(), there are no errors. But I want the 
function And :s .

My code :
----------------------------------------------------------
query = And()
query &= Eq('portal_type', 'J_Product')
query &= Eq('review_state', 'published')

query2 = Or()

if type1 != None:
    query2 |= Eq('getJ_product_type', int(1))

if type2 != None:
    query2 |= Eq('getJ_product_type', int(2))

if type3 != None:
    query2 |= Eq('getJ_product_type', int(3))

if type4 != None:
    query2 |= Eq('getJ_product_type', int(4))

if type5 != None:
    query2 |= Eq('getJ_product_type', int(5))

if type6 != None:
    query2 |= Eq('getJ_product_type', int(6))

if type1 != None or type2 != None or type3 != None or type4 != None or 
type5 != None or type6 != None :
   query &= query2


resultat_product= context.portal_catalog.evalAdvancedQuery(query)

sort_on_pr = (("Title","strcoll_nocase","asc"),)

tri_association =sequence.sort(resultat_product, sort_on_pr)

return tri_product
----------------------------------------------------------------------

Thanks,
Julian



More information about the Zope mailing list