~rlane/nova/ldapimprovements

« back to all changes in this revision

Viewing changes to nova/api/ec2/__init__.py

  • Committer: Ryan Lane
  • Date: 2010-11-24 15:46:32 UTC
  • mfrom: (382.48.1 trunk)
  • Revision ID: laner@controller-20101124154632-zh7kwjuyyd02a2lh
MergeĀ fromĀ trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16
16
#    License for the specific language governing permissions and limitations
17
17
#    under the License.
 
18
"""
 
19
Starting point for routing EC2 requests.
18
20
 
19
 
"""Starting point for routing EC2 requests"""
 
21
"""
20
22
 
21
23
import logging
22
24
import routes
238
240
            return self._error(req, type(ex).__name__, str(ex))
239
241
 
240
242
    def _error(self, req, code, message):
 
243
        logging.error("%s: %s", code, message)
241
244
        resp = webob.Response()
242
245
        resp.status = 400
243
246
        resp.headers['Content-Type'] = 'text/xml'
244
 
        resp.body = ('<?xml version="1.0"?>\n'
 
247
        resp.body = str('<?xml version="1.0"?>\n'
245
248
                     '<Response><Errors><Error><Code>%s</Code>'
246
249
                     '<Message>%s</Message></Error></Errors>'
247
 
                     '<RequestID>?</RequestID></Response>') % (code, message)
 
250
                     '<RequestID>?</RequestID></Response>' % (code, message))
248
251
        return resp