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

Last change on this file since 2111 was 503, checked in by mylan, 18 years ago

Add possibility of exporting objects to Skin Product for following importing on its installation. Add full css and javascripts registries dumping. Change interface.

  • 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
13def urltool_call(self, relative=0, *args, **kw):
14    """ Get by default the absolute URL of the portal. If request is annonated then add suffix to portal_url
15    """
16    # print '################################ Called patched portal_url __call__: ' + self.REQUEST.URL
17    url_suffix = ''
18    if self.REQUEST:
19        annotator = IRequestPortalUrlAnnotator(self.REQUEST, None)
20        if annotator is not None:
21            url_suffix = annotator.getPortalUrlSuffix(default=marker)
22            if not url_suffix == marker:
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.