Can you send me a patch?

On Monday, 31 December 2012 05:06:50 UTC-6, DenesL wrote:
>
> Hi Jeff,
>
> I noticed this too but I forgot to post about it.
> My solution was to define specific auto generation for each table:
>
> patterns = [':auto[person]',':auto[pet]']
>
> but maybe this needs to be fixed in the code or in the book.
>
> Regards,
> Denes
>
>
>
> On Monday, December 31, 2012 2:39:43 AM UTC-5, Jeff Kusi wrote:
>>
>> I followed the example for the  REST API (multiple times actually). 
>> However I keep getting *"**no matching pattern"* every time.
>> In fact it looks like the auto pattern is not generating because when I 
>> navigate to 
>> api/patterns.json, I see 
>>
>> {"content": "auto"}
>>
>> instead of the beautiful rendering of all my table patterns.
>>
>> Here are the sample tables I tested with
>> db.define_table('person',Field('name'),Field('info'))
>>
>> db.define_table('pet',Field('owner',db.person),Field('name'),Field('info'))
>>
>> Here's my api code
>>
>> @request.restful()
>> def api():
>>     response.view = 'generic.'+request.extension
>>     def GET(*args,**vars):
>> patterns = 'auto'
>>         parser = db.parse_as_rest(patterns,args,vars)
>>         if parser.status == 200:
>>             return dict(content=parser.response)
>>         else:
>>             raise HTTP(parser.status,parser.error)
>>     def POST(table_name,**vars):
>>         return db[table_name].validate_and_insert(**vars)
>>     def PUT(table_name,record_id,**vars):
>>         return db(db[table_name]._id==record_id).update(**vars)
>>     def DELETE(table_name,record_id):
>>         return db(db[table_name]._id==record_id).delete()
>>     return locals()
>>
>>
>> web2py version 2.3.2 (2012-12-17 15:03:30) stable
>> python version 2.7
>>
>> Any help please?
>>
>

-- 



Reply via email to