Free views

Summary

Separating views from component

Problem

Views or let's say browser pages and it's derivates are based on a specific layout pattern. The default views are using macros and slots. This is not allways what we like to use.

This proposal describes a way to make the usage of such built in views optional. This allows us to load eggs including views but not to configure them. Another option whould be to split views out of a package and support them in different packages. But this whould be hard and whould break existing inheritation in 3rd party packages.

Proposal

Add a component.zcml and move all component related configuration into this configuration file. Include component.zcml in the existing configure.zcml file. This is fully compatible and if somebody includes configure.zcml, he will get the full configuration.

The additional component.zcml could be used to include only component related configuration whitout the view parts defined in the browser.zcml. Because the browser.zcml get's included from the configure.zcml but not from the component.zcml

Current status

Right now it's not possible to use another layout pattern without to support zmi_views and zmi_action and it's menut item pattern. The views defined in all packages also require the use-macro, fill-slot pattern which is not what we allways whant. Right now there is no option to get rid of this patterns except to duplicate packages and replace existing views.

Implementation Details

Define a configure.zcml like:

<configure ...>
  <include file="component.zcml" />
  <include file="browser.zcml" />
</configure>

Define views in the browser.zcml or browser/configure.zcml like we do till now:

<configure ...>
  <browser:page
      name="foo"
      class="..foo.MyFoo"
      permission="zope.Public"
      />
</configure>

And define a component.zcl wich contains the configuration as it does before in configure.zcml without any view related configuration:

<configure ...>
  <class class=".foo.MyFoo"
      <requires interface=".interfaces.IFoo" />
  </class>
</configure>

Optional we provide a additional attribute in the include (IInclude?) directive called component. This attribute allows us to specify a package like we do in package right now. The different whould be, that if we use the component attribut for specify a package, only the compontn.zcml get loaded.

In a egg application setup we could use for include the full configuration from a package:

<include package="foo.bar" />

But if we like to load only the component related configuration without any view configuration, we could use:

<include component="foo.bar />"

Risks

Allways the same, how does everybody find out that we have a new pattern. No other risk are known. Existing including of configure.zcml will work as excepted.

Implementation status

Implemented in my workspace, ready to commit.



( 97 subscribers )