Changes between Version 32 and Version 33 of BluePrintRESTImplementation
- Timestamp:
- 01/15/09 22:22:09 (16 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
BluePrintRESTImplementation
v32 v33 6 6 resource='shelter' 7 7 table=module+'_'+resource 8 db.define_table(table, 9 SQLField('modified_on','datetime',default=now), 10 SQLField('uuid',length=64,default=uuid.uuid4()), 8 db.define_table(table,timestamp,uuidstamp, 11 9 SQLField('name')) 12 10 exec("s3.crud_fields.%s=['name']" % table) … … 16 14 # NB Beware of lambdas & %s substitution as they get evaluated when called, not when defined! 17 15 #db['%s' % table].represent=lambda table:shn_list_item(table,resource='shelter',action='display') 16 db[table].uuid.requires=IS_NOT_IN_DB(db,'%s.uuid' % table) 18 17 title_create=T('Add Shelter') 19 18 title_display=T('Shelter Details') … … 36 35 }}} 37 36 38 This is the supporting material in {{{models/_ db.py}}}:37 This is the supporting material in {{{models/__db.py}}}: 39 38 {{{ 40 39 from gluon.storage import Storage … … 73 72 CSV create/update 74 73 SMS,XML,PDF 75 Search method76 74 Customisable Security Policy 77 75 """ … … 366 364 else: 367 365 t2.redirect('login',vars={'_destination':'%s/delete/%i' % (resource,t2.id)}) 366 elif method=="search": 367 if session.s3.audit_read: 368 db.s3_audit.insert( 369 person=t2.person_id, 370 operation='search', 371 module=request.controller, 372 resource=resource, 373 old_value='', 374 new_value='' 375 ) 376 if representation=="html": 377 if t2.logged_in and s3.deletable: 378 db[table].represent=lambda table:shn_list_item(table,resource='%s' % resource,action='display',extra="INPUT(_type='checkbox',_class='delete_row',_name='%s' % resource,_id='%i' % table.id)") 379 else: 380 db[table].represent=lambda table:shn_list_item(table,resource='%s' % resource,action='display') 381 search=t2.search(table) 382 # Check for presence of Custom View 383 custom_view='%s_search.html' % resource 384 _custom_view=os.path.join(request.folder,'views',module,custom_view) 385 if os.path.exists(_custom_view): 386 response.view=module+'/'+custom_view 387 else: 388 response.view='search.html' 389 title=s3.crud_strings.title_search 390 return dict(module_name=module_name,modules=modules,options=options,search=search,title=title) 391 else: 392 session.error=T("Unsupported format!") 393 redirect(URL(r=request,f=resource)) 368 394 else: 369 395 session.error=T("Unsupported method!")