Пример #1
0
 def get_bucket(self, name):
     """
         Helper for getting a bucket.
         Sends 404 back if the bucket is not found
     """
     try:
         return Bucket(name, self.datadir)
     except OSError as exception:
         _logger.warn(exception)
         self.send_error(404)
Пример #2
0
 def put(self, name):
     if self.has_section("versioning"):
         bucket = self.get_bucket(name)
         if not bucket:
             return
         if '<Status>Enabled</Status>' in self.request.body:
             bucket.enable_versioning()
         else:
             bucket.disable_versioning()
     else:
         bucket = Bucket.create(name, self.datadir)
         if not bucket:
             _logger.warn("Could not create bucket %s", name)
             self.send_error(409)
             return
     self.echo()
Пример #3
0
 def get(self):
     result = ListAllMyBucketsResponse(Bucket.get_all_buckets(self.datadir))
     self.render_xml(result)