equal
deleted
inserted
replaced
7 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED |
7 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED |
8 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
8 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
9 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS |
9 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS |
10 # FOR A PARTICULAR PURPOSE. |
10 # FOR A PARTICULAR PURPOSE. |
11 # |
11 # |
|
12 from pyams_skin.layer import IPyAMSUserLayer |
12 |
13 |
13 __docformat__ = 'restructuredtext' |
14 __docformat__ = 'restructuredtext' |
14 |
15 |
15 |
16 |
16 # import standard library |
17 # import standard library |
33 from pyams_sequence.utility import get_reference_target |
34 from pyams_sequence.utility import get_reference_target |
34 from pyams_utils.adapter import adapter_config, ContextAdapter |
35 from pyams_utils.adapter import adapter_config, ContextAdapter |
35 from pyams_utils.registry import query_utility |
36 from pyams_utils.registry import query_utility |
36 from pyams_utils.request import check_request |
37 from pyams_utils.request import check_request |
37 from pyams_utils.traversing import get_parent |
38 from pyams_utils.traversing import get_parent |
38 from pyams_utils.url import absolute_url |
39 from pyams_utils.url import absolute_url, relative_url |
39 from pyams_utils.vocabulary import vocabulary_config |
40 from pyams_utils.vocabulary import vocabulary_config |
40 from pyams_utils.zodb import volatile_property |
41 from pyams_utils.zodb import volatile_property |
41 from zope.interface import implementer |
42 from zope.interface import implementer |
42 from zope.schema.fieldproperty import FieldProperty |
43 from zope.schema.fieldproperty import FieldProperty |
43 from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm |
44 from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm |
130 |
131 |
131 def get_editor_url(self): |
132 def get_editor_url(self): |
132 return 'oid://{0}'.format(self.reference) |
133 return 'oid://{0}'.format(self.reference) |
133 |
134 |
134 def get_url(self, request=None, view_name=None): |
135 def get_url(self, request=None, view_name=None): |
135 target = self.get_target(state=VISIBLE_STATES) |
136 target = self.get_target() |
136 if target is not None: |
137 if target is not None: |
137 if request is None: |
138 if request is None: |
138 request = check_request() |
139 request = check_request() |
139 return absolute_url(target, request, view_name) |
140 return relative_url(target, request, view_name=view_name) |
140 else: |
141 else: |
141 return '' |
142 return '' |
142 |
143 |
143 |
144 |
144 @adapter_config(context=IInternalLink, provides=IFormContextPermissionChecker) |
145 @adapter_config(context=IInternalLink, provides=IFormContextPermissionChecker) |