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
|
Rev | Line | |
---|
[1] | 1 | from zope.interface import implements |
---|
| 2 | from zope.component import adapts |
---|
| 3 | from zope.publisher.interfaces.browser import IBrowserRequest |
---|
| 4 | from zope.annotation.interfaces import IAnnotations |
---|
| 5 | |
---|
| 6 | from Products.qLocalSkin.config import ANNOTATION_KEY |
---|
| 7 | from interfaces import IRequestPortalUrlAnnotator |
---|
| 8 | |
---|
| 9 | class 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 | |
---|
[503] | 28 | def getPortalUrlSuffix(self, default=''): |
---|
[1] | 29 | if self.annotations is not None: |
---|
[503] | 30 | return self.annotations.get(self.key, default) |
---|
| 31 | return default |
---|
Note: See
TracBrowser
for help on using the repository browser.