wyatt-bC wrote:
> Ben Bangert wrote:
> > On Oct 3, 2006, at 5:39 PM, wyatt-bC wrote:
> >
> > > I'm trying to use the resource method like this to create some Web
> > > services:
> > >
> > >     m.resource(
> > >         'address',
> > >         controller='address',
> > >         path_prefix='/:region',
> > >         name_prefix='region_'
> > >     )
> >
> > The controller you specified is redundant in this case as the
> > 'address' will map to the controller by that name as well.
> >
> > > When I load up my version, I get a Server Error like this:
> > >
> > > sre_constants.error: bad character in group name
> > >
> > > If I remove the colon from path_prefix or if I swap the values of
> > > path_prefix and name_prefix, it works, sort of, at least in that I
> > > don't get a Server Error. It seems like I shouldn't get an error in
> > > the
> > > first place, since my example looks a lot like the example from the
> > > manual. Am I missing something?
> >
> > You're not missing anything, its a bug that I just fixed today.
> > easy_install -U Routes==dev
> >
> > Will get you the latest version where this is fixed.
> >
> > > The defaults for the resource method seems to do mostly what I want.
> > > The only tricky thing is, I want requests to these Web services to be
> > > prefixed with a region, hence my attempt shown above.
> > >
> > > For example:
> > >
> > > /Seattle/address/yada_yada
> > > /Portland/route/blah_blah_to_blah_blah_blah
> > >
> > > Any ideas? Is this even possible?
> >
> > Yup, and you're using it right as well. Give it a try now.
> >
> > Cheers,
> > Ben
>
> I haven't gotten around to trying this yet, but I will tomorrow. In the
> meantime I seem to have run into another problem.
>
> I have some resources set up like this:
>
> m.resource('query')
>
> When I enter something like "http://blahblah/query/stuff and things"
> [notice the spaces], I get "The resource could not be found" every
> time. If I take out the spaces, it works (except that it doesn't
> actually, because I need the spaces). Commas don't work either.
>
> I have some other routes that don't use the resource method and those
> do fine with spaces and commas.
>
> I went and looked at the source and the problem, if that's what it is,
> seems to be on line 963 in base.py:
>
>         route_options['requirements'] = {'id':'\w+'}
>
> Would it wreak havoc to allow non-word characters in id, other than
> that there might be a conflict with semi-colons and periods?

I thought I had a proposal for this, but then I looked some and
realized I don't quite get it.

In this list:

GET    /messages         -> messages.index()
POST   /messages         -> messages.create()
PUT    /messages/1       -> messages.update(id)
DELETE /messages/1       -> messages.delete(id)
GET    /messages/1       -> messages.show(id)
GET    /messages/1;edit  -> messages.edit(id)

what is the difference between update and edit? How come there's no
;delete? Also, what does new do?

I was thinking something like this might be good, separating the
"parameters" from the main URL, where :id could be anything:

/:controller/:id/:action;:format

Maybe either side of the semi-colon could be blank? This setup would be
good for my situation because I wouldn't need the :action;:format at
all and could just ignore it.

Anyway, these are just some ideas I'm having; maybe I'm off my rocker
here...

--
Wyatt Baldwin
byCycle.org


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss
-~----------~----~----~----~------~----~------~--~---

Reply via email to