On Tue, Jan 27, 2009 at 14:06, Milos Prudek <pru...@bvx.cz> wrote:
> I would like to upgrade my site from Zope 2.7.x to Zope 2.10.x
> When I try to run my site under Zope 2.10.x, I get this exception:
>  class JMZPTMacros:
>  File "/home/orl/Zope/Products/JMZPTMacros/JMZPTMacros.py", line 28, in
> JMZPTMacros
>    security.declarePublic()
> TypeError: declarePublic() takes at least 2 arguments (1 given)
> I need to use JMZPTMacros. It is an old product that seems to require a patch
> to line 28. I can see that Zope 2.7.x defines declarePublic() as:
> def declarePublic(self, *names):
> and that Zope 2.10.x defines declarePublic() as:
> def declarePublic(self, name, *names):
> therefore I understand that one parameter is obligatory. But I cannot guess
> what parameter it should be for JMZPTMacros. I tried to look how
> declarePublic is used inside Zope but it gave me no clue.

declarePublic was never meant to be called without any names, hence
the signature change. Calling it without names is a bug in
JMZPTMacros. Most likely, the author meant to protect the method right
below that line.

To illustrate, the code probably looks something like:

  def someMethod(self, REQUEST):

You put the name of that method in a string:


It could also be that the author assumed that not putting in a method
name meant that *all* methods on the class would be public. In that
case, you'll need to use declareObjectPublic() instead.

Martijn Pieters
Zope maillist  -  Zope@zope.org
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-dev )

Reply via email to