Same error using locals()

:(

On Thu, Aug 9, 2012 at 5:23 PM, Bruno Rocha <[email protected]> wrote:

> try to replace  return dict(GET=GET, POST=POST, PUT=PUT, DELETE=DELETE)
> with return locals()
>
> I dont know, but maybe its the problem
>
> On Wed, Aug 8, 2012 at 10:49 PM, Tito Garrido <[email protected]>wrote:
>
>> Hi folks,
>>
>> *I have a simple table:*
>>
>> *db.define_table('estadio',
>>     Field('cod_estadio','id'),
>>     Field('nome_estadio'),
>>     Field('cidade'),migrate=False) *
>>
>> *A simple entry:*
>>
>> *estadio.cod_estadio**estadio.nome_estadio* *estadio.cidade**1**A Definir
>> **A Definir*
>> and using Bruno's example in web2pyslice:
>>
>>
>>    1. @request.restful()
>>
>>    2. def api():
>>    3.     response.view = 'generic.'+request.extension
>>    4.     def GET(*args,**vars):
>>    5.         patterns = 'auto'
>>    6.         parser = db.parse_as_rest(patterns,args,vars)
>>
>>
>>
>>    7.         if parser.status == 200:
>>    8.             return dict(content=parser.response)
>>    9.         else:
>>    10.             raise HTTP(parser.status,parser.error)
>>
>>
>>
>>    11.     def POST(table_name,**vars):
>>    12.         return db[table_name].validate_and_insert(**vars)
>>    13.     def PUT(table_name,record_id,**vars):
>>    14.         return db(db[table_name]._id==record_id).update(**vars)
>>
>>
>>
>>    15.     def DELETE(table_name,record_id):
>>    16.         return db(db[table_name]._id==record_id).delete()
>>
>>
>>
>>    17.     return dict(GET=GET, POST=POST, PUT=PUT, DELETE=DELETE)
>>
>>
>>
>>
>>
>> *but when I try to:*
>> *
>> curl -i -H "Accept: application/json" -X PUT -d "nome_estadio='teste"
>> http://127.0.0.1:8080/ws/default/api/estadio/cod-estadio/1.json*
>>
>> *it returns:*
>>
>> HTTP/1.1 400 BAD REQUEST
>> Server: nginx
>> Date: Thu, 09 Aug 2012 01:41:44 GMT
>> Content-Type: text/html; charset=UTF-8
>> Connection: keep-alive
>> Set-Cookie:
>> session_id_ws=xxxxxxxxxx-65e0b712-7d93-4b21-a553-d06ce06af2a2; Path=/
>> Content-Length: 540
>>
>> invalid arguments<!--
>> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>> //-->
>>
>> *What am I missing here?
>>
>> Thanks in advance!*
>>
>>
>> --
>>
>> Linux User #387870
>> .........____
>> .... _/_õ|__|
>> ..º[ .-.___.-._| . . . .
>> .__( o)__( o).:_______
>>
>> --
>>
>>
>>
>>
>
>  --
>
>
>
>



-- 

Linux User #387870
.........____
.... _/_õ|__|
..º[ .-.___.-._| . . . .
.__( o)__( o).:_______

-- 



Reply via email to