Author: jmorliaguet Date: Tue Jun 20 23:54:24 2006 New Revision: 3478 Modified: cpsskins/branches/paris-sprint-2006/browser/rendering/viewer.py cpsskins/branches/paris-sprint-2006/standard/negotiation/perspective.py cpsskins/branches/paris-sprint-2006/thememanager.py
Log: - fix: the location context/path during negotiation was incorrect. Modified: cpsskins/branches/paris-sprint-2006/browser/rendering/viewer.py ============================================================================== --- cpsskins/branches/paris-sprint-2006/browser/rendering/viewer.py (original) +++ cpsskins/branches/paris-sprint-2006/browser/rendering/viewer.py Tue Jun 20 23:54:24 2006 @@ -23,6 +23,7 @@ from zope.event import notify from zope.interface import implements from zope.publisher.interfaces import IRequest +from zope.traversing.interfaces import IPhysicallyLocatable from cpsskins.browser.negotiation.interfaces import INegotiation from cpsskins.browser.rendering.context import ContextInfo @@ -64,19 +65,24 @@ notify(ViewNodeEvent(element)) - contexts = {} - tree = contexts['tree'] = {} + # update global context info variables passed as keyword parameters + globals = ContextInfo(kw) + + # set the current location unless specified + if globals.location is None: + globals.location = IPhysicallyLocatable(element).getNearestSite() + + if globals.engine is None: + globals.engine = u'default' tmutil = getThemeManager(element) relations = tmutil.getRelationStorage() - negotiation = getMultiAdapter((element, request), + negotiation = getMultiAdapter((globals.location, request), INegotiation, 'negotiation') perspective = negotiation.getPerspective() resources = getUtility(IResourceManager) - # update global context info variables passed as keyword parameters - # e.g. the engine's name - globals = ContextInfo(kw) + # set other global variables globals.update({ 'request': request, 'perspective': perspective, @@ -84,15 +90,12 @@ 'resources': resources, }) - if globals.engine is None: - globals.engine = u'default' + # XXX globals.accesskeys = [] - # set the current location unless specified - if globals.location is None: - globals.location = tmutil.getSite() - # build the tree and store it in the request + contexts = {} + tree = contexts['tree'] = {} _updateTreeInfo(tree=tree, node=element, globals=globals) # render the tree Modified: cpsskins/branches/paris-sprint-2006/standard/negotiation/perspective.py ============================================================================== --- cpsskins/branches/paris-sprint-2006/standard/negotiation/perspective.py (original) +++ cpsskins/branches/paris-sprint-2006/standard/negotiation/perspective.py Tue Jun 20 23:54:24 2006 @@ -20,6 +20,7 @@ from zope.app.session.interfaces import ISession from zope.interface import implements from zope.traversing.api import getPath +from zope.traversing.interfaces import IPhysicallyLocatable from cpsskins.browser.negotiation.scheme import NegotiationScheme from cpsskins.standard.negotiation import ISessionNegotiationScheme @@ -36,7 +37,9 @@ def __call__(self): context = self.context tmutil = getThemeManager(context) - path = getPath(context) + nearest_site = IPhysicallyLocatable(context).getNearestSite() + path = getPath(context)[len(getPath(nearest_site)):] + print path location = tmutil.getLocation(path, root=u'perspectives') if location is not None: return location() Modified: cpsskins/branches/paris-sprint-2006/thememanager.py ============================================================================== --- cpsskins/branches/paris-sprint-2006/thememanager.py (original) +++ cpsskins/branches/paris-sprint-2006/thememanager.py Tue Jun 20 23:54:24 2006 @@ -58,9 +58,6 @@ The methods may be moved to other classes. """ - def getSite(): - """Return the site""" - def getIdRegistry(): """Return the unique id registry.""" @@ -158,10 +155,6 @@ # snapshots self[u'snapshots'] = SnapshotStorage() - def getSite(self): - # XXX - return self - ################################################################### # Local utilities ################################################################### -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins