| OLD | NEW |
| 1 # Copyright 2008 Google Inc. | 1 # Copyright 2008 Google Inc. |
| 2 # | 2 # |
| 3 # Licensed under the Apache License, Version 2.0 (the "License"); | 3 # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 # you may not use this file except in compliance with the License. | 4 # you may not use this file except in compliance with the License. |
| 5 # You may obtain a copy of the License at | 5 # You may obtain a copy of the License at |
| 6 # | 6 # |
| 7 # http://www.apache.org/licenses/LICENSE-2.0 | 7 # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 # | 8 # |
| 9 # Unless required by applicable law or agreed to in writing, software | 9 # Unless required by applicable law or agreed to in writing, software |
| 10 # distributed under the License is distributed on an "AS IS" BASIS, | 10 # distributed under the License is distributed on an "AS IS" BASIS, |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 max_length=MAX_MESSAGE, | 304 max_length=MAX_MESSAGE, |
| 305 widget=forms.Textarea(attrs={'cols': 60})) | 305 widget=forms.Textarea(attrs={'cols': 60})) |
| 306 message_only = forms.BooleanField(required=False, | 306 message_only = forms.BooleanField(required=False, |
| 307 widget=forms.HiddenInput()) | 307 widget=forms.HiddenInput()) |
| 308 no_redirect = forms.BooleanField(required=False, | 308 no_redirect = forms.BooleanField(required=False, |
| 309 widget=forms.HiddenInput()) | 309 widget=forms.HiddenInput()) |
| 310 commit = forms.BooleanField(required=False, widget=forms.HiddenInput()) | 310 commit = forms.BooleanField(required=False, widget=forms.HiddenInput()) |
| 311 in_reply_to = forms.CharField(required=False, | 311 in_reply_to = forms.CharField(required=False, |
| 312 max_length=MAX_DB_KEY_LENGTH, | 312 max_length=MAX_DB_KEY_LENGTH, |
| 313 widget=forms.HiddenInput()) | 313 widget=forms.HiddenInput()) |
| 314 automated = forms.BooleanField(required=False, widget=forms.HiddenInput(), | 314 auto_generated = forms.BooleanField(required=False, |
| 315 initial=True) | 315 widget=forms.HiddenInput(), |
| 316 verbose = forms.BooleanField(required=False, widget=forms.HiddenInput()) | 316 initial=False) |
| 317 cq_dry_run = forms.BooleanField(required=False, |
| 318 widget=forms.HiddenInput(), |
| 319 initial=False) |
| 320 cq_status_url = forms.CharField(required=False, |
| 321 widget=forms.HiddenInput()) |
| 317 | 322 |
| 318 | 323 |
| 319 class MiniPublishForm(forms.Form): | 324 class MiniPublishForm(forms.Form): |
| 320 | 325 |
| 321 reviewers = forms.CharField( | 326 reviewers = forms.CharField( |
| 322 required=False, | 327 required=False, |
| 323 max_length=MAX_REVIEWERS, | 328 max_length=MAX_REVIEWERS, |
| 324 widget=AccountInput(attrs={'size': 60}), | 329 widget=AccountInput(attrs={'size': 60}), |
| 325 help_text=REQUIRED_REVIEWERS_HELP_TEXT) | 330 help_text=REQUIRED_REVIEWERS_HELP_TEXT) |
| 326 cc = forms.CharField(required=False, | 331 cc = forms.CharField(required=False, |
| 327 max_length=MAX_CC, | 332 max_length=MAX_CC, |
| 328 label = 'CC', | 333 label = 'CC', |
| 329 widget=AccountInput(attrs={'size': 60})) | 334 widget=AccountInput(attrs={'size': 60})) |
| 330 send_mail = forms.BooleanField(required=False) | 335 send_mail = forms.BooleanField(required=False) |
| 331 add_as_reviewer = forms.BooleanField(required=False, initial=True) | 336 add_as_reviewer = forms.BooleanField(required=False, initial=True) |
| 332 message = forms.CharField(required=False, | 337 message = forms.CharField(required=False, |
| 333 max_length=MAX_MESSAGE, | 338 max_length=MAX_MESSAGE, |
| 334 widget=forms.Textarea(attrs={'cols': 60})) | 339 widget=forms.Textarea(attrs={'cols': 60})) |
| 335 message_only = forms.BooleanField(required=False, | 340 message_only = forms.BooleanField(required=False, |
| 336 widget=forms.HiddenInput()) | 341 widget=forms.HiddenInput()) |
| 337 no_redirect = forms.BooleanField(required=False, | 342 no_redirect = forms.BooleanField(required=False, |
| 338 widget=forms.HiddenInput()) | 343 widget=forms.HiddenInput()) |
| 339 commit = forms.BooleanField(required=False, widget=forms.HiddenInput()) | 344 commit = forms.BooleanField(required=False, widget=forms.HiddenInput()) |
| 340 automated = forms.BooleanField(required=False, widget=forms.HiddenInput(), | 345 auto_generated = forms.BooleanField(required=False, |
| 341 initial=True) | 346 widget=forms.HiddenInput(), |
| 342 verbose = forms.BooleanField(required=False, widget=forms.HiddenInput()) | 347 initial=False) |
| 348 cq_dry_run = forms.BooleanField(required=False, |
| 349 widget=forms.HiddenInput(), |
| 350 initial=False) |
| 351 cq_status_url = forms.CharField(required=False, |
| 352 widget=forms.HiddenInput()) |
| 343 | 353 |
| 344 | 354 |
| 345 class BlockForm(forms.Form): | 355 class BlockForm(forms.Form): |
| 346 blocked = forms.BooleanField( | 356 blocked = forms.BooleanField( |
| 347 required=False, | 357 required=False, |
| 348 help_text='Should this user be blocked') | 358 help_text='Should this user be blocked') |
| 349 | 359 |
| 350 | 360 |
| 351 FORM_CONTEXT_VALUES = [(z, '%d lines' % z) for z in models.CONTEXT_CHOICES] | 361 FORM_CONTEXT_VALUES = [(z, '%d lines' % z) for z in models.CONTEXT_CHOICES] |
| 352 FORM_CONTEXT_VALUES.append(('', 'Whole file')) | 362 FORM_CONTEXT_VALUES.append(('', 'Whole file')) |
| (...skipping 3059 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3412 tbd, comments = _get_draft_comments(request, issue) | 3422 tbd, comments = _get_draft_comments(request, issue) |
| 3413 else: | 3423 else: |
| 3414 tbd = [] | 3424 tbd = [] |
| 3415 comments = [] | 3425 comments = [] |
| 3416 issue.update_comment_count(len(comments)) | 3426 issue.update_comment_count(len(comments)) |
| 3417 tbd.append(issue) | 3427 tbd.append(issue) |
| 3418 | 3428 |
| 3419 if comments: | 3429 if comments: |
| 3420 logging.warn('Publishing %d comments', len(comments)) | 3430 logging.warn('Publishing %d comments', len(comments)) |
| 3421 | 3431 |
| 3432 email_to = None |
| 3422 if request.user.email().lower() in (CQ_COMMIT_BOT_EMAIL, CQ_SERVICE_ACCOUNT): | 3433 if request.user.email().lower() in (CQ_COMMIT_BOT_EMAIL, CQ_SERVICE_ACCOUNT): |
| 3423 issue.update_cq_status_url_if_any(form.cleaned_data['message']) | 3434 if form.cleaned_data['cq_status_url']: |
| 3435 issue.update_cq_status_url_if_any( |
| 3436 form.cleaned_data['cq_status_url'].strip()) |
| 3424 | 3437 |
| 3425 # Email only the triggerer and the CL owner if it was a CQ dry run request. | 3438 if form.cleaned_data['cq_dry_run']: |
| 3426 # More details are in http://crbug.com/476883. | 3439 # Email only the triggerer and the CL owner the dry run result, |
| 3427 email_to = None | 3440 # More details are in http://crbug.com/626427. |
| 3428 # Mark CQ dry run messages as autogenerated. | 3441 email_to = list(set([issue.owner.email(), |
| 3429 # More details: http://crbug.com/596249. | 3442 issue.cq_dry_run_last_triggered_by])) |
| 3430 auto_generated = False | 3443 |
| 3431 if (request.user.email().lower() in (CQ_COMMIT_BOT_EMAIL, CQ_SERVICE_ACCOUNT) | |
| 3432 and 'dry run' in form.cleaned_data['message'].lower()): | |
| 3433 email_to = [issue.owner.email()] | |
| 3434 auto_generated = True | |
| 3435 if (issue.cq_dry_run_last_triggered_by and | |
| 3436 issue.cq_dry_run_last_triggered_by != issue.owner.email()): | |
| 3437 email_to.append(issue.cq_dry_run_last_triggered_by) | |
| 3438 msg = make_message(request, issue, | 3444 msg = make_message(request, issue, |
| 3439 form.cleaned_data['message'], | 3445 form.cleaned_data['message'], |
| 3440 comments, | 3446 comments, |
| 3441 form.cleaned_data['send_mail'], | 3447 form.cleaned_data['send_mail'], |
| 3442 draft=draft_message, | 3448 draft=draft_message, |
| 3443 email_to=email_to, | 3449 email_to=email_to, |
| 3444 in_reply_to=form.cleaned_data.get('in_reply_to'), | 3450 in_reply_to=form.cleaned_data.get('in_reply_to'), |
| 3445 auto_generated=auto_generated) | 3451 auto_generated=form.cleaned_data['auto_generated']) |
| 3446 tbd.append(msg) | 3452 tbd.append(msg) |
| 3447 | 3453 |
| 3448 for obj in tbd: | 3454 for obj in tbd: |
| 3449 obj.put() | 3455 obj.put() |
| 3450 | 3456 |
| 3451 if form.cleaned_data['commit'] and not issue.cq_dry_run and not issue.closed: | 3457 if form.cleaned_data['commit'] and not issue.cq_dry_run and not issue.closed: |
| 3452 notify_approvers_of_new_patchsets(request, issue) | 3458 notify_approvers_of_new_patchsets(request, issue) |
| 3453 | 3459 |
| 3454 notify_xmpp.notify_issue(request, issue, 'Comments published') | 3460 notify_xmpp.notify_issue(request, issue, 'Comments published') |
| 3455 | 3461 |
| (...skipping 2120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5576 return HttpResponseNotFound() | 5582 return HttpResponseNotFound() |
| 5577 tops = [] | 5583 tops = [] |
| 5578 shame = [] | 5584 shame = [] |
| 5579 for i in data: | 5585 for i in data: |
| 5580 if i.score == models.AccountStatsBase.NULL_SCORE: | 5586 if i.score == models.AccountStatsBase.NULL_SCORE: |
| 5581 shame.append(i) | 5587 shame.append(i) |
| 5582 else: | 5588 else: |
| 5583 tops.append(i) | 5589 tops.append(i) |
| 5584 return respond( | 5590 return respond( |
| 5585 request, 'leaderboard.html', {'tops': tops, 'shame': shame, 'when': when}) | 5591 request, 'leaderboard.html', {'tops': tops, 'shame': shame, 'when': when}) |
| OLD | NEW |