Skip to content

Commit

Permalink
Terminology fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
toastdriven committed May 12, 2010
1 parent 542645e commit 4fdd1ba
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 17 deletions.
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
url='http://github.com/toastdriven/django-tastypie/',
packages=[
'tastypie',
'tastypie.representations',
'tastypie.utils',
],
package_data={
Expand Down
4 changes: 0 additions & 4 deletions tastypie/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ class NotFound(TastyPieError):
pass


class MultipleRepresentationsFound(TastyPieError):
pass


class ApiFieldError(TastyPieError):
pass

Expand Down
7 changes: 3 additions & 4 deletions tastypie/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class NOT_PROVIDED:
# All the ApiField variants.

class ApiField(object):
"""The base implementation of a field used by the representations."""
"""The base implementation of a field used by the resources."""
dehydrated_type = 'string'

def __init__(self, attribute=None, default=NOT_PROVIDED, null=False, readonly=False):
Expand Down Expand Up @@ -64,7 +64,7 @@ def default(self):
def dehydrate(self, bundle):
"""
Takes data from the provided object and prepares it for the
representation.
resource.
"""
if self.attribute is not None:
# Check for `__` in the field for looking through the relation.
Expand Down Expand Up @@ -350,14 +350,13 @@ def get_related_resource(self, related_instance):
def dehydrate_related(self, bundle, related_resource):
"""
Based on the ``full_resource``, returns either the endpoint or the data
from ``full_dehydrate`` for the related representation.
from ``full_dehydrate`` for the related resource.
"""
if not self.full:
# Be a good netizen.
return related_resource.get_resource_uri(bundle)
else:
# ZOMG extra data and big payloads.
# FIXME: What to do here, since state is no longer maintained?
return related_resource.full_dehydrate(related_resource.instance)

def build_related_resource(self, value):
Expand Down
6 changes: 3 additions & 3 deletions tastypie/paginator.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Paginator(object):
(Django) so none of the page-related calculations are necessary.
This implementation also provides additional details like the
``total_count`` of representations seen and convenience links to the
``total_count`` of resources seen and convenience links to the
``previous``/``next`` pages of data as available.
"""
def __init__(self, request_data, objects, resource_uri=None, limit=None, offset=0):
Expand All @@ -24,8 +24,8 @@ def __init__(self, request_data, objects, resource_uri=None, limit=None, offset=
May provide ``limit`` and/or ``offset`` to override the defaults.
Commonly provided ``request.GET``. Required.
The ``objects`` should be a list-like object of ``Representations``.
This is typically a ``RepresentationSet`` but can be anything that
The ``objects`` should be a list-like object of ``Resources``.
This is typically a ``QuerySet`` but can be anything that
implements slicing. Required.
Optionally accepts a ``limit`` argument, which specifies how many
Expand Down
8 changes: 4 additions & 4 deletions tastypie/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from tastypie.authentication import Authentication
from tastypie.bundle import Bundle
from tastypie.cache import NoCache
from tastypie.exceptions import NotFound, BadRequest, MultipleRepresentationsFound, InvalidFilterError, HydrationError
from tastypie.exceptions import NotFound, BadRequest, InvalidFilterError, HydrationError
from tastypie.fields import *
from tastypie.http import *
from tastypie.paginator import Paginator
Expand Down Expand Up @@ -314,7 +314,7 @@ def get_via_uri(self, uri):
This needs to be implemented at the user level.
This pulls apart the salient bits of the URI and populates the
representation via a ``get`` with the ``obj_id``.
resource via a ``get`` with the ``obj_id``.
Example::
Expand All @@ -330,7 +330,7 @@ def get_via_uri(self, uri):
def full_dehydrate(self, obj):
"""
Given an object instance, extract the information from it to populate
the representation.
the resource.
"""
bundle = Bundle(obj=obj)

Expand Down Expand Up @@ -402,7 +402,7 @@ def hydrate_m2m(self, bundle):
if field_object.attribute:
# Note that we only hydrate the data, leaving the instance
# unmodified. It's up to the user's code to handle this.
# The ``ModelRepresentation`` provides a working baseline
# The ``ModelResource`` provides a working baseline
# in this regard.
bundle.data[field_name] = field_object.hydrate_m2m(bundle)

Expand Down
2 changes: 1 addition & 1 deletion tests/core/tests/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def test_determine_format(self):
def test__get_available_filters(self):
resource = NoteResource()

# Field not in the representation.
# Field not in the resource.
borked_filters_1 = {
'foobar': 'all',
}
Expand Down

0 comments on commit 4fdd1ba

Please sign in to comment.