Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(16)  |  Call(16)  |  Derive(0)  |  Import(0)

        def init(dbfile, create=False):
    global RssCategory, RssFeed, RssData, load_flag, engine

    if load_flag and not create:
        return

    engine = create_engine('sqlite://filename=%s' % dbfile, echo=False)

    if is_create('rss_category'):
        f = True
    else:
        f = False

    RssCategory = Table('rss_category', engine,
        Column('id', Integer, primary_key = True),
        Column('title', String, nullable = False),
        redefine = True
    )

    RssFeed = Table('rss_feed', engine,
        Column('id', Integer, primary_key = True),
        Column('category_id', Integer, ForeignKey("rss_category.id")),
        Column('title', String, nullable = False),
        Column('link', String, nullable = False),
        Column('homelink', String),
        Column('imagelink', String),
        Column('description', String),
        redefine = True
    )

    RssData = Table('rss_data', engine,
        Column('id', Integer, primary_key = True),
        Column('feed_id', Integer, ForeignKey("rss_feed.id")),
        Column('guid', String, nullable = False),
        Column('link', String, nullable = False),
        Column('pubDate', DateTime),
        Column('title', String),
        Column('comments', String),
        Column('description', String),
        Column('read', Boolean, nullable = False),
        redefine = True
    )

    if create and f:
        RssCategory.drop()
        RssFeed.drop()
        RssData.drop()
    if not f or create:
        RssCategory.create()
        RssFeed.create()
        RssData.create()

#    assign_mapper(Data, RssData, properties = {
#                    'description':deferred(RssData.c.description)
#                }
#            )
    assign_mapper(Data, RssData)
    assign_mapper(Feed, RssFeed, properties = {
                    'posts' : relation(Data.mapper, private=True)
                }
            )
    assign_mapper(Category, RssCategory, properties = {
                    'feeds' : relation(Feed.mapper, private=True)
                }
            )

    load_flag = True
        


src/u/l/ulipad-HEAD/plugins/rssreader/__init__.py   ulipad(Download)
        if ret == wx.YES:
            import RssDb
            RssDb.init(Globals.rss_dbfile, create=True)
            item, node = win.get_cur_node()
            win.reset_cur_item()

src/u/l/ulipad-HEAD/plugins/rssreader/RssReader.py   ulipad(Download)
            elif node.get('level', '') == 'category':
                cate_id = node['data']['id']
                RssDb.init(Globals.rss_dbfile)
                RssDb.Category.delete_id(cate_id)
                self.del_category_ids(cate_id)
                return True
            elif node.get('level', '') == 'feed':
                RssDb.init(Globals.rss_dbfile)
    def refresh_feed_unread(self, rssid):
        RssDb.init(Globals.rss_dbfile)
 
        feed = RssDb.Feed.get(rssid)
        number = RssDb.Data.un_read_count(rssid)
    def feed(self, rssid, text):
        RssDb.init(Globals.rss_dbfile)
 
#        b = r.match(text)
#        if b:
    def startup(self, item):
        sharewin = self.parent
        RssDb.init(Globals.rss_dbfile)
        categories = RssDb.Category.select()
        sharewin.tree.Freeze()

src/u/l/ulipad-HEAD/plugins/rssreader/RssPage.py   ulipad(Download)
    def load_from_db(self, rssid):
        RssDb.init(Globals.rss_dbfile)
        from modules.Debug import error
        error.info('load_from_db'+str(rssid))
        self.data = []
    def show_unread(self, rssid):
        t = Template()
        t.load(os.path.join(Globals.workpath, 'plugins/rssreader/unread_message.py'), 'python')
 
        RssDb.init(Globals.rss_dbfile)
    def OnCheck(self, index, checkflag):
        RssDb.init(Globals.rss_dbfile)
 
        data = RssDb.Data.get_by(guid=self.guids[index])
        data.read = checkflag
    def OnChanged(self, event):
        t = Template()
        t.load(os.path.join(Globals.workpath, 'plugins/rssreader/single_message.txt'), 'text')
 
        RssDb.init(Globals.rss_dbfile)