Changeset 893

Show
Ignore:
Timestamp:
06/21/07 14:34:31
Author:
mylan
Message:

Fix limiting number of syndication results bug.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • qRSS2Syndication/trunk/skins/qrss2syndication/setup_rss2.cpt

    r608 r893  
    6767            <input type="checkbox"  
    6868                   name="include_subfolders"  
    69                    value="0
     69                   value="1
    7070                   tal:define="checked python:sy_info['include_subfolders'] and 'checked'" 
    7171                   tal:attributes="checked checked"/> 
  • qRSS2Syndication/trunk/utils.py

    r707 r893  
    4545    res = [] 
    4646    ps = getToolByName(context,'portal_syndication') 
    47     cpath = '/'.join(context.getPhysicalPath()) 
    48     syProperties = {} 
    49     syProperties = getRSS2Properties(context) 
    50     include_subfolders = 0 
    5147    if ps.isSyndicationAllowed(context): 
     48        cpath = '/'.join(context.getPhysicalPath()) 
     49        syProperties = getRSS2Properties(context) 
    5250        types = syProperties['rss2_types'] 
    5351        only_published = syProperties['only_published'] 
     
    5654 
    5755        catalog = getToolByName(context,'portal_catalog') 
    58         args = {'portal_type':types,  
    59               'path':cpath, 
     56        args = {'portal_type':types, 
     57                'path':cpath, 
    6058                'sort_on':'effective', 
    6159                'sort_order':'reverse',} 
     
    6361            args['review_state'] = 'published' 
    6462        if include_subfolders == 0: 
     63            path_length=len(cpath)+1 
     64            for i in catalog.searchResults(args): 
     65                if i.getPath()[path_length:].find('/')<0: 
     66                    res.append(i) 
     67            res = res[:articles_number] 
     68        else: 
    6569            args['sort_limit'] = articles_number 
    66         res=catalog.searchResults(args) 
    67     path_length=len(cpath)+1 
    68     res1=[] 
    69     if include_subfolders == 0: 
    70         for i in res : 
    71             if i.getPath()[path_length:].find('/')<0: 
    72                 res1.append(i) 
    73         res = res1[:articles_number] 
    74     res = [r.getObject() for r in res] 
     70            res=catalog.searchResults(args) 
     71        res = [r.getObject() for r in res] 
    7572    return res 
    7673