def create_bug_object_for_remote_bug_id(remote_bug_id): '''Create but don't save a bug.''' remote_bug_url = "http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=%d" % remote_bug_id try: tree = lxml.html.document_fromstring(urllib2.urlopen(remote_bug_url).read()) except urllib2.HTTPError, e: if e.code == 404: return None # otherwise, bubble that crazy error up. raise e bug = Bug() metadata_dict = view_bug_table2dict(tree) bug.submitter_username = '' # FIXME: Find an example of this having a value bug.submitter_realname = '' # FIXME: Find an example of this having a value bug.date_reported = decode_datetime(metadata_dict['Submit Date']) bug.last_touched = decode_datetime(metadata_dict['Last Update Date']) bug.canonical_bug_link = remote_bug_url bug.good_for_newcomers = 'oss-bite-size' in metadata_dict['Keywords'] bug.status = metadata_dict['State'] status_number = int(bug.status.split('-')[0]) bug.looks_closed = (status_number in (8, 10, 11)) bug.title = metadata_dict['Synopsis'] bug.importance = '' # No importance, as far as I can tell. # For description, just grab the first "message" bug.description = metadata_dict['Description'] # We are always the project called Python.