Пример #1
0
 def _format_message_with_teardown_message(self, message):
     teardown = self.failure.teardown
     if teardown.startswith('*HTML*'):
         teardown = teardown[6:].lstrip()
         if not message.startswith('*HTML*'):
             message = '*HTML* ' + html_escape(message)
     elif message.startswith('*HTML*'):
         teardown = html_escape(teardown)
     return self.also_teardown_message % (message, teardown)
Пример #2
0
 def __getattr__(self, name):
     if name == 'htmldoc':
         return utils.html_escape(self.doc, formatting=True)
     if name == 'longname':
         return self.get_long_name()
     raise AttributeError("%s does not have attribute '%s'" %
                          (self.__class__.__name__, name))
Пример #3
0
 def __getattr__(self, name):
     if name == 'htmldoc':
         return utils.html_escape(self.doc, formatting=True)
     if name == 'longname':
         return self.get_long_name()
     raise AttributeError("%s does not have attribute '%s'"
                          % (self.__class__.__name__, name))
Пример #4
0
 def _write_keyword_info(self, kw):
     self._writer.start('table', {'class': 'metadata'})
     doc = utils.html_escape(kw.doc, formatting=True)
     self._write_metadata_row('Documentation', doc, escape=False)
     self._write_metadata_row('Timeout', kw.timeout)
     self._write_times(kw)
     self._writer.end('table')
Пример #5
0
 def _format_html_messages(self, messages):
     from robot.utils import html_escape
     for msg in messages:
         if msg.startswith('*HTML*'):
             yield msg[6:].lstrip()
         else:
             yield html_escape(msg)
Пример #6
0
def _download_and_format_issues():
    try:
        from robot.utils import HtmlWriter, html_escape
    except ImportError:
        sys.exit('creating release requires Robot Framework to be installed.')
    URL = Template('http://code.google.com/p/robotframework-ride/issues/csv?'
                   'sort=priority+type&colspec=ID%20Type%20Priority%20Summary'
                   '&q=target%3A${version}&can=1')
    reader = csv.reader(urlopen(URL.substitute({'version': VERSION})))
    total_issues = 0
    writer = HtmlWriter(StringIO())
    writer.element('h2', 'Release notes for %s' % VERSION)
    writer.start('table', attrs={'border': '1'})
    for row in reader:
        if not row or row[1] == 'Task':
            continue
        row = row[:4]
        writer.start('tr')
        if reader.line_num == 1:
            row = [ '*%s*' % cell for cell in row ]
        else:
            row[0] = '<a href="http://code.google.com/p/robotframework-ride/'\
                     'issues/detail?id=%s">Issue %s</a>' % (row[0], row[0])
            total_issues += 1
        for cell in row:
            if reader.line_num == 1:
                cell = html_escape(cell, formatting=True)
            writer.element('td', cell, escape=False)
        writer.end('tr')
    writer.end('table')
    writer.element('p', 'Altogether %d issues.' % total_issues)
    return writer.output.getvalue()
Пример #7
0
 def _format_html_messages(self, messages):
     from robot.utils import html_escape
     for msg in messages:
         if msg.startswith('*HTML*'):
             yield msg[6:].lstrip()
         else:
             yield html_escape(msg)
Пример #8
0
 def _write_keyword_info(self, kw):
     self._writer.start('table', {'class': 'metadata'})
     doc = utils.html_escape(kw.doc, formatting=True)
     self._write_metadata_row('Documentation', doc, escape=False)
     self._write_metadata_row('Timeout', kw.timeout)
     self._write_times(kw)
     self._writer.end('table')
Пример #9
0
 def get_full_message(self, html=False):
     """Returns suite's message including statistics message"""
     stat_msg = self.get_stat_message(html)
     if self.message == '':
         return stat_msg
     if not html:
         return '%s\n\n%s' % (self.message, stat_msg)
     return '%s<br /><br />%s' % (utils.html_escape(self.message), stat_msg)
Пример #10
0
 def report_config(self):
     if not self.report:
         return {}
     return {
         "title": html_escape(self["ReportTitle"] or ""),
         "logURL": self._url_from_path(self.report, self.log),
         "background": self._resolve_background_colors(),
     }
Пример #11
0
 def get_full_message(self, html=False):
     """Returns suite's message including statistics message"""
     stat_msg = self.get_stat_message(html)
     if self.message == '':
         return stat_msg
     if not html:
         return '%s\n\n%s' % (self.message, stat_msg)
     return '%s<br /><br />%s' % (utils.html_escape(self.message), stat_msg)
Пример #12
0
 def report_config(self):
     if not self.report:
         return {}
     return {
         'title': utils.html_escape(self['ReportTitle'] or ''),
         'logURL': self._url_from_path(self.report, self.log),
         'background' : self._resolve_background_colors(),
     }
Пример #13
0
 def log_config(self):
     if not self.log:
         return {}
     return {
         "title": html_escape(self["LogTitle"] or ""),
         "reportURL": self._url_from_path(self.log, self.report),
         "splitLogBase": os.path.basename(os.path.splitext(self.log)[0]),
         "defaultLevel": self["VisibleLogLevel"],
     }
Пример #14
0
 def __init__(self, name, arguments=None, newname=None):
     lib = self._import(name, arguments)
     self.name = newname or lib.name
     self.version = utils.html_escape(getattr(lib, 'version', '<unknown>'))
     self.doc = self._process_doc(self._get_doc(lib))
     self.inits = self._get_initializers(lib)
     self.keywords = [ KeywordDoc(handler, self) 
                       for handler in lib.handlers.values() ]
     self.keywords.sort()
Пример #15
0
 def log_config(self):
     if not self.log:
         return {}
     return {
         'title': utils.html_escape(self['LogTitle'] or ''),
         'reportURL': self._url_from_path(self.log, self.report),
         'splitLogBase': os.path.basename(os.path.splitext(self.log)[0]),
         'defaultLevel': self['VisibleLogLevel']
     }
Пример #16
0
 def log_config(self):
     if not self.log:
         return {}
     return {
         'title': utils.html_escape(self['LogTitle'] or ''),
         'reportURL': self._url_from_path(self.log, self.report),
         'splitLogBase': os.path.basename(os.path.splitext(self.log)[0]),
         'defaultLevel': self['VisibleLogLevel']
     }
Пример #17
0
 def __init__(self, name, arguments=None):
     lib = self._import(name, arguments)
     self.supports_named_arguments = lib.supports_named_arguments
     self.name = lib.name
     self.version = utils.html_escape(getattr(lib, 'version', '<unknown>'))
     self.scope = self._get_scope(lib)
     self.doc = self._process_doc(self._get_doc(lib))
     self.inits = self._get_initializers(lib)
     self.keywords = sorted(
         KeywordDoc(handler, self) for handler in lib.handlers.values())
 def __init__(self, name, arguments=None):
     lib = self._import(name, arguments)
     self.supports_named_arguments = lib.supports_named_arguments
     self.name = lib.name
     self.version = utils.html_escape(getattr(lib, 'version', '<unknown>'))
     self.scope = self._get_scope(lib)
     self.doc = self._process_doc(self._get_doc(lib))
     self.inits = self._get_initializers(lib)
     self.keywords = sorted(KeywordDoc(handler, self)
                            for handler in lib.handlers.values())
Пример #19
0
 def __init__(self, path, newname=None):
     cls = self._get_class(path)
     self.name = newname or cls.qualifiedName()
     self.version = utils.html_escape(self._get_version(cls))
     self.doc = self._process_doc(cls.getRawCommentText())
     self.keywords = [ JavaKeywordDoc(method, self) 
                       for method in cls.methods() ]
     self.inits = [ JavaKeywordDoc(init, self)
                    for init in cls.constructors() ]
     if len(self.inits) == 1 and not self.inits[0].args:
         self.inits = []
     self.keywords.sort()
Пример #20
0
 def _create_label(self, message):
     # JLabel doesn't support multiline text, setting size, or wrapping.
     # Need to handle all that ourselves. Feels like 2005...
     wrapper = textwrap.TextWrapper(MAX_CHARS_PER_LINE,
                                    drop_whitespace=False)
     lines = []
     for line in html_escape(message, linkify=False).splitlines():
         if line:
             lines.extend(wrapper.wrap(line))
         else:
             lines.append('')
     return JLabel('<html>%s</html>' % '<br>'.join(lines))
 def _create_label(self, message):
     # JLabel doesn't support multiline text, setting size, or wrapping.
     # Need to handle all that ourselves. Feels like 2005...
     wrapper = textwrap.TextWrapper(MAX_CHARS_PER_LINE,
                                    drop_whitespace=False)
     lines = []
     for line in html_escape(message, linkify=False).splitlines():
         if line:
             lines.extend(wrapper.wrap(line))
         else:
             lines.append('')
     return JLabel('<html>%s</html>' % '<br>'.join(lines))
Пример #22
0
 def report(self):
     with open(self._monitor_out, 'r') as monitor_file:
         monitor_output = monitor_file.read()
     try:
         os.remove(self._monitor_out)
     except:
         pass
     match = re.search('^Log:     (.*)$', monitor_output, re.MULTILINE)
     monitor_output = self._replace_stdout_log_message_levels(monitor_output)
     monitor_output = html_escape(monitor_output)
     if match:
         monitor_output = monitor_output.replace(match.group(1), '<a href="%s#test_%s.%s">%s</a>' % (self._log, self._suite_name, self.test, match.group(1)))
     monitor_output = self._add_colours(monitor_output)
     print "*HTML* %s" % monitor_output
