Source

bugs.python.org / scripts / updatecc

#!/usr/bin/python
import sys, os, urllib2, logging, datetime
basedir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(basedir+"/rietveld")
os.environ["DJANGO_SETTINGS_MODULE"]="settings"
import gae2django
gae2django.install(server_software='Django')

from codereview.models import (Repository, Branch, Patch, 
                               PatchSet, Issue, Content)
from django.db import connection, transaction
c = connection.cursor()

for issue in Issue.objects.all():
    c.execute("select _address from _user,issue_nosy where nodeid=%s and id=linkid",
              (issue.id,))
    issue.cc = [r[0] for r in c.fetchall()]
    issue.save()