[Zope3-dev] ZCML alternative

Jeffrey P Shell jeffrey@cuemedia.com
Tue, 04 Jun 2002 13:33:54 -0600


On 6/3/02 7:36 AM, "Barry A. Warsaw" <barry@zope.com> wrote:

> 
>>>>>> "PvW" == Philipp von Weitershausen <philikon@gmx.net> writes:
> 
>   PvW> Python, on the other hand, does a lot more than just data
>   PvW> description. As a programming language, it relies on syntax,
>   PvW> code blocks etc. etc. This would make it more likely for
>   PvW> people to make mistakes when they don't know Python.
> 
> Maybe postmasters are different than Zope site admin <wink>, but I
> think most can handle simple variable assignment configuration files.
> They almost don't have to know it's Python save for some simple rules
> (string quoting, None, list brackets).  Beyond that, if they actually
> have to write Python classes and such, you probably lose 90% of them.
> 
> Maybe xml is easier if they know html, but only tangentially, because
> they're probably familar with where their < and > keys are.  You still
> need good documentation about the xml dialect (zcml), just as you need
> good documentation for html if you're web slinging.

FWIW, Java Servlets/JSP's have been using XML for deployment services for a
while.  Tomcat's deployment documentation page [1] describes all of the
parts, and supplies a decent example file [2].

  As mentioned above, the /WEB-INF/web.xml file contains the Web Application
  Deployment Descriptor for your application. As the filename extension
  implies, this file is an XML document, and defines everything about your
  application that a server needs to know (except the context path, which is
  assigned by the system administrator when the application is deployed).

  The complete syntax and semantics for the deployment descriptor is defined
  in Chapter 13 of the Servlet API Specification, version 2.3. Over time, it
  is expected that development tools will be provided that create and edit
  the deployment descriptor for you. In the meantime, to provide a starting
  point, a basic web.xml file is provided. This file includes comments that
  describe the purpose of each included element.

[1] http://jakarta.apache.org/tomcat/tomcat-4.0-doc/appdev/deployment.html
[2] http://jakarta.apache.org/tomcat/tomcat-4.0-doc/appdev/web.xml.txt

Personally, I find their web.xml code to be quite readable - I was able to
fill this stuff in when checking out Servlets and JSP a couple of months
back without too much difficulty.  But the Web Application Deployment
Descriptors used by Servlets have no apparent namespaces (at this time),
except perhaps ones used by tools that extend the Servlet specification.

I wouldn't mind seeing code like this:

<security:permission permission_id="Manage Contacts"
                     title="Manage Contacts"/>

<zmi:provideClass name="Zope.Contact."
                  permission_id="Manage Contacts"
                  title="Contact"
/>

<security:protectClass name="Zope.Contact."
                  permission_id="Zope.View"
                  methods="name, first, last, email, address, postal_code"
/>


Turned into:

<zmi>
 <provide-class name="Zope.Contact."
                permission="Manage contacts"
  >Contact</provide-class>
</zmi>

<security>
 <permission id="Manage Contacts">Manage Contacts</permission>
 <protect-class name="Zope.Contact." permission="Zope.View">
  <method>name</method>
  <method>first</method>
  <method>last</method>
  <method>email</method>
  <method>address</method>
  <method>postal_code</method>
 </protect-class>
</security>

Or something similar.  *shrug*.  I like the concept of ZCML, but even it's
been one of the primary factors keeping me away from Zope 3.  That's
primarily been due to my feelings that ZCML was still a moving target, and I
didn't want to get wrapped up in learning all of the namespaces and learning
what the . expansion rules were until they settled down a bit.

The big mess of colons in the Tutorial step 6 made quite a mess out of my
own colon.

-- 
Jeffrey P Shell 
www.cuemedia.com