| 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 auto_generated = forms.BooleanField(required=False, | 314 automated = forms.BooleanField(required=False, widget=forms.HiddenInput(), |
| 315 widget=forms.HiddenInput(), | 315 initial=True) |
| 316 initial=False) | 316 verbose = forms.BooleanField(required=False, widget=forms.HiddenInput()) |
| 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()) | |
| 322 | 317 |
| 323 | 318 |
| 324 class MiniPublishForm(forms.Form): | 319 class MiniPublishForm(forms.Form): |
| 325 | 320 |
| 326 reviewers = forms.CharField( | 321 reviewers = forms.CharField( |
| 327 required=False, | 322 required=False, |
| 328 max_length=MAX_REVIEWERS, | 323 max_length=MAX_REVIEWERS, |
| 329 widget=AccountInput(attrs={'size': 60}), | 324 widget=AccountInput(attrs={'size': 60}), |
| 330 help_text=REQUIRED_REVIEWERS_HELP_TEXT) | 325 help_text=REQUIRED_REVIEWERS_HELP_TEXT) |
| 331 cc = forms.CharField(required=False, | 326 cc = forms.CharField(required=False, |
| 332 max_length=MAX_CC, | 327 max_length=MAX_CC, |
| 333 label = 'CC', | 328 label = 'CC', |
| 334 widget=AccountInput(attrs={'size': 60})) | 329 widget=AccountInput(attrs={'size': 60})) |
| 335 send_mail = forms.BooleanField(required=False) | 330 send_mail = forms.BooleanField(required=False) |
| 336 add_as_reviewer = forms.BooleanField(required=False, initial=True) | 331 add_as_reviewer = forms.BooleanField(required=False, initial=True) |
| 337 message = forms.CharField(required=False, | 332 message = forms.CharField(required=False, |
| 338 max_length=MAX_MESSAGE, | 333 max_length=MAX_MESSAGE, |
| 339 widget=forms.Textarea(attrs={'cols': 60})) | 334 widget=forms.Textarea(attrs={'cols': 60})) |
| 340 message_only = forms.BooleanField(required=False, | 335 message_only = forms.BooleanField(required=False, |
| 341 widget=forms.HiddenInput()) | 336 widget=forms.HiddenInput()) |
| 342 no_redirect = forms.BooleanField(required=False, | 337 no_redirect = forms.BooleanField(required=False, |
| 343 widget=forms.HiddenInput()) | 338 widget=forms.HiddenInput()) |
| 344 commit = forms.BooleanField(required=False, widget=forms.HiddenInput()) | 339 commit = forms.BooleanField(required=False, widget=forms.HiddenInput()) |
| 345 auto_generated = forms.BooleanField(required=False, | 340 automated = forms.BooleanField(required=False, widget=forms.HiddenInput(), |
| 346 widget=forms.HiddenInput(), | 341 initial=True) |
| 347 initial=False) | 342 verbose = forms.BooleanField(required=False, widget=forms.HiddenInput()) |
| 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()) | |
| 353 | 343 |
| 354 | 344 |
| 355 class BlockForm(forms.Form): | 345 class BlockForm(forms.Form): |
| 356 blocked = forms.BooleanField( | 346 blocked = forms.BooleanField( |
| 357 required=False, | 347 required=False, |
| 358 help_text='Should this user be blocked') | 348 help_text='Should this user be blocked') |
| 359 | 349 |
| 360 | 350 |
| 361 FORM_CONTEXT_VALUES = [(z, '%d lines' % z) for z in models.CONTEXT_CHOICES] | 351 FORM_CONTEXT_VALUES = [(z, '%d lines' % z) for z in models.CONTEXT_CHOICES] |
| 362 FORM_CONTEXT_VALUES.append(('', 'Whole file')) | 352 FORM_CONTEXT_VALUES.append(('', 'Whole file')) |
| (...skipping 3059 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3422 tbd, comments = _get_draft_comments(request, issue) | 3412 tbd, comments = _get_draft_comments(request, issue) |
| 3423 else: | 3413 else: |
| 3424 tbd = [] | 3414 tbd = [] |
| 3425 comments = [] | 3415 comments = [] |
| 3426 issue.update_comment_count(len(comments)) | 3416 issue.update_comment_count(len(comments)) |
| 3427 tbd.append(issue) | 3417 tbd.append(issue) |
| 3428 | 3418 |
| 3429 if comments: | 3419 if comments: |
| 3430 logging.warn('Publishing %d comments', len(comments)) | 3420 logging.warn('Publishing %d comments', len(comments)) |
| 3431 | 3421 |
| 3422 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']) |
| 3424 |
| 3425 # Email only the triggerer and the CL owner if it was a CQ dry run request. |
| 3426 # More details are in http://crbug.com/476883. |
| 3432 email_to = None | 3427 email_to = None |
| 3433 if request.user.email().lower() in (CQ_COMMIT_BOT_EMAIL, CQ_SERVICE_ACCOUNT): | 3428 # Mark CQ dry run messages as autogenerated. |
| 3434 if form.cleaned_data['cq_status_url']: | 3429 # More details: http://crbug.com/596249. |
| 3435 issue.update_cq_status_url(form.cleaned_data['cq_status_url'].strip()) | 3430 auto_generated = False |
| 3436 | 3431 if (request.user.email().lower() in (CQ_COMMIT_BOT_EMAIL, CQ_SERVICE_ACCOUNT) |
| 3437 if form.cleaned_data['cq_dry_run']: | 3432 and 'dry run' in form.cleaned_data['message'].lower()): |
| 3438 # Email only the triggerer and the CL owner the dry run result, | 3433 email_to = [issue.owner.email()] |
| 3439 # More details are in http://crbug.com/626427. | 3434 auto_generated = True |
| 3440 email_to = list(set([issue.owner.email(), | 3435 if (issue.cq_dry_run_last_triggered_by and |
| 3441 issue.cq_dry_run_last_triggered_by])) | 3436 issue.cq_dry_run_last_triggered_by != issue.owner.email()): |
| 3442 | 3437 email_to.append(issue.cq_dry_run_last_triggered_by) |
| 3443 msg = make_message(request, issue, | 3438 msg = make_message(request, issue, |
| 3444 form.cleaned_data['message'], | 3439 form.cleaned_data['message'], |
| 3445 comments, | 3440 comments, |
| 3446 form.cleaned_data['send_mail'], | 3441 form.cleaned_data['send_mail'], |
| 3447 draft=draft_message, | 3442 draft=draft_message, |
| 3448 email_to=email_to, | 3443 email_to=email_to, |
| 3449 in_reply_to=form.cleaned_data.get('in_reply_to'), | 3444 in_reply_to=form.cleaned_data.get('in_reply_to'), |
| 3450 auto_generated=form.cleaned_data['auto_generated']) | 3445 auto_generated=auto_generated) |
| 3451 tbd.append(msg) | 3446 tbd.append(msg) |
| 3452 | 3447 |
| 3453 for obj in tbd: | 3448 for obj in tbd: |
| 3454 obj.put() | 3449 obj.put() |
| 3455 | 3450 |
| 3456 if form.cleaned_data['commit'] and not issue.cq_dry_run and not issue.closed: | 3451 if form.cleaned_data['commit'] and not issue.cq_dry_run and not issue.closed: |
| 3457 notify_approvers_of_new_patchsets(request, issue) | 3452 notify_approvers_of_new_patchsets(request, issue) |
| 3458 | 3453 |
| 3459 notify_xmpp.notify_issue(request, issue, 'Comments published') | 3454 notify_xmpp.notify_issue(request, issue, 'Comments published') |
| 3460 | 3455 |
| (...skipping 2120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5581 return HttpResponseNotFound() | 5576 return HttpResponseNotFound() |
| 5582 tops = [] | 5577 tops = [] |
| 5583 shame = [] | 5578 shame = [] |
| 5584 for i in data: | 5579 for i in data: |
| 5585 if i.score == models.AccountStatsBase.NULL_SCORE: | 5580 if i.score == models.AccountStatsBase.NULL_SCORE: |
| 5586 shame.append(i) | 5581 shame.append(i) |
| 5587 else: | 5582 else: |
| 5588 tops.append(i) | 5583 tops.append(i) |
| 5589 return respond( | 5584 return respond( |
| 5590 request, 'leaderboard.html', {'tops': tops, 'shame': shame, 'when': when}) | 5585 request, 'leaderboard.html', {'tops': tops, 'shame': shame, 'when': when}) |
| OLD | NEW |