Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(199)

Side by Side Diff: app/handlers/__init__.py

Issue 815973002: Remove legacy Package.uploaders PackageVersion.{uploader,readme,changelog} properties (Closed) Base URL: https://github.com/dart-lang/pub-dartlang.git@master
Patch Set: Small fix in changelog/readme handling for new uploads Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | app/handlers/api/package_uploaders.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 # for details. All rights reserved. Use of this source code is governed by a 2 # for details. All rights reserved. Use of this source code is governed by a
3 # BSD-style license that can be found in the LICENSE file. 3 # BSD-style license that can be found in the LICENSE file.
4 4
5 """This module provides utility functions for handlers.""" 5 """This module provides utility functions for handlers."""
6 6
7 import logging 7 import logging
8 import os 8 import os
9 import re 9 import re
10 10
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 This implies requires_user. It does not require that a package exist; if 231 This implies requires_user. It does not require that a package exist; if
232 none does, it only checks that the user has permission to upload packages at 232 none does, it only checks that the user has permission to upload packages at
233 all. 233 all.
234 234
235 Admins have uploader rights for all packages. 235 Admins have uploader rights for all packages.
236 """ 236 """
237 237
238 if is_current_user_admin(): return fn(*args, **kwargs) 238 if is_current_user_admin(): return fn(*args, **kwargs)
239 239
240 package = request().maybe_package 240 package = request().maybe_package
241 if package and not package.has_uploader(get_current_user()): 241 if package and not package.has_uploader_email(get_current_user().email()):
242 message = "You aren't an uploader for package '%s'." % package.name 242 message = "You aren't an uploader for package '%s'." % package.name
243 if request().is_json: 243 if request().is_json:
244 http_error(403, message) 244 http_error(403, message)
245 else: 245 else:
246 flash(message) 246 flash(message)
247 raise cherrypy.HTTPRedirect('/packages/%s' % package.name) 247 raise cherrypy.HTTPRedirect('/packages/%s' % package.name)
248 248
249 return fn(*args, **kwargs) 249 return fn(*args, **kwargs)
250 250
251 @decorator 251 @decorator
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 521
522 package_name = self.request.params['package_id'] 522 package_name = self.request.params['package_id']
523 if not package_name: 523 if not package_name:
524 http_error(403, "No package name found.") 524 http_error(403, "No package name found.")
525 525
526 self._package_version = PackageVersion.get_by_name_and_version( 526 self._package_version = PackageVersion.get_by_name_and_version(
527 package_name, version) 527 package_name, version)
528 if self._package_version: return self._package_version 528 if self._package_version: return self._package_version
529 http_error(404, "\"%s\" version %s doesn't exist." % 529 http_error(404, "\"%s\" version %s doesn't exist." %
530 (package_name, version)) 530 (package_name, version))
OLDNEW
« no previous file with comments | « no previous file | app/handlers/api/package_uploaders.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698