Skip to main content

Checks that all grokked "view-like" components require a permission.

Project description

megrok.strictrequire

What is megrok.strictrequire?

Strictrequire implements additional grokkers for the various view components in Grok. These grokkers determine whether the grok.require directive has been explicitly set on the view component (or on its baseclass).

It will raise an error (and thus prevent the startup of the application) if there’s a view component without an explicit use of the grok.require directive, providing a minimal safety net for finding unprotected views in your application.

Making use of megrok.strictrequire

To enable megrok.strictrequire simply list it as a requirement in your projects’s setup.py. Grok based applications that were bootstrapped with a recent version of the grokproject command will automatically include the megrok.strictrequire’s configure.zcml making the additional grokkers effective.

Caveat

If your applications triggers the registration of “third-party” views that do not themselves specifically use the grok.require directive, your application will not start.

If you decide you still want to make use of the third-aprty views you should make sure the inclusion of the configure.zcml of megrok.strictrequire comes after the inclusion of the third-party package by tweaking your applications’s configure.zcml. For example:

<configure xmlns="http://namespaces.zope.org/zope"
           xmlns:grok="http://namespaces.zope.org/grok">
  <include package="grok" />

  <!-- include this package before mgrok.strictrequire is included -->
  <include package="package_with_unprotected_views" />

  <!-- includeDependencies will include megrok.strictrequire -->
  <includeDependencies package="." />
  <grok:grok package="." />
</configure>

Changelog of megrok.strictrequire

0.6 (2013-10-16)

  • Add grokker for grok.Page components.

0.5 (2011-07-19)

  • Reflect recent changes in grok 1.8.

0.4 (2011-07-11)

  • Use the groktoolkit versions.

  • Don’t check the requirement directive for ViewletManager, as these are not exposed as views.

0.3 (2010-05-18)

  • Test-requirements have been fixed. They formally include zope.app.testing for the moment.

0.2 (2009-06-22)

  • Check ViewletManager and Viewlet components too.

0.1 (2009-06-18)

  • Initial release.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

megrok.strictrequire-0.6.zip (18.6 kB view details)

Uploaded Source

File details

Details for the file megrok.strictrequire-0.6.zip.

File metadata

File hashes

Hashes for megrok.strictrequire-0.6.zip
Algorithm Hash digest
SHA256 83e7812080f6ebcbe83fa7883f3141cb7cfe559d8a1eb429076678198a7b8dc2
MD5 68e3d91e316044dfbb09ffe6b83b5794
BLAKE2b-256 f02a6263d8c1122146a1ddd2d602347c886f258338144f2259e6ea2d31d0bd40

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page