l.a.b.l.Macro : class documentation

Part of lp.app.browser.launchpad View In Hierarchy

Keeps templates that are registered as pages from being URL accessable.

The standard pattern in LP is to register templates that contain macros as views on all objects:

<browser:page
for="*" name="+main-template-macros" template="../templates/base-layout-macros.pt" permission="zope.Public" />

Without this class, that pattern would make the template URL traversable from any object. Therefore requests like these would all "work":

http://launchpad.net/+main-template-macros http://launchpad.net/ubuntu/+main-template-macros http://launchpad.net/ubuntu/+main-template-macros https://blueprints.launchpad.test/ubuntu/hoary/+main-template-macros

Obviously, those requests wouldn't do anything useful and would instead generate an OOPS.

It would be nice to use a different pattern for macros instead, but we've grown dependent on some of the peculiatrities of registering macro templates in this way.

This class was created in order to prevent macro templates from being accessable via URL without having to make nontrivial changes to the many, many templates that use macros. To use the class add a "class" parameter to macro template registrations:

<browser:page
for="*" name="+main-template-macros" template="../templates/base-layout-macros.pt" class="lp.app.browser.launchpad.Macro" permission="zope.Public" />
Method __init__ Undocumented
Method traverse Undocumented
Method browserDefault Undocumented
Method publishTraverse Undocumented
Method __call__ Undocumented
def __init__(self, context, request):
Undocumented
def traverse(self, name, furtherPath):
Undocumented
def browserDefault(self, request):
Undocumented
def publishTraverse(self, request, name):
Undocumented
def __call__(self):
Undocumented
API Documentation for Launchpad, generated by pydoctor at 2022-06-16 00:00:12.