Changeset 3027 for trunk


Ignore:
Timestamp:
05/07/10 16:37:35 (10 years ago)
Author:
jukka
Message:

Fixed #1968

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/GroupBlog.py

    r3026 r3027  
    271271        return 'Manager' in roles or 'Reviewer' in roles 
    272272         
    273     def getPosts(self, batch=True, b_size=30, b_start=0, objects=True, limit=0): 
     273    def getPosts(self, batch=True, b_size=30, b_start=0, objects=True, limit=0, remove_zeros=False): 
    274274        """ Return get posts as *metadata* objects, sort them by date and batch them """ 
    275275        pc= getToolByName(self,'portal_catalog') 
    276276        blogposts=pc({'portal_type':'BlogPost', 'getState':'public', 'path':'/'.join(self.getPhysicalPath()[1:])}) 
    277277        resources=pc({'getRawGroupEditing':self.UID(), 'getState':('public','draft')}) 
     278        if remove_zeros:         
     279            resources = filter(lambda x: x.postCount, resources) 
     280            blogposts = list(blogposts) # this is required as the filter operation changes lazy catalog object to list 
     281            # and blogposts need to be list too so that they can be concatenated 
    278282        results=[(int(DateTime(r.getLastCommentDate).timeTime()), r.aq_base, r) for r in blogposts+resources if r.getLastCommentDate] 
    279283        results.sort() 
  • trunk/skins/lemill/groupblog_view.pt

    r3014 r3027  
    7676  
    7777    <tal:discussions define="b_size python:20;b_start python:0;b_start request/b_start | b_start; 
    78                             batch python:here.getPosts(batch=True, b_size=b_size, b_start=b_start, objects=False); 
     78                            batch python:here.getPosts(batch=True, b_size=b_size, b_start=b_start, objects=False, remove_zeros=True); 
    7979                            ">     
    8080    <table border="0" cellpadding="2" cellspacing="2" width="100%"> 
Note: See TracChangeset for help on using the changeset viewer.