示例#1
0
 def format_records(self, format='text', mode='short', tags=None, reverse=False, *args, **kwargs):
     if format=='text' and mode=='short':
         return '\n'.join(self.get_labels(tags=tags, reverse=reverse))
     else:
         records = self.find_records(tags=tags, reverse=reverse, *args, **kwargs)
         formatter = get_formatter(format)(records, project=self, tags=tags)
         return formatter.format(mode)
示例#2
0
 def format_records(self, format='text', mode='short', tags=None, reverse=False, *args, **kwargs):
     if format=='text' and mode=='short' and ('parameters' not in kwargs.keys()):
         return '\n'.join(self.get_labels(tags=tags, reverse=reverse, *args, **kwargs))
     else:
         records = self.find_records(tags=tags, reverse=reverse, *args, **kwargs)
         formatter = get_formatter(format)(records, project=self, tags=tags)
         return formatter.format(mode)
示例#3
0
 def format_records(self,
                    format='text',
                    mode='short',
                    tags=None,
                    reverse=False):
     records = self.find_records(tags=tags, reverse=reverse)
     formatter = get_formatter(format)(records, project=self, tags=tags)
     return formatter.format(mode)
示例#4
0
def view(argv):
    """View detail of a single record."""
    usage = "%(prog)s view [options] LABEL"
    description = "View detail of a single record."
    parser = ArgumentParser(usage=usage, description=description)
    parser.add_argument('label')
    parser.add_argument('-s',
                        '--script',
                        action='store_true',
                        help="show script content.")
    args = parser.parse_args(argv)
    project = load_project()
    record = project.get_record(args.label)
    if args.script:
        print('Main_File\t :', record.main_file)
        print(80 * '-')
        print(record.script_content)
        print(80 * '-')
    else:
        formatter = get_formatter('text')([record], project=project)
        print(formatter.format('long'))
示例#5
0
 def test__get_formatter__should_return_Formatter_subclass(self):
     for format in 'text', 'html', 'textdiff':
         assert issubclass(get_formatter(format), Formatter)
示例#6
0
 def format_records(self, format='text', mode='short', tags=None, reverse=False):
     records = self.find_records(tags=tags, reverse=reverse)
     formatter = get_formatter(format)(records, project=self, tags=tags)
     return formatter.format(mode)
示例#7
0
 def export_records(self, records, indent=2):
     """Returns a string with a JSON representation of the given records."""
     json_formatter = get_formatter('json')(records)
     return json_formatter.long()
示例#8
0
文件: base.py 项目: Felix11H/sumatra
 def export_records(self, records, indent=2):
     """Returns a string with a JSON representation of the given records."""
     json_formatter = get_formatter('json')(records)
     return json_formatter.long()
示例#9
0
 def test__get_formatter__should_return_Formatter_subclass(self):
     for format in 'text', 'html', 'textdiff':
         assert issubclass(get_formatter(format), Formatter)
示例#10
0
 def test__get_formatter__should_return_Formatter_subclass(self):
     for format in "text", "html", "textdiff":
         assert issubclass(get_formatter(format), Formatter)