Ejemplo n.º 1
0
 def format_item(tup):
     d = {
         'review_comment_id':
         tup[0],
         'position':
         tup[1],
         'text':
         tup[2],
         'html':
         tup[3],
         'commentby':
         tup[6],
         'commentbyurl':
         self.url_user(tup[6]),
         'nature':
         tup[7] or '',
         'action':
         tup[8] or '',
         'approved':
         tup[4],
         'datestr':
         h.utc_2_usertz(tup[5],
                        c.authuser.timezone).strftime('%d %b %Y'),
     }
     return d
Ejemplo n.º 2
0
 def format_item(qres):
     s = h.utc_2_usertz(qres[4],
                        c.authuser.timezone).strftime('%d %b %Y, %r')
     d = {
         'wiki_comment_id': qres[0],
         'version_id': qres[1],
         'commentby': qres[5],
         'text': qres[2],
         'html': qres[3],
         'commentbyicon': '',
         'commentbyurl': self.url_user(qres[5]),
         'datestr': s
     }
     return d
Ejemplo n.º 3
0
 def format_item(qres):
     d = {
         'ticket_comment_id':
         qres[0],
         'commentby':
         qres[4],
         'text':
         qres[1],
         'html':
         qres[2],
         'commentbyicon':
         '',
         'commentbyurl':
         self.url_user(qres[4]),
         'datestr':
         h.utc_2_usertz(qres[3],
                        c.authuser.timezone).strftime('%d %b %Y, %r'),
     }
     return d
Ejemplo n.º 4
0
 def format_item(w):
     wcnt = wikicomp.get_content(w)
     votes = wikicomp.countvotes(votes=w.votes)
     lastmod = h.utc_2_usertz(
         wcnt.created_on,
         c.authuser.timezone).strftime('%d %b %Y') if wcnt else 'N/A'
     author = wcnt.author if wcnt else 'N/A'
     d = {
         'id': w.id,
         'wikiurl': w.wikiurl,
         'pagename': c.wurl,
         'summary': w.summary,
         'sourceurl': w.sourceurl,
         'wiki_typename': w.type.wiki_typename,
         'latest_version': str(w.latest_version),
         'last_modified': lastmod,
         'author': author,
         'upvotes': votes.get('up', 0),
         'downvotes': votes.get('down', 0)
     }
     return d
Ejemplo n.º 5
0
    def ticket( self, projectname, ticket ) :
        """
        === ticket( projectname, ticket )
        
        :Description ::
            Read ticket `ticket, under project `projectname`

        Positional arguments,
        |= projectname | a valid project-name
        |= ticket      | a valid ticket id

        :Return ::
            On success,
                [<PRE
                { 'rpcstatus'    : 'ok',
                  'id'        : <id>,
                  'summary'   : <summary string>,
                  'type'      : <type string>,
                  'severity'  : <severity string>,
                  'status'    : <status string>,
                  'due_date'  : <due_date in DD/MM/YYYY format>
                  'created_on': <created_in DD/MM/YYYY format>
                  'owner'     : <owner string>,
                  'promptuser': <promptuser string>,
                  'compid'    : <component-id>,
                  'compname'  : <componentname>,
                  'mstnid'    : <milestone-id>,
                  'mstnname'  : <milestone_name>,
                  'verid'     : <version-id>,
                  'vername'   : <version_name>,
                  'parent'    : <parent-ticketid>,
                  'description'      : <description string>,
                  'descriptionhtml'  : <description as html>,
                  'blockedby' : [ <ticket-id>, <ticket-id>, ... ],
                  'blocking'  : [ <ticket-id>, <ticket-id>, ... ],
                  'children'  : [ <ticket-id>, <ticket-id>, ... ]
                } >]
            On failure,
                [<PRE
                { 'rpcstatus' : 'fail',
                  'message'   : <msg string indicating reason for failure>
                }
        """
        from zeta.config.environment    import xicomp

        res = self._permissions(
                    c.authuser, h.authorized( h.HasPermname( 'TICKET_VIEW' ))
              )
        if res :
            return res
        else :
            rc, d, failmsg = xicomp.read_ticket( unicode(projectname), ticket )
            if d : # Convert datetimes to user-timezone
                due_date   = d.get( 'due_date', None )
                created_on = d.get( 'created_on', None )
                if due_date :
                    due_date = h.utc_2_usertz( due_date, c.authuser.timezone 
                                             ).strftime( "%d/%m/%Y" )
                if created_on :
                    created_on = h.utc_2_usertz( created_on, c.authuser.timezone 
                                               ).strftime( "%d/%m/%Y" )
                d['due_date']   = due_date
                d['created_on'] = created_on
            # Marshal None into 'None'
            for k in d :
                d[k] = self._marshalNone( d[k] )
            return _result( rc, d=d, failmsg=failmsg )