本文整理汇总了Python中core.db.connection.DataHubConnection.delete_license_view方法的典型用法代码示例。如果您正苦于以下问题:Python DataHubConnection.delete_license_view方法的具体用法?Python DataHubConnection.delete_license_view怎么用?Python DataHubConnection.delete_license_view使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core.db.connection.DataHubConnection
的用法示例。
在下文中一共展示了DataHubConnection.delete_license_view方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from core.db.connection import DataHubConnection [as 别名]
# 或者: from core.db.connection.DataHubConnection import delete_license_view [as 别名]
#.........这里部分代码省略.........
Collaborator.objects.get(
user=collab, repo_name=repo, repo_base=self.repo_base).delete()
result = conn.delete_collaborator(
repo=repo, collaborator=collaborator)
return result
def create_license_view(self, repo, table, view_params, license_id):
view_sql = self.user_con.get_view_sql(
repo_base=self.repo_base,
repo=repo,
table=table,
view_params=view_params,
license_id=license_id)
license_id = int(license_id)
license_view_obj, created = LicenseView.objects.get_or_create(
repo_base=self.repo_base,
repo_name=repo,
table=table,
view_sql=view_sql,
license_id=license_id)
# Create view in database
self.user_con.create_license_view(
repo_base=self.repo_base,
repo=repo,
table=table,
view_sql=view_sql,
license_id=license_id)
return True
def delete_license_view(self, repo, table, license_view, license_id):
license_view_obj = LicenseView.objects.filter(
repo_base=self.repo_base,
repo_name=repo,
table=table,
license_id=license_id)
if len(license_view_obj) == 1:
license_view_obj[0].delete()
# delete actual view
self.user_con.delete_license_view(
repo_base=self.repo_base,
repo=repo,
license_view=license_view)
return True
def list_repo_files(self, repo):
"""
Lists a repo's files.
Returns an empty list on bad repo names.
Raises PermissionDenied on insufficient privileges, even for bad repo
names.
"""
# check for permissions
DataHubManager.has_repo_file_privilege(
self.username, self.repo_base, repo, 'read')
# make a directory for files, if it doesn't already exist
repo_dir = DataHubManager.create_user_data_folder(self.repo_base, repo)