Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def get(self, request):
"""
Return a list of all currently existing snippets.
"""
unique_ids = [os.path.split(f)[1] for f in list_dir_sorted_by_ctime(HIGHLIGHTED_CODE_DIR)]
return [reverse('pygments-instance', request=request, args=[unique_id]) for unique_id in unique_ids]
def get(self, request):
return [{'name': 'Simple Resource example', 'url': reverse('example-resource', request=request)},
{'name': 'Simple ModelResource example', 'url': reverse('model-resource-root', request=request)},
{'name': 'Simple Mixin-only example', 'url': reverse('mixin-view', request=request)},
{'name': 'Object store API', 'url': reverse('object-store-root', request=request)},
{'name': 'Code highlighting API', 'url': reverse('pygments-root', request=request)},
{'name': 'Blog posts API', 'url': reverse('blog-posts-root', request=request)},
{'name': 'Permissions example', 'url': reverse('permissions-example', request=request)}
]
def get(self, request):
return [{'name': 'Simple Resource example', 'url': reverse('example-resource', request=request)},
{'name': 'Simple ModelResource example', 'url': reverse('model-resource-root', request=request)},
{'name': 'Simple Mixin-only example', 'url': reverse('mixin-view', request=request)},
{'name': 'Object store API', 'url': reverse('object-store-root', request=request)},
{'name': 'Code highlighting API', 'url': reverse('pygments-root', request=request)},
{'name': 'Blog posts API', 'url': reverse('blog-posts-root', request=request)},
{'name': 'Permissions example', 'url': reverse('permissions-example', request=request)}
]
def url(self, instance):
return reverse('blog-post',
kwargs={'key': instance.key},
request=self.request)
def get(self, request):
return [{'name': 'Simple Resource example', 'url': reverse('example-resource', request=request)},
{'name': 'Simple ModelResource example', 'url': reverse('model-resource-root', request=request)},
{'name': 'Simple Mixin-only example', 'url': reverse('mixin-view', request=request)},
{'name': 'Object store API', 'url': reverse('object-store-root', request=request)},
{'name': 'Code highlighting API', 'url': reverse('pygments-root', request=request)},
{'name': 'Blog posts API', 'url': reverse('blog-posts-root', request=request)},
{'name': 'Permissions example', 'url': reverse('permissions-example', request=request)}
]
def get(self, request):
return [{'name': 'Simple Resource example', 'url': reverse('example-resource', request=request)},
{'name': 'Simple ModelResource example', 'url': reverse('model-resource-root', request=request)},
{'name': 'Simple Mixin-only example', 'url': reverse('mixin-view', request=request)},
{'name': 'Object store API', 'url': reverse('object-store-root', request=request)},
{'name': 'Code highlighting API', 'url': reverse('pygments-root', request=request)},
{'name': 'Blog posts API', 'url': reverse('blog-posts-root', request=request)},
{'name': 'Permissions example', 'url': reverse('permissions-example', request=request)}
]
def get(self, request):
return [{'name': 'Simple Resource example', 'url': reverse('example-resource', request=request)},
{'name': 'Simple ModelResource example', 'url': reverse('model-resource-root', request=request)},
{'name': 'Simple Mixin-only example', 'url': reverse('mixin-view', request=request)},
{'name': 'Object store API', 'url': reverse('object-store-root', request=request)},
{'name': 'Code highlighting API', 'url': reverse('pygments-root', request=request)},
{'name': 'Blog posts API', 'url': reverse('blog-posts-root', request=request)},
{'name': 'Permissions example', 'url': reverse('permissions-example', request=request)}
]
def get_file_url(key, request):
"""
Given a stored object's key returns the URL for the object.
"""
return reverse('stored-object', kwargs={'key': key}, request=request)
def get(self, request):
return [
{
'name': 'Throttling Example',
'url': reverse('throttled-resource', request=request)
},
{
'name': 'Logged in example',
'url': reverse('loggedin-resource', request=request)
},
def get(self, request):
"""
Handle GET requests, returning a list of URLs pointing to 3 other views.
"""
resource_urls = [reverse('another-example',
kwargs={'num': num},
request=request)
for num in range(3)]
return {"Some other resources": resource_urls}