Re: [Re: [Re: [Zope] Problem with passing objects from External Methods]]
Jason, I reported this issue to the Collector (the Zope bug tracking system) and I hope to get a chance to take a closer look at it tomorrow. Sorry I can't be more helpful right now... - C ----- Original Message ----- From: "Jason Joy" <kyroraz@usa.net> To: "Chris McDonough" <chrism@digicool.com> Sent: Tuesday, April 10, 2001 8:24 PM Subject: Re: [Re: [Re: [Zope] Problem with passing objects from External Methods]] Yes, there is visible (non-only source) tracebacks available: Zope Error Zope has encountered an error while publishing this resource. Error Type: TypeError Error Value: call of non-function (type string) Troubleshooting Suggestions The URL may be incorrect. The parameters passed to this resource may be incorrect. A resource that this resource relies on may be encountering an error. For more detailed information about the error, please refer to the HTML source for this page. If the error persists please contact the site maintainer. Thank you for your patience. File /usr/local/Zope-2.3.0/lib/python/ZPublisher/Publish.py, line 222, in publish_module File /usr/local/Zope-2.3.0/lib/python/ZPublisher/Publish.py, line 187, in publish File /usr/local/Zope-2.3.0/lib/python/Zope/__init__.py, line 221, in zpublisher_exception_hook (Object: Traversable) File /usr/local/Zope-2.3.0/lib/python/ZPublisher/Publish.py, line 171, in publish File /usr/local/Zope-2.3.0/lib/python/ZPublisher/mapply.py, line 160, in mapply (Object: DTMLFILE) File /usr/local/Zope-2.3.0/lib/python/ZPublisher/Publish.py, line 112, in call_object (Object: DTMLFILE) File /usr/local/Zope-2.3.0/lib/python/OFS/DTMLMethod.py, line 189, in __call__ (Object: DTMLFILE) File /usr/local/Zope-2.3.0/lib/python/DocumentTemplate/DT_String.py, line 538, in __call__ (Object: DTMLFILE) File /usr/local/Zope-2.3.0/lib/python/DocumentTemplate/DT_In.py, line 711, in renderwob (Object: passthis(foo)) File /usr/local/Zope-2.3.0/lib/python/DocumentTemplate/DT_Util.py, line 328, in eval (Object: foo) (Info: foo) File /usr/local/Zope-2.3.0/lib/python/OFS/DTMLMethod.py, line 261, in validate (Object: DTMLFILE) File /usr/local/Zope-2.3.0/lib/python/AccessControl/SecurityManager.py, line 144, in validate File /usr/local/Zope-2.3.0/lib/python/AccessControl/ZopeSecurityPolicy.py, line 164, in validate TypeError: (see above) Chris McDonough <chrism@digicool.com> wrote: Hi Jason, Is there a traceback associated with the error? (If it's not immediately evident, view the page source). Jason Joy wrote:
Chris,
I thank you for all your help with this frustrating issue. All your
changes
have pointed me in the right direction, but I am facing one other issue with it that I was wondering if you could shed some light on.
The <dtml-var foo> within the <dtml-in passthis(bar)> is raising an interesting error of:
Error Type: TypeError Error Value: call of non-function (type string)
Removing the <dtml-var foo> does not bring up this error, of course. Is there something that I am missing?
Jason
Chris McDonough <chrism@digicool.com> wrote: Hi Jason,
This is a stumper. But there's a solution. Rewrite your external method to look like this:
import string, regex from AccessControl import ClassSecurityInfo from Acquisition import Implicit import Globals
class element(Implicit): security = ClassSecurityInfo() security.declareObjectPublic() security.setDefaultAccess('allow')
def passthis(passed): info = [] structures = string.split(passed) for structure in structures: bit = element() bit.data = foo bit.source = structure info.append(bit) return(info)
Globals.InitializeClass(element)
For more info on why this is necessary, see
http://dev.zope.org/Wikis/DevSite/Projects/DeclarativeSecurity/ZopeSecurityF orDevelopers
HTH,
- C
def passthis(passed): class element: pass info = [] structures = string.split(passed) for structure in structures: bit = element() ## Get Information here, and store it in foo. bit.data = foo bit.source = structure info.append(bit) return(info)
---
Jason Joy wrote:
This one has been driving me a bit crazy and I think there is a simple solution to this. I have written an external method to return a list of objects back to a DTML method which executes the code via a dtml-in.
The dtml code looks like:
<dtml-in processMethod(passthis)> <dtml-var sequence-index><dtml-var data><BR> </dtml-in>
And this is passthis.py:
import string, regex
def passthis(passed): class element: pass info = [] structures = string.split(passed) for structure in structures: bit = element() ## Get Information here, and store it in foo. bit.data = foo bit.source = structure info.append(bit) return(info)
---
When I run the code, I get a box that asks me to revalidate my Zope
login
and
nothing works, finally, the system gives up and gives me an error with this at the bottom:
File /usr/local/Zope-2.3.0/lib/python/AccessControl/ZopeSecurityPolicy.py, line 168, in validate Unauthorized: data
Does anyone have any advice on this one? This is an example of what I am doing and I need to pass a list of objects (with about 10 properties on each) to be run through a dtml-in.
Thanks,
Jason
____________________________________________________________________ Get free email and a permanent address at http://www.netaddress.com/?N=1
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
____________________________________________________________________ Get free email and a permanent address at http://www.netaddress.com/?N=1
____________________________________________________________________ Get free email and a permanent address at http://www.netaddress.com/?N=1
participants (1)
-
Chris McDonough