|
a/Allura/allura/model/attachments.py |
|
b/Allura/allura/model/attachments.py |
|
|
1 |
import urllib
|
|
|
2 |
|
1 |
from pylons import c
|
3 |
from pylons import c
|
2 |
from ming.orm import FieldProperty
|
4 |
from ming.orm import FieldProperty
|
3 |
from ming import schema as S
|
5 |
from ming import schema as S
|
4 |
|
6 |
|
5 |
from allura.lib import helpers as h
|
7 |
from allura.lib import helpers as h
|
|
... |
|
... |
23 |
@property
|
25 |
@property
|
24 |
def artifact(self):
|
26 |
def artifact(self):
|
25 |
return self.ArtifactType.query.get(_id=self.artifact_id)
|
27 |
return self.ArtifactType.query.get(_id=self.artifact_id)
|
26 |
|
28 |
|
27 |
def url(self):
|
29 |
def url(self):
|
28 |
return self.artifact.url() + 'attachment/' + self.filename
|
30 |
return self.artifact.url() + 'attachment/' + urllib.quote_plus(self.filename)
|
29 |
|
31 |
|
30 |
def is_embedded(self):
|
32 |
def is_embedded(self):
|
31 |
from pylons import request
|
33 |
from pylons import request
|
32 |
return self.filename in request.environ.get('allura.macro.att_embedded', [])
|
34 |
return self.filename in request.environ.get('allura.macro.att_embedded', [])
|
33 |
|
35 |
|