Пример #23
0
 def _tag_row(self, stat):
     self._writer.start('tr', {'class': 'tag_row'})
     self._writer.start('td', {'class': 'col_name'}, newline=False)
     self._writer.element('a', None, {'name': 'tag_%s' % stat.name},
                          newline=False)
     self._writer.content(stat.name)
     self._writer.end('td')
     doc = utils.html_escape(stat.get_doc() or '', formatting=True)
     self._writer.element('td', doc, {'class': 'col_doc'}, escape=False)
     self._writer.element('td', 'N/A', {'class': 'col_tags not_available'})
     self._writer.element('td', self._get_crit(stat), {'class': 'col_crit'})
     status = stat.failed == 0 and 'PASS' or 'FAIL'
     self._writer.element('td', status,
                          {'class': 'col_status %s' % status.lower()})
     self._writer.element('td', self._get_msg(stat.passed, stat.failed),
                          {'class': 'col_msg'}, escape=False)
     self._writer.element('td', self._get_elapsed(stat.tests),
                          {'class': 'col_times'})
     self._writer.end('tr')
Пример #24
0
 def _tag_row(self, stat):
     self._writer.start('tr', {'class': 'tag_row'})
     self._writer.start('td', {'class': 'col_name'}, newline=False)
     self._writer.element('a',
                          None, {'name': 'tag_%s' % stat.name},
                          newline=False)
     self._writer.content(stat.name)
     self._writer.end('td')
     doc = utils.html_escape(stat.get_doc() or '', formatting=True)
     self._writer.element('td', doc, {'class': 'col_doc'}, escape=False)
     self._writer.element('td', 'N/A', {'class': 'col_tags not_available'})
     self._writer.element('td', self._get_crit(stat), {'class': 'col_crit'})
     status = stat.failed == 0 and 'PASS' or 'FAIL'
     self._writer.element('td', status,
                          {'class': 'col_status %s' % status.lower()})
     self._writer.element('td',
                          self._get_msg(stat.passed, stat.failed),
                          {'class': 'col_msg'},
                          escape=False)
     self._writer.element('td', self._get_elapsed(stat.tests),
                          {'class': 'col_times'})
     self._writer.end('tr')
Пример #25
0
 def html_message(self):
     """Returns the message content as HTML."""
     return self.message if self.html else html_escape(self.message)
Пример #26
0
 def _get_version(self, cls):
     version = self._get_attr(cls, 'VERSION', '<unknown>')
     return utils.html_escape(version)
Пример #27
0
 def _html_escape(self, item):
     return html_escape(item) if is_string(item) else item
Пример #28
0
 def _html_escape(self, item):
     return html_escape(item) if isinstance(item, string_types) else item
Пример #29
0
 def get_metadata(self, html=False):
     names = sorted(self.metadata.keys())
     values = [self.metadata[n] for n in names]
     if html:
         values = [utils.html_escape(v, formatting=True) for v in values]
     return zip(names, values)
Пример #30
0
 def _get_htmldoc(self, doc):
     doc = utils.html_escape(doc, formatting=True)
     return self._name_regexp.sub(self._link_keywords, doc)
Пример #31
0
 def _html_escape(self, message):
     if message.startswith('*HTML*'):
         return message[6:].lstrip()
     else:
         return html_escape(message)
Пример #32
0
 def __init__(self, content='', attributes=None, tag='td', escape=True):
     if escape:
         content = utils.html_escape(content)
     self.content = self._replace_newlines(content)
     self.attributes = attributes or {}
     self.tag = tag
Пример #33
0
 def _format_text(self, doc):
     return '<p style="white-space: pre-wrap">%s</p>' % html_escape(doc)
Пример #34
0
 def _get_htmldoc(self, doc):
     doc = utils.html_escape(doc, formatting=True)
     return self._name_regexp.sub(self._link_keywords, doc)
Пример #35
0
 def _escape(self, item):
     return html_escape(item)
Пример #36
0
 def _escape(self, item):
     return utils.html_escape(item)
Пример #37
0
 def _html_escape(self, item):
     return html_escape(item) if isinstance(item, basestring) else item
Пример #38
0
 def _escape_and_encode_targets(self, targets):
     return NormalizedDict(
         (html_escape(key), self._encode_uri_component(value)) for key, value in targets.iteritems()
     )
Пример #39
0
 def _html_format(self, msg):
     from robot.utils import html_escape
     if msg.startswith('*HTML*'):
         return msg[6:].lstrip()
     return html_escape(msg)
Пример #40
0
 def _link_from_name(self, name, type_):
     return '<a name="%s_%s">%s</a>' % (type_, utils.attribute_escape(name),
                                        utils.html_escape(name))
Пример #41
0
 def _html_escape(self, item):
     return html_escape(item) if isinstance(item, basestring) else item
Пример #42
0
 def html_message(self):
     return self.message if self.html else html_escape(self.message)
Пример #43
0
 def _escape(self, item):
     return utils.html_escape(item)
 def _html_escape(self, message):
     if message.startswith('*HTML*'):
         return message[6:].lstrip()
     else:
         return html_escape(message)
Пример #45
0
 def html_message(self):
     return self.message if self.html else html_escape(self.message)