本文整理汇总了Python中pyasm.common.Environment.get_license_dir方法的典型用法代码示例。如果您正苦于以下问题:Python Environment.get_license_dir方法的具体用法?Python Environment.get_license_dir怎么用?Python Environment.get_license_dir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.common.Environment
的用法示例。
在下文中一共展示了Environment.get_license_dir方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: execute
# 需要导入模块: from pyasm.common import Environment [as 别名]
# 或者: from pyasm.common.Environment import get_license_dir [as 别名]
def execute(self):
web = self.get_web()
keys = web.get_form_keys()
file_name = self.kwargs.get("file_name")
# process and get the uploaded files
dir = Environment.get_upload_dir()
license_file = "%s/%s" % (dir, file_name)
if not os.path.exists(license_file):
raise TacticException("Error retrieving the license file in [%s]"%license_file)
std_name = 'tactic-license.xml'
head, file_name = os.path.split(license_file)
# no restrictions for license file
#if file_name != std_name:
# raise TacticException("License file name should be named tactic-license.xml. The file given is [%s]" %file_name)
license_dir = Environment.get_license_dir()
current_license = "%s/%s" %(license_dir, std_name)
if os.path.exists(current_license):
FileUndo.remove(current_license)
FileUndo.move(license_file, current_license)
self.add_description('Renewed license file')
security = Environment.get_security()
security.reread_license()