Hi All,

I'm attempting to use `autodelegate` to get some dispatch going on  
related urls, but what I'm seeing is that I'm ending up with  
something in my dispatch table that looks like:

     '/home', 'HomeR',
     '/home/(.*)', 'Home',

Where:

class HomeR:
     def GET(self):
         web.seeother('/home/')

class Home:
     def GET(self):
         pass # do stuff on index
     POST = web.autodelegate('POST_')
     def POST_new(self):
         pass

And while this works fine (I'm not sure if there's a better way  
yet...) it seems a bit more logical if web.autodelegate allowed you  
to have a '/' at the beginning rather than forcing the '/' upon you.

m...@jasonfox web $ diff application.py application2.py
610c610,616
<         if '/' in arg:
---
 >         if arg.startswith('/'):
 >             func = prefix + arg[1:]
 >             args = []
 >         elif '/' not in arg:
 >             func = prefix + arg
 >             args = []
 >         else:
614,616d619
<         else:
<             func = prefix + arg
<             args = []

Seems a bit more appropriate, which takes care of the 'HomeR' case  
and turns the dispatch table into:

     '/home(.*)', 'Home',

and then Home's GET might be something like def GET(self, arg=None).  
You might end up doing a check in GET, I suppose.

But, I wonder, is the use of autodelegate discouraged in webpy  
because of these problems?

I guess I could always just handle GET /home with another class, but  
then I'm right back to where I started once GET /home/something needs  
to exist....


--
Andrew Gwozdziewycz
[email protected]
http://www.apgwoz.com  |  http://www.photub.com




--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to