source: products/qLocalSkin/trunk/adapters/requestannotator.py

Last change on this file 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.0 KB
Line 
1from zope.interface import implements
2from zope.component import adapts
3from zope.publisher.interfaces.browser import IBrowserRequest
4from zope.annotation.interfaces import IAnnotations
5
6from Products.qLocalSkin.config import ANNOTATION_KEY
7from interfaces import IRequestPortalUrlAnnotator
8
9class RequestPortalUrlAnnotator(object):
10    """ Adapter for working with portal_url suffix in request's annotation. """
11
12    implements(IRequestPortalUrlAnnotator)
13    adapts(IBrowserRequest)
14
15    key = ANNOTATION_KEY
16
17    def __init__(self, request):
18        self.request = request
19        self.annotations = IAnnotations(self.request, None)
20
21    def annotate(self, value):
22        if self.annotations is not None:
23            self.annotations[self.key] = value
24            # print "################## Setted annotation on request from qLocalSkin: " + str(value)
25            return True
26        return False
27
28    def getPortalUrlSuffix(self, default=''):
29        if self.annotations is not None:
30            return self.annotations.get(self.key, default)
31        return default
Note: See TracBrowser for help on using the repository browser.