I'm really liking Webware so far, but I'd really like to be able to tweak out the URL->handler dispatch logic for scenarios where the existing URL->Servlet dispatch mechanism doesn't fit the application.

Nevow [1] has what I think is a nice solution to this.

For example, say you have a Calendar app or API. A URI would look like http://john.calendar.com/2004/3/21. Nevow has a hook to locate handlers that look like this:

def locateChild(self, request, childSegments):
# childSegments is ('2004', '3', '21') in this example
try:
year, month, date = map(int, childSegments)
import day
#day.DayDetail is class that derives from Nevow's Page class, similar to Webware's Page class
return day.DayDetail(self.calendarEntries, year, month, date), ()
except ValueError:
# If the url doesn't consist of a tuple of year, month, day, or the segments
# are not integers, then we render a 404 page.
return rend.NotFound


I see that the Webware community has looked at this before [2] [3] [4], but I started hacking on Application.py to put my custom dispatcher in and it looked a bit daunting.

Thoughts? Apologies if I'm out of date or the discussion has been beaten to death... (I'm new to Webware.)

thanks,
john

[1] http://nevow.com/Nevow2004Tutorial.html
[2] http://cheetah.colorstudy.net/twiki/bin/view/Webware/ ManagingTheURISpace
[3] http://cheetah.colorstudy.net/twiki/bin/view/Webware/UriMapping
[4] http://jaguar.sourceforge.net/webware/urldecode.html




-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to