HELP: External methods as methods of objects...
After searching through the archives for something relevant it seems like most people are calling external methods from DTML, rather than accessing them directly through the web. So I guess my first question is, is there a big reason for that? My real question: I've set up an external method that is meant to parse the file it is called on. So if my folder has a File object called "spam", and my external method "parse", I can call "/spam/parse" to call the method on the object spam: self.id() is "spam". However, as far as I can tell this only works for files and folders; if I try it on a DTML Document I get a missing docstring error. You can't add __doc__ as a property, and there's a __doc__ both at the top level of my module and for the function. Any way around this? You can see my minimal failed example at http://www.zope.org/Members/aez/example TIA...
"M. Papillon" wrote:
However, as far as I can tell this only works for files and folders; if I try it on a DTML Document I get a missing docstring error.
There's your key. You need to add a Python docstring. For example: def methodFoo(): """ This is mthodFoo's docstring""" # rest of methodFoo pass This is part of Zope's permissions system -- python methods can't be called on objects unless they have a docstring, and don't begin with an underscore. This is documented somewhere (promise!), but I can't remember where :-/ -- Steve Alexander Software Engineer Cat-Box limited
participants (2)
-
M. Papillon -
Steve Alexander