HTMLOperations.py
{{{Help on module HTMLOperations:
NAME
- HTMLOperations
FILE
- bughelper.main/launchpadBugs/HTMLOperations.py
DESCRIPTION
- # Written by Henrik Nilsen Omma # (C) Canonical, Ltd. Licensed under the GPL # # HTML - Parsing of Launchpad-pages # # At the moment this module contains code used by bughelper and apport. # # TODO: # * In the future this module should be divide into two [1],[2] # as suggested in the docstring of each class. # * The functions sanitize_html and safe_urlopen should move to utils.
# * Use XPath instead of RegEx # * working with assertions
CLASSES
builtin.object
class Bug(builtin.object)
- | Get Bug-information | | * TODO: | * move to [2] | | Methods defined here: | | Comments(self) | Return a list of comments. | | Format for each comment: (Nr,LP-User,Time) | | Reporter(self) | Return the Reporter of a Bug | | Tags(self) | Return a list of tags. |
| init(self, bugnumber, sourcepackage=None, attachments_path=None, content_types=[], attachments_regex=None, cookie_file=None) | | add_comment(self, subject, text, attachment=None, description=None, is_patch=False) | Add a new comment (with given subject) to this bug. | | If attachment is not None, it must be a file-like object that gets | attached to the bug with the given description. Set is_patch to True | for patches to get the correct MIME type handling. | | Return the resulting urllib2 file object. | | get_metadata(self) | Load title, description, tags, and nickname. | | set_metadata(self) | Write back title, description, tags, and nickname attributes. | |
- | Get Bug-information | | * TODO: | * move to [2] | | Methods defined here: | | Comments(self) | Return a list of comments. | | Format for each comment: (Nr,LP-User,Time) | | Reporter(self) | Return the Reporter of a Bug | | Tags(self) | Return a list of tags. |
- | Data descriptors defined here: |
| dict | dictionary for instance variables (if defined) | | weakref | list of weak references to the object (if defined)
class BugAttachment(builtin.object)
- | Caches an attachment and read its content | | * TODO: | * move to [2] | * add function to organize cache | | Methods defined here: |
| init(self, URL, attachments_path, content_types, attachments_regex=None) | |
- | Caches an attachment and read its content | | * TODO: | * move to [2] | * add function to organize cache | | Methods defined here: |
- | Data descriptors defined here: |
| dict | dictionary for instance variables (if defined) | | weakref | list of weak references to the object (if defined)
class BugInfo(builtin.object)
- | Summarize information on an Bug in an object and defines Integer | and String representatives | | * currently: nr, status,importance, summary | | * TODO: | * move to [1] | | Methods defined here: |
| init(self, nr, status, importance, summary) | | int(self) | | repr(self) | |
- | Summarize information on an Bug in an object and defines Integer | and String representatives | | * currently: nr, status,importance, summary | | * TODO: | * move to [1] | | Methods defined here: |
- | Data descriptors defined here: |
| dict | dictionary for instance variables (if defined) | | weakref | list of weak references to the object (if defined)
class BugList(builtin.object)
- | Returns a set of Bugs | | * TODO: | * move to [1]
| * change set into list => use filter instead of interation-blocks | | Methods defined here: | | init(self, opt) | |
- | Returns a set of Bugs | | * TODO: | * move to [1]
- | Data descriptors defined here: |
| dict | dictionary for instance variables (if defined) | | weakref | list of weak references to the object (if defined)
class BugPage(builtin.object)
- | Grap content of a +bugs - Page | | * TODO: | * move to [1] | * check usage of urllib2.add_header | | Methods defined here: |
| init(self, URL) | |
- | Grap content of a +bugs - Page | | * TODO: | * move to [1] | * check usage of urllib2.add_header | | Methods defined here: |
- | Data descriptors defined here: |
| dict | dictionary for instance variables (if defined) | | weakref | list of weak references to the object (if defined)
FUNCTIONS
- safe_urlopen(url, attempt=5)
- Try to open an url [attempt]-times, raises an error on failure.
- TODO:
- move to utils
- use global builtopener
- Replaces HTML-encoded characters.
currently: ' ',,'<','>' and '&'
- TODO:
- move to utils
DATA
baseUrl = 'https://launchpad.net/bugs/'
}}}