~roadmr/checkbox/912946

« back to all changes in this revision

Viewing changes to checkbox/report.py

  • Committer: David Murphy
  • Date: 2009-02-18 23:28:47 UTC
  • mto: (478.1.3 trunk)
  • mto: This revision was merged to the branch mainline in revision 480.
  • Revision ID: david.murphy@canonical.com-20090218232847-o26woqv9c6w6vszi
Added the ability to view generated reports via XSL.

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
    handlers to understand the formats for dumping and loading actions.
28
28
    """
29
29
 
30
 
    def __init__(self, name, version=None):
 
30
    def __init__(self, name, version=None, stylesheet=None):
31
31
        self.name = name
32
32
        self.version = version
 
33
        self.stylesheet = stylesheet
33
34
        self.dumps_table = {}
34
35
        self.loads_table = {}
35
36
        self.document = None
83
84
        supported by the reports added to the manager.
84
85
        """
85
86
        self.document = Document()
 
87
 
 
88
        if self.stylesheet: 
 
89
            type = "text/xsl"
 
90
            href = "file://%s" % self.stylesheet
 
91
            style = self.document.createProcessingInstruction("xml-stylesheet",
 
92
                "type=\"%s\" href=\"%s\"" % (type, href))
 
93
            self.document.appendChild(style)
 
94
 
86
95
        node = self.document.createElement(self.name)
87
96
        self.document.appendChild(node)
88
97