Re: [Zope] declarePublic function
As the bottom of my email stated, use declareObjectPublic() in this case. The rest of the security calls are then somewhat redundant, Yes, I used your advice and it seems to have resolved the issue. Thank you! -- Milos Prudek ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
[Zope] declarePublic function
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. Please help. -- Milos Prudek ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] declarePublic function
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: security.declarePublic() def someMethod(self, REQUEST): Whatever You put the name of that method in a string: security.declarePublic('someMethod') 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 http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] declarePublic function
JMZPTMacros. Most likely, the author meant to protect the method right below that line. To illustrate, the code probably looks something like: security.declarePublic() def someMethod(self, REQUEST): Actually, it does not look like that. It is not followed by method definition. Here is all the context: class JMZPTMacros: #All the ZPT Objects will be loaded as attributes of my #JMZPTMacros class security=ClassSecurityInfo() security.declarePublic() #Loads my generic manage_add form macros security.declarePublic('generic_add') generic_add=PageTemplateFile('zpt/generic_add',globals()) generic_add._owner=None #Loads my generic manage_edit form macros security.declarePublic('generic_edit') generic_edit=PageTemplateFile('zpt/generic_edit',globals()) generic_edit._owner=None #Loads my generic manage_view form macros security.declarePublic('generic_view') generic_view=PageTemplateFile('zpt/generic_view',globals()) generic_view._owner=None #Loads my generic macros security.declarePublic('generic') generic=PageTemplateFile('zpt/generic',globals()) generic._owner=None So, since there are many correct calls of declarePublic(), what does the incorrect (paremeter-less) call near the top of the class do? -- Milos Prudek ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] declarePublic function
On Tue, Jan 27, 2009 at 16:31, Milos Prudek pru...@bvx.cz wrote: Actually, it does not look like that. It is not followed by method definition. Here is all the context: class JMZPTMacros: #All the ZPT Objects will be loaded as attributes of my #JMZPTMacros class security=ClassSecurityInfo() security.declarePublic() snip So, since there are many correct calls of declarePublic(), what does the incorrect (paremeter-less) call near the top of the class do? As the bottom of my email stated, use declareObjectPublic() in this case. The rest of the security calls are then somewhat redundant, probably put in because the first declarePublic didn't do what the author expected of it.. -- Martijn Pieters ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )