1 ##############################################################################
2 # Copyright (c) 2015 Huawei Technologies Co.,Ltd and others.
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ##############################################################################
12 import vstf.common.pyhtml as pyhtm
15 class HtmlBase(object):
17 def __init__(self, provider):
18 self._page = pyhtm.PyHtml('Html Text')
19 self._provider = provider
21 def save(self, ofile):
23 os.system('rm -rf %s' % ofile)
24 self._page.output(ofile)
27 return self._page.as_string()
29 def add_table(self, data):
30 if data and zip(*data):
31 self._page.add_table(data)
34 style = self._provider.get_style
35 self._page.add_style(style)
37 def create(self, ofile='text.html'):
41 return self.as_string()
43 def create_story(self):
44 raise NotImplementedError("abstract HtmlBase")