[Erp5-dev] How to search for None in catalog?
    Jérome Perrin 
    jerome at nexedi.com
       
    Tue Oct 23 11:24:00 CEST 2007
    
    
  
Łukasz Nowak a écrit :
> Hello,
> 
> I've got:
> 
> search_kw = {
>   'portal_type' : 'Sale Supply',
>   'destination_section_title' : context.getDestinationTitle()
> }
> 
> Using above in portal_catalog I'm able to find all objects of given
> portal_type, which has filled destination_section_title
> 
> But I'd like to extend it to find objects which has
> destination_section_title set to None or '' - SQL expression:
>   destination_section_title = 'context.getDestinationTitle()' OR
>   destination_section_title = None OR
>   destination_section_title = ''
> 
> But creating:
> search_kw = {
>   'portal_type' : 'Sale Supply',
>   'destination_section_title' : \
> [context.getDestinationTitle(),None,'None',''] }
> 
> Is giving me:
>   related_catalog_1.title = 'context.getDestinationTitle()' OR
>   related_catalog_1.title = 'None' OR related_catalog_1.title = 'None'
> 
> So how my I search for None,'' objects properties in catalog?
Hi,
You can pass ignore_empty_string=0, but this will return documents for 
which there is another document related with destination category, to 
get documents without any documents related, it's another story.
Jérome
    
    
More information about the Erp5-dev
mailing list