{"id":31782321,"url":"https://github.com/zopefoundation/products.pythonscripts","last_synced_at":"2025-10-10T09:18:39.898Z","repository":{"id":5559039,"uuid":"6763891","full_name":"zopefoundation/Products.PythonScripts","owner":"zopefoundation","description":"Provides support for restricted execution of Python scripts in Zope.","archived":false,"fork":false,"pushed_at":"2025-03-17T07:48:42.000Z","size":529,"stargazers_count":6,"open_issues_count":0,"forks_count":10,"subscribers_count":60,"default_branch":"master","last_synced_at":"2025-09-29T03:06:50.751Z","etag":null,"topics":["maintained"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zopefoundation.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGES.rst","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2012-11-19T17:02:04.000Z","updated_at":"2025-03-17T07:48:46.000Z","dependencies_parsed_at":"2024-10-18T12:59:10.372Z","dependency_job_id":null,"html_url":"https://github.com/zopefoundation/Products.PythonScripts","commit_stats":{"total_commits":185,"total_committers":15,"mean_commits":"12.333333333333334","dds":0.7081081081081081,"last_synced_commit":"b31dc7294be958015b73228999397c167e05e809"},"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"purl":"pkg:github/zopefoundation/Products.PythonScripts","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zopefoundation%2FProducts.PythonScripts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zopefoundation%2FProducts.PythonScripts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zopefoundation%2FProducts.PythonScripts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zopefoundation%2FProducts.PythonScripts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zopefoundation","download_url":"https://codeload.github.com/zopefoundation/Products.PythonScripts/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zopefoundation%2FProducts.PythonScripts/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279003410,"owners_count":26083581,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-10T02:00:06.843Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["maintained"],"created_at":"2025-10-10T09:18:38.335Z","updated_at":"2025-10-10T09:18:39.888Z","avatar_url":"https://github.com/zopefoundation.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":".. image:: https://github.com/zopefoundation/Products.PythonScripts/actions/workflows/tests.yml/badge.svg\n   :target: https://github.com/zopefoundation/Products.PythonScripts/actions/workflows/tests.yml\n\n.. image:: https://coveralls.io/repos/github/zopefoundation/Products.PythonScripts/badge.svg?branch=master\n   :target: https://coveralls.io/github/zopefoundation/Products.PythonScripts?branch=master\n\n.. image:: https://img.shields.io/pypi/v/Products.PythonScripts.svg\n   :target: https://pypi.org/project/Products.PythonScripts/\n   :alt: Current version on PyPI\n\n.. image:: https://img.shields.io/pypi/pyversions/Products.PythonScripts.svg\n   :target: https://pypi.org/project/Products.PythonScripts/\n   :alt: Supported Python versions\n\n\nProducts.PythonScripts\n======================\nThe Python Scripts product provides support for restricted execution of\nPython scripts, exposing them as callable objects within the Zope\nenvironment.\n\nProviding access to extra modules\n---------------------------------\nPython script objects have a limited number of \"safe\" modules\navailable to them by default. In the course of working with Zope,\nyou will probably wish to make other modules available to script\nobjects.\n\nThe Utility.py module in the PythonScripts products provides a\nsimple way to make modules available for use by script objects\non a site-wide basis. Before making a module available to Python\nscripts, you should carefully consider the potential for abuse\nor misuse of the module, since all users with permission to\ncreate and edit Python scripts will be able to use any functions\nand classes defined in the module. In some cases, you may want to\ncreate a custom module that just imports a subset of names from\nanother module and make that custom module available to reduce\nthe risk of abuse.\n\nThe easiest way to make modules available to Python scripts on\nyour site is to create a new directory in your Products directory\ncontaining an ``__init__.py`` file. At Zope startup time, this\n\"product\" will be imported, and any module assertions you make\nin the ``__init__.py`` will take effect. Here's how to do it:\n\n- In your Products directory (either in lib/python of your\n  Zope installation or in the root of your Zope install,\n  depending on your deployment model), create a new directory\n  with a name like \"GlobalModules\".\n\n- In the new directory, create a file named ``__init__.py``.\n\n- Edit the ``__init__.py`` file, and add calls to the 'allow_module'\n  function (located in the Products.PythonScripts.Utility module),\n  passing the names of modules to be enabled for use by scripts.\n  For example::\n\n    # Global module assertions for Python scripts\n    from Products.PythonScripts.Utility import allow_module\n\n    allow_module('base64')\n    allow_module('re')\n    allow_module('DateTime.DateTime')\n\n  This example adds the modules 'base64', 're' and the 'DateTime'\n  module in the 'DateTime' package for use by Python scripts. Note\n  that for packages (dotted names), each module in the package path\n  will become available to script objects.\n\n- Restart your Zope server. After restarting, the modules you enabled\n  in your custom product will be available to Python scripts.\n\nPlacing security assertions within the package/module you are trying\nto import will not work unless that package/module is located in\nyour Products directory.\n\nThis is because that package/module would have to be imported for its\nincluded security assertions to take effect, but to do\nthat would require importing a module without any security\ndeclarations, which defeats the point of the restricted\nPython environment.\n\nProducts work differently as they are imported at Zope startup.\nBy placing a package/module in your Products directory, you are\nasserting, among other things, that it is safe for Zope to check\nthat package/module for security assertions. As a result, please\nbe careful when place packages or modules that are not Zope Products\nin the Products directory.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzopefoundation%2Fproducts.pythonscripts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzopefoundation%2Fproducts.pythonscripts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzopefoundation%2Fproducts.pythonscripts/lists"}