Ejemplo n.º 1
0
    def index( self, environ ) :
        """Index of all registered users
        URLS :
            /u
            /u?alphaindex=<a>
        """
        from zeta.config.environment import userscomp

        c.rclose = h.ZResp()

        # Setup context for page rendering
        c.users = userscomp.get_user( attrload=[ 'userinfo', 'photofile' ] )
        byindex = {}
        [ byindex.setdefault( u.username[0], [] ).append(u) for u in c.users ]
        c.indexlist = sorted( byindex.keys() )
        if (c.alphaindex == None) and (len(c.users) > h.MAX2SWITCH_ALPHAINDEX) :
            c.alphaindex = c.indexlist[0]
        if c.alphaindex :
            c.users = byindex[c.alphaindex]
        c.urlusersphoto = dict([
            ( u.id, h.url_attach( u.photofile.id ) )
            for u in c.users if u.photofile
        ])
        c.title = 'Users'

        # Html page generation
        if c.jsonobj and c.view == 'js' :
            html = self.handlejson(environ)
        else :
            html = render( '/derived/userpage/usersindex.html' )
        c.rclose.append(html)
        return c.rclose
Ejemplo n.º 2
0
    def timeline( self, environ, username ) :
        """User timeline
        URLS :
            /u/timeline/{username}
        """
        from zeta.config.environment import userscomp

        c.rclose = h.ZResp()

        # Action specific query parameters
        logid   = request.params.get( 'logid', None )
        dir     = request.params.get( 'dir', None )
        fromoff = request.params.get( 'fromoff', 1 )
        logid   = logid and int(logid)
        fromoff = int(fromoff)
        
        c.user = userscomp.get_user( username )
        self.tline_controller(
            h.r_usertline, { 'username' : username }, [ 'user' ],
            fromoff, logid, dir, c.user
        )
        c.title   = '%s:timeline' % username
        c.datatline, c.startdt = h.tlineplot( c.logs[:] )
        c.timeline = True

        # Html page generation
        c.rclose.append(render( '/derived/userpage/usertline.html' ))
        return c.rclose
Ejemplo n.º 3
0
    def usercharts( self, environ, username='' ) :
        """User charts
        URLS :
            /u/{username}/charts
            /u/{username}/charts?chartname=<name>
        """
        from zeta.config.environment import userscomp

        c.rclose = h.ZResp()

        # Setup context for page rendering
        c.chartname = c.chartname or 'chart12'
        c.selectedchart = (c.chartname, self._usercharts[c.chartname])
        c.chartoptions = [ (self.url_userschart(name), text)
                           for name, text in self._usercharts.iteritems() ]

        c.user = userscomp.get_user( unicode(username) )
        c.ua   = ca.get_analyticobj( 'users' )

        data   = getattr( c.ua, 'chart12_data', {} ).get(
                          c.user.id, [ c.user.id, c.user.username, [] ] )
        c.chart12_data = data
        c.title   = '%s:Charts' % username

        # Html page generation
        c.rclose.append(render( '/derived/userpage/usercharts.html' ))
        return c.rclose
Ejemplo n.º 4
0
    def create_attach(self,
                      filename,
                      fdfile=None,
                      uploader=None,
                      summary=None,
                      log=False,
                      doclose=None):
        """Create an attachment for `filename`,
        Return,
            Attachment instance."""
        from zeta.config.environment import userscomp, tlcomp, srchcomp

        uploader = uploader and userscomp.get_user(uploader)
        content = fdfile and fdfile.read() or ''
        msession = meta.Session()
        with msession.begin(subtransactions=True):
            attach = Attachment(filename, 0)
            summary and setattr(attach, 'summary', summary)
            uploader and setattr(attach, 'uploader', uploader)
            attach.size = len(content)
            msession.add(attach)

        self._store_fileupload(content, attach)
        fdfile and fdfile.close()

        log = log and 'Uploaded attachment, %s' % filename or ''

        # Post processing, optional deferred handling
        def onclose(tlcomp, srchcomp, attach, uploader, log):
            srchcomp.indexattach([attach])
            log and tlcomp.log(uploader, log, attach=attach)

        doclose(h.hitchfn(onclose, tlcomp, srchcomp, attach, uploader, log))
        return attach
