|
Revision 1337
(checked in by mylan, 1 month ago)
|
Add patch for Products.Five.browser.resource.FileResource? - prevent breakage on POST requests
|
- Property svn:eol-style set to
native
|
| Line | |
|---|
| 1 |
from Products.CMFPlone.URLTool import URLTool |
|---|
| 2 |
|
|---|
| 3 |
from adapters.interfaces import IRequestPortalUrlAnnotator |
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
marker = [] |
|---|
| 8 |
from Products.Five.browser.resource import FileResource |
|---|
| 9 |
|
|---|
| 10 |
if getattr(FileResource, 'POST', marker) == marker: |
|---|
| 11 |
FileResource.POST = FileResource.GET |
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
def urltool_call(self, relative=0, *args, **kw): |
|---|
| 15 |
""" Get by default the absolute URL of the portal. If request is annonated then add suffix to portal_url |
|---|
| 16 |
""" |
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
url_suffix = '' |
|---|
| 20 |
if self.REQUEST: |
|---|
| 21 |
annotator = IRequestPortalUrlAnnotator(self.REQUEST, None) |
|---|
| 22 |
if annotator is not None: |
|---|
| 23 |
url_suffix = annotator.getPortalUrlSuffix() |
|---|
| 24 |
|
|---|
| 25 |
|
|---|
| 26 |
return self.getPortalObject().absolute_url(relative=relative) + url_suffix |
|---|
| 27 |
|
|---|
| 28 |
def urltool_getPortalPath(self): |
|---|
| 29 |
""" Get the portal object's URL without the server URL component. |
|---|
| 30 |
""" |
|---|
| 31 |
|
|---|
| 32 |
url_suffix = '' |
|---|
| 33 |
if self.REQUEST: |
|---|
| 34 |
annotator = IRequestPortalUrlAnnotator(self.REQUEST, None) |
|---|
| 35 |
if annotator is not None: |
|---|
| 36 |
url_suffix = annotator.getPortalUrlSuffix() |
|---|
| 37 |
|
|---|
| 38 |
|
|---|
| 39 |
return '/'.join(self.getPortalObject().getPhysicalPath()) + url_suffix |
|---|
| 40 |
|
|---|
| 41 |
URLTool.__call__ = urltool_call |
|---|
| 42 |
|
|---|