OLD | NEW |
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 import cgi | 5 import cgi |
6 import json | 6 import json |
7 import logging | 7 import logging |
8 | 8 |
9 from google.appengine.api import memcache | 9 from google.appengine.api import memcache |
10 from google.appengine.api import users | 10 from google.appengine.api import users |
11 from google.appengine.ext import db | 11 from google.appengine.ext import db |
12 | 12 |
13 import models | 13 import models |
14 from pubspec import Pubspec | 14 from pubspec import Pubspec |
15 | 15 |
16 class Package(db.Model): | 16 class Package(db.Model): |
17 """The model for a package. | 17 """The model for a package. |
18 | 18 |
19 A package contains only metadata that applies to every version of the | 19 A package contains only metadata that applies to every version of the |
20 package, such as its name and uploader. Each individual version of the | 20 package, such as its name and uploader. Each individual version of the |
21 package is represented by a PackageVersion model. | 21 package is represented by a PackageVersion model. |
22 | 22 |
23 Whenever a new PackageVersion for a Package is added or modified, you must | 23 Whenever a new PackageVersion for a Package is added or modified, you must |
24 call invalidate_cache() to ensure any stale cached description of the | 24 call invalidate_cache() to ensure any stale cached description of the |
25 package is discarded. | 25 package is discarded. |
26 """ | 26 """ |
27 | 27 |
28 MAX_SIZE = 10 * 2**20 # 10MB | 28 MAX_SIZE = 100 * 2**20 # 100MB |
29 """The maximum package size, in bytes.""" | 29 """The maximum package size, in bytes.""" |
30 | 30 |
31 uploaderEmails = db.StringListProperty(validator=models.validate_not_empty) | 31 uploaderEmails = db.StringListProperty(validator=models.validate_not_empty) |
32 """The user emails who are allowed to upload new versions of the package. | 32 """The user emails who are allowed to upload new versions of the package. |
33 | 33 |
34 When this is set, invalidate_cache() must be called.""" | 34 When this is set, invalidate_cache() must be called.""" |
35 | 35 |
36 name = db.StringProperty(required=True) | 36 name = db.StringProperty(required=True) |
37 """The name of the package.""" | 37 """The name of the package.""" |
38 | 38 |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 | 230 |
231 @property | 231 @property |
232 def _package_json_cache_key(self): | 232 def _package_json_cache_key(self): |
233 """The memcache key for the cached JSON for this package.""" | 233 """The memcache key for the cached JSON for this package.""" |
234 return 'package_json_' + self.name | 234 return 'package_json_' + self.name |
235 | 235 |
236 @property | 236 @property |
237 def _dart_package_json_cache_key(self): | 237 def _dart_package_json_cache_key(self): |
238 """The Dart memcache key for the cached JSON for this package.""" | 238 """The Dart memcache key for the cached JSON for this package.""" |
239 return 'dart_package_json_' + self.name | 239 return 'dart_package_json_' + self.name |
OLD | NEW |