quality module

bzr revid: mra@tinyerp.com-20090113065413-0c7l5tdfy8q93ox0
This commit is contained in:
mra (Open ERP) 2009-01-13 12:24:13 +05:30
parent 36b367e8d2
commit 592242bbe9
4 changed files with 18 additions and 8 deletions

View File

@ -106,7 +106,7 @@ class abstract_quality_check(object):
result_ids[obj] = ids
return result_ids
def format_table(self, header=[], data_list=[]):
def format_table(self, header=[], data_list=[]): #This function can work forwidget="text_wiki"
detail = ""
detail += (header[0]) % tuple(header[1])
frow = '\n|-'
@ -117,6 +117,18 @@ class abstract_quality_check(object):
detail = detail + '\n|}'
return detail
def format_html_table(self, header=[], data_list=[]): #This function can work for widget="html_tag"
# function create html table....
detail = ""
detail += (header[0]) % tuple(header[1])
frow = '<tr>'
for i in header[1]:
frow += '<td>%s</td>'
frow += '</tr>'
for key, value in data_list.items():
detail += (frow) % tuple(value)
return detail
def add_quatation(self, x, y):
return x/y

View File

@ -67,7 +67,6 @@ class quality_test(base_module_quality.abstract_quality_check):
break
n += 1
leftchar = -1
# print res
while res[leftchar:leftchar+1] != ' ' and leftchar-1 <= 0:
leftchar -= 1
rightchar = -10
@ -81,7 +80,6 @@ class quality_test(base_module_quality.abstract_quality_check):
score += 0
#self.result += file + ": "+_("Unable to parse the result. Check the details.")+"\n"
dict[file] = [file, _("Unable to parse the result. Check the details.")]
# self.result_details += res.replace('''<div''', '''<div class="wikiwidget readonlyfield"''')
self.result_details += res.replace('''<div''', '''<div class="wikiwidget readonlyfield"''')
self.result_details += '</body></html>'
average_score = n and score / n or score

View File

@ -62,7 +62,7 @@ disable-msg=C0103,F0401,E0611,R0903,W0232,W0102,E1002,R0913,R0904
# set the output format. Available formats are text, parseable, colorized and
# html
output-format=html
output-format=html,text
# Include message's id in output
include-ids=yes

View File

@ -110,11 +110,11 @@ This test checks the speed of the module. Note that at least 5 demo data is need
return ""
def get_result_details(self, dict):
# header = ('{| border="1" cellspacing="0" cellpadding="5" align="left" \n! %-40s \n! %-10s \n! %-10s \n! %-10s \n! %-10s \n! %-20s', [_('Object Name'), _('N (Number of Records)'), _('1'), _('N/2'), _('N'), _('Reading Complexity')])
header = ('! %-40s \n! %-10s \n! %-10s \n! %-10s \n! %-10s \n! %-20s', [_('Object Name'), _('N (Number of Records)'), _('1'), _('N/2'), _('N'), _('Reading Complexity')])
# todo ...ronvert result come from format table to html format will display in table format
str_html = '''<html><head></head><body><table border="1">'''
header = ('<tr><th>%s</th><th>%s</th><th>%s</th><th>%s</th><th>%s</th><th>%s</th></tr>', [_('Object Name'), _('N (Number of Records)'), _('1'), _('N/2'), _('N'), _('Reading Complexity')])
if not self.error:
return '<pre>' + self.format_table(header, data_list=dict) + '</pre>'
res = str_html + self.format_html_table(header, data_list=dict) + '</table></body></html>'
return res
return ""
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: