~hudson-openstack/glance/trunk

« back to all changes in this revision

Viewing changes to glance/api/v1/images.py

  • Committer: Tarmac
  • Author(s): Justin Shepherd
  • Date: 2011-08-02 17:43:16 UTC
  • mfrom: (170.3.2 lp816077)
  • Revision ID: tarmac-20110802174316-pd1mn1wq9oaws5g2
Replaced occurances of |str(e)| with |"%s" % e|.
  
Except in bin/glance, where |unicode(e).split('\n')| makes more sense than |("%s" % e).split('\n')|

Show diffs side-by-side

added added

removed removed

Lines of Context:
107
107
            images = registry.get_images_list(self.options, req.context,
108
108
                                              **params)
109
109
        except exception.Invalid, e:
110
 
            raise HTTPBadRequest(explanation=str(e))
 
110
            raise HTTPBadRequest(explanation="%s" % e)
111
111
 
112
112
        return dict(images=images)
113
113
 
138
138
            images = registry.get_images_detail(self.options, req.context,
139
139
                                                **params)
140
140
        except exception.Invalid, e:
141
 
            raise HTTPBadRequest(explanation=str(e))
 
141
            raise HTTPBadRequest(explanation="%s" % e)
142
142
        return dict(images=images)
143
143
 
144
144
    def _get_query_params(self, req):
365
365
            return location
366
366
 
367
367
        except exception.Duplicate, e:
368
 
            msg = ("Attempt to upload duplicate image: %s") % str(e)
 
368
            msg = ("Attempt to upload duplicate image: %s") % e
369
369
            logger.error(msg)
370
370
            self._safe_kill(req, image_id)
371
371
            raise HTTPConflict(msg, request=req)
372
372
 
373
373
        except exception.NotAuthorized, e:
374
 
            msg = ("Unauthorized upload attempt: %s") % str(e)
 
374
            msg = ("Unauthorized upload attempt: %s") % e
375
375
            logger.error(msg)
376
376
            self._safe_kill(req, image_id)
377
377
            raise HTTPForbidden(msg, request=req,
378
378
                                content_type='text/plain')
379
379
 
380
380
        except Exception, e:
381
 
            msg = ("Error uploading image: %s") % str(e)
 
381
            msg = ("Error uploading image: %s") % e
382
382
            logger.error(msg)
383
383
            self._safe_kill(req, image_id)
384
384
            raise HTTPBadRequest(msg, request=req)