[Zope] Extended use of the calendar tag

Michel Pelletier michel@digicool.com
Fri, 23 Apr 1999 12:55:36 -0400


> -----Original Message-----
> From: Jeff K. Hoffman [mailto:jkhoffman@usa.net]
> Sent: Friday, April 23, 1999 11:53 AM
> To: Ty Sarna
> Cc: zope@zope.org
> Subject: Re: [Zope] Extended use of the calendar tag
> 
> 
> On 23 Apr 1999, Ty Sarna wrote:
> 
> > Alternately, with more magic you could include the date as 
> part of the
> > URL. (/some/place/form/1999-05-14)
> 
> Would Ty, or anyone else, care to expound on what this magic might be?
> 
> I have an application I am working on which could really use something
> like this, but my brain is short-circuiting trying to figure 
> out how to
> achieve it in a dynamic fashion.
> 

Putting the information in the actual URL is easy, that just involves
using DTML and the var tag to format the URL:

If the var 'blah' equaled 'aling':

<a href="/my/ding/<!--#var blah url_quote fmt=spam-->">

The trick is getting the 'aling' object to be traversable.  There are
several ways to make an object traversalbe, or another way of putting is
is: ZPublisher tries several different traversal mechanisms in this
order:

Example URL:  /my/ding/aling/

call __bobo_traverse__:  my.ding.__bobo_traverse__(request)

If the object 'ding' does not have a __bobo_traverse__ method then
ZPublisher tries:

getattr:  my.ding.aling

(note: '-' is illegal in a python name, so this first method obviously
wont work for a date with dashes in it)

If this fails with a 'AttributeError' exception, ZPublisher tries:

getitem:  my.ding['aling']

(this would work for items with '-' in them)

If this fails, ZPulisher gives up and raises a 'NotFound'.

-Michel



> jkh
> 
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://www.zope.org/mailman/listinfo/zope
> 
> (For developer-specific issues, use the companion list,
> zope-dev@zope.org - http://www.zope.org/mailman/listinfo/zope-dev )
>