[Zope3-dev] RFC: Heads up! Major changes coming!
Jim Fulton
jim@zope.com
Tue, 28 May 2002 09:05:00 -0400
Over the last couple of months, there has been a lot of good
discussion about making Zope 3 easier for the Python programmer. I've
been trying to capture much of this in the recent flurry of Zope 3
proposals. I want to get a number of these ideas incoprated before
EuroPython and before a sprint I'll be conducting in a couple of weeks.
This weekend, I worked on updating the tutoria; to reflect a number of
the recent changes. In doing so, I came up with some additional ideas
for which I posted proposals this morning, including providing a class
directive to collect configuration for classes, especially content
classes, and a simplification of the view API.
I've posted a copy of the updated slides at
http://dev.zope.org/Wikis/DevSite/Projects/ComponentArchitecture/TutorialSlides/index.html.
for your review and comment here. (They aren't Wiki pages. :(.
Some things to note.
- The configuration file has become a good bit more readable.
Here's the old step 5 configuration::
<zopeConfigure
xmlns='http://namespaces.zope.org/zope'
xmlns:security='http://namespaces.zope.org/security'
xmlns:zmi='http://namespaces.zope.org/zmi'
xmlns:browser='http://namespaces.zope.org/browser'>
<security:permission
permission_id=".Contact.ManageContacts"
title="Manage Contacts" />
<security:protectClass name=".Contact.">
<security:protect interface=".Contact.IContactInfo."
permission_id="Zope.View" />
<security:instances permission_id="Zope.View"/>
<security:protect methods="update"
permission_id=".Contact.ManageContacts"/>
</security:protectClass>
<zmi:factoryFromClass name=".Contact."
permission_id=".Contact.ManageContacts"
title="Personal Contact Information" />
<security:protectClass name=".Contact.ContactInfoView."
permission_id="Zope.View" />
<browser:defaultView for=".Contact.IContactInfo."
name="info"
factory=".Contact.ContactInfoView." />
<security:protectClass name=".Contact.ContactEditView."
permission_id=".Contact.ManageContacts"
methods="index, action" />
<browser:view for=".Contact.IContactEdit."
name="edit"
factory=".Contact.ContactEditView." />
<zmi:tabs for=".Contact.IContact.">
<zmi:tab label="Edit" action="edit;view"/>
<zmi:tab label="View" action="info;view"/>
<zmi:tab label="Undo" action="undo"/>
</zmi:tabs>
<zmi:icon for=".Contact.IContact." file="Contact/contact.gif" />
<security:protectClass
name=".Contact.stubpostal.Lookup"
interface=".Contact.IPostal.IPostalLookup."
permission_id="Zope.Public" />
<security:protectClass
name=".Contact.stubpostal.Info"
interface=".Contact.IPostal.IPostalInfo"
permission_id="Zope.Public" />
<utility
component=".Contact.stubpostal.lookup"
provides=".Contact.IPostal.IPostalLookup" />
<security:protectClass name=".Contact.ContactCityState."
interface=".Contact.IPostal.IPostalInfo"
permission_id="Zope.Public" />
<adapter
factory=".Contact.ContactCityState."
provides=".Contact.IPostal.IPostalInfo"
for=".Contact.IContactInfo." />
</zopeConfigure>
and here's the new one::
<zopeConfigure
xmlns='http://namespaces.zope.org/zope'
xmlns:security='http://namespaces.zope.org/security'
xmlns:zmi='http://namespaces.zope.org/zmi'
xmlns:browser='http://namespaces.zope.org/browser'>
<security:permission
permission_id=".Contact.ManageContacts"
title="Manage Contacts" />
<class class=".Contact.">
<zmi:factory permission_id=".Contact.ManageContacts"
title="Personal Contact Information" />
<security:allow interface=".Contact.IContactInfo."
permission_id="Zope.View" />
<security:allow method="update"
permission_id=".Contact.ManageContacts"/>
</class>
<browser:defaultView for=".IContact.IContactInfo."
name="info.html"
PageTemplate="info.pt"
permission_id="Zope.View" />
<browser:view for=".IContact."
factory=".Contact.ContactEditView."
permission_id=".Contact.ManageContacts" >
<browser:page name="editForm.html" attribute="editForm" />
<browser:page name="edit.html" attribute="edit" />
</browser:view>
<zmi:tabs for=".IContact.">
<zmi:tab label="Edit" action="edit"/>
<zmi:tab label="View" action="info"/>
<zmi:tab label="Undo" action="undo"/>
</zmi:tabs>
<zmi:icon for=".IContact." file="Contact/contact.gif" />
<security:allow
class=".Contact.stubpostal.Info"
interface=".Contact.IPostal.IPostalInfo"
permission_id="Zope.Public" />
<utility
component=".Contact.stubpostal.LookupUtility"
provides=".Contact.IPostal.IPostalLookup"
permission_id="Zope.Public" />
<adapter
factory=".Contact.ContactCityState."
provides=".Contact.IPostal.IPostalInfo"
for=".Contact.IContactInfo"
permission_id="Zope.Public"
/>
</zopeConfigure>
Note that, in the new version, all components are configured with a
single directive.
- I really like the idea of explicitly defining the pages provided by
views and having the pages appear as pages on the content. This
makes page construction feel more natural, eliminating the extra URL
step for the view.
This also eliminates the need to traverse the view and for the view
to control traversal. There's no need for the magic in
AttributePublisher.
I'd like to make this view style the default.
One troublesome consequence of this change is that view names are
now page names. With the current URI-parameter
namespace-qualification syntax, the namespace parameter will appear
after the page name, as in::
aFolder/grants.html;view
Because most (all) clients aren't aware of URI parameters, the
namespace parameter effectively hides the file-name extension. This
is a problem, since Zope 3 is trying to be file-extension
friendly. Note that this is only an issue when namespacve
qualification is necessary, which might be avoided in many cases.
Given this, I wonder if we should switch to the namespace syntax
used by XPath (and perl and C++ ;)::
aFolder/view::grants.html
This syntax is a little nicer looking (to me :) and doesn't mess
with the file-extension. The only downside is that we'd have to
disallow ids/names that begin with identifier characters followed by
"::". I expect that this limitation would be acceptable.
Thoughts?
--
Jim Fulton mailto:jim@zope.com Python Powered!
CTO (888) 344-4332 http://www.python.org
Zope Corporation http://www.zope.com http://www.zope.org