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):
16 def __init__(self, provider):
17 self._page = pyhtm.PyHtml('Html Text')
18 self._provider = provider
20 def save(self, ofile):
22 os.system('rm -rf %s' % ofile)
23 self._page.output(ofile)
26 return self._page.as_string()
28 def add_table(self, data):
29 if data and zip(*data):
30 self._page.add_table(data)
33 style = self._provider.get_style
34 self._page.add_style(style)
36 def create(self, ofile='text.html'):
40 return self.as_string()
42 def create_story(self):
43 raise NotImplementedError("abstract HtmlBase")