|
a/Allura/allura/model/artifact.py |
|
b/Allura/allura/model/artifact.py |
|
... |
|
... |
131 |
self.shorthand_id(),
|
131 |
self.shorthand_id(),
|
132 |
subject)
|
132 |
subject)
|
133 |
else:
|
133 |
else:
|
134 |
return 'mailto:%s' % self.email_address
|
134 |
return 'mailto:%s' % self.email_address
|
135 |
|
135 |
|
136 |
def dump_ref(self):
|
|
|
137 |
'''Return a pickle-serializable reference to an artifact'''
|
|
|
138 |
try:
|
|
|
139 |
d = ArtifactReference(dict(
|
|
|
140 |
project_id=self.app_config.project._id,
|
|
|
141 |
mount_point=self.app_config.options.mount_point,
|
|
|
142 |
artifact_type=bson.Binary(pickle.dumps(self.__class__)),
|
|
|
143 |
artifact_id=self._id))
|
|
|
144 |
return d
|
|
|
145 |
except AttributeError:
|
|
|
146 |
return None
|
|
|
147 |
|
|
|
148 |
@property
|
136 |
@property
|
149 |
def project(self):
|
137 |
def project(self):
|
150 |
return self.app_config.project
|
138 |
return self.app_config.project
|
151 |
|
139 |
|
152 |
@property
|
140 |
@property
|
|
... |
|
... |
235 |
|
223 |
|
236 |
def get_discussion_thread(self, data=None):
|
224 |
def get_discussion_thread(self, data=None):
|
237 |
'''Return the discussion thread for this artifact (possibly made more
|
225 |
'''Return the discussion thread for this artifact (possibly made more
|
238 |
specific by the message_data)'''
|
226 |
specific by the message_data)'''
|
239 |
from .discuss import Thread
|
227 |
from .discuss import Thread
|
240 |
return Thread.query.get(artifact_reference=self.dump_ref())
|
228 |
return Thread.query.get(ref_id=self.index_id())
|
241 |
|
229 |
|
242 |
@LazyProperty
|
230 |
@LazyProperty
|
243 |
def discussion_thread(self):
|
231 |
def discussion_thread(self):
|
244 |
return self.get_discussion_thread()
|
232 |
return self.get_discussion_thread()
|
245 |
|
233 |
|
|
... |
|
... |
564 |
"Create a Feed item"
|
552 |
"Create a Feed item"
|
565 |
idx = artifact.index()
|
553 |
idx = artifact.index()
|
566 |
if title is None:
|
554 |
if title is None:
|
567 |
title='%s modified by %s' % (idx['title_s'], c.user.get_pref('display_name'))
|
555 |
title='%s modified by %s' % (idx['title_s'], c.user.get_pref('display_name'))
|
568 |
if description is None: description = title
|
556 |
if description is None: description = title
|
569 |
item = cls(artifact_reference=artifact.dump_ref(),
|
557 |
item = cls(ref_id=artifact.index_id(),
|
570 |
title=title,
|
558 |
title=title,
|
571 |
description=description,
|
559 |
description=description,
|
572 |
link=artifact.url())
|
560 |
link=artifact.url())
|
573 |
return item
|
561 |
return item
|
574 |
|
562 |
|