Re: Python scripts

Laurence Rowe <[email protected]>
Newsgroups gmane.comp.web.zope.general
Message-ID <CAOycyLRS0B2qsDg+uSQ_cdM5154S3_mGy7WG-L5TV3Y9rjPFyw@mail.gmail.com>
On 6 July 2012 14:09, Richard Harley <[email protected]> wrote:
> On Zope 2.10 is there a simple/universal way to only allow python scripts to
> be called by DTML methods or other python scripts and not directly TTW?

You can check that the script is not the published object with:

    if container.REQUEST['PUBLISHED'] is script:
        raise 'Forbidden'

For newer versions of Zope raise an exception object:

    from zExceptions import Forbidden
    if container.REQUEST['PUBLISHED'] is script:
        raise Forbidden('Script may not be published.')

Laurence
_______________________________________________
Zope maillist  -  [email protected]
https://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope-dev )
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.