Polarion Utils

Other useful functions that do not fit anywhere else.

HTML parsing

You can get the parsed description by using the parser like the example below. Passing the project to the parser is only needed when you want to find the title for linked workitems in the HTML text. If not supplied it will only list the linked ID.

# if you have a project and workitem
project = pol.getProject('')
workitem = project.getWorkitem('')

# get the parsed description like this
parser = DescriptionParser(project)
parser.feed(workitem.getDescription())
print(parser.data)

Document functions

class polarion.utils.DescriptionParser(polarion_project: Project = None)
property data

The parsed data @return: string

handle_data(data)

Handles the data within HTML tags @param data: the data inside a HTML tag @return: None

handle_endtag(tag)

Handles the end of a tag. @param tag: Name of the tag @return: None

handle_starttag(tag, attrs)

Handles the start of a HTML tag. In some cases the start tag is the only tag and then it parses the attributes depending on the tag. @param tag: Tag identifier @param attrs: A tuple of attributes @return: None

reset()

Reset the parsing state @return: None