Skip to content

Commit

Permalink
Added missing docstrings.
Browse files Browse the repository at this point in the history
  • Loading branch information
toastdriven committed Mar 9, 2011
1 parent 04c9ead commit 43df629
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion tastypie/resources.py
Expand Up @@ -614,7 +614,7 @@ def full_hydrate(self, bundle):
if field_object.attribute:
value = field_object.hydrate(bundle)

if value is not None or field_object.null:
if value is not None:
# We need to avoid populating M2M data here as that will
# cause things to blow up.
if not getattr(field_object, 'is_related', False):
Expand Down Expand Up @@ -752,14 +752,25 @@ def apply_authorization_limits(self, request, object_list):
return object_list

def can_create(self):
"""
Checks to ensure ``post`` is within ``allowed_methods``.
"""
allowed = set(self._meta.list_allowed_methods + self._meta.detail_allowed_methods)
return 'post' in allowed

def can_update(self):
"""
Checks to ensure ``put`` is within ``allowed_methods``.
Used when hydrating related data.
"""
allowed = set(self._meta.list_allowed_methods + self._meta.detail_allowed_methods)
return 'put' in allowed

def can_delete(self):
"""
Checks to ensure ``delete`` is within ``allowed_methods``.
"""
allowed = set(self._meta.list_allowed_methods + self._meta.detail_allowed_methods)
return 'delete' in allowed

Expand Down

0 comments on commit 43df629

Please sign in to comment.