Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
  • 2 commits
  • 7 files changed
  • 0 commit comments
  • 1 contributor
Commits on May 07, 2013
@bruth bruth Remove redundant rel attribute
The key itself is the rel (relation) attribute.

Fix #29
71d6c10
@bruth bruth Add self link to field stats resource JSON representation 74d8a0c
View
2  serrano/resources/concept.py
@@ -43,11 +43,9 @@ def concept_posthook(instance, data, request, embed, brief, categories=None):
if not brief:
data['_links'] = {
'self': {
- 'rel': 'self',
'href': uri(reverse('serrano:concept', args=[instance.pk])),
},
'fields': {
- 'rel': 'fields',
'href': uri(reverse('serrano:concept-fields', args=[instance.pk])),
}
}
View
1  serrano/resources/context.py
@@ -26,7 +26,6 @@ def context_posthook(instance, data, request):
data['_links'] = {
'self': {
- 'rel': 'self',
'href': uri(reverse('serrano:contexts:single', args=[instance.pk])),
}
}
View
2  serrano/resources/exporter.py
@@ -18,7 +18,6 @@ def get(self, request):
'title': 'Serrano Exporter Endpoints',
'_links': {
'self': {
- 'rel': 'self',
'href': uri(reverse('serrano:data:exporter')),
},
}
@@ -26,7 +25,6 @@ def get(self, request):
for export_type in EXPORT_TYPES:
resp['_links'][export_type] = {
- 'rel': export_type,
'href': uri(reverse('serrano:data:exporter',
kwargs={'export_type': export_type})),
}
View
4 serrano/resources/field/base.py
@@ -24,25 +24,21 @@ def field_posthook(instance, data, request):
# Augment the links
data['_links'] = {
'self': {
- 'rel': 'self',
'href': uri(reverse('serrano:field', args=[instance.pk])),
},
'values': {
- 'rel': 'data',
'href': uri(reverse('serrano:field-values', args=[instance.pk])),
},
}
if stats_capable(instance):
data['_links']['stats'] = {
- 'rel': 'data',
'href': uri(reverse('serrano:field-stats', args=[instance.pk])),
}
# Add distribution link only if the relevent dependencies are
# installed.
if OPTIONAL_DEPS['scipy']:
data['_links']['distribution'] = {
- 'rel': 'data',
'href': uri(reverse('serrano:field-distribution', args=[instance.pk])),
}
View
4 serrano/resources/field/stats.py
@@ -22,8 +22,10 @@ def get(self, request, pk):
resp = next(iter(stats))
resp['_links'] = {
+ 'self': {
+ 'href': uri(reverse('serrano:field-stats', args=[instance.pk])),
+ },
'parent': {
- 'rel': 'parent',
'href': uri(reverse('serrano:field', args=[instance.pk])),
},
}
View
4 serrano/resources/preview.py
@@ -136,26 +136,22 @@ def get(self, request):
# Augment previous and next page links if other pages exist
links = {
'self': {
- 'rel': 'self',
'href': uri(reverse('serrano:data:preview') + '?page=' + \
str(page.number)),
},
'base': {
- 'rel': 'base',
'href': uri(reverse('serrano:data:preview')),
}
}
if page.number != 1:
links['prev'] = {
- 'rel': 'prev',
'href': uri(reverse('serrano:data:preview') + '?page=' + \
str(page.number - 1)),
}
if page.number < paginator.num_pages - 1:
links['next'] = {
- 'rel': 'next',
'href': uri(reverse('serrano:data:preview') + '?page=' + \
str(page.number + 1)),
}
View
1  serrano/resources/view.py
@@ -18,7 +18,6 @@ def view_posthook(instance, data, request):
uri = request.build_absolute_uri
data['_links'] = {
'self': {
- 'rel': 'self',
'href': uri(reverse('serrano:views:single', args=[instance.pk])),
}
}

No commit comments for this range

Something went wrong with that request. Please try again.