Skip to content

Commit

Permalink
Merge pull request #203 from newbrough/master
Browse files Browse the repository at this point in the history
check for missing args that led to "(fix) Broken preload"
  • Loading branch information
daf committed Jan 11, 2013
2 parents 39030f1 + b3a8055 commit c8f5004
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pyon/datastore/couchdb/couchdb_datastore.py
Original file line number Diff line number Diff line change
Expand Up @@ -662,10 +662,14 @@ def find_subjects_mult(self, objects, id_only=False):

def find_objects(self, subject, predicate=None, object_type=None, id_only=False, **kwargs):
log.debug("find_objects(subject=%s, predicate=%s, object_type=%s, id_only=%s", subject, predicate, object_type, id_only)

if type(id_only) is not bool:
raise BadRequest('id_only must be type bool, not %s' % type(id_only))
if not subject:
raise BadRequest("Must provide subject")
if object_type and not predicate:
raise BadRequest("Cannot provide object type without a predictate")

ds, datastore_name = self._get_datastore()

if type(subject) is str:
Expand Down Expand Up @@ -698,11 +702,16 @@ def find_objects(self, subject, predicate=None, object_type=None, id_only=False,
return (obj_list, obj_assocs)

def find_subjects(self, subject_type=None, predicate=None, obj=None, id_only=False, **kwargs):

log.debug("find_subjects(subject_type=%s, predicate=%s, object=%s, id_only=%s", subject_type, predicate, obj, id_only)

if type(id_only) is not bool:
raise BadRequest('id_only must be type bool, not %s' % type(id_only))
if not obj:
raise BadRequest("Must provide object")
if subject_type and not predicate:
raise BadRequest("Cannot provide subject type without a predicate")

ds, datastore_name = self._get_datastore()

if type(obj) is str:
Expand Down

0 comments on commit c8f5004

Please sign in to comment.