|
a/Allura/allura/controllers/discuss.py |
|
b/Allura/allura/controllers/discuss.py |
|
... |
|
... |
150 |
file_info = kw.pop('file_info', None)
|
150 |
file_info = kw.pop('file_info', None)
|
151 |
p = self.thread.add_post(**kw)
|
151 |
p = self.thread.add_post(**kw)
|
152 |
if hasattr(file_info, 'file'):
|
152 |
if hasattr(file_info, 'file'):
|
153 |
p.attach(
|
153 |
p.attach(
|
154 |
file_info.filename, file_info.file, content_type=file_info.type,
|
154 |
file_info.filename, file_info.file, content_type=file_info.type,
|
|
|
155 |
post_id=p._id,
|
155 |
thread_id=p.thread_id,
|
156 |
thread_id=p.thread_id,
|
156 |
discussion_id=p.discussion_id)
|
157 |
discussion_id=p.discussion_id)
|
157 |
if self.thread.artifact:
|
158 |
if self.thread.artifact:
|
158 |
self.thread.artifact.mod_date = datetime.utcnow()
|
159 |
self.thread.artifact.mod_date = datetime.utcnow()
|
159 |
flash('Message posted')
|
160 |
flash('Message posted')
|
|
... |
|
... |
229 |
def index(self, version=None, **kw):
|
230 |
def index(self, version=None, **kw):
|
230 |
c.post = self.W.post
|
231 |
c.post = self.W.post
|
231 |
if request.method == 'POST':
|
232 |
if request.method == 'POST':
|
232 |
require(has_artifact_access('moderate', self.post))
|
233 |
require(has_artifact_access('moderate', self.post))
|
233 |
post_fields = self.W.edit_post.to_python(kw, None)
|
234 |
post_fields = self.W.edit_post.to_python(kw, None)
|
|
|
235 |
file_info = post_fields.pop('file_info', None)
|
|
|
236 |
if hasattr(file_info, 'file'):
|
|
|
237 |
self.post.attach(
|
|
|
238 |
file_info.filename, file_info.file, content_type=file_info.type,
|
|
|
239 |
post_id=self.post._id,
|
|
|
240 |
thread_id=self.post.thread_id,
|
|
|
241 |
discussion_id=self.post.discussion_id)
|
234 |
for k,v in post_fields.iteritems():
|
242 |
for k,v in post_fields.iteritems():
|
235 |
try:
|
243 |
try:
|
236 |
setattr(self.post, k, v)
|
244 |
setattr(self.post, k, v)
|
237 |
except AttributeError:
|
245 |
except AttributeError:
|
238 |
continue
|
246 |
continue
|