Skip to content

Instantly share code, notes, and snippets.

@GrahamDumpleton
Created August 24, 2012 07:01
Show Gist options
  • Save GrahamDumpleton/3446930 to your computer and use it in GitHub Desktop.
Save GrahamDumpleton/3446930 to your computer and use it in GitHub Desktop.
meta = getattr(instance, '_meta', None)
if meta is None:
group = 'Python/TastyPie/Api'
name = instance.api_name
elif meta.api_name is not None:
group = 'Python/TastyPie/Api'
name = '%s/%s/%s' % (meta.api_name, meta.resource_name, view_name)
else:
group = 'Python/TastyPie/Resource'
name = '%s/%s' % (meta.resource_name, view_name)
@amjith
Copy link

amjith commented Aug 24, 2012

meta = getattr(instance, '_meta', None)

if meta is None:       # /api/v1/
    group = 'Python/TastyPie/Api'
    name = instance.api_name
elif meta.api_name is not None:     # /api/v1/poll/
    group = 'Python/TastyPie/Api'
    name = '%s/%s/%s' % (meta.api_name, meta.resource_name, view_name)
else:   #/api/poll
    group = 'Python/TastyPie/Resource'
    name = '%s/%s' % (meta.resource_name, view_name)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment