Re: [Zope3-Users] Using attributes in a nameChooser
Am Freitag, 5. August 2005 15:49 schrieb Ruslan Spivak: > В Птн, 05/08/2005 в 12:25 +0200, Florian Lindner пишет: > > Hello, > > in a Containers chooseName function I want to use a attribute of the > > created object: > > > > def chooseName(self, name, object): > > return object.name > > > > > > File > > "/home/florian/Desktop/zope/lib/python/CS/ContentFolder/contentfolder.py" > >, line 15, in chooseName > > return object.name > > AttributeError: 'Link' object has no attribute 'name' > > You should define atributes from schema you want to access with > set_before_add in your addform directive. This works perfect. Can this set_before_add behevoir be somehow defined global for the object or even better be imposed by the container? So that it does not need to be declared by every addform. Thanks, Florian ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Using attributes in a nameChooser
В Птн, 05/08/2005 в 12:25 +0200, Florian Lindner пишет: > Hello, > in a Containers chooseName function I want to use a attribute of the created > object: > > def chooseName(self, name, object): > return object.name > > > File > "/home/florian/Desktop/zope/lib/python/CS/ContentFolder/contentfolder.py", > line 15, in chooseName > return object.name > AttributeError: 'Link' object has no attribute 'name' > You should define atributes from schema you want to access with set_before_add in your addform directive. Ruslan ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Using attributes in a nameChooser
On Friday 05 August 2005 06:25, Florian Lindner wrote: > in a Containers chooseName function I want to use a attribute of the > created object: > > def chooseName(self, name, object): > return object.name > > > File > "/home/florian/Desktop/zope/lib/python/CS/ContentFolder/contentfolder.py", > line 15, in chooseName > return object.name > AttributeError: 'Link' object has no attribute 'name' > > > Even though apidoc says there is a attribute name. > > Or is it impossible to access the attributes at this time of the creation > process? Simply start the debugger to see what's going on. import pdb; pdb.set_trace() inside the chooseName method and you can inspect the object. You might have to say "up" once first to access it. Regards, Stephan -- Stephan Richter CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student) Web2k - Web Software Design, Development and Training ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Using attributes in a nameChooser
Hello, in a Containers chooseName function I want to use a attribute of the created object: def chooseName(self, name, object): return object.name File "/home/florian/Desktop/zope/lib/python/CS/ContentFolder/contentfolder.py", line 15, in chooseName return object.name AttributeError: 'Link' object has no attribute 'name' Even though apidoc says there is a attribute name. Or is it impossible to access the attributes at this time of the creation process? Thanks, Florian ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users