How to use methods from OFS?
Hi! I'm trying to import and use OFS.content_types.guess_content_type(), Zope's method to get content types of files by name or content, in a Python script within Zope. But all I get is an Unauthorized error: "You are not allowed to access content_types in this context" (even Proxy role "Manager" didn't succeed). I guess invoking OFS modules needs special permissions or even External Methods. Is this correct, and can somebody give me a hint/a working example how to achieve this? Thanks a lot! And good night now... Martin
Martin Gebert wrote:
Hi!
I'm trying to import and use OFS.content_types.guess_content_type(), Zope's method to get content types of files by name or content, in a Python script within Zope. But all I get is an Unauthorized error: "You are not allowed to access content_types in this context" (even Proxy role "Manager" didn't succeed). I guess invoking OFS modules needs special permissions or even External Methods. Is this correct, and can somebody give me a hint/a working example how to achieve this? Thanks a lot! And good night now...
Martin
please read: Zope/lib/python/Products/PythonScripts/README.txt -- Maik Jablonski __o www.zfl.uni-bielefeld.de _ \<_ Deutsche Zope User Group Bielefeld, Germany (_)/(_) www.dzug.org
Maik Jablonski schrieb:
Martin Gebert wrote:
I'm trying to import and use OFS.content_types.guess_content_type(), Zope's method to get content types of files by name or content, in a Python script within Zope. But all I get is an Unauthorized error: "You are not allowed to access content_types in this context" (even Proxy role "Manager" didn't succeed). I guess invoking OFS modules needs special permissions or even External Methods. Is this correct, and can somebody give me a hint/a working example how to achieve this?
please read:
Zope/lib/python/Products/PythonScripts/README.txt
Yep, that's it. Thank you, and have a nice weekend :-) Martin
participants (2)
-
Maik Jablonski -
Martin Gebert