[Zope3-Users] Contained File object
Tom Dossis
td at yoma.com.au
Tue Jan 18 02:42:57 EST 2005
Should zope.app.file.File implement IContained? Why / Why not?
Here's a comparison b/w adding a Folder and File...
>>> folder = Folder()
>>> root['folder'] = folder
>>> zapi.getPath(folder)
u'/folder'
>>> zapi.getName(folder)
u'folder'
>>> zapi.getParent(folder)
<zope.app.folder.folder.Folder object at 0x421b8aac>
>>> file = File()
>>> root['file'] = file
>>> zapi.getPath(file)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File
"/home/tomd/app/ZopeX3-3.0.0/build/lib.linux-i686-2.3/zope/app/traversing/api.py",
line 62, in getPath
File
"/home/tomd/app/ZopeX3-3.0.0/build/lib.linux-i686-2.3/zope/interface/interface.py",
line 682, in __call__
TypeError: ('Could not adapt', <zope.app.file.file.File object at
0x4221806c>, <InterfaceClass
zope.app.traversing.interfaces.IPhysicallyLocatable>)
>>> zapi.getName(file)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File
"/home/tomd/app/ZopeX3-3.0.0/build/lib.linux-i686-2.3/zope/app/traversing/api.py",
line 122, in getName
File
"/home/tomd/app/ZopeX3-3.0.0/build/lib.linux-i686-2.3/zope/interface/interface.py",
line 682, in __call__
TypeError: ('Could not adapt', <zope.app.file.file.File object at
0x4221806c>, <InterfaceClass
zope.app.traversing.interfaces.IPhysicallyLocatable>)
>>> zapi.getParent(file)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File
"/home/tomd/app/ZopeX3-3.0.0/build/lib.linux-i686-2.3/zope/app/traversing/api.py",
line 139, in getParent
TypeError: ('Not enough context information to get parent',
<zope.app.file.file.File object at 0x4221806c>)
>
More information about the Zope3-users
mailing list