python - Which function will be called when using tastypie resource -


i want understand point.

this url: repositories/api/2/repositories/?format=json

this urls.py:

    repositories_resource = repositoriesresource()     (r'^api/2/', include(repositories_resource.urls)), 

this api.py:

class repositoriesresource(resource):   fs_repositories = fields.charfield(attribute='fs_repositories')   full_path = fields.charfield(attribute='full_path')   path = fields.charfield(attribute='path')   permissions = fields.charfield(attribute='permissions')   perms_read = fields.listfield(attribute='perms_read')   perms_write = fields.listfield(attribute='perms_write')   perms_no_access = fields.charfield(attribute='perms_no_access')       class meta:     resource_name = 'repositories'     authorization= authorization()   def obj_get_list(self, request=none, **kwargs):     request.get = request.get.copy()     request.get.update({"output":"json"})      frs=svn_repositories(request)      posts = []     l in frs.fs_repositories:         posts.append(dict2obj({'fs_repositories': l,'full_path':l.full_path,'path':l.path,'permissions':l.permissions,'perms_read':l.perms_read,'perms_write':l.perms_write,'perms_no_access':l.perms_no_access }))           return posts 

it works fine, want know why why obj_get_list called if don't specify it, , if want use other functions obj_get? function called default?

url : repositories/api/2/repositories/?format=json

will list available objects .

now using obj_get_list u can override way json response display. can customize, limit response (here in case posts json dict )


Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -