source: products/qLocalSkin/trunk/__init__.py @ 359

Last change on this file since 359 was 298, checked in by chervol, 18 years ago

version bump

  • Property svn:eol-style set to native
File size: 1.5 KB
Line 
1from Products.CMFPlone.URLTool import URLTool
2
3from adapters.interfaces import IRequestPortalUrlAnnotator
4
5## XXX PATCH FOR FILERESOURCE, UNTILL ADD 'POST' METHOD OR FIX
6## ResourceRegistries.tools.BaseRegistry.BaseRegistryTool.getResourceContent method
7marker = []
8from Products.Five.browser.resource import FileResource
9
10if getattr(FileResource, 'POST', marker) == marker:
11    FileResource.POST = FileResource.GET
12
13
14def 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    # print '################################ Called patched portal_url __call__: ' + self.REQUEST.URL
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            # print '############ Added sufix to portal_url: ' + url_suffix
25
26    return self.getPortalObject().absolute_url(relative=relative) +  url_suffix
27
28def 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            # print '############ Added sufix to portal_url: ' + url_suffix
38
39    return '/'.join(self.getPortalObject().getPhysicalPath()) + url_suffix
40
41URLTool.__call__ = urltool_call
42#URLTool.getPortalPath = urltool_getPortalPath
Note: See TracBrowser for help on using the repository browser.