|
a/Allura/allura/model/discuss.py |
|
b/Allura/allura/model/discuss.py |
|
... |
|
... |
19 |
from datetime import datetime
|
19 |
from datetime import datetime
|
20 |
|
20 |
|
21 |
import pymongo
|
21 |
import pymongo
|
22 |
from pymongo.errors import DuplicateKeyError
|
22 |
from pymongo.errors import DuplicateKeyError
|
23 |
from pylons import tmpl_context as c, app_globals as g
|
23 |
from pylons import tmpl_context as c, app_globals as g
|
|
|
24 |
from urlparse import urljoin
|
|
|
25 |
from tg import config
|
24 |
|
26 |
|
25 |
from ming import schema
|
27 |
from ming import schema
|
26 |
from ming.orm.base import session
|
28 |
from ming.orm.base import session
|
27 |
from ming.orm.property import (FieldProperty, RelationProperty,
|
29 |
from ming.orm.property import (FieldProperty, RelationProperty,
|
28 |
ForeignIdProperty)
|
30 |
ForeignIdProperty)
|
|
... |
|
... |
161 |
def __json__(self):
|
163 |
def __json__(self):
|
162 |
return dict(
|
164 |
return dict(
|
163 |
_id=self._id,
|
165 |
_id=self._id,
|
164 |
discussion_id=str(self.discussion_id),
|
166 |
discussion_id=str(self.discussion_id),
|
165 |
subject=self.subject,
|
167 |
subject=self.subject,
|
166 |
posts=[dict(slug=p.slug, subject=p.subject)
|
168 |
posts=[dict(slug=p.slug,
|
|
|
169 |
subject=p.subject,
|
|
|
170 |
attachments=[dict(bytes=attach.length,
|
|
|
171 |
url=urljoin(config.get('base_url', 'http://sourceforge.net/'),
|
|
|
172 |
attach.url())) for attach in p.attachments])
|
167 |
for p in self.posts])
|
173 |
for p in self.posts])
|
168 |
|
174 |
|
169 |
@property
|
175 |
@property
|
170 |
def activity_name(self):
|
176 |
def activity_name(self):
|
171 |
return 'thread %s' % self.subject
|
177 |
return 'thread %s' % self.subject
|