Example #1
0
                    ])
                storyid = cur.fetchone()['storyid']

                if commentgroupid == 0:
                    cur.execute(
                        "insert into commentgroups(url) values (%s) returning commentgroupid;",
                        [link])
                    commentgroupid = cur.fetchone()['commentgroupid']

                #now, commentgroupid is set, either way.
                cur.execute(
                    "update stories set commentgroup = %s where storyid = %s;",
                    [commentgroupid, storyid])
                #EVERYONE posts into ALL-STORIES. EVERYTHING goes there! ;)
                cur.execute(
                    "insert into stories (usr,title,url,text,name,location,commentgroup,channame) values (%s,%s,%s,%s,%s,0,%s,(select name from channels where chanid = 0 )) returning storyid;",
                    [
                        feed.usr, title, link, 'Via: ' + digglink,
                        feed.feedname, commentgroupid
                    ])
                api = ApiClient(
                    'http://:[email protected]')
                index = api.get_index('Pages')
                index.add_document(storyid, {'text': title, 'link': link})

            cur.execute("update feeds set lasttime = now() where feedid = %s",
                        [feed.feedid])
            a += 1

        db.commit()