contained2pathadapter.py
2008-01-11 19:08...
### -*- coding: utf-8 -*- #############################################
#######################################################################
"""Product class for the Zope 3 based product package
$Id: product.py 12897 2007-11-10 15:32:08Z cray $
"""
__author__ = "Yegor Shershnev"
__license__ = "GPL"
__version__ = "$Revision: 12897 $"
from zope.interface import implements, implementedBy
from zope.app.container.interfaces import IContained
from pathadaptersimple.interfaces import IPath
from zope.component import adapts
from pathadapterbase import PathAdapterBase
from zope.dublincore.interfaces import IZopeDublinCore
from titleadapter.interfaces import ITitle
class Contained2PathAdapter(PathAdapterBase) :
implements(IPath)
adapts(IContained)
@property
def titledpath(self) :
return "/".join([
IPath(IContained(self.context.__parent__)).titledpath,
ITitle(self.context).title])
@property
def path(self) :
#if IContained(self.context).__parent__ is None :
# return "/"
#else :
return "/".join([IPath(IContained(self.context.__parent__)).path,
IContained(self.context).__name__])



