コード例 #1
0
    def xml(self, indent=0, show_comments=False):
        if self.time == None:
            timestring = ""
        else:
            timestring = utility.time_to_str(self.time)

        info = [('uuid', self.uuid),
                ('short-name', self.id.user()),
                ('severity', self.severity),
                ('status', self.status),
                ('assigned', self.assigned),
                ('reporter', self.reporter),
                ('creator', self.creator),
                ('created', timestring),
                ('summary', self.summary)]
        lines = ['<bug>']
        for (k,v) in info:
            if v is not None:
                lines.append('  <%s>%s</%s>' % (k,xml.sax.saxutils.escape(v),k))
        for estr in self.extra_strings:
            lines.append('  <extra-string>%s</extra-string>' % estr)
        if show_comments == True:
            comout = self.comment_root.xml_thread(indent=indent+2)
            if len(comout) > 0:
                lines.append(comout)
        lines.append('</bug>')
        istring = ' '*indent
        sep = '\n' + istring
        return istring + sep.join(lines).rstrip('\n')
コード例 #2
0
    def xml(self, indent=0, show_comments=False):
        if self.time == None:
            timestring = ""
        else:
            timestring = utility.time_to_str(self.time)

        info = [('uuid', self.uuid), ('short-name', self.id.user()),
                ('severity', self.severity), ('status', self.status),
                ('assigned', self.assigned), ('reporter', self.reporter),
                ('creator', self.creator), ('created', timestring),
                ('summary', self.summary)]
        lines = ['<bug>']
        for (k, v) in info:
            if v is not None:
                lines.append('  <%s>%s</%s>' %
                             (k, xml.sax.saxutils.escape(v), k))
        for estr in self.extra_strings:
            lines.append('  <extra-string>%s</extra-string>' % estr)
        if show_comments == True:
            comout = self.comment_root.xml_thread(indent=indent + 2)
            if len(comout) > 0:
                lines.append(comout)
        lines.append('</bug>')
        istring = ' ' * indent
        sep = '\n' + istring
        return istring + sep.join(lines).rstrip('\n')
コード例 #3
0
 def _comment_summary_string(self, comment):
     return 'from %s on %s' % (comment.author, time_to_str(comment.time))
コード例 #4
0
ファイル: diff.py プロジェクト: gitmob/yabbe
 def _comment_summary_string(self, comment):
     return 'from %s on %s' % (comment.author, time_to_str(comment.time))
コード例 #5
0
ファイル: bug.py プロジェクト: gitmob/yabbe
    def xml(self, indent=0, show_comments=False):
        """
        >>> bugA = Bug(uuid='0123', summary='Need to test Bug.xml()')
        >>> bugA.uuid = 'bugA'
        >>> bugA.time_string = 'Thu, 01 Jan 1970 00:00:00 +0000'
        >>> bugA.creator = u'Frank'
        >>> bugA.extra_strings += ['TAG: very helpful']
        >>> commA = bugA.comment_root.new_reply(body='comment A')
        >>> commA.uuid = 'commA'
        >>> commA.date = 'Thu, 01 Jan 1970 00:01:00 +0000'
        >>> commB = commA.new_reply(body='comment B')
        >>> commB.uuid = 'commB'
        >>> commB.date = 'Thu, 01 Jan 1970 00:02:00 +0000'
        >>> commC = commB.new_reply(body='comment C')
        >>> commC.uuid = 'commC'
        >>> commC.date = 'Thu, 01 Jan 1970 00:03:00 +0000'
        >>> print(bugA.xml(show_comments=True))  # doctest: +REPORT_UDIFF
        <bug>
          <uuid>bugA</uuid>
          <short-name>/bug</short-name>
          <severity>minor</severity>
          <status>open</status>
          <creator>Frank</creator>
          <created>Thu, 01 Jan 1970 00:00:00 +0000</created>
          <summary>Need to test Bug.xml()</summary>
          <extra-string>TAG: very helpful</extra-string>
          <comment>
            <uuid>commA</uuid>
            <short-name>/bug/commA</short-name>
            <author></author>
            <date>Thu, 01 Jan 1970 00:01:00 +0000</date>
            <content-type>text/plain</content-type>
            <body>comment A</body>
          </comment>
          <comment>
            <uuid>commB</uuid>
            <short-name>/bug/commB</short-name>
            <in-reply-to>commA</in-reply-to>
            <author></author>
            <date>Thu, 01 Jan 1970 00:02:00 +0000</date>
            <content-type>text/plain</content-type>
            <body>comment B</body>
          </comment>
          <comment>
            <uuid>commC</uuid>
            <short-name>/bug/commC</short-name>
            <in-reply-to>commB</in-reply-to>
            <author></author>
            <date>Thu, 01 Jan 1970 00:03:00 +0000</date>
            <content-type>text/plain</content-type>
            <body>comment C</body>
          </comment>
        </bug>
        >>> print(bugA.xml(show_comments=True, indent=2))
        ... # doctest: +REPORT_UDIFF
          <bug>
            <uuid>bugA</uuid>
            <short-name>/bug</short-name>
            <severity>minor</severity>
            <status>open</status>
            <creator>Frank</creator>
            <created>Thu, 01 Jan 1970 00:00:00 +0000</created>
            <summary>Need to test Bug.xml()</summary>
            <extra-string>TAG: very helpful</extra-string>
            <comment>
              <uuid>commA</uuid>
              <short-name>/bug/commA</short-name>
              <author></author>
              <date>Thu, 01 Jan 1970 00:01:00 +0000</date>
              <content-type>text/plain</content-type>
              <body>comment A</body>
            </comment>
            <comment>
              <uuid>commB</uuid>
              <short-name>/bug/commB</short-name>
              <in-reply-to>commA</in-reply-to>
              <author></author>
              <date>Thu, 01 Jan 1970 00:02:00 +0000</date>
              <content-type>text/plain</content-type>
              <body>comment B</body>
            </comment>
            <comment>
              <uuid>commC</uuid>
              <short-name>/bug/commC</short-name>
              <in-reply-to>commB</in-reply-to>
              <author></author>
              <date>Thu, 01 Jan 1970 00:03:00 +0000</date>
              <content-type>text/plain</content-type>
              <body>comment C</body>
            </comment>
          </bug>
        """
        if self.time == None:
            timestring = ""
        else:
            timestring = utility.time_to_str(self.time)

        info = [('uuid', self.uuid),
                ('short-name', self.id.user()),
                ('severity', self.severity),
                ('status', self.status),
                ('assigned', self.assigned),
                ('reporter', self.reporter),
                ('creator', self.creator),
                ('created', timestring),
                ('summary', self.summary)]
        lines = ['<bug>']
        for (k,v) in info:
            if v is not None:
                lines.append('  <%s>%s</%s>' % (k,xml.sax.saxutils.escape(v),k))
        for estr in self.extra_strings:
            lines.append('  <extra-string>%s</extra-string>' % estr)
        if show_comments == True:
            comout = self.comment_root.xml_thread(indent=indent+2)
            if comout:
                comout = comout[indent:]  # strip leading indent spaces
                lines.append(comout)
        lines.append('</bug>')
        istring = ' '*indent
        sep = '\n' + istring
        return istring + sep.join(lines).rstrip('\n')
コード例 #6
0
ファイル: bug.py プロジェクト: gitmob/yabbe
 def _set_time(self, value):
     if not hasattr(self, '_cached_time') or value != self._cached_time:
         self.time_string = utility.time_to_str(value)
         self._cached_time_string = self.time_string
         self._cached_time = value
コード例 #7
0
 def _set_time(self, value):
     self.date = utility.time_to_str(value)
