|
a/Allura/allura/controllers/discuss.py |
|
b/Allura/allura/controllers/discuss.py |
|
... |
|
... |
284 |
|
284 |
|
285 |
@h.vardec
|
285 |
@h.vardec
|
286 |
@expose()
|
286 |
@expose()
|
287 |
def attach(self, file_info=None):
|
287 |
def attach(self, file_info=None):
|
288 |
require(has_artifact_access('moderate', self.post))
|
288 |
require(has_artifact_access('moderate', self.post))
|
289 |
if file_info:
|
289 |
if file_info is not None:
|
290 |
filename = file_info.filename
|
290 |
filename = file_info.filename
|
291 |
content_type = guess_type(filename)
|
291 |
content_type = guess_type(filename)
|
292 |
if content_type[0]: content_type = content_type[0]
|
292 |
if content_type[0]: content_type = content_type[0]
|
293 |
else: content_type = 'application/octet-stream'
|
293 |
else: content_type = 'application/octet-stream'
|
294 |
with self.M.Attachment.create(
|
294 |
with self.M.Attachment.create(
|