~tr3buchet/nova/lock

« back to all changes in this revision

Viewing changes to nova/objectstore/handler.py

  • Committer: Vishvananda Ishaya
  • Date: 2010-12-22 20:59:53 UTC
  • mto: This revision was merged to the branch mainline in revision 482.
  • Revision ID: vishvananda@gmail.com-20101222205953-j2j5t0qjwlcd0t2s
merge trunk and upgrade to cheetah templating

Show diffs side-by-side

added added

removed removed

Lines of Context:
102
102
                _render_parts(subsubvalue, write_cb)
103
103
                write_cb('</' + utils.utf8(name) + '>')
104
104
    else:
105
 
        raise Exception("Unknown S3 value type %r", value)
 
105
        raise Exception(_("Unknown S3 value type %r"), value)
106
106
 
107
107
 
108
108
def get_argument(request, key, default_value):
134
134
                                          check_type='s3')
135
135
        return context.RequestContext(user, project)
136
136
    except exception.Error as ex:
137
 
        logging.debug("Authentication Failure: %s", ex)
 
137
        logging.debug(_("Authentication Failure: %s"), ex)
138
138
        raise exception.NotAuthorized()
139
139
 
140
140
 
227
227
 
228
228
    def render_PUT(self, request):
229
229
        "Creates the bucket resource"""
230
 
        logging.debug("Creating bucket %s", self.name)
 
230
        logging.debug(_("Creating bucket %s"), self.name)
231
231
        logging.debug("calling bucket.Bucket.create(%r, %r)",
232
232
                      self.name,
233
233
                      request.context)
237
237
 
238
238
    def render_DELETE(self, request):
239
239
        """Deletes the bucket resource"""
240
 
        logging.debug("Deleting bucket %s", self.name)
 
240
        logging.debug(_("Deleting bucket %s"), self.name)
241
241
        bucket_object = bucket.Bucket(self.name)
242
242
 
243
243
        if not bucket_object.is_authorized(request.context):
261
261
        Raises NotAuthorized if user in request context is not
262
262
        authorized to delete the object.
263
263
        """
264
 
        logging.debug("Getting object: %s / %s", self.bucket.name, self.name)
 
264
        logging.debug(_("Getting object: %s / %s"),
 
265
                      self.bucket.name,
 
266
                      self.name)
265
267
 
266
268
        if not self.bucket.is_authorized(request.context):
267
269
            raise exception.NotAuthorized()
279
281
        Raises NotAuthorized if user in request context is not
280
282
        authorized to delete the object.
281
283
        """
282
 
        logging.debug("Putting object: %s / %s", self.bucket.name, self.name)
 
284
        logging.debug(_("Putting object: %s / %s"),
 
285
                      self.bucket.name,
 
286
                      self.name)
283
287
 
284
288
        if not self.bucket.is_authorized(request.context):
285
289
            raise exception.NotAuthorized()
298
302
        authorized to delete the object.
299
303
        """
300
304
 
301
 
        logging.debug("Deleting object: %s / %s",
 
305
        logging.debug(_("Deleting object: %s / %s"),
302
306
                      self.bucket.name,
303
307
                      self.name)
304
308
 
394
398
        image_id = get_argument(request, 'image_id', u'')
395
399
        image_object = image.Image(image_id)
396
400
        if not image_object.is_authorized(request.context):
397
 
            logging.debug("not authorized for render_POST in images")
 
401
            logging.debug(_("not authorized for render_POST in images"))
398
402
            raise exception.NotAuthorized()
399
403
 
400
404
        operation = get_argument(request, 'operation', u'')
401
405
        if operation:
402
406
            # operation implies publicity toggle
403
 
            logging.debug("handling publicity toggle")
 
407
            logging.debug(_("handling publicity toggle"))
404
408
            image_object.set_public(operation == 'add')
405
409
        else:
406
410
            # other attributes imply update
407
 
            logging.debug("update user fields")
 
411
            logging.debug(_("update user fields"))
408
412
            clean_args = {}
409
413
            for arg in request.args.keys():
410
414
                clean_args[arg] = request.args[arg][0]