text stringlengths 0 828 |
|---|
metadata=metadata, |
**kwargs) |
except DriverException as e: |
LOG.exception('upload_object() with %s raised\ |
an exception %s.', self.driver, e)" |
1909,"def stat_object(self, container, obj): |
""""""Stat object metadata |
:param container: container name (Container is equivalent to |
Bucket term in Amazon). |
:param obj: object name (Object is equivalent to |
Key term in Amazon). |
"""""" |
LOG.debug('stat_object() with %s is success.', self.driver) |
return self.driver.stat_object(container, obj)" |
1910,"def delete_object(self, container, obj, **kwargs): |
""""""Delete object in container |
:param container: container name (Container is equivalent to |
Bucket term in Amazon). |
:param obj: object name (Object is equivalent to |
Key term in Amazon). |
"""""" |
try: |
LOG.debug('delete_object() with %s is success.', self.driver) |
return self.driver.delete_object(container, obj, **kwargs) |
except DriverException as e: |
LOG.exception('download_object() with %s raised\ |
an exception %s.', self.driver, e)" |
1911,"def list_container_objects(self, container, prefix=None, delimiter=None): |
""""""List container objects |
:param container: container name (Container is equivalent to |
Bucket term in Amazon). |
:param prefix: prefix query |
:param delimiter: string to delimit the queries on |
"""""" |
LOG.debug('list_container_objects() with %s is success.', self.driver) |
return self.driver.list_container_objects(container, prefix, delimiter)" |
1912,"def update_object(self, container, obj, metadata, **kwargs): |
""""""Update object metadata |
:param container: container name (Container is equivalent to |
Bucket term in Amazon). |
:param obj: object name (Object is equivalent to |
Key term in Amazon). |
:param metadata(dict): additional metadata to include in the request. |
"""""" |
try: |
LOG.debug('update_object() with %s is success.', self.driver) |
return self.driver.update_object(container, obj, |
metadata, **kwargs) |
except DriverException as e: |
LOG.exception('copy_object() with %s raised\ |
an exception %s.', self.driver, e)" |
1913,"def copy_object(self, container, obj, metadata=None, |
destination=None, **kwargs): |
""""""Copy object |
:param container: container name (Container is equivalent to |
Bucket term in Amazon). |
:param obj: object name (Object is equivalent to |
Key term in Amazon). |
:param destination: The container and object name of the destination |
object in the form of /container/object; if None, |
the copy will use the source as the destination. |
:param metadata(dict): additional metadata(headers) |
to include in the request |
:param **kwargs(dict): extend args for specific driver. |
"""""" |
try: |
LOG.debug('copy_object() with %s is success.', self.driver) |
return self.driver.copy_object(container, obj, metadata=metadata, |
destination=destination, **kwargs) |
except DriverException as e: |
LOG.exception('copy_object() with %s raised\ |
an exception %s.', self.driver, e)" |
1914,"def permission_required(*actions, obj=None, raise_exception=False): |
""""""Permission checking decorator -- works like the |
``permission_required`` decorator in the default Django |
authentication system, except that it takes a sequence of actions |
to check, an object must be supplied, and the user must have |
permission to perform all of the actions on the given object for |
the permissions test to pass. *Not actually sure how useful this |
is going to be: in any case where obj is not None, it's going to |
be tricky to get the object into the decorator. Class-based views |
are definitely best here...* |
"""""" |
def checker(user): |
ok = False |
if user.is_authenticated() and check_perms(user, actions, [obj]): |
ok = True |
if raise_exception and not ok: |
raise PermissionDenied |
else: |
return ok |
def decorator(view_func): |
@wraps(view_func, assigned=available_attrs(view_func)) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.