Ejemplo n.º 5
0
    def delfavorites(self, wiki, favusers, doclose=None, byuser=None):
        """Delete the wiki as favorite for users identified by
        `favusers`, which can be (also can be an array of)
            `id` or `username` or `User` instance.
        to `wiki` which can be,
            `id` or `wikiurl` or `Wiki` instance."""
        from zeta.config.environment import userscomp, tlcomp, srchcomp

        if not isinstance(favusers, list):
            favusers = [favusers]

        favusers = [userscomp.get_user(u) for u in favusers]
        wiki = self.get_wiki(wiki)
        msession = meta.Session()
        with msession.begin(subtransactions=True):
            [
                wiki.favoriteof.remove(u) for u in favusers
                if u in wiki.favoriteof
            ]

        log = 'removed wiki page from favorite'

        # Post processing, optional deferred handling
        def onclose(tlcomp, wiki, byuser, log):
            tlcomp.log(byuser, log, wiki=wiki)

        doclose(h.hitchfn(onclose, tlcomp, wiki, byuser, log))
        return None
Ejemplo n.º 6
0
def upgrade_0_7( defenv, appenv ) :
    """Upgrade Database version from 0.7 to 0.8"""
    from zeta.config.environment    import userscomp

    print "Converting 'password' column values into message digest ..."
    users     = userscomp.get_user()
    oldpass   = dict([ (u.username, u.password) for u in users ])
    msession  = meta.Session()
    with msession.begin( subtransactions=True ) :
        for u in users :
            u.password = sha1( u.password ).hexdigest()

    # Verify
    newpass   = dict([ (u.username, u.password) for u in userscomp.get_user() ])
    assert len(newpass) == len(oldpass)
    for u in oldpass :
        assert unicode(newpass[u]) == unicode( sha1(oldpass[u]).hexdigest() )

    print "Converted %s user passwords" % len(users)
Ejemplo n.º 7
0
    def get_vote( self, voter=None ) :
        """Get all the votes casted by the user"""
        from zeta.config.environment import userscomp

        voter     = voter and userscomp.get_user( voter )
        msession  = meta.Session()
        if voter :
            vote = msession.query( Vote ).filter( Vote.user_id==voter.id ).all()
        else :
            vote = msession.query( Vote ).all()
        return vote
Ejemplo n.º 8
0
    def analyse(self):
        from zeta.config.environment import projcomp, userscomp

        users = userscomp.get_user(attrload=['adminprojects', 'owncomponents'])

        self.id2name = dict([(u.id, u.username) for u in users])
        self.name2id = dict([(u.username, u.id) for u in users])
        self.chart8_data = self.do_chart8(users)
        self.chart9_data = self.do_chart9(userscomp, users)
        self.chart10_data = self.do_chart10(users)
        self.chart11_data, self.chart11_ccnt = self.do_chart11(users, projcomp)
        self.chart12_data = self.do_chart12(users)
Ejemplo n.º 9
0
def url_formodel(name, obj):
    """Compute the href for model object"""
    from zeta.config.environment import \
            userscomp, attcomp, tagcomp, liccomp, projcomp, wikicomp, \
            tckcomp, revcomp, vcscomp

    a_tmpl = name + ' <a href="%s" title="%s">%s</a>'
    cntlr = BaseController()

    if name == 'user':
        u = userscomp.get_user(obj)
        a = a_tmpl % (cntlr.url_user(u.username), u.username, u.username)

    elif name == 'tag':
        t = tagcomp.get_tag(obj)
        a = a_tmpl % (cntlr.url_tag(t.tagname), t.tagname, t.tagname)

    elif name == 'attach':
        att = attcomp.get_attach(obj)
        a = a_tmpl % (cntlr.url_attach(att.id), att.filename, att.filename)

    elif name == 'license':
        l = liccomp.get_license(obj)
        a = a_tmpl % (cntlr.url_forlicense(l.id), l.summary, l.licensename)

    elif name == 'project':
        p = projcomp.get_project(obj)
        a = a_tmpl % (cntlr.url_forproject(
            p.projectname), p.summary, p.projectname)

    elif name == 'ticket':
        a = a_tmpl % (cntlr.url_ticket(obj.project.projectname,
                                       obj.id), obj.summary, obj.id)

    elif name == 'review':
        a = a_tmpl % (cntlr.url_revwid(obj.project.projectname, obj.id),
                      obj.resource_url, obj.resource_url)

    elif name == 'vcs':
        a = a_tmpl % (cntlr.url_vcsbrowse(obj.project.projectname,
                                          obj.id), obj.name, obj.name)

    elif name == 'wiki':
        a = a_tmpl % (obj.wikiurl, obj.summary, obj.wikiurl)

    elif name == 'staticwiki':
        a = a_tmpl % (obj.path, obj.path, obj.path)

    else:
        raise ZetaError('Unkown model name in timeline reference')

    return a
