{"id":27568,"library":"zope-ptresource","title":"zope.ptresource","description":"Page template resource plugin for zope.browserresource. Version 6.0 supports Python >=3.9. Provides a way to register page templates as browser resources using ZCML directives. Release cadence is low, maintained by Zope Foundation.","status":"active","version":"6.0","language":"python","source_language":"en","source_url":"https://github.com/zopefoundation/zope.ptresource/","tags":["zope","pagetemplate","resource"],"install":[{"cmd":"pip install zope.ptresource","lang":"bash","label":"Standard install"}],"dependencies":[{"reason":"Core dependency; provides resource infrastructure","package":"zope.browserresource","optional":false},{"reason":"Required for page template parsing","package":"zope.pagetemplate","optional":false},{"reason":"Required for ZCML and component architecture","package":"zope.component","optional":false}],"imports":[{"wrong":"from zope.ptresource import PageTemplateResource","symbol":"PageTemplateResource","correct":"from zope.ptresource import PageTemplateResource"}],"quickstart":{"code":"# Example ZCML registration (configure.zcml)\n<configure xmlns=\"http://namespaces.zope.org/zope\">\n  <include package=\"zope.ptresource\" file=\"meta.zcml\" />\n  \n  <ptresource\n      name=\"my_template\"\n      template=\"my_template.pt\"\n      for=\"*\"\n      layer=\"default\"\n      />\n</configure>","lang":"python","description":"Register a page template resource using ZCML. The ptresource directive requires package='zope.ptresource' to be included first."},"warnings":[{"fix":"Ensure Python >=3.9 and upgrade the library.","message":"Version 6.0 drops support for Python 2 and Python <3.9. Upgrade your Python version if you are on older releases.","severity":"breaking","affected_versions":"<=5.x"},{"fix":"Use layer_name='default' instead of layer='default' if using ZCML.","message":"The 'layer' attribute in ZCML ptresource directive is deprecated in favor of 'layer_name' (string) or 'layer' as a dotted name. Using integer layer IDs is no longer supported.","severity":"deprecated","affected_versions":">=6.0"},{"fix":"Add <include package=\"zope.ptresource\" file=\"meta.zcml\" /> before using ptresource directive.","message":"Missing include of 'meta.zcml' will cause unknown directive error. The ptresource directive is not available until the meta.zcml is loaded.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"search_vec":"'3.9':12 '6.0':9 'browser':21 'cadenc':27 'direct':25 'foundat':33 'low':29 'maintain':30 'page':2,18 'pagetempl':35 'plugin':5 'provid':13 'python':11 'regist':17 'releas':26 'resourc':4,22,36 'support':10 'templat':3,19 'use':23 'version':8 'way':15 'zcml':24 'zope':32,34 'zope.browserresource':7 'zope.ptresource':1","created_at":"2026-05-01T17:46:56.431097+00:00","updated_at":"2026-05-01T17:46:56.431097+00:00","problems":{"verify_error":"Traceback (most recent call last):\n  File \"<string>\", line 1, in <module>\nImportError: cannot import name 'PageTemplateResource' from 'zope.ptresource' (/tmp/tmpa072shzg/venv/lib/python3.12/site-packages/zope/ptresource/__init__.py)"},"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/zopefoundation/zope.ptresource","docs":null,"changelog":null,"pypi":"https://pypi.org/project/zope-ptresource/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["web-framework"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"import_fail","verified_at":"2026-07-03","last_verified":"2026-07-03","next_check":"2026-07-10","install_tag":null}}