Exemplo n.º 1
0
    def upgradewiki(self, byuser=u'admin'):
        """Upgrade the database fields supporting wiki markup to the latest
        zwiki version"""
        from zeta.config.environment import tlcomp, srchcomp

        msession = meta.Session()
        wikis = self.get_wiki()
        wcmts = self.get_wikicomment()
        cnt_wcmt = len(wcmts)
        cnt_wcnt = 0
        while wikis:
            with msession.begin(subtransactions=True):
                w = wikis.pop(0)
                wcnts = self.get_content(w, all=True)
                cnt_wcnt += len(wcnts)
                for wcnt in wcnts:
                    wcnt.texthtml = wcnt.translate(wiki=w,
                                                   cache=True)  # To HTML
        while wcmts:
            with msession.begin(subtransactions=True):
                wcmt = wcmts.pop(0)
                wcmt.texthtml = wcmt.translate()  # To HTML

        # Database Post processing
        tlcomp.log(byuser,
                   "Upgraded wiki contents and comments to latest wiki")

        return (cnt_wcnt, cnt_wcmt)
Exemplo n.º 2
0
    def remove_tag(self, tag, byuser=None):
        """Remove existing tag entry."""
        from zeta.config.environment import tlcomp

        tag = self.get_tag(tag)
        tagname = tag and tag.tagname or ''
        msession = meta.Session()
        with msession.begin(subtransactions=True):
            tag and msession.delete(tag)

        # Database Post processing
        tlcomp.log(byuser, 'deleted tag, `%s`' % tagname)
Exemplo n.º 3
0
    def upgradewiki(self, byuser=None):
        """Upgrade the database fields supporting wiki markup to the latest
        zwiki version"""
        from zeta.config.environment import tlcomp, srchcomp

        msession = meta.Session()
        staticwikis = self.get_staticwiki()
        with msession.begin(subtransactions=True):
            for sw in staticwikis:
                sw.texthtml = sw.translate(wiki=sw)  # To HTML

        # Database Post processing
        tlcomp.log(byuser, "Upgraded static wiki pages")

        return len(staticwikis)
Exemplo n.º 4
0
    def create_wikitype(self, wiki_typenames, byuser=None):
        """Create wiki_typename  entries for the wiki_typenames specified by,
        `wiki_typenames`
            which can be, a string specifying the wiki_typename name or a list of
            such strings"""
        from zeta.config.environment import tlcomp, srchcomp

        if isinstance(wiki_typenames, (str, unicode)):
            wiki_typenames = [wiki_typenames]

        logs = []
        msession = meta.Session()
        with msession.begin(subtransactions=True):
            [msession.add(WikiType(unicode(wt))) for wt in wiki_typenames]

        # Database Post processing
        tlcomp.log(byuser,
                   'added wiki type names, `%s`' % ', '.join(wiki_typenames))
Exemplo n.º 5
0
    def create_vcstype(self, vcs_typenames, byuser=None):
        """Create vcs_typename  entries for the vcs_typenames specified by,
        `vcs_typenames`
            which can be, a string specifying the vcs_typename name or a list of
            such strings"""
        from zeta.config.environment import tlcomp

        if isinstance(vcs_typenames, (str, unicode)):
            vcs_typenames = [vcs_typenames]

        logs = []
        msession = meta.Session()
        with msession.begin(subtransactions=True):
            [msession.add(VcsType(unicode(t))) for t in vcs_typenames]

        # Database Post processing
        tlcomp.log( byuser,
                    'added version control types, `%s`' % \
                            ', '.join(vcs_typenames)
                  )
Exemplo n.º 6
0
    def create_tag(self, tagname, byuser=None):
        """Create a new tag entry."""
        from zeta.config.environment import tlcomp

        tag = None
        log = ''
        msession = meta.Session()
        if self.is_tagnamevalid(tagname):
            with msession.begin(subtransactions=True):
                if not self.tag_exists(tagname):
                    tag = Tag(tagname)
                    msession.add(tag)
                    log = 'created new tag, `%s`' % tagname

                else:
                    raise ZetaTagError('Duplicate tag entry %s' % tagname)

        # Database Post processing
        log and tlcomp.log(byuser, log, tag=tag)

        return tag
Exemplo n.º 7
0
 def onclose(tlcomp, byuser, log):
     log and tlcomp.log(byuser, log)
Exemplo n.º 8
0
 def onclose(tlcomp, srchcomp, byuser, log, idxreplace):
     tlcomp.log(byuser, log)
     srchcomp.indexstaticwiki([sw], replace=idxreplace)
Exemplo n.º 9
0
 def onclose(tlcomp, project, byuser, log):
     tlcomp.log(byuser, log, project=project)
Exemplo n.º 10
0
 def onclose(tlcomp, srchcomp, attach, log, byuser):
     srchcomp.indexattach([attach], replace=True)
     log and tlcomp.log(byuser, log, attach=attach)
Exemplo n.º 11
0
 def onclose(tlcomp, vcs, byuser, log):
     tlcomp.log(byuser, log, project=vcs.project)
Exemplo n.º 12
0
 def onclose(tlcomp, mount, byuser, log):
     log and tlcomp.log(byuser, log, project=mount.vcs.project)
Exemplo n.º 13
0
 def onclose(tlcomp, srchcomp, license, byuser, log, idxreplace):
     log and tlcomp.log(byuser, log, license=license)
     srchcomp.indexlicense([license], replace=idxreplace)
Exemplo n.º 14
0
 def onclose(tlcomp, vcs, byuser, log):
     log and tlcomp.log(byuser, log, vcs=vcs)
Exemplo n.º 15
0
 def onclose(tlcomp, srchcomp, attach, log, byuser):
     # TODO : Delete this attachment.
     #srchcomp.indexattach( [attach], replace=True )
     log and tlcomp.log(byuser, log)
Exemplo n.º 16
0
 def onclose(tlcomp, license, log, byuser):
     log and tlcomp.log(byuser, log, license=license)
Exemplo n.º 17
0
 def onclose(tlcomp, byuser, log):
     tlcomp.log(byuser, log)
Exemplo n.º 18
0
 def onclose(tlcomp, srchcomp, wiki, author, log):
     tlcomp.log(author, log, wiki=wiki)
     srchcomp.indexwiki([wiki], replace=True)
Exemplo n.º 19
0
 def onclose(tlcomp, srchcomp, wiki, byuser, log):
     log and tlcomp.log(byuser, log, wiki=wiki)
     log and srchcomp.indexwiki([wiki], replace=True)
Exemplo n.º 20
0
 def onclose(tlcomp, wiki, user, log):
     tlcomp.log(user, log, wiki=wiki)
Exemplo n.º 21
0
 def onclose(tlcomp, wiki, byuser, log):
     log and tlcomp.log(byuser, log, wiki=wiki)
Exemplo n.º 22
0
 def onclose(tlcomp, licname, byuser):
     tlcomp.log(byuser, 'deleted license %s' % licname)
Exemplo n.º 23
0
 def onclose(tlcomp, srchcomp, attach, uploader, log):
     srchcomp.indexattach([attach])
     log and tlcomp.log(uploader, log, attach=attach)