Hi Jonathan. It was a typo. It'd be service instead of app:

curl --data-urlencode 'fields={"name": "test"}'
"http://localhost:8000/service/person/create";

Thanks anyway.

On Mon, Feb 7, 2011 at 1:21 PM, Jonathan Lundell <[email protected]> wrote:
> On Feb 6, 2011, at 4:47 PM, Gabriel wrote:
>>
>> Hi, I have this json service:
>>
>> app/default.py
>> ...
>> @service.json
>> def create(model, fields):
>>  return dict(id=get_model_or_404(model).insert(**json.loads(fields)))
>>
>> and I am trying to map this:
>>
>> routes_in = (
>>  ('/service/$model/create', '/app/default/call/json/create?model=
>> $model'),
>> )
>>
>> With this I'd want to do:
>>
>> curl --data-urlencode 'fields={"name": "test"}' "http://localhost:8000/
>> app/person/create"
>>
>> and in the create function get model="person" and in fields='{"name":
>> "test"}'
>> But it does not work, it is redirecting to default page.
>> In httpserver.log I get
>>
>> 127.0.0.1, 2011-02-06 20:41:12, POST, , HTTP/1.1, 200, 0.330055
>>
>> If I do:
>> curl --data-urlencode 'fields={"name": "test"}' "http://localhost:
>> 8000/app/default/call/json/create?model=person"
>> it works, so I think the problem is the routing.
>>
>> Any help about what I'm doing wrong?
>
> Is it as simple as 'app' in your incoming URL not matching 'service' in the 
> routes pattern?
>
>
>> Thanks for advance.
>
>
>

Reply via email to