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