rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
def test_miro_bug_object(self, mock_xml_opener):
def test_old_miro_bug_object(self, mock_xml_opener):
def test_miro_bug_object(self, mock_xml_opener): # Parse XML document as if we got it from the web mock_xml_opener.return_value = lxml.etree.XML(open(os.path.join( settings.MEDIA_ROOT, 'sample-data', 'miro-2294-2009-08-06.xml')).read())
def test_full_grab_miro_bugs(self, mock_xml_opener):
def test_old_full_grab_miro_bugs(self, mock_xml_opener):
def test_full_grab_miro_bugs(self, mock_xml_opener): mock_xml_opener.return_value = lxml.etree.XML(open(os.path.join( settings.MEDIA_ROOT, 'sample-data', 'miro-2294-2009-08-06.xml')).read())
def test_miro_bugzilla_detects_closedness(self, mock_xml_opener):
def test_old_miro_bugzilla_detects_closedness(self, mock_xml_opener):
def test_miro_bugzilla_detects_closedness(self, mock_xml_opener): cooked_xml = open(os.path.join( settings.MEDIA_ROOT, 'sample-data', 'miro-2294-2009-08-06.xml')).read().replace( 'NEW', 'CLOSED') mock_xml_opener.return_value = lxml.etree.XML(cooked_xml)
def test_full_grab_resolved_miro_bug(self, mock_xml_opener):
def test_old_full_grab_resolved_miro_bug(self, mock_xml_opener):
def test_full_grab_resolved_miro_bug(self, mock_xml_opener): mock_xml_opener.return_value = lxml.etree.XML(open(os.path.join( settings.MEDIA_ROOT, 'sample-data', 'miro-2294-2009-08-06-RESOLVED.xml')).read())
def test_full_grab_miro_bugs_refreshes_older_bugs(self, mock_xml_opener):
def test_old_full_grab_miro_bugs_refreshes_older_bugs(self, mock_xml_opener):
def test_full_grab_miro_bugs_refreshes_older_bugs(self, mock_xml_opener): mock_xml_opener.return_value = lxml.etree.XML(open(os.path.join( settings.MEDIA_ROOT, 'sample-data', 'miro-2294-2009-08-06.xml')).read()) miro = mysite.customs.bugtrackers.bugzilla.MiroBugzilla() miro.update()
def test_regrab_miro_bugs_refreshes_older_bugs_even_when_missing_from_csv(self, mock_xml_bug_tree, mock_xml_opener):
def test_old_regrab_miro_bugs_refreshes_older_bugs_even_when_missing_from_csv(self, mock_xml_bug_tree, mock_xml_opener):
def test_regrab_miro_bugs_refreshes_older_bugs_even_when_missing_from_csv(self, mock_xml_bug_tree, mock_xml_opener): mock_xml_opener.return_value = lxml.etree.XML(open(os.path.join( settings.MEDIA_ROOT, 'sample-data', 'miro-2294-2009-08-06.xml')).read())
def test_save_portfolio_entry(self): url = reverse(mysite.profile.views.save_portfolio_entry_do) portfolio_entry = PortfolioEntry.objects.get_or_create( project=Project.objects.get_or_create(name='project name')[0], person=Person.objects.get(user__username='paulproteus'))[0]
def setUp(self): TwillTests.setUp(self) self.user = "paulproteus" self.portfolio_entry = PortfolioEntry.objects.get_or_create( project=Project.objects.get_or_create(name='project name')[0], person=Person.objects.get(user__username=self.user))[0]
def test_save_portfolio_entry(self): url = reverse(mysite.profile.views.save_portfolio_entry_do)
portfolio_entry=portfolio_entry, data_import_attempt=DataImportAttempt.objects.get_or_create( source='rs', query='paulproteus', completed=True, person=Person.objects.get(user__username='paulproteus'))[0] )
portfolio_entry=self.portfolio_entry, data_import_attempt=DataImportAttempt.objects.get_or_create( source='rs', query=self.user, completed=True, person=Person.objects.get(user__username=self.user))[0] )
def test_save_portfolio_entry(self): url = reverse(mysite.profile.views.save_portfolio_entry_do)
input = { 'portfolio_entry__pk': portfolio_entry.pk,
self.experience_description = [ 'This is a multiparagraph experience description.', 'This is the second paragraph.', 'This is the third paragraph.'] self.project_description = [ 'This is a multiparagraph project description.', 'This is the second paragraph.', 'This is the third paragraph.'] self.POST_data = { 'portfo...
def test_save_portfolio_entry(self): url = reverse(mysite.profile.views.save_portfolio_entry_do)
'project_description': "project description", 'experience_description': "experience description",
'project_description': "\n".join(self.project_description), 'experience_description': "\n".join(self.experience_description)
def test_save_portfolio_entry(self): url = reverse(mysite.profile.views.save_portfolio_entry_do)
'portfolio_entry__pk': portfolio_entry.pk
'portfolio_entry__pk': self.portfolio_entry.pk
def test_save_portfolio_entry(self): url = reverse(mysite.profile.views.save_portfolio_entry_do)
self.assertEqual( simplejson.loads(self.login_with_client().post(url, input).content), expected_output)
self.assertEqual(simplejson.loads(self.post_result.content), expected_output)
def test_save_portfolio_entry(self): url = reverse(mysite.profile.views.save_portfolio_entry_do)
portfolio_entry = PortfolioEntry.objects.get(pk=portfolio_entry.pk)
portfolio_entry = PortfolioEntry.objects.get(pk=self.portfolio_entry.pk)
def test_save_portfolio_entry(self): url = reverse(mysite.profile.views.save_portfolio_entry_do)
input['project_description'])
self.POST_data['project_description'])
def test_save_portfolio_entry(self): url = reverse(mysite.profile.views.save_portfolio_entry_do)
input['experience_description'])
self.POST_data['experience_description'])
def test_save_portfolio_entry(self): url = reverse(mysite.profile.views.save_portfolio_entry_do)
ret['importance'] = 'N/A'
ret['importance'] = ''
def as_data_dict_for_bug_object(self): trac_data = self.as_bug_specific_csv_data() html_data = self.get_parsed_bug_html_page()
get_relevant_person_data = lambda p: ( {'name': person.get_full_name_or_username(), 'location': location or DEFAULT_LOCATION})
get_relevant_person_data = lambda p: ( {'name': p.get_full_name_or_username(), 'location': p.location_display_name or DEFAULT_LOCATION})
def people(request): """Display a list of people.""" # {{{ data = {} # pull in q from GET query = request.GET.get('q', '') data['raw_query'] = query data.update(mysite.profile.controllers.parse_string_query(query)) if data['query_type'] != 'project': # Figure out which projects happen to match that projects_that_mat...
available_projects = [k['project__name'] for k in bugs.values('project__name').distinct()]
available_projects = [k['project__name'] for k in bugs.values('project__name').order_by('project__name').distinct()]
def get_possible_facets(self):
query_data = [ { 'canned_query': 'open', } ]
query_objs = gt.googlequery_set.all() query_data = [] for query_obj in query_objs: one_query = { 'max_results': 10000, 'canned_query': 'open', 'label': query_obj.label } query_data.append(one_query)
def generate_current_bug_atom(self): query_data = [ { 'canned_query': 'open', } ] queries = [] for kwargs in query_data: queries.append(create_google_query(**kwargs)) return self.generate_bug_atom_from_queries(queries)
ret_dict['good_for_newcomers'] = (gt.bitesized_text in labels) ret_dict['bite_size_tag_name'] = gt.bitesized_text
if gt.bitesized_type == 'label': ret_dict['good_for_newcomers'] = (gt.bitesized_text in labels) ret_dict['bite_size_tag_name'] = gt.bitesized_label
def extract_tracker_specific_data(issue, ret_dict): # Make modifications to ret_dict using provided atom data labels = [label.text for label in issue.label] ret_dict['good_for_newcomers'] = (gt.bitesized_text in labels) ret_dict['bite_size_tag_name'] = gt.bitesized_text # Check whether documentation bug ret_dict['conce...
ret_dict['concerns_just_documentation'] = (gt.documentation_text in labels)
if gt.documentation_type == 'label': ret_dict['concerns_just_documentation'] = (gt.documentation_text in labels)
def extract_tracker_specific_data(issue, ret_dict): # Make modifications to ret_dict using provided atom data labels = [label.text for label in issue.label] ret_dict['good_for_newcomers'] = (gt.bitesized_text in labels) ret_dict['bite_size_tag_name'] = gt.bitesized_text # Check whether documentation bug ret_dict['conce...
if product == 'docs': ret_dict['concerns_just_documentation'] = True
ret_dict['concerns_just_documentation'] = (product == 'docs')
def extract_tracker_specific_data(xml_data, ret_dict): # Make modifications to ret_dict using provided metadata keywords_text = mysite.customs.bugtrackers.bugzilla.get_tag_text_from_xml(xml_data, 'keywords') keywords = map(lambda s: s.strip(), keywords_text.split(',')) ret_dict['good_for_newcomers'] = ('junior-jobs' in...
opps_query_string = { u'q': query, u'start': 11, u'end': 20} opps_url = make_twill_url('http://openhatch.org'+reverse(opps_view) + '?' + mysite.base.unicode_sanity.urlencode(opps_query_string))
GET = { u'q': query, u'start': 11, u'end': 20} query_string = mysite.base.unicode_sanity.urlencode(GET) opps_url = make_twill_url('http://openhatch.org'+reverse(opps_view) + '?' + query_string)
def exercise_alert(self, anonymous=True): """The 'anonymous' parameter allows the alert functionality to be tested for anonymous and logged-in users."""
'query': query,
'query_string': query_string,
def exercise_alert(self, anonymous=True): """The 'anonymous' parameter allows the alert functionality to be tested for anonymous and logged-in users."""
'this_page_query_str': '?q=old_query_string'
def exercise_alert(self, anonymous=True): """The 'anonymous' parameter allows the alert functionality to be tested for anonymous and logged-in users."""
self.assert_(alert_data_in_form['this_page_query_str'] in redirect_target_url)
self.assert_(query_string in redirect_target_url)
def exercise_alert(self, anonymous=True): """The 'anonymous' parameter allows the alert functionality to be tested for anonymous and logged-in users."""
del assert_that_record_has_this_data['this_page_query_str']
def exercise_alert(self, anonymous=True): """The 'anonymous' parameter allows the alert functionality to be tested for anonymous and logged-in users."""
for query_name in queries: query_url = queries[query_name]
if type(queries) == type({}): queries = [queries[query_name] for query_name in queries] for query_url in queries:
def generate_bug_xml_from_queries(self, queries): for query_name in queries: query_url = queries[query_name] # Check if this url has been accessed in the last day if url_is_more_fresh_than_one_day(query_url): # Sweet, ignore this one and go on. logging.info("[Bugzilla] URL %s is fresh, skipping..." % query_url) continu...
return add_tracker_url(request, tracker_type=tracker_type)
return HttpResponseRedirect(reverse(add_tracker_url, args=[tracker_type, project_name]))
def add_tracker_url_do(request, tracker_type, project_name): url_form = None if tracker_type in all_trackers: tracker_obj = all_trackers[tracker_type]['model'].all_trackers.get( project_name=project_name) url_obj = all_trackers[tracker_type]['urlmodel']( tracker=tracker_obj) url_form = all_trackers[tracker_type]['urlfo...
u'sidebar_name': u"main project language",
u'sidebar_heading': u"Pick a language",
def get_possible_facets(self):
u'sidebar_name': u'project',
u'sidebar_heading': u'Pick a project',
def get_possible_facets(self):
u'sidebar_name': u"toughness",
u'sidebar_heading': u"Show just bitesize bugs?",
def get_possible_facets(self):
u'sidebar_name': u"kind of help needed",
u'sidebar_heading': u"Just bugs labeled...",
def get_possible_facets(self):
.filter(bug__looks_closed=True)
.filter(bug__looks_closed=False)
def get_project_names(self): from django.db.models import Count
params={'query': username}, many=True, person=person)
params={u'query': unicode(username)}, many=True, person=person)
def get_contribution_info_by_username(self, username, person=None): '''Input: A username. We go out and ask Ohloh, "What repositories have you indexed where that username was a committer?" Optional: a Person model, which is used to log messages to the user in case Ohloh is being slow.
if tracker_type == 'bugzilla': trackers = mysite.customs.models.BugzillaTracker.all_trackers.all() else: trackers = [] data['tracker_type'] = tracker_type data['trackers'] = trackers
else: tracker_type = 'bugzilla' else: tracker_type = 'bugzilla' if tracker_type == 'bugzilla': trackers = mysite.customs.models.BugzillaTracker.all_trackers.all() else: trackers = [] data['tracker_type'] = tracker_type data['trackers'] = trackers
def list_trackers(request, tracker_types_form=None): data = {} if request.POST: tracker_types_form = mysite.customs.forms.TrackerTypesForm( request.POST, prefix='list_trackers') if tracker_types_form.is_valid(): tracker_type = tracker_types_form.cleaned_data['tracker_type'] if tracker_type == 'bugzilla': trackers = mys...
if notification_id == 'add-success': data['customs_notification'] = 'Bugtracker successfully added! Bugs from this tracker should start appearing within 24 hours.' elif notification_id == 'edit-success': data['customs_notification'] = 'Bugtracker successfully edited! New settings should take effect within 24 hours.' el...
notifications = { 'add-success': 'Bugtracker successfully added! Bugs from this tracker should start appearing within 24 hours.', 'edit-success': 'Bugtracker successfully edited! New settings should take effect within 24 hours.', 'delete-success': 'Bugtracker successfully deleted!', 'tracker-existence-fail': 'Hmm, coul...
def list_trackers(request, tracker_types_form=None): data = {} if request.POST: tracker_types_form = mysite.customs.forms.TrackerTypesForm( request.POST, prefix='list_trackers') if tracker_types_form.is_valid(): tracker_type = tracker_types_form.cleaned_data['tracker_type'] if tracker_type == 'bugzilla': trackers = mys...
tracker_types_form = mysite.customs.forms.TrackerTypesForm()
tracker_types_form = mysite.customs.forms.TrackerTypesForm(prefix='list_trackers')
def list_trackers(request, tracker_types_form=None): data = {} if request.POST: tracker_types_form = mysite.customs.forms.TrackerTypesForm( request.POST, prefix='list_trackers') if tracker_types_form.is_valid(): tracker_type = tracker_types_form.cleaned_data['tracker_type'] if tracker_type == 'bugzilla': trackers = mys...
tracker_form = mysite.customs.forms.BugzillaTrackerForm()
tracker_form = mysite.customs.forms.BugzillaTrackerForm(prefix='add_tracker')
def add_tracker(request, tracker_type=None, tracker_form=None): data = {} if tracker_type == 'bugzilla': data['action_url'] = reverse('add_tracker_specific_do', args=[tracker_type]) if tracker_form is None: tracker_form = mysite.customs.forms.BugzillaTrackerForm() else: # Wrong or no tracker type data['action_url'] = r...
tracker_form = mysite.customs.forms.TrackerTypesForm()
tracker_form = mysite.customs.forms.TrackerTypesForm(prefix='add_tracker')
def add_tracker(request, tracker_type=None, tracker_form=None): data = {} if tracker_type == 'bugzilla': data['action_url'] = reverse('add_tracker_specific_do', args=[tracker_type]) if tracker_form is None: tracker_form = mysite.customs.forms.BugzillaTrackerForm() else: # Wrong or no tracker type data['action_url'] = r...
instance=bugzilla_url)
instance=bugzilla_url, prefix='add_tracker_url')
def add_tracker_url(request, tracker_type, project_name, url_form=None): data = {} if tracker_type == 'bugzilla': if url_form is None: if project_name: try: bugzilla_tracker = mysite.customs.models.BugzillaTracker.all_trackers.get( project_name=project_name) bugzilla_url = mysite.customs.models.BugzillaUrl( bugzilla_tr...
url_form = mysite.customs.forms.BugzillaUrlForm()
url_form = mysite.customs.forms.BugzillaUrlForm(prefix='add_tracker_url')
def add_tracker_url(request, tracker_type, project_name, url_form=None): data = {} if tracker_type == 'bugzilla': if url_form is None: if project_name: try: bugzilla_tracker = mysite.customs.models.BugzillaTracker.all_trackers.get( project_name=project_name) bugzilla_url = mysite.customs.models.BugzillaUrl( bugzilla_tr...
instance=bugzilla_tracker)
instance=bugzilla_tracker, prefix='edit_tracker')
def edit_tracker(request, tracker_type, project_name, tracker_form=None): data = {} if tracker_type == 'bugzilla': try: bugzilla_tracker = mysite.customs.models.BugzillaTracker.all_trackers.get( project_name=project_name) if tracker_form is None: tracker_form = mysite.customs.forms.BugzillaTrackerForm( instance=bugzill...
request.POST, prefix='edit_tracker')
request.POST, instance=bugzilla_tracker, prefix='edit_tracker')
def edit_tracker_do(request, tracker_type, project_name): if tracker_type == 'bugzilla': tracker_form = mysite.customs.forms.BugzillaTrackerForm( request.POST, prefix='edit_tracker') if tracker_form.is_valid(): tracker_form.save() return HttpResponseRedirect(reverse(list_trackers) + '?notification_id=edit-success') els...
instance=bugzilla_url)
instance=bugzilla_url, prefix='edit_tracker_url')
def edit_tracker_url(request, tracker_type, project_name, url_form=None): data = {} url = request.GET.get('url', None) if tracker_type == 'bugzilla': if url_form is None: if url: try: bugzilla_url = mysite.customs.models.BugzillaUrl.objects.get(url=url) url_form = mysite.customs.forms.BugzillaUrlForm( instance=bugzilla...
enabled = True
enabled = False
def extract_tracker_specific_data(xml_data, ret_dict): # Make modifications to ret_dict using provided metadata # Check for the bitesized keyword keywords_text = mysite.customs.bugtrackers.bugzilla.get_tag_text_from_xml(xml_data, 'keywords') keywords = map(lambda s: s.strip(), keywords_text.split(',')) ret_dict['good_f...
'answer__text': """Help produce official documentation, share the solution to a problem, or check, proof and test other documents for accuracy.""",
'answer__text': """Help produce official documentation, share \ the solution to a problem, or check, proof and test other documents for \ accuracy.""",
def test_create_answer(self):
def bugzilla_tracker_factory(params):
def bugzilla_tracker_factory(bt):
def bugzilla_tracker_factory(params): # Create '__init__' method def __init__(self): BugzillaBugTracker.__init__(self, base_url=params['base_url'], project_name=params['project_name'], bug_project_name_format=params.get('bug_project_name_format', '')) if not (params.get('bug_queries') and params.get('tracker_bug_url')...
base_url=params['base_url'], project_name=params['project_name'], bug_project_name_format=params.get('bug_project_name_format', '')) if not (params.get('bug_queries') and params.get('tracker_bug_url')): raise ValueError('Either bug_queries or tracker_bug_url must be defined.') def generate_current_bug_xml(self): que...
base_url=bt.base_url, project_name=bt.project_name bug_project_name_format=bt.bug_project_name_format def generate_current_bug_xml(self): queries = bt.query_url
def __init__(self): BugzillaBugTracker.__init__(self, base_url=params['base_url'], project_name=params['project_name'], bug_project_name_format=params.get('bug_project_name_format', ''))
return mysite.customs.bugtrackers.bugzilla.tracker_bug2bug_ids(params.get('tracker_bug_url'))
return mysite.customs.bugtrackers.bugzilla.tracker_bug2bug_ids(bt.query_url)
def get_current_bug_id_list(self): return mysite.customs.bugtrackers.bugzilla.tracker_bug2bug_ids(params.get('tracker_bug_url'))
if params.get('bitesized_keyword'): ret_dict['good_for_newcomers'] = (params['bitesized_keyword'] in keywords) ret_dict['bite_size_tag_name'] = params['bitesized_keyword']
if bt.bitesized_type == 'key':: ret_dict['good_for_newcomers'] = (bt.bitesized_text in keywords) ret_dict['bite_size_tag_name'] = bt.bitesized_text
def extract_tracker_specific_data(xml_data, ret_dict): # Make modifications to ret_dict using provided metadata # Get keywords first since used in multiple checks keywords_text = mysite.customs.bugtrackers.bugzilla.get_tag_text_from_xml(xml_data, 'keywords') keywords = map(lambda s: s.strip(), keywords_text.split(','))
elif params.get('bitesized_whiteboard_tag'):
elif bt.bitesized_type == 'wboard':
def extract_tracker_specific_data(xml_data, ret_dict): # Make modifications to ret_dict using provided metadata # Get keywords first since used in multiple checks keywords_text = mysite.customs.bugtrackers.bugzilla.get_tag_text_from_xml(xml_data, 'keywords') keywords = map(lambda s: s.strip(), keywords_text.split(','))
ret_dict['good_for_newcomers'] = (whiteboard_text == params['bitesized_whiteboard_tag']) ret_dict['bite_size_tag_name'] = params['bitesized_whiteboard_tag']
ret_dict['good_for_newcomers'] = (whiteboard_text == bt.bitesized_text) ret_dict['bite_size_tag_name'] = bt.bitesized_text
def extract_tracker_specific_data(xml_data, ret_dict): # Make modifications to ret_dict using provided metadata # Get keywords first since used in multiple checks keywords_text = mysite.customs.bugtrackers.bugzilla.get_tag_text_from_xml(xml_data, 'keywords') keywords = map(lambda s: s.strip(), keywords_text.split(','))
if params.get('documentation_keyword'): ret_dict['concerns_just_documentation'] = (params['documentation_keyword'] in keywords)
if bt.documentation_type == 'key': ret_dict['concerns_just_documentation'] = (bt.documentation_text in keywords)
def extract_tracker_specific_data(xml_data, ret_dict): # Make modifications to ret_dict using provided metadata # Get keywords first since used in multiple checks keywords_text = mysite.customs.bugtrackers.bugzilla.get_tag_text_from_xml(xml_data, 'keywords') keywords = map(lambda s: s.strip(), keywords_text.split(','))
elif params.get('documentation_component'):
elif bt.documentation_type == 'comp':
def extract_tracker_specific_data(xml_data, ret_dict): # Make modifications to ret_dict using provided metadata # Get keywords first since used in multiple checks keywords_text = mysite.customs.bugtrackers.bugzilla.get_tag_text_from_xml(xml_data, 'keywords') keywords = map(lambda s: s.strip(), keywords_text.split(','))
ret_dict['concerns_just_documentation'] = (component == params['documentation_component'])
ret_dict['concerns_just_documentation'] = (component == bt.documentation_text)
def extract_tracker_specific_data(xml_data, ret_dict): # Make modifications to ret_dict using provided metadata # Get keywords first since used in multiple checks keywords_text = mysite.customs.bugtrackers.bugzilla.get_tag_text_from_xml(xml_data, 'keywords') keywords = map(lambda s: s.strip(), keywords_text.split(','))
elif params.get('documentation_product'):
elif bt.documentation_type == 'prod':
def extract_tracker_specific_data(xml_data, ret_dict): # Make modifications to ret_dict using provided metadata # Get keywords first since used in multiple checks keywords_text = mysite.customs.bugtrackers.bugzilla.get_tag_text_from_xml(xml_data, 'keywords') keywords = map(lambda s: s.strip(), keywords_text.split(','))
ret_dict['concerns_just_documentation'] = (product == params['documentation_product']) if params.get('as_appears_in_distribution'): ret_dict['as_appears_in_distribution'] = params['as_appears_in_distribution']
ret_dict['concerns_just_documentation'] = (product == bt.documentation_text) ret_dict['as_appears_in_distribution'] = bt.as_appears_in_distribution
def extract_tracker_specific_data(xml_data, ret_dict): # Make modifications to ret_dict using provided metadata # Get keywords first since used in multiple checks keywords_text = mysite.customs.bugtrackers.bugzilla.get_tag_text_from_xml(xml_data, 'keywords') keywords = map(lambda s: s.strip(), keywords_text.split(','))
if params.get('bug_queries'):
if bt.query_url_type = 'xml':
#def generate_bug_project_name(self, bb): #return params['project_name']
if not params.get('bug_project_name_format'): raise ValueError('bug_project_name_format must be defined - overloading not supported at this time.')
#def generate_bug_project_name(self, bb): #return params['project_name']
sub-class_name = '%sBugzilla' % params['project_name'].replace(' ', '')
sub-class_name = '%sBugzilla' % bt.project_name.replace(' ', '')
#def generate_bug_project_name(self, bb): #return params['project_name']
tracker_params = { 'Miro': { 'project_name': 'Miro', 'base_url': 'http://bugzilla.pculture.org/', 'bug_project_name_format': '{project}', 'bug_queries': { 'Easy bugs': 'http://bugzilla.pculture.org/buglist.cgi?bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&field-1-0-0=bug_status&field-1-1-0=product&field-1-2-0=...
def generate_bugzilla_tracker_classes(tracker_name=None): # List of data for the trackers. # FIXME: This should be replaced by a database. tracker_params = { 'Miro': { 'project_name': 'Miro', 'base_url': 'http://bugzilla.pculture.org/', 'bug_project_name_format': '{project}', 'bug_queries': { 'Easy bugs': 'http://bugzi...
params = tracker_params[tracker_name] return bugzilla_tracker_factory(params)
try: bt = customs.models.BugzillaTracker.all_trackers.get(project_name=tracker_name) return bugzilla_tracker_factory(bt) except mysite.customs.models.BugzillaTracker.DoesNotExist: return None
def generate_bugzilla_tracker_classes(tracker_name=None): # List of data for the trackers. # FIXME: This should be replaced by a database. tracker_params = { 'Miro': { 'project_name': 'Miro', 'base_url': 'http://bugzilla.pculture.org/', 'bug_project_name_format': '{project}', 'bug_queries': { 'Easy bugs': 'http://bugzi...
for tracker in tracker_params: params = tracker_params[tracker] yield bugzilla_tracker_factory(params)
for bt in mysite.customs.models.BugzillaTracker.all_trackers.all(): yield bugzilla_tracker_factory(bt)
def generate_bugzilla_tracker_classes(tracker_name=None): # List of data for the trackers. # FIXME: This should be replaced by a database. tracker_params = { 'Miro': { 'project_name': 'Miro', 'base_url': 'http://bugzilla.pculture.org/', 'bug_project_name_format': '{project}', 'bug_queries': { 'Easy bugs': 'http://bugzi...
'celery==1.0',
'celery==1.0.5',
def read(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read()
for bug_id in RoundupBugTracker.csv_url2bugs(url):
for bug_id in mysite.customs.models.RoundupBugTracker.csv_url2bugs(url):
def run(self, **kwargs): logger = self.get_logger(**kwargs) logger.info("Started to grab the list of Python documentation bugs.") url = 'http://bugs.python.org/issue?status=1%2C3&%40sort=activity&%40columns=id&%40startwith=0&%40group=priority&%40filter=status%2Ccomponents&components=4&%40action=export_csv' for bug_id i...
for bug_id in RoundupBugTracker.csv_url2bugs(url):
for bug_id in mysite.customs.models.RoundupBugTracker.csv_url2bugs(url):
def run(self, **kwargs): logger = self.get_logger(**kwargs) logger.info("Started to grab the list of Python easy bugs.") url = 'http://bugs.python.org/issue?status=1%2C3&%40sort=activity&%40columns=id&%40startwith=0&%40group=priority&%40filter=status%2Ckeywords&keywords=6&%40action=export_csv' for bug_id in RoundupBugT...
rpt = RoundupBugTracker.objects.get(name='GrabPythonBugs') except RoundupBugTracker.DoesNotExist:
rpt = mysite.customs.models.RoundupBugTracker.objects.get(name='GrabPythonBugs') except mysite.customs.models.RoundupBugTracker.DoesNotExist:
def run(self, bug_id, **kwargs): logger = self.get_logger(**kwargs) logger.info("Was asked to look at bug %d in Python" % bug_id) # If the bug is already in our database, just skip the # request. url = 'http://bugs.python.org/issue%d' % bug_id matching_bugs = mysite.search.models.Bug.all_bugs.filter( canonical_bug_link...
rpts = RoundupBugTracker.objects.filter(roundup_root_url=roundup_root_url)
rpts = mysite.customs.models.RoundupBugTracker.objects.filter(roundup_root_url=roundup_root_url)
def run(self, **kwargs): logger = self.get_logger(**kwargs) logger.info("Started to grab Python 'easy' bugs") bug_tracker_name = self.__class__.__name__ python_core, _ = mysite.search.models.Project.objects.get_or_create(name='Python', language='Python')
p, _ = RoundupBugTracker.objects.get_or_create(name=bug_tracker_name, project=python_core)
p, _ = mysite.customs.models.RoundupBugTracker.objects.get_or_create(name=bug_tracker_name, project=python_core)
def run(self, **kwargs): logger = self.get_logger(**kwargs) logger.info("Started to grab Python 'easy' bugs") bug_tracker_name = self.__class__.__name__ python_core, _ = mysite.search.models.Project.objects.get_or_create(name='Python', language='Python')
'last_polled': ('django.db.models.fields.DateTimeField', [], {}),
'last_polled': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(1970, 1, 1, 0, 0)'}),
def backwards(self, orm): "Write your backwards migration here"
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '200'})
'logo_contains_name': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), 'modified_date': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '200', 'unique': 'True'}), 'people_who_wanna_...
def backwards(self, orm): "Write your backwards migration here"
def get_facet_option_data(option_name): caller_query = self GET_data = dict(self.active_facet_options) GET_data.update({ u'q': unicode(self.terms_string), unicode(facet_name): unicode(option_name), }) query_string = mysite.base.unicode_sanity.urlencode(GET_data) query = Query.create_from_GET_data(GET_data) the_...
options = [self.get_facet_option_data(facet_name, n) for n in option_names] return sorted(options, key=lambda x: 0 - x['count'])
def get_facet_option_data(option_name):
projects = ( mysite.search.models.Project.objects.filter(pk__in=list(bugs.values_list(u'project__pk', flat=True).distinct())) .filter(bug__looks_closed=False) .annotate(Count('bug')) .order_by('-bug__count') )
project_ids = list(bugs.values_list(u'project__id', flat=True).distinct()) projects = Project.objects.filter(id__in=project_ids)
def get_project_names(self): from django.db.models import Count
req = mechanize_get(nice_url)
req = mechanize_get(url)
def link_works(url): try: req = mechanize_get(nice_url) except urllib2.URLError, e: return False return True
forwarder = visible_forwarders_matching_user[0].address
forwarder = visible_forwarders_matching_user[0].get_email_address()
def put_forwarder_in_contact_blurb_if_they_want(str, user): forwarder_magic_string = u'$fwd' # if they want a forwarder if not string.count(str, forwarder_magic_string) == 0: visible_forwarders_matching_user = mysite.profile.models.Forwarder.objects.filter(user=user, stops_being_listed_on__gt=datetime.datetime.utcnow()...
warning("patch file incomplete - %s" % filename)
warning("patch file incomplete")
def parse(self, stream): """ parse unified diff """ self.header = []
def delete_very_old_bugs(self, days, hours=0):
def delete_old_bugs(self, days, hours=0):
def delete_very_old_bugs(self, days, hours=0): x_days_ago = (datetime.datetime.now() - datetime.timedelta(days=days, hours=hours)) Bug.all_bugs.filter(last_polled__lt=x_days_ago).delete()
self.assert_(response.context['svn_checkout_success'])
def test_do_checkout_mission_correctly(self): self.client.post(reverse(views.svn_resetrepo)) response = self.client.get(reverse(views.svn_checkout)) checkoutdir = tempfile.mkdtemp() try: subprocess.check_call(['svn', 'checkout', response.context['checkout_url'], checkoutdir]) word = open(os.path.join(checkoutdir, respo...
self.assertFalse(response.context['svn_checkout_success'])
def test_do_checkout_mission_incorrectly(self): self.client.post(reverse(views.svn_resetrepo)) response = self.client.post(reverse(views.svn_checkout_submit), {'secret_word': 'not_the_secret_word'}) self.assertFalse(response.context['svn_checkout_success']) paulproteus = Person.objects.get(user__username='paulproteus')...
self.assert_(response.context['svn_diff_success'])
def test_do_diff_mission_correctly(self): self.client.post(reverse(views.svn_resetrepo)) response = self.client.get(reverse(views.svn_checkout)) checkoutdir = tempfile.mkdtemp() try: # Check the repository out and make the required change. subprocess.check_call(['svn', 'checkout', response.context['checkout_url'], chec...
logging.info("About to run %s" % callable")
logging.info("About to run %s" % callable)
def handle(self, *args, **options): # Make celery always eager, baby # A bunch of classes whose .run() we want to .delay() dot_run_these = [ # Twisted mysite.search.tasks.trac_instances.LearnAboutNewEasyTwistedBugs, mysite.search.tasks.trac_instances.RefreshAllTwistedEasyBugs, ] for thing in dot_run_these: thing().run...
def test(self):
def test_on_mark_looks_closed(self):
def test(self): # There's no Epoch for bugs yet, right? now = mysite.search.models.Epoch.get_for_model(mysite.search.models.Bug) self.assertEqual(now, mysite.search.models.Epoch.zero_hour)
def test_on_delete(self): now = mysite.search.models.Epoch.get_for_model(mysite.search.models.Bug) self.assertEqual(now, mysite.search.models.Epoch.zero_hour) p = mysite.search.models.Project.create_dummy() b = mysite.search.models.Bug.create_dummy(project=p) now = mysite.search.models.Epoch.get_for_model(mysite.se...
def test(self): # There's no Epoch for bugs yet, right? now = mysite.search.models.Epoch.get_for_model(mysite.search.models.Bug) self.assertEqual(now, mysite.search.models.Epoch.zero_hour)
new_image_fd, old.field_name, old.name, old.content_type, new_image_fd.len, old.charset)
name='', file=new_image_fd, content_type=None, size=new_image_fd.len, charset=None)
def clean_photo(self): # Safe copy of data... self.cleaned_data['photo'].seek(0) data = self.cleaned_data['photo'].read() self.cleaned_data['photo'].seek(0) data_fd = StringIO.StringIO(data)
self.assertEqual(lucky_projects, ['Twisted'])
self.assertEqual([k.name for k in lucky_projects], ['Myproject'])
def test(self): # Steps for this test # 1. User POSTs to the wannahelp POST handler, indicating the request came from offsite # 2. User is redirected to a login page that knows the request came from offsite project_id = Project.create_dummy(name='Myproject').id
python_core, _ = Project.objects.get_or_create(name='Python (project)', language='Python')
python_core, _ = Project.objects.get_or_create(name='Python', language='Python')
def run(self, **kwargs): logger = self.get_logger(**kwargs) logger.info("Started to grab Python 'easy' bugs") bug_tracker_name = self.__class__.__name__ python_core, _ = Project.objects.get_or_create(name='Python (project)', language='Python') # FIXME: Do we need this line? RoundupBugTracker.objects.filter(name=bug_tra...
python_core, _ = Project.objects.get_or_create(name='Python (project)', language='Python')
python_core, _ = Project.objects.get_or_create(name='Python', language='Python')
def run(self, **kwargs): logger = self.get_logger(**kwargs) logger.info("Started to grab Python documentation bugs") bug_tracker_name = self.__class__.__name__ python_core, _ = Project.objects.get_or_create(name='Python (project)', language='Python') # FIXME: Do we need this line? RoundupBugTracker.objects.filter(name=...
self.project = mysite.search.models.Project.objects.get(name=project_name)
self.project, _ = mysite.search.models.Project.objects.get_or_create(name=project_name)
def __init__(self, root_url, project_name): assert root_url[-1] == '/' assert root_url[-2] != '/' self.root_url = unicode(root_url) self.project = mysite.search.models.Project.objects.get(name=project_name)
project_name=bt.project_name bug_project_name_format=bt.bug_project_name_format
project_name=bt.project_name, bug_project_name_format=bt.bug_project_name_format)
def __init__(self): BugzillaBugTracker.__init__(self, base_url=bt.base_url, project_name=bt.project_name bug_project_name_format=bt.bug_project_name_format
if bt.bitesized_type == 'key'::
if bt.bitesized_type == 'key':
def extract_tracker_specific_data(xml_data, ret_dict): # Make modifications to ret_dict using provided metadata # Get keywords first since used in multiple checks keywords_text = mysite.customs.bugtrackers.bugzilla.get_tag_text_from_xml(xml_data, 'keywords') keywords = map(lambda s: s.strip(), keywords_text.split(','))
if bt.query_url_type = 'xml':
if bt.query_url_type == 'xml':
#def generate_bug_project_name(self, bb): #return bt.project_name
sub-class_name = '%sBugzilla' % bt.project_name.replace(' ', '') return type(sub-class_name, (BugzillaBugTracker,), class_dict)
subclass_name = '%sBugzilla' % bt.project_name.replace(' ', '') return type(subclass_name, (BugzillaBugTracker,), class_dict)
#def generate_bug_project_name(self, bb): #return bt.project_name
return bugzilla_tracker_factory(bt)
bt_class = bugzilla_tracker_factory(bt)
def generate_bugzilla_tracker_classes(tracker_name=None): # If a tracker name was passed in then return the # specific sub-class for that tracker. if tracker_name: try: bt = customs.models.BugzillaTracker.all_trackers.get(project_name=tracker_name) return bugzilla_tracker_factory(bt) except mysite.customs.models.Bugzil...
return None
bt_class = None yield bt_class return
def generate_bugzilla_tracker_classes(tracker_name=None): # If a tracker name was passed in then return the # specific sub-class for that tracker. if tracker_name: try: bt = customs.models.BugzillaTracker.all_trackers.get(project_name=tracker_name) return bugzilla_tracker_factory(bt) except mysite.customs.models.Bugzil...
@mock.patch('urllib2.urlopen', mock.Mock(return_value=open(closed_bug_filename))) def test_scrape_bug_status_and_mark_as_closed(self):
@mock.patch('urllib2.urlopen') def test_scrape_bug_status_and_mark_as_closed(self, mock_urlopen): mock_urlopen.return_value=open(RoundupGrab.closed_bug_filename)
def _test_we_save_ohloh_data_in_failure(self): # Create a DIA # Ask it to do_what_it_says_on_the_tin # That will cause it to go out to the network and download some data from Ohloh. # Two cases to verify: # 2. Success - verify that we store the same data Ohloh gave us back paulproteus = Person.objects.get(user__usernam...
repos = mysite.customs.github.info_by_username('phinze')
repos = mysite.customs.github.repos_by_username('phinze')
def test_find_tircd_for_phinze(self): '''This test gives our github info_by_username a shot.''' repos = mysite.customs.github.info_by_username('phinze') found_tircd_yet = False for repo in repos: if repo.name == 'tircd': found_tircd_yet = True self.assertTrue(found_tircd_yet)
repo = controllers.SvnRepository(user.username)
repo = controllers.SvnRepository(self.request.user.username)
def as_dict_for_template_context(self): (data, person) = self.get_base_data_dict_and_person() data.update({ 'svn_checkout_success': False, 'svn_checkout_form': forms.CheckoutForm(), 'svn_checkout_error_message': '', 'svn_diff_success': False, 'svn_diff_form': forms.DiffForm(), 'svn_diff_error_message': '', 'mission_ste...
logger.info("Filling recommended bugs cache for all people.")
logging.info("Filling recommended bugs cache for all people.")
def fill_recommended_bugs_cache(): logger.info("Filling recommended bugs cache for all people.") for person in Person.objects.all(): suggested_searches = person.get_recommended_search_terms() # expensive? recommended_bugs = mysite.profile.controllers.recommend_bugs(suggested_searches, n=5) # cache fill logger.info("Fin...
logger.info("Finished filling recommended bugs cache for all people.")
logging.info("Finished filling recommended bugs cache for all people.")
def fill_recommended_bugs_cache(): logger.info("Filling recommended bugs cache for all people.") for person in Person.objects.all(): suggested_searches = person.get_recommended_search_terms() # expensive? recommended_bugs = mysite.profile.controllers.recommend_bugs(suggested_searches, n=5) # cache fill logger.info("Fin...