[Zope3-Users] Custom Content Container

Tom Gross tom at lalisio.com
Wed Nov 29 04:08:35 EST 2006


Hi David,

    I found another workaround. I defined a dummy Widget for the 
abstract Field-field. Something like this:

from zope.app.form.browser.widget import SimpleInputWidget

class DummyWidget(SimpleInputWidget):
    def __call__(self):        
	pass

and additional in zcml:

 <view
      type="zope.publisher.interfaces.browser.IBrowserRequest"
      for="zope.schema.interfaces.IField"
      provides="zope.app.form.interfaces.IInputWidget"
      factory=".DummyWidget"
      permission="zope.Public"
      />

Although  it's a workaround it looks a bit nicer in the code :). You can 
use container constraints the intended way.

Cheers
-Tom

David Johnson wrote:
> I figured out the problem.  In my interfaces I was using the contains and
> containers methods.  When I stuck to the more tedious __parent__ = ...
> approach as outlined in Stephan's book, all was solved.  
>
> Thanks.
>
>
>   
>> -----Original Message-----
>> From: zope3-users-bounces at zope.org [mailto:zope3-users-bounces at zope.org]
>> On Behalf Of David Johnson
>> Sent: Tuesday, November 28, 2006 2:21 PM
>> To: 'Tom Gross'
>> Cc: zope3-users at zope.org
>> Subject: RE: [Zope3-Users] Custom Content Container
>>
>> Yes indeed. I'm only using 1 Text and 3 TextLine fields.  This is my first
>> attempt at this so I'm trying to keep it fairly simple.
>>
>>
>>     
>>> -----Original Message-----
>>> From: Tom Gross [mailto:tom at lalisio.com]
>>> Sent: Tuesday, November 28, 2006 2:05 PM
>>> To: David Johnson
>>> Cc: zope3-users at zope.org
>>> Subject: Re: [Zope3-Users] Custom Content Container
>>>
>>> Hi David,
>>>
>>> which fields does your IOwner-interface consist of? You get this error
>>> if you call an auto generated form from a List-field, without
>>> having value_type specified, but there are other scenarios, so this
>>> information would be helpful.
>>>
>>> Cheers
>>> -Tom
>>>
>>> David Johnson wrote:
>>>       
>>>> I created a custom content container that reads entries from a MySQL
>>>> database and allows editing of the container objects. Or at least that
>>>> is my desire...
>>>>
>>>> The content container by itself "seems" to work well. However when I
>>>> click on an object in the contents ZMI view, I receive the following
>>>> exception:
>>>>
>>>> ComponentLookupError: ((<zope.schema._bootstrapfields.Field object at
>>>> 0x420f450c>, <zope.publisher.browser.BrowserRequest instance
>>>>
>>>>         
>> URL=http://192.168.81.89:8070/++etc++site/default/TPM%20on%20Dev/4/@@editT
>>     
>>> PMOwner.html>),
>>>       
>>>> <InterfaceClass zope.app.form.interfaces.IInputWidget>, u'')
>>>>
>>>>
>>>> I'm not quite sure why "IInputWidget" is being looked up, though I
>>>> suppose it has something to do with the form I am creating, and I'm
>>>> not sure why it is not finding what it is looking for.
>>>>
>>>> editTPMOwner.html is simply a <browser:editform> ZCML directive that
>>>> uses schema IOwner.
>>>>
>>>> Any ideas or thoughts? Thanks so kindly in advance.
>>>>
>>>> --
>>>>
>>>> David Johnson
>>>>
>>>> ----------------------------------------------------------------------
>>>>         
>> --
>>     
>>>> _______________________________________________
>>>> Zope3-users mailing list
>>>> Zope3-users at zope.org
>>>> http://mail.zope.org/mailman/listinfo/zope3-users
>>>>
>>>>         
>> _______________________________________________
>> Zope3-users mailing list
>> Zope3-users at zope.org
>> http://mail.zope.org/mailman/listinfo/zope3-users
>>     
>
>   



More information about the Zope3-users mailing list