<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#CCCCCC" text="#333333">
    That works great, thanks. So there is no way to do this across, say,
    a folder with hundreds of scripts in without duplicating the code in
    each individually?<br>
    <br>
    <br>
    On 06/07/12 13:30, Laurence Rowe wrote:
    <blockquote
cite="mid:CAOycyLRS0B2qsDg+uSQ_cdM5154S3_mGy7WG-L5TV3Y9rjPFyw@mail.gmail.com"
      type="cite">
      <pre wrap="">On 6 July 2012 14:09, Richard Harley <a class="moz-txt-link-rfc2396E" href="mailto:richard@scholarpack.com">&lt;richard@scholarpack.com&gt;</a> wrote:
</pre>
      <blockquote type="cite">
        <pre wrap="">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?
</pre>
      </blockquote>
      <pre wrap="">
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
</pre>
    </blockquote>
  </body>
</html>