[Zope] RE: Zope digest, Vol 1 #2068 - 50 msgs
Ria Marinussen
marinus@cs.utwente.nl
Fri, 26 Apr 2002 08:54:40 +0200
Hi Dennis,
I strugled with the same problem a little while ago, don't know how I
figured it out exactly, but this is how I managed it:
Put this in a PythonScript and everytime you call it (or test it) a new TTP
wil be created, with id= tt_page, title=Tiny Tabel Page and colums name and
value. (of course you can make those variable and pass them to the
script...)
new_ttp=context.manage_addProduct['TinyTablePlus'].manage_addTinyTablePlus(i
d='tt_page',title='Tiny Table Page',columns='name value')
Greetings,
Ria Marinussen
Webmaster Department of Computer Science
University of Twente
Enschede
The Netherlands.
> Message: 28
> Date: Thu, 25 Apr 2002 02:59:19 -0700 (PDT)
> From: Dennis Allison <allison@sumeru.stanford.EDU>
> To: zope@zope.org
> Subject: [Zope] Tiny Tables Plus's Constructor
>
> I've been using TTP and find it meets my needs for a "not quite a
> database" sort of object. Up until now, I've created the
> tables using
> the usual ZMI management interface.
>
> Now I need to create, delete, and modify the tables programatically.
> I've don't quite understand the interface for the product. A
> little help
> would be much appreciated.
>
> As I understand Zope, a Product's constructor is registerd with an
> ObjectManager and accessed throught it, e.g.,
>
> self.manage_addproduct['OFSP'].manage_addFolder(id,title)
>
> is the usual pattern for creating a folder.
>
> I looked at the TTP code. The constructor is addItem( self,
> id, title)
> but I've been unable to grok how the product has registered with an
> ObjectManager and under what name it is to be found. Where is the
> product-type specified in the Product so I can locate the proper
> ObjectManager instance to create new instances.
>
> I have tried the obvious'TinyTablePlus' key. It found an
> ObjectManager
> but the constructor 'addItem' was not found and so the constructor
>
> self.manage_addproduct['TinyTablePlus'].addItem(
> 'newtable', 'test')
>
> failed with a getattr error for addItem.
>
> I suspected it might be a permissions problem. I checked the
> permissions
> on the product panel and enabled all of the Tiny Table
> options (Add and
> Change). Truth be told, I am not sure what the impact of those
> permissions should be. I saw no change with my constructor problem...
>
> Thanks for any help you can provide.
>