~cjwatson/lazr.restful/double-closing-brace

« back to all changes in this revision

Viewing changes to src/lazr/restful/_resource.py

Tags: 0.19.2
[r=jcsackett][bug=842917] generate a 400 instead of an unhandled TypeError when multiple ws.op values are provided

Show diffs side-by-side

added added

removed removed

Lines of Context:
700
700
        :return: The result of the operation: either a string or an
701
701
        object that needs to be serialized to JSON.
702
702
        """
 
703
        if not isinstance(operation_name, basestring):
 
704
            self.request.response.setStatus(400)
 
705
            return "Expected a single operation: %r" % (operation_name,)
 
706
 
703
707
        try:
704
708
            operation = getMultiAdapter((self.context, self.request),
705
709
                                        IResourceGETOperation,
722
726
        :return: The result of the operation: either a string or an
723
727
        object that needs to be serialized to JSON.
724
728
        """
 
729
        if not isinstance(operation_name, basestring):
 
730
            self.request.response.setStatus(400)
 
731
            return "Expected a single operation: %r" % (operation_name,)
 
732
 
725
733
        try:
726
734
            operation = getMultiAdapter((self.context, self.request),
727
735
                                        IResourcePOSTOperation,