Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Zope: CMF
[dev] add view traversal
 

Index | Next | Previous | View Flat


y.2008 at wcm-solutions

Sep 14, 2008, 3:26 AM


Views: 1020
Permalink
[dev] add view traversal

Hi!


This mail has been lying around for a while because I'm not sure it's
the right way to start the discussion. But now I'll give it a try. Maybe
the sprinters find some time to discuss this:

One result of the "Add forms and menus"[1] thread was that we'd like to
get add views by portal type name. Some custom traversal should look up
and return the right view for the specified portal type.

I'm currently trying to figure out how to implement that correctly and
am struggling with some details:


1.) What should URLs look like?
-------------------------------

Here are same possible URLs for adding a Message to a guest book:

http://www.example.org/guestbook/+Message
http://www.example.org/guestbook/@@+Message
http://www.example.org/guestbook/addMessage.html

http://www.example.org/guestbook/+/Message
http://www.example.org/guestbook/@@+/Message
http://www.example.org/guestbook/+/addMessage.html

http://www.example.org/guestbook/+cmf/Message
http://www.example.org/guestbook/@@+cmf/Message
http://www.example.org/guestbook/+cmf/addMessage.html

http://www.example.org/guestbook/add/Message
http://www.example.org/guestbook/@@add/Message
http://www.example.org/guestbook/add/addMessage.html


2.) Which hook should be used for custom traversal?
---------------------------------------------------

a) for URLs like http://www.example.org/guestbook/+Message

In this case we use a special prefix '+' followed by the portal type
name. CMF containers don't implement IPublishTraverse, so we can
register an IPublishTraverse adapter. If we don't find an add view, we
can fall back to DefaultPublishTraverse behavior.

Unfortunately the IPublishTraverse hook only works with one adapter. If
other packages like plone.app.imaging[2] try to use the same hook, we
get a problem.


b) for URLs like http://www.example.org/guestbook/+/Message

The '+' view already implements IPublishTraverse, so we can't change
traversal using an adapter. The only solution I can see is to replace
the '+' view by a customized version.


c) for URLs like http://www.example.org/guestbook/add/Message

If we use our own adding view, we can implement IPublishTraverse inside
the view or as adapter.


3.) For which context should we register the add views?
-------------------------------------------------------

The add views will depend on special portal type handling done by the
traverser. So we register the add views for traverser?

Or should all views have a default portal type that is used if we access
add views directly? In that case we would register the add view for the
container.



plone.dexterity[3] uses an @@add-dexterity-content traverser, but I
don't think product names like dexterity or cmf should be visible in
URLs. Those are implementation details that should be transparent for users.

Any feedback is welcome.


Cheers,

Yuppie



[1] http://mail.zope.org/pipermail/zope-cmf/2008-July/027500.html

[2]
http://dev.plone.org/plone/browser/plone.app.imaging/trunk/plone/app/imaging/traverse.py

[3]
http://dev.plone.org/plone/browser/plone.dexterity/trunk/plone/dexterity/browser/add.py

_______________________________________________
Zope-CMF maillist - Zope-CMF[at]lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests

Subject User Time
[dev] add view traversal y.2008 at wcm-solutions Sep 14, 2008, 3:26 AM
    Re: [dev] add view traversal jens at dataflake Sep 14, 2008, 3:50 AM
        Re: [dev] add view traversal optilude at gmx Sep 14, 2008, 4:30 AM
            Re: [dev] add view traversal charlie at begeistert Sep 14, 2008, 4:44 AM
            Re: [dev] add view traversal y.2008 at wcm-solutions Sep 15, 2008, 4:00 AM
    Re: [dev] add view traversal charlie at begeistert Sep 14, 2008, 4:38 AM
    Re: [dev] add view traversal optilude at gmx Sep 14, 2008, 4:47 AM
        Re: [dev] add view traversal y.2008 at wcm-solutions Sep 15, 2008, 4:04 AM
    Re: [dev] add view traversal optilude at gmx Sep 14, 2008, 4:53 AM
    Re: [dev] add view traversal tseaver at palladion Sep 14, 2008, 5:50 AM
        Re: [dev] add view traversal rnix at squarewave Sep 14, 2008, 6:11 AM
    Re: [dev] add view traversal y.2008 at wcm-solutions Sep 15, 2008, 4:05 AM
        Re: [dev] add view traversal optilude at gmx Sep 15, 2008, 6:31 AM
            Re: [dev] add view traversal y.2008 at wcm-solutions Sep 15, 2008, 9:21 AM
                Re: [dev] add view traversal optilude at gmx Sep 15, 2008, 11:08 AM

  Index | Next | Previous | View Flat
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.