Permalink
Browse files

Merge pull request #203 from newbrough/master

check for missing args that led to "(fix) Broken preload"
  • Loading branch information...
2 parents 39030f1 + b3a8055 commit c8f50048061943c2e6fae8b5c71723c6874ddb0e @daf daf committed Jan 11, 2013
Showing with 9 additions and 0 deletions.
  1. +9 −0 pyon/datastore/couchdb/couchdb_datastore.py
View
9 pyon/datastore/couchdb/couchdb_datastore.py
@@ -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:
@@ -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:

0 comments on commit c8f5004

Please sign in to comment.