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 copy | 5 import copy |
6 import json | 6 import json |
7 import tarfile | 7 import tarfile |
8 | 8 |
9 from google.appengine.api import memcache | 9 from google.appengine.api import memcache |
10 from google.appengine.ext import db | 10 from google.appengine.ext import db |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 self.uploaderEmail = self.uploader.email() | 89 self.uploaderEmail = self.uploader.email() |
90 | 90 |
91 if self.readme: | 91 if self.readme: |
92 self.readmeFilename = self.readme.filename | 92 self.readmeFilename = self.readme.filename |
93 self.readmeContent = db.Text(self.readme.text) | 93 self.readmeContent = db.Text(self.readme.text) |
94 | 94 |
95 if self.changelog: | 95 if self.changelog: |
96 self.changelogFilename = self.changelog.filename | 96 self.changelogFilename = self.changelog.filename |
97 self.changelogContent = db.Text(self.changelog.text) | 97 self.changelogContent = db.Text(self.changelog.text) |
98 | 98 |
| 99 @property |
| 100 def readme_obj(self): |
| 101 if self.readmeFilename: |
| 102 return Readme(self.readmeContent, self.readmeFilename) |
| 103 else: |
| 104 return None |
| 105 |
| 106 @property |
| 107 def changelog_obj(self): |
| 108 if self.readmeFilename: |
| 109 return Readme(self.changelogContent, self.changelogFilename) |
| 110 else: |
| 111 return None |
| 112 |
99 @classmethod | 113 @classmethod |
100 def new(cls, **kwargs): | 114 def new(cls, **kwargs): |
101 """Construct a new package version. | 115 """Construct a new package version. |
102 | 116 |
103 Unlike __init__, this infers some properties from others. In particular: | 117 Unlike __init__, this infers some properties from others. In particular: |
104 | 118 |
105 - The version is inferred from the pubspec. | 119 - The version is inferred from the pubspec. |
106 - The key name is set to the version. | 120 - The key name is set to the version. |
107 - The parent entity is set to the package. | 121 - The parent entity is set to the package. |
108 """ | 122 """ |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 | 330 |
317 if full: | 331 if full: |
318 value.update({ | 332 value.update({ |
319 'created': self.created.isoformat(), | 333 'created': self.created.isoformat(), |
320 'downloads': self.downloads, | 334 'downloads': self.downloads, |
321 'libraries': self.libraries, | 335 'libraries': self.libraries, |
322 'uploader': self.uploader.email() | 336 'uploader': self.uploader.email() |
323 }) | 337 }) |
324 | 338 |
325 return value | 339 return value |
OLD | NEW |