Ejemplo n.º 10
0
    def user_password(self, username, authchoice=None):
        """
        Returns,
            the password associated with the user or
            ``None`` if no password exists or user disabled.
        """
        from zeta.config.environment import userscomp

        user = userscomp.get_user(username)
        if user.disabled:
            return None
        else:
            return user.password
Ejemplo n.º 11
0
    def user_has_password(self, username, password, authchoice=None):
        """
        Returns,
            ``True`` if the user has the password specified,
            ``False`` otherwise. Passwords are case sensitive.
        If user is disabled returns ``False``
        """
        from zeta.config.environment import userscomp

        user = userscomp.get_user(username)
        if user.disabled:
            return False
        else:
            return user.password == self.encrypt(password)
Ejemplo n.º 12
0
    def processmails(self, inmails, account):
        """Process `inmails` extracting fields, text and attachment and
        process them for structured text, return a context object for each
        inmail"""
        from zeta.config.environment import userscomp, projcomp

        config = self.compmgr.config
        user = userscomp.get_user(u'admin')

        if not isinstance(inmails, list):
            inmails = [inmails]

        ctxts = []
        attachs = []
        for inmail in inmails:
            if inmail.multipart:
                From = inmail.rootpart.get('From')
                To = [
                    to.strip(' \t')
                    for to in inmail.rootpart.get('To').split(',')
                ]
                Sub = inmail.rootpart.get('Subject')
                textparts = [
                    part.get_payload(decode=True) for part in inmail.messages
                ]
                for part in inmail.attachments:
                    cdisp = part.get('Content-Disposition')
                    fname = cdisp.split(';', 1)[1].strip(' \t')
                    cont = part.get_payload(decode=True)
                    fname = mime_attachfname(fname)
                    attachs.append((fname, cont))
            else:
                From = inmail.m.get('From')
                To = [to.strip(' \t') for to in inmail.m.get('To').split(',')]
                Sub = inmail.m.get('Subject')
                textparts = [inmail.m.get_payload(decode=True)]

            if account != self.login:
                projstr = 'project : %s\n' % account.split('@', 1)[0]
            else:
                projstr = ''

            text = email2text(textparts)
            text = projstr + text
            ctxt = parse(text)
            ctxt.commit(config, user, attachments=attachs)
            ctxts.append(ctxt)

        return ctxts
Ejemplo n.º 13
0
    def userhome( self, environ, username ) :
        """User Home page
        URLS :
            /u/{username}
            /u/{username}?jsonobj=userphoto&view=js
            /u/{username}?jsonobj=usericon&view=js
        """
        from zeta.config.environment import \
                userscomp, attcomp, projcomp, tckcomp, wikicomp, revcomp, \
                votecomp, tlcomp

        c.rclose = h.ZResp()

        # Setup context for page rendering
        c.username = username
        c.user  = userscomp.get_user( username, 
                                      attrload=[ 'userinfo' ],
                                      attrload_all=[ 'owncomponents.project' ]
                                    )
        votes   = votecomp.uservotes( c.user )
        c.statistics = {
            'uploadedfiles' : len(attcomp.uploadedbyuser( c.user )),
            'votes'         : dict([ ( votedas, len(votes[votedas]) )
                                     for votedas in votes ]),
            'adminprojects' : projcomp.adminprojects( c.user ),
            'inprojects'    : projcomp.userprojects( c.user ),
            'tickets'       : len(tckcomp.usertickets( c.user ).keys()),
            'tckcomments'   : len(tckcomp.usercomments( c.user )),
            'wikicomments'  : len(wikicomp.usercomments( c.user )),
            'authoredrevw'  : len(revcomp.userasauthor( c.user )),
            'modertrevw'    : len(revcomp.userasmoderator( c.user )),
            'particprevw'   : len(revcomp.userasparticipant( c.user )),
            'revwcomments'  : len(revcomp.usercomments( c.user )),
        }
        c.googlemaps = h.gmapkey( c.sysentries )
        c.logs = tlcomp.fetchlogs( 'user', c.user, limit=20 )
        c.useraddr= [ [ username, h.useraddress( c.user.userinfo ) ] ]
        photofile = c.user.photofile
        h.url_userphoto = photofile and self.url_attach(photofile.id)
        c.projecturls = self.projecturls( projcomp.projectnames )
        c.title = username

        # Html page generation
        if c.jsonobj and c.view == 'js' :
            html = self.handlejson(environ)
        else :
            html = render( '/derived/userpage/userhome.html' )
        c.rclose.append(html)
        return c.rclose
