sushy/models.py
def index_wiki_page(**kwargs):
    """Adds wiki page metatada and FTS data."""
    with db.atomic():
        values = {}
        for k in [u"name", u"title", u"tags", u"hash", u"mtime", u"pubtime", u"idxtime", u"readtime"]:
            values[k] = kwargs[k]
        log.debug(values)
        try:
            page = Page.create(**values)
        except IntegrityError:
            page = Page.get(Page.name == values['name'])
            page.update(**values)
        if len(kwargs['body']):
            values['body'] = kwargs['body']
            # Not too happy about this, but FTS update() seems to be buggy and indexes keep growing
            FTSPage.delete().where(FTSPage.page == page).execute()
            FTSPage.create(page = page, **values)
        return page
Adds wiki page metatada and FTS data.
Adds wiki page metatada and FTS data.
Adds wiki page metatada and FTS data .
def index_wiki_page(**kwargs):
    with db.atomic():
        values = {}
        for k in [u"name", u"title", u"tags", u"hash", u"mtime", u"pubtime", u"idxtime", u"readtime"]:
            values[k] = kwargs[k]
        log.debug(values)
        try:
            page = Page.create(**values)
        except IntegrityError:
            page = Page.get(Page.name == values['name'])
            page.update(**values)
        if len(kwargs['body']):
            values['body'] = kwargs['body']
            FTSPage.delete().where(FTSPage.page == page).execute()
            FTSPage.create(page = page, **values)
        return page
def index_wiki_page ( ** kwargs ) : with db . atomic ( ) : values = { } for k in [ u"name" , u"title" , u"tags" , u"hash" , u"mtime" , u"pubtime" , u"idxtime" , u"readtime" ] : values [ k ] = kwargs [ k ] log . debug ( values ) try : page = Page . create ( ** values ) except IntegrityError : page = Page . get ( Page . name == values [ 'name' ] ) page . update ( ** values ) if len ( kwargs [ 'body' ] ) : values [ 'body' ] = kwargs [ 'body' ] FTSPage . delete ( ) . where ( FTSPage . page == page ) . execute ( ) FTSPage . create ( page = page , ** values ) return page
Adds wiki page metatada and FTS data.
Adds wiki page metatada and FTS data .
"""Adds wiki page metatada and FTS data.""" # Not too happy about this, but FTS update() seems to be buggy and indexes keep growing