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
Bug
BugAttachment
BugInfo
BugList
BugPage
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.
|
| ----------------------------------------------------------------------
| 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)
|
| ----------------------------------------------------------------------
| 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)
|
| ----------------------------------------------------------------------
| 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)
|
| ----------------------------------------------------------------------
| 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)
|
| ----------------------------------------------------------------------
| 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
sanitize_html(text)
Replaces HTML-encoded characters.
* currently: ' ','','<','>' and '&'
* TODO:
* move to utils
DATA
baseUrl = 'https://launchpad.net/bugs/' Go Back to BugHelper/Dev.
CategoryBugHelper
BugHelper/Dev/HTMLOperations.py (last edited 2008-08-06 16:59:36 by localhost)