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

Last change on this file since 488 was 488, checked in by gerrykirk, 18 years ago

made some more English language improvements and consistencies, found a missing string for translation, url encoded a status message

  • 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    # print '################################ Called patched portal_url __call__: ' + self.REQUEST.URL
18    url_suffix = ''
19    if self.REQUEST:
20        annotator = IRequestPortalUrlAnnotator(self.REQUEST, None)
21        if annotator is not None:
22            url_suffix = annotator.getPortalUrlSuffix()
23            return url_suffix
24    return self.getPortalObject().absolute_url(relative=relative)
25
26def urltool_getPortalPath(self):
27    """ Get the portal object's URL without the server URL component.
28    """
29
30    url_suffix = ''
31    if self.REQUEST:
32        annotator = IRequestPortalUrlAnnotator(self.REQUEST, None)
33        if annotator is not None:
34            url_suffix = annotator.getPortalUrlSuffix()
35            # print '############ Added sufix to portal_url: ' + url_suffix
36
37    return '/'.join(self.getPortalObject().getPhysicalPath()) + url_suffix
38
39URLTool.__call__ = urltool_call
40#URLTool.getPortalPath = urltool_getPortalPath
Note: See TracBrowser for help on using the repository browser.