def add_allow_top_to_srs(): "Add the allow_top property to all stored subdiggs" from r2.models import Subdigg from r2.lib.db.operators import desc from r2.lib.utils import fetch_things2 q = Subdigg._query(Subreddit.c._spam == (True,False), sort = desc('_date')) for sr in fetch_things2(q): sr.allow_top = True; sr._commit()
def get_sr_counts(period=count_period): srs = Subdigg._query() return dict((l._fullname, (0, l.sr_id)) for l in links)