Ejemplo n.º 14
0
    def get_ticketvote( self, voter=None, ticket=None ) :
        """Get the vote with specific attribute"""
        from zeta.config.environment import userscomp

        voter     = voter and userscomp.get_user( voter )
        msession = meta.Session()
        if voter and ticket :
            vote = msession.query( Vote ).join( 'ticket' 
                   ).filter_by( id=ticket.id ).filter( Vote.user_id==voter.id ).first()
        elif ticket :
            vote = msession.query( Vote ).join( 'ticket' 
                   ).filter_by( id=ticket.id ).all()
        else :
            vote = msession.query( Vote ).all()
        return vote
Ejemplo n.º 15
0
    def cast_vote( self, voter, modelobj=None, votedas='', medium='' ) :
        """Cast a vote for `voter`, which can be,
            `user_id`, `username` or User instance"""
        from zeta.config.environment import userscomp

        voter     = userscomp.get_user( voter )
        msession  = meta.Session()
        with msession.begin( subtransactions=True ) :
            vote = Vote()
            votedas and setattr( vote, 'votedas', votedas )
            medium  and setattr( vote, 'medium', medium )
            vote.voter = voter
            msession.add( vote )
            voter.votes.append( vote )
            modelobj and modelobj.votes.append( vote )
Ejemplo n.º 16
0
    def create_wikicomment(self,
                           wiki,
                           wcmtdetail,
                           update=False,
                           doclose=None,
                           byuser=None):
        """For the Wiki instance identified by,
        `wiki` which can be,
            `id` or `wikiurl` or `Wiki` instance.
        `wcmtdetail` can be,
            (id, commentby, version_id, text)
        if update==True,
            then wcmtdetail[0] must be valid, in which an older comment
            will be updated.
        """
        from zeta.config.environment import userscomp, tlcomp, srchcomp

        log = ''
        wiki = self.get_wiki(wiki)
        wikicmt = (update and self.get_wikicomment(wcmtdetail[0])) or None
        commentby = userscomp.get_user(wcmtdetail[1])
        msession = meta.Session()
        with msession.begin(subtransactions=True):
            if (update and wikicmt) or wikicmt:
                wikicmt.commentby = commentby
                wikicmt.version_id = wcmtdetail[2]
                wikicmt.text = wcmtdetail[3]
                wikicmt.texthtml = wikicmt.translate()  # To HTML
                log = 'updated comment,\n%s' % wikicmt.text

            else:
                wikicmt = WikiComment(wcmtdetail[2], wcmtdetail[3])
                wikicmt.commentby = commentby
                wikicmt.wiki = wiki
                wikicmt.texthtml = wikicmt.translate()  # To HTML
                wiki.comments.append(wikicmt)
                msession.add(wikicmt)
                log = 'commented as,\n%s' % wikicmt.text

        # Post processing, optional deferred handling
        def onclose(tlcomp, srchcomp, wiki, byuser, log):
            tlcomp.log(byuser, log, wiki=wiki)
            srchcomp.indexwiki([wiki], replace=True)

        doclose(h.hitchfn(onclose, tlcomp, srchcomp, wiki, byuser, log))
        return wikicmt
