[Zope3-Users] error headache: __init__() takes exactly 1 argument (3 given)

Bernd Dorn zope-mailinglist at mopa.at
Thu Apr 27 17:00:57 EDT 2006


On 27.04.2006, at 22:49, Jachin Rupe wrote:

> hi there
>
> Thanks for the reply.  Removing the class attribute from the page  
> directive got rid of the error.  However I'm not overriding the  
> VinePackage class.
>
> class VinePackage(BTreeContainer):
> 	
> 	implements(IVinePackage)
> 	
> 	title = u""
>

ups, you are on the wrong track

the VinePackage class is your content class, the page directive  
requires a view class if given any, if you don't provide one it is  
created on the fly

a view is a multiadapter for the interface you declared in the page  
directive and the request to a publishable object

take a look here:
http://www.zope.org/Wikis/DevSite/Projects/ComponentArchitecture/ 
Zope3Book/componentviews.html



>
> Since it is inheriting from BTreeContainer, perhaps that overrides  
> the constructor?  I'll look into it and if I find an answer before  
> someone else offers one I'll post it.
>
> -jachin
>
> On Apr 27, 2006, at 3:35 PM, Bernd Dorn wrote:
>
>> did you override the constructor in vine.vinePackage.VinePackage  
>> or one of its superclasses?
>>
>> iv yes, then you need
>>
>> def __init__(self,context,request):
>>     ...
>>
>> as constructor, you can test it by just removing the class  
>> attribute of your page directive
>>
>>
>>
>> On 27.04.2006, at 21:08, Jachin Rupe wrote:
>>
>>> hi there
>>>
>>> I've got an error I've been stuck on for several hours now and I  
>>> know the problem has got to be a very simple one but the error  
>>> message I'm getting is not helping.  I'm just trying to create a  
>>> view for a very simple object.  Here's the error I'm getting:
>>>
>>> 2006-04-27T13:58:09 ERROR SiteError http://localhost:8080/ 
>>> VinePackage/@@details.html
>>> Traceback (most recent call last):
>>>   File "/usr/local/Zope-3.2.1/lib/python/zope/publisher/ 
>>> publish.py", line 135, in publish
>>>     object = request.traverse(object)
>>>   File "/usr/local/Zope-3.2.1/lib/python/zope/publisher/ 
>>> browser.py", line 500, in traverse
>>>     ob = super(BrowserRequest, self).traverse(object)
>>>   File "/usr/local/Zope-3.2.1/lib/python/zope/publisher/http.py",  
>>> line 451, in traverse
>>>     ob = super(HTTPRequest, self).traverse(object)
>>>   File "/usr/local/Zope-3.2.1/lib/python/zope/publisher/base.py",  
>>> line 289, in traverse
>>>     subobject = publication.traverseName(
>>>   File "/usr/local/Zope-3.2.1/lib/python/zope/app/publication/ 
>>> publicationtraverse.py", line 46, in traverseName
>>>     ob2 = namespaceLookup(ns, nm, ob, request)
>>>   File "/usr/local/Zope-3.2.1/lib/python/zope/app/traversing/ 
>>> namespace.py", line 121, in namespaceLookup
>>>     return traverser.traverse(name, ())
>>>   File "/usr/local/Zope-3.2.1/lib/python/zope/app/traversing/ 
>>> namespace.py", line 363, in traverse
>>>     name=name)
>>>   File "/usr/local/Zope-3.2.1/lib/python/zope/component/ 
>>> __init__.py", line 165, in queryMultiAdapter
>>>     return sitemanager.queryMultiAdapter(objects, interface,  
>>> name, default)
>>>   File "/usr/local/Zope-3.2.1/lib/python/zope/component/site.py",  
>>> line 75, in queryMultiAdapter
>>>     default)
>>>   File "/usr/local/Zope-3.2.1/lib/python/zope/interface/ 
>>> adapter.py", line 475, in queryMultiAdapter
>>>     return factory(*objects)
>>> TypeError: __init__() takes exactly 1 argument (3 given)
>>>
>>> None of code I have written is in that trace so I have no idea  
>>> where the problem is.  Everything else I try to do with the  
>>> object I'm trying to create a new view for works so I'm assuming  
>>> the problem is in the ZCML for the view:
>>>
>>> <page
>>> 	name="details.html"
>>> 	for="vine.interfaces.IVinePackage"
>>> 	class="vine.vinePackage.VinePackage"
>>> 	template="vinePackage.pt"
>>> 	permission="zope.Public"
>>> 	menu="zmi_views"
>>> 	title="Preview"
>>> />
>>>
>>> The only other file I can think of that might be the cause of the  
>>> problem is vinePackage.pt   I took out all of the parts that  
>>> refer to the Content Object in case the problem was there so I  
>>> removed stuff until it was just a static html page and I was  
>>> still getting the error.  As far as I can tell I'm following the  
>>> message board example in the Zope book pretty closely.  If anyone  
>>> has any suggestions on where I should look for the problem I  
>>> would really appreciate it.
>>>
>>> thanks
>>>
>>> -jachin
>>> _______________________________________________
>>> 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