File: fix_replies.py

package info (click to toggle)
squishdot 1.3.0-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 896 kB
  • ctags: 349
  • sloc: python: 2,313; makefile: 56; sh: 54
file content (24 lines) | stat: -rw-r--r-- 786 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# $Id: fix_replies.py,v 1.4 2001/05/21 15:27:26 fresh Exp $
from Products.UpdateSupport.updatesupport import _updateall,_log

def do_update(self):
    """ Set the reply count and moderated count to what they should be """
    
    for id in self.data.keys():
        obj = self.data[id]
        obj.revsub=0
        obj.reply_cnt=0
        
    for id in self.data.keys():
        obj = self.data[id]
        for tid in obj.thread:
            tobj = self.data[tid]
            if obj.reviewed:
                tobj.reply_cnt = tobj.reply_cnt + 1
            else:
                tobj.revsub = tobj.revsub + 1
                    
    return _log('','Fixing up reply counts and moderation counts')

def update(self):
    return _updateall(self,do_update, metatypes=['Squishdot Site'])