Re: [Zope3-Users] Blog package

2006-09-08 Thread Lennart Regebro

On 8/17/06, David Pratt [EMAIL PROTECTED] wrote:

 *  Accessing /blog/ will show a list of all posts by reverse date order
 * Accessing /blog/year/, eg /blog/2006/ will show a listing of
posts for just that year.
 * Accessing /blog/year/month/, eg /blog/2006/12/ will show a
listing of posts for that month.
 * Accessing /blog/year/month/day/, eg /blog/2006/12/20/ will
show all postings on that particular day
 * Accessing /blog/year/month/day/article will show a
particular article.


What!? Does people actually WANT that? I thought that was just an
effect of either crappy programming or stupid programmers. :)


Can you explain an approach to accomplish something similar in zope3.


As long as you also make it possible to access each article with just
/blog/article, I'll be happy. :)

--
Lennart Regebro, Nuxeo http://www.nuxeo.com/
CPS Content Management http://www.cps-project.org/
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Blog package

2006-08-17 Thread Stephan Richter
On Thursday 17 August 2006 09:37, David Pratt wrote:
 I have looked at it and thought it would be a nice package to finish
 however I haven't yet got how to perform the nice traversal tricks for
 nice urls for entries (I had written to the five list in July). Any
 pointers or an explanation would be appreciated. From my post to five list:

Null problemo with z3c.traverser. :-)

Seriously, the pluggable traverser and the plugins are the way to go. We use 
them for the lovely package heavily to do logic paths.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics  Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Blog package

2006-08-17 Thread David Pratt

Hi Stephan. Many thanks for this excellent example! :-)

Regards,
David

Stephan Richter wrote:

On Thursday 17 August 2006 10:32, David Pratt wrote:

Hi Stephan. Yes, I have seen this added recently with great interest.

:-) I'm hoping to experiment with this shortly to see how this works.

Can you point to any code using this at the moment that I may see a
practical demonstration of its integration. Many thanks.


Here is the basic idea:

  !-- Make IBlog traversing pluggable for browser access only --
  view
  for=.interfaces.IBlog
  type=zope.publisher.interfaces.browser.IBrowserRequest
  provides=zope.publisher.interfaces.browser.IBrowserPublisher
  factory=z3c.traverser.browser.PluggableBrowserTraverser
  permission=zope.Public
  /

  !-- Make sure container item traversal is available for all containers --
  subscriber
  for=zope.app.container.interfaces.IReadContainer
   zope.publisher.interfaces.browser.IBrowserRequest
  provides=z3c.traverser.interfaces.ITraverserPlugin
  factory=z3c.traverser.traverser.ContainerTraverserPlugin
  /

  !-- A plugin that traverses all years --
  subscriber
  for=.interfaces.IBlog
   zope.publisher.interfaces.browser.IBrowserRequest
  provides=z3c.traverser.interfaces.ITraverserPlugin
  factory=.blog.YearTraverser
  /

In Python something like that:

import zope.interface
from zope.location import location
from zope.publisher.interfaces import NotFound
from z3c.traverser import interfaces

class YearTraverser(object):
zope.interface.implements(interfaces.ITraverserPlugin)

def __init__(self, context, request):
self.context = context
self.request = request

def publishTraverse(self, request, name):
yearNumber = int(name)
if yearNumber  2000:
raise NotFound(name)
year = YearProxy()
location.locate(year, self.context, name)
return tag

Regards,
Stephan


___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users