On Mon, Sep 16, 2013 at 09:28:19PM +0200, Denis Laxalde wrote: > def add(url): > return subprocess.call(['r2e', 'add', slugify(url), url]) > > +def pause(index): > + return subprocess.call(['r2e', 'pause', str(index)]) > > def main(): > if new_db_exists(): > @@ -88,10 +90,12 @@ def main(): > set_email(email) > > print 'Adding feeds:' > - for feed in feeds: > + for i, feed in enumerate(feeds): > url = feed.url > print url > add(url) > + if not feed.active: > + pause(i)
I haven't used the conversion script myself, but if you're using slugify(url) to generate feed names in add(), I'd recommend using the same feed name (and not the feed index) for pausing: def pause(url): return subprocess.call(['r2e', 'pause', slugify(url)]) Then there is no need for enumerate(), and you don't run into errors if there are already feeds in the 3.x database when you run the conversion script (which would shift the index numbers). Feeds.index() allows you to index by name since ff650e8 (Cleanups to Feed and Feeds, 2012-10-04), which was well before 3.0.
signature.asc
Description: OpenPGP digital signature