Ejemplo n.º 17
0
    def create_content(self, wiki, author, text, version=None, doclose=None):
        """For the Wiki page identified by 
        `wiki`, which can be,
            `id` or `wikiurl` or `Wiki` instance.
        add wiki content as the next version to wikipage table. if version is
        specified and matches a wikipage.id, then update the entry."""
        from zeta.config.environment import userscomp, tlcomp, srchcomp

        log = ''
        wiki = self.get_wiki(wiki)
        author = userscomp.get_user(author)
        msession = meta.Session()
        with msession.begin(subtransactions=True):
            WikiPage = self._map_wikipage(wiki.tablemap.table_pagenum)
            if version:
                wikipage = msession.query(WikiPage).filter_by(
                    id=version).first()
                wikipage and author and setattr(wikipage, 'author',
                                                author.username)
                if wikipage and text:
                    wikipage.text = text
                    wikipage.translate(
                        wiki=wiki,
                        cache=True)  # To HTML, maybe cached, maybe not !
                log = 'updated existing wiki version %s' % version
            else:
                wikipage = WikiPage(text)
                wikipage and author and setattr(wikipage, 'author',
                                                author.username)
                if wikipage and text:
                    wikipage.text = text
                    wikipage.translate(
                        wiki=wiki,
                        cache=True)  # To HTML, maybe cached, maybe not !
                msession.add(wikipage)
                msession.flush()
                wiki.latest_version = wikipage.id
                log = 'updated wiki content to version %s' % wiki.latest_version

        # Post processing, optional deferred handling
        def onclose(tlcomp, srchcomp, wiki, author, log):
            tlcomp.log(author, log, wiki=wiki)
            srchcomp.indexwiki([wiki], replace=True)

        doclose(h.hitchfn(onclose, tlcomp, srchcomp, wiki, author, log))
        return wikipage
Ejemplo n.º 18
0
    def gmap( self, environ ) :
        """all registered users on google map
        URLS :
            /u/gmap
        """
        from zeta.config.environment import userscomp

        c.rclose = h.ZResp()
        # Setup context for page rendering
        c.useraddrs = [ [ u.username, h.useraddress( u.userinfo ) ]
                        for u in userscomp.get_user(attrload=['userinfo'])
                      ]
        c.googlemaps= h.gmapkey( c.sysentries )
        c.title = 'UsersOnGooglemap'

        # Html page generation
        c.rclose.append(render( '/derived/userpage/usersgmap.html' ))
        return c.rclose
Ejemplo n.º 19
0
    def feed( self, environ, username ) :
        """Feed for user timeline
        URLS :
            /u/feed/{username}
        """
        from zeta.config.environment import userscomp

        title = '%s:timeline' % c.user.username
        link = h.urlroot(environ)
        descr = 'Timeline for user %s' % c.user.username
        c.user = userscomp.get_user( username )
        feed   = h.FeedGen( title, link, descr )
        self.tline_controller( 
            h.r_usertline, { 'username': username },
            'user', 1, None, None, c.user
        )
        feedhtml = self.feeds( environ, link, feed, c.logs )
        response.content_type = 'application/atom+xml'
        return feedhtml
Ejemplo n.º 20
0
    def indexuser( self, users=[], clear=False, replace=False, flush=True ) :
        """Index all the users passed as argument, or index all the users in
        the database if 'users' is empty.
        If clear == True,
            then do the reverse, (i.e) clear the list of users from index
        If replace == True,
            then replace the list of users with new data"""
        from zeta.config.environment import userscomp

        config = self.compmgr.config
        if config['zeta.xapiansearch'] :
            do_onetime( config )
            users = users or userscomp.get_user()
            if clear :
                [ self.clear( 'id:user_%s' % u.id, flush=flush ) for u in user ]
            else :
                [ self.index( userscomp.documentof( u ), replace, flush=flush )
                  for u in users ]
        return
Ejemplo n.º 21
0
    def votedown(self, wiki, user, doclose=None):
        """Decrease popularity for the wiki page"""
        from zeta.config.environment import userscomp, votecomp, tlcomp, srchcomp

        log = ''
        user = userscomp.get_user(user)
        wiki = self.get_wiki(wiki)
        vote = votecomp.get_wikivote(user, wiki)
        if vote:
            votecomp.recast_vote(vote, u'down')
            log = 're-casted vote'

        else:
            vote = votecomp.cast_vote(user, wiki, u'down')
            log = 'casted vote'

        # Post processing, optional deferred handling
        def onclose(tlcomp, wiki, user, log):
            tlcomp.log(user, log, wiki=wiki)

        doclose(h.hitchfn(onclose, tlcomp, wiki, user, log))
        return vote
Ejemplo n.º 22
0
    def __before__( self, environ=None ) :
        """Called before calling any actions under this controller"""
        from zeta.config.environment    import syscomp, userscomp

        # Collect the query values into 'context'
        c.username   = request.params.get( 'username', None )
        c.password   = request.params.get( 'password', None )

        # setup Environment, since we are not calling standard
        # self.beforecontrollers()
        environ   = request.environ
        c.sysentries = syscomp.get_sysentry()

        # Initialize Permission Mapping System.
        permmod.pms_root = permmod.init_pms( ctxt=c.sysentries )

        # Authenticate user, `anonymous` users cannot use XMLRPC
        user = userscomp.get_user( unicode(c.username) )
        if user and user.password == c.password :
            c.authuser     = user
            c.authusername = user.username
        else :
            c.authuser     = None
            c.authusername = ''
