How to do a Code Tour
From Dreamwidth Notes
Revision as of 08:11, 28 September 2009 by Foxfirefey (Talk | contribs)
What is a code tour?
A code tour lists information about all of the bugs in Bugzilla that have been closed in the past week. You can view previous code tours in dw_dev here.
How to make a code tour
First, get a link to a Bugzilla search from denise. Then, put the information each bug into this example format:
<a href="http://bugs.dwscoalition.org/show_bug.cgi?id=NNNN">Bug NNNN</a>: Bug Title Category: What section of the site is this bug about? Patch by: <user name="username"> or submitter name Description: What problem does this bug solve, or what new feature does it add?
Then, make a post to dw_dev tagged "code tour". The time to do these is generally Monday, so they can be included in the dw_news update.
Template Making Script
If you are comfortable with using Python on the command line, here is a script that can help you make a template with all the bugs in a CSV download of the week's bugs.
#!/usr/bin/env python # usage: python code_tour_template.py bugs-2009-09-15.csv import csv, re, sys def parse_assignment(assign): """Attempt to parse the assignment for the submitter's username. Use the full assignment field otherwise.""" # [:username] match = re.search('\[\:([a-z0-9_]+)\]', assign); try: return "".join(['<user name="', match.group(1), '">']) except (IndexError, AttributeError): return assign # Get the CSV file for the bugs bugs_file = sys.argv[1] bugReader = csv.DictReader(open(bugs_file)) # This is a template for a bug record template_record = """ <b><a href="http://bugs.dwscoalition.org/show_bug.cgi?id=%(bug_id)s">Bug %(bug_id)s</a>:</b> %(title)s <b>Category:</b> %(category)s <b>Patch by:</b> %(patch_by)s <b>Description:</b> FILL IN """ # For each row in the bug CSV file, put the appropriate variables into # the template and print for row in bugReader: replacements = { "patch_by": parse_assignment(row["assigned_to_realname"]), "bug_id": row["bug_id"], "category": row["component"], "title": row["short_desc"] } print template_record % replacements