コード例 #8
0
    def xml(self, indent=0, show_comments=False):
        """
        >>> bugA = Bug(uuid='0123', summary='Need to test Bug.xml()')
        >>> bugA.uuid = 'bugA'
        >>> bugA.time_string = 'Thu, 01 Jan 1970 00:00:00 +0000'
        >>> bugA.creator = u'Frank'
        >>> bugA.extra_strings += ['TAG: very helpful']
        >>> commA = bugA.comment_root.new_reply(body='comment A')
        >>> commA.uuid = 'commA'
        >>> commA.date = 'Thu, 01 Jan 1970 00:01:00 +0000'
        >>> commB = commA.new_reply(body='comment B')
        >>> commB.uuid = 'commB'
        >>> commB.date = 'Thu, 01 Jan 1970 00:02:00 +0000'
        >>> commC = commB.new_reply(body='comment C')
        >>> commC.uuid = 'commC'
        >>> commC.date = 'Thu, 01 Jan 1970 00:03:00 +0000'
        >>> print(bugA.xml(show_comments=True))  # doctest: +REPORT_UDIFF
        <bug>
          <uuid>bugA</uuid>
          <short-name>/bug</short-name>
          <severity>minor</severity>
          <status>open</status>
          <creator>Frank</creator>
          <created>Thu, 01 Jan 1970 00:00:00 +0000</created>
          <summary>Need to test Bug.xml()</summary>
          <extra-string>TAG: very helpful</extra-string>
          <comment>
            <uuid>commA</uuid>
            <short-name>/bug/commA</short-name>
            <author></author>
            <date>Thu, 01 Jan 1970 00:01:00 +0000</date>
            <content-type>text/plain</content-type>
            <body>comment A</body>
          </comment>
          <comment>
            <uuid>commB</uuid>
            <short-name>/bug/commB</short-name>
            <in-reply-to>commA</in-reply-to>
            <author></author>
            <date>Thu, 01 Jan 1970 00:02:00 +0000</date>
            <content-type>text/plain</content-type>
            <body>comment B</body>
          </comment>
          <comment>
            <uuid>commC</uuid>
            <short-name>/bug/commC</short-name>
            <in-reply-to>commB</in-reply-to>
            <author></author>
            <date>Thu, 01 Jan 1970 00:03:00 +0000</date>
            <content-type>text/plain</content-type>
            <body>comment C</body>
          </comment>
        </bug>
        >>> print(bugA.xml(show_comments=True, indent=2))
        ... # doctest: +REPORT_UDIFF
          <bug>
            <uuid>bugA</uuid>
            <short-name>/bug</short-name>
            <severity>minor</severity>
            <status>open</status>
            <creator>Frank</creator>
            <created>Thu, 01 Jan 1970 00:00:00 +0000</created>
            <summary>Need to test Bug.xml()</summary>
            <extra-string>TAG: very helpful</extra-string>
            <comment>
              <uuid>commA</uuid>
              <short-name>/bug/commA</short-name>
              <author></author>
              <date>Thu, 01 Jan 1970 00:01:00 +0000</date>
              <content-type>text/plain</content-type>
              <body>comment A</body>
            </comment>
            <comment>
              <uuid>commB</uuid>
              <short-name>/bug/commB</short-name>
              <in-reply-to>commA</in-reply-to>
              <author></author>
              <date>Thu, 01 Jan 1970 00:02:00 +0000</date>
              <content-type>text/plain</content-type>
              <body>comment B</body>
            </comment>
            <comment>
              <uuid>commC</uuid>
              <short-name>/bug/commC</short-name>
              <in-reply-to>commB</in-reply-to>
              <author></author>
              <date>Thu, 01 Jan 1970 00:03:00 +0000</date>
              <content-type>text/plain</content-type>
              <body>comment C</body>
            </comment>
          </bug>
        """
        if self.time == None:
            timestring = ""
        else:
            timestring = utility.time_to_str(self.time)

        info = [('uuid', self.uuid), ('short-name', self.id.user()),
                ('severity', self.severity), ('status', self.status),
                ('assigned', self.assigned), ('reporter', self.reporter),
                ('creator', self.creator), ('created', timestring),
                ('summary', self.summary)]
        lines = ['<bug>']
        for (k, v) in info:
            if v is not None:
                lines.append('  <%s>%s</%s>' %
                             (k, xml.sax.saxutils.escape(v), k))
        for estr in self.extra_strings:
            lines.append('  <extra-string>%s</extra-string>' % estr)
        if show_comments == True:
            comout = self.comment_root.xml_thread(indent=indent + 2)
            if comout:
                comout = comout[indent:]  # strip leading indent spaces
                lines.append(comout)
        lines.append('</bug>')
        istring = ' ' * indent
        sep = '\n' + istring
        return istring + sep.join(lines).rstrip('\n')
コード例 #9
0
 def _set_time(self, value):
     if not hasattr(self, '_cached_time') or value != self._cached_time:
         self.time_string = utility.time_to_str(value)
         self._cached_time_string = self.time_string
         self._cached_time = value
コード例 #10
0
 def _set_time(self, value):
     self.date = utility.time_to_str(value)