Ejemplo n.º 23
0
    def create_wiki(self,
                    wikiurl,
                    wtype=None,
                    summary=u'',
                    sourceurl=u'',
                    creator=None,
                    doclose=None):
        """Create a new Wiki entry."""
        from zeta.config.environment import userscomp, tlcomp, srchcomp

        wtype = wtype and self.get_wikitype(wtype)
        creator = creator and userscomp.get_user(creator)
        msession = meta.Session()
        if summary == None:
            summary = u''
        if sourceurl == None:
            sourceurl = u''
        summary = summary.replace('\n', ' ').replace('\r', ' ')
        with msession.begin(subtransactions=True):
            wiki = Wiki(wikiurl, summary, 0)
            wiki.sourceurl = sourceurl
            wtype and setattr(wiki, 'type', wtype)
            creator and setattr(wiki, 'creator', creator)
            msession.add(wiki)
            wiki.tablemap = WikiTable_Map(self._nexttablenumber())
            self._map_wikipage(wiki.tablemap.table_pagenum)

        log = 'created the wiki page'

        # Post processing, optional deferred handling
        def onclose(tlcomp, srchcomp, wiki, creator, log):
            tlcomp.log(creator, log, wiki=wiki)
            srchcomp.indexwiki([wiki], replace=True)

        doclose(h.hitchfn(onclose, tlcomp, srchcomp, wiki, creator, log))
        return wiki
Ejemplo n.º 24
0
    def urlfor_match( self, m, urlconstructor ) :
        """Construct url for the matching document"""
        from zeta.config.environment import \
                    userscomp, attcomp, liccomp, syscomp, projcomp, tckcomp, \
                    revcomp, wikicomp

        do_onetime( self.compmgr.config )
        doc     = m.document
        doctype = doc.get_value( DOCTYPE )
        id      = doc.get_value( ID )
        if doctype == 'user' :
            user    = userscomp.get_user( int(id ))
            text    = 'User : %s' % user.username
            url     = urlconstructor['user']( int(id)  )
        elif doctype == 'attach' :
            attach  = attcomp.get_attach( int(id ))
            # Attachments can be deleted
            if attach :
                text = 'Attachment : %s' % attach.filename
                url  = urlconstructor['attach']( int(id) )
            else :
                text = '-- Missing attachment. May be deleted'
                url  = ''
        elif doctype == 'license' :
            license = liccomp.get_license( int(id ))
            # License can be deleted
            if license :
                text = 'License : %s' % license.licensename
                url  = urlconstructor['license']( int(id) )
            else :
                text = '-- Missing License. May be deleted'
                url  = ''
        elif doctype == 'staticwiki' :  # id is 'path'
            swiki = syscomp.get_staticwiki( unicode(id) )
            text = 'Guest Wiki : %s' % swiki.path
            url = urlconstructor['staticwiki']( id )
        elif doctype == 'project' :
            project = projcomp.get_project( int(id) )
            text = 'Project : %s' % project.projectname
            url = urlconstructor['project']( int(id) )
        elif doctype == 'ticket' :
            projectname = doc.get_value( PROJECTNAME )
            ticket = tckcomp.get_ticket( int(id) )
            text = '(%s) Ticket : %s' % (projectname, ticket.summary)
            url = urlconstructor['ticket']( projectname, int(id) )
        elif doctype == 'review' :
            projectname = doc.get_value( PROJECTNAME )
            review  = revcomp.get_review( int(id) )
            text    = '(%s) Review : %s' % (projectname, review.id)
            url = urlconstructor['review']( projectname, int(id) )
        elif doctype == 'wiki' :
            projectname = doc.get_value( PROJECTNAME )
            wiki    = wikicomp.get_wiki( int(id) )
            text    = '(%s) Wiki : %s' % \
                            (projectname, os.path.basename(wiki.wikiurl))
            url = urlconstructor['wiki']( projectname, int(id) )
        else :
            text = ''
            url  = ''

        return text, url
Ejemplo n.º 25
0
 def sr_userurl(self, id):
     from zeta.config.environment import userscomp
     user = userscomp.get_user(id)
     return self.url_user(user.username)