| 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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 | 162 |
| 163 | 163 |
| 164 class UploadForm(forms.Form): | 164 class UploadForm(forms.Form): |
| 165 | 165 |
| 166 subject = forms.CharField(max_length=MAX_SUBJECT) | 166 subject = forms.CharField(max_length=MAX_SUBJECT) |
| 167 description = forms.CharField(max_length=MAX_DESCRIPTION, required=False) | 167 description = forms.CharField(max_length=MAX_DESCRIPTION, required=False) |
| 168 project = forms.CharField(required=False) | 168 project = forms.CharField(required=False) |
| 169 content_upload = forms.BooleanField(required=False) | 169 content_upload = forms.BooleanField(required=False) |
| 170 separate_patches = forms.BooleanField(required=False) | 170 separate_patches = forms.BooleanField(required=False) |
| 171 base = forms.CharField(max_length=MAX_URL, required=False) | 171 base = forms.CharField(max_length=MAX_URL, required=False) |
| 172 target_ref = forms.CharField(max_length=MAX_URL, required=False) |
| 172 data = forms.FileField(required=False) | 173 data = forms.FileField(required=False) |
| 173 issue = forms.IntegerField(required=False) | 174 issue = forms.IntegerField(required=False) |
| 174 reviewers = forms.CharField(max_length=MAX_REVIEWERS, required=False) | 175 reviewers = forms.CharField(max_length=MAX_REVIEWERS, required=False) |
| 175 cc = forms.CharField(max_length=MAX_CC, required=False) | 176 cc = forms.CharField(max_length=MAX_CC, required=False) |
| 176 private = forms.BooleanField(required=False, initial=False) | 177 private = forms.BooleanField(required=False, initial=False) |
| 177 send_mail = forms.BooleanField(required=False) | 178 send_mail = forms.BooleanField(required=False) |
| 178 base_hashes = forms.CharField(required=False) | 179 base_hashes = forms.CharField(required=False) |
| 179 commit = forms.BooleanField(required=False) | 180 commit = forms.BooleanField(required=False) |
| 180 repo_guid = forms.CharField(required=False, max_length=MAX_URL) | 181 repo_guid = forms.CharField(required=False, max_length=MAX_URL) |
| 181 | 182 |
| (...skipping 1184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1366 if base is None: | 1367 if base is None: |
| 1367 return (None, None) | 1368 return (None, None) |
| 1368 | 1369 |
| 1369 first_issue_id, _ = models.Issue.allocate_ids(1) | 1370 first_issue_id, _ = models.Issue.allocate_ids(1) |
| 1370 issue_key = ndb.Key(models.Issue, first_issue_id) | 1371 issue_key = ndb.Key(models.Issue, first_issue_id) |
| 1371 | 1372 |
| 1372 issue = models.Issue(subject=form.cleaned_data['subject'], | 1373 issue = models.Issue(subject=form.cleaned_data['subject'], |
| 1373 description=form.cleaned_data['description'], | 1374 description=form.cleaned_data['description'], |
| 1374 project=form.cleaned_data['project'], | 1375 project=form.cleaned_data['project'], |
| 1375 base=base, | 1376 base=base, |
| 1377 target_ref=form.cleaned_data.get('target_ref', None), |
| 1376 repo_guid=form.cleaned_data.get('repo_guid', None), | 1378 repo_guid=form.cleaned_data.get('repo_guid', None), |
| 1377 reviewers=reviewers, | 1379 reviewers=reviewers, |
| 1378 required_reviewers=required_reviewers, | 1380 required_reviewers=required_reviewers, |
| 1379 cc=cc, | 1381 cc=cc, |
| 1380 private=form.cleaned_data.get('private', False), | 1382 private=form.cleaned_data.get('private', False), |
| 1381 n_comments=0, | 1383 n_comments=0, |
| 1382 key=issue_key) | 1384 key=issue_key) |
| 1383 issue.put() | 1385 issue.put() |
| 1384 | 1386 |
| 1385 first_ps_id, _ = models.PatchSet.allocate_ids(1, parent=issue.key) | 1387 first_ps_id, _ = models.PatchSet.allocate_ids(1, parent=issue.key) |
| (...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2155 'closed': issue.closed, | 2157 'closed': issue.closed, |
| 2156 'cc': issue.cc, | 2158 'cc': issue.cc, |
| 2157 'reviewers': issue.reviewers, | 2159 'reviewers': issue.reviewers, |
| 2158 'all_required_reviewers_approved': issue.all_required_reviewers_approved, | 2160 'all_required_reviewers_approved': issue.all_required_reviewers_approved, |
| 2159 'patchsets': [p.key.id() for p in issue.patchsets], | 2161 'patchsets': [p.key.id() for p in issue.patchsets], |
| 2160 'description': issue.description, | 2162 'description': issue.description, |
| 2161 'subject': issue.subject, | 2163 'subject': issue.subject, |
| 2162 'project': issue.project, | 2164 'project': issue.project, |
| 2163 'issue': issue.key.id(), | 2165 'issue': issue.key.id(), |
| 2164 'base_url': issue.base, | 2166 'base_url': issue.base, |
| 2167 'target_ref': issue.target_ref, |
| 2165 'private': issue.private, | 2168 'private': issue.private, |
| 2166 'commit': issue.commit, | 2169 'commit': issue.commit, |
| 2167 } | 2170 } |
| 2168 if messages: | 2171 if messages: |
| 2169 values['messages'] = sorted( | 2172 values['messages'] = sorted( |
| 2170 ({ | 2173 ({ |
| 2171 'sender': m.sender, | 2174 'sender': m.sender, |
| 2172 'recipients': m.recipients, | 2175 'recipients': m.recipients, |
| 2173 'date': str(m.date), | 2176 'date': str(m.date), |
| 2174 'text': m.text, | 2177 'text': m.text, |
| (...skipping 2997 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5172 return HttpResponseNotFound() | 5175 return HttpResponseNotFound() |
| 5173 tops = [] | 5176 tops = [] |
| 5174 shame = [] | 5177 shame = [] |
| 5175 for i in data: | 5178 for i in data: |
| 5176 if i.score == models.AccountStatsBase.NULL_SCORE: | 5179 if i.score == models.AccountStatsBase.NULL_SCORE: |
| 5177 shame.append(i) | 5180 shame.append(i) |
| 5178 else: | 5181 else: |
| 5179 tops.append(i) | 5182 tops.append(i) |
| 5180 return respond( | 5183 return respond( |
| 5181 request, 'leaderboard.html', {'tops': tops, 'shame': shame, 'when': when}) | 5184 request, 'leaderboard.html', {'tops': tops, 'shame': shame, 'when': when}) |
| OLD | NEW |