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

Side by Side Diff: app/handlers/api/package_versions.py

Issue 816693002: Add string versions of User/Pickled objects to datastore models (Closed) Base URL: https://github.com/dart-lang/pub-dartlang.git@master
Patch Set: Use db.Text(encoding="utf-8") 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 | « app/handlers/api/package_uploaders.py ('k') | app/handlers/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 from cStringIO import StringIO 5 from cStringIO import StringIO
6 from contextlib import closing 6 from contextlib import closing
7 from uuid import uuid4 7 from uuid import uuid4
8 import json 8 import json
9 import logging 9 import logging
10 import time 10 import time
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 if self._should_update_latest_version(version): 99 if self._should_update_latest_version(version):
100 version.package.latest_version = version 100 version.package.latest_version = version
101 else: 101 else:
102 version.package.latest_version = version 102 version.package.latest_version = version
103 103
104 cloud_storage.modify_object(version.storage_path, 104 cloud_storage.modify_object(version.storage_path,
105 acl='public-read', 105 acl='public-read',
106 copy_source='tmp/' + id) 106 copy_source='tmp/' + id)
107 107
108 with models.transaction(): 108 with models.transaction():
109 version.package.temp_synchronize_uploaders_to_uploaderemails()
109 version.package.put() 110 version.package.put()
111 version.temp_synchronize_uploader_to_uploaderemail_and_pickles()
110 version.put() 112 version.put()
111 version.package.invalidate_cache() 113 version.package.invalidate_cache()
112 114
113 deferred.defer(self._compute_version_order, version.package.name) 115 deferred.defer(self._compute_version_order, version.package.name)
114 116
115 return handlers.json_success('%s %s uploaded successfully.' % 117 return handlers.json_success('%s %s uploaded successfully.' %
116 (version.package.name, version.version)) 118 (version.package.name, version.version))
117 finally: 119 finally:
118 cloud_storage.delete_object('tmp/' + id) 120 cloud_storage.delete_object('tmp/' + id)
119 121
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 @handlers.requires_oauth_key 181 @handlers.requires_oauth_key
180 @handlers.requires_uploader 182 @handlers.requires_uploader
181 def new_dartdoc(self, package_id, id): 183 def new_dartdoc(self, package_id, id):
182 """Retrieve the form for uploading dartdoc for this package version.""" 184 """Retrieve the form for uploading dartdoc for this package version."""
183 version = handlers.request().package_version(id) 185 version = handlers.request().package_version(id)
184 upload = cloud_storage.Upload(version.dartdoc_storage_path, 186 upload = cloud_storage.Upload(version.dartdoc_storage_path,
185 acl='public-read', 187 acl='public-read',
186 size_range=(0, Package.MAX_SIZE)) 188 size_range=(0, Package.MAX_SIZE))
187 189
188 return upload.to_json() 190 return upload.to_json()
OLDNEW
« no previous file with comments | « app/handlers/api/package_uploaders.py ('k') | app/handlers/package_uploaders.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698