当前位置: 首页>>代码示例>>Python>>正文


Python DatabaseImpl.clear_table_cache方法代码示例

本文整理汇总了Python中pyasm.search.DatabaseImpl.clear_table_cache方法的典型用法代码示例。如果您正苦于以下问题:Python DatabaseImpl.clear_table_cache方法的具体用法?Python DatabaseImpl.clear_table_cache怎么用?Python DatabaseImpl.clear_table_cache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyasm.search.DatabaseImpl的用法示例。


在下文中一共展示了DatabaseImpl.clear_table_cache方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: execute

# 需要导入模块: from pyasm.search import DatabaseImpl [as 别名]
# 或者: from pyasm.search.DatabaseImpl import clear_table_cache [as 别名]

#.........这里部分代码省略.........
            from_template_path = "%s/%s" % (base_dir, template_name)
            from_data_path = "%s/%s" % (base_dir, data_name)
            from_file_path = "%s/%s" % (base_dir, file_name)
            to_file_path = from_file_path

            # copy the files 
            # ???? why are we copying here?
            shutil.copy(from_template_path, to_template_path)
            shutil.copy(from_data_path, to_data_path)

        else:


            # TEST TEST TEST
            ticket = server.get_value("server")

            remote_server = TacticServerStub(
                protocol='xmlrpc',
                server=server,
                project=project_code,
                #user=user,
                #password=password,
                ticket=ticket,
            )


            class_name = 'tactic.ui.sync.SyncCreateTemplateCmd'
            kwargs = {
                'project_code': project_code
            }
            remote_server.execute_cmd(class_name, kwargs)

            base_url = "http://%s/assets/_temp/" % server


            # download and install the files


            from_template_path = "%s/%s_template-%s.zip" % (base_url, project_code, version)
            from_data_path = "%s/%s_data-%s.zip" % (base_url, project_code, version)

            remote_server.download(from_template_path, to_dir)
            remote_server.download(from_data_path, to_dir)



        # This makes the pretty big assumption that this is an official template
        if not os.path.exists(to_template_path):
            raise Exception("Path [%s] does not exist" % to_template_path)

        template_code = project_code

        try:
            new_project = False

            from tactic.command import ProjectTemplateInstallerCmd

            cmd = ProjectTemplateInstallerCmd(project_code=project_code, path=to_template_path,template_code=template_code, new_project=new_project, version=version)
            cmd.execute()

            Project.set_project(project_code)
            project = Project.get()

            # NOTE: this avoids breaking on search.py, line 203, where it checks
            # for tables.  The caching mechanism for what tables are in the
            # database need to be refreshed once a template is imported
            from pyasm.search import DatabaseImpl, DbContainer
            DatabaseImpl.clear_table_cache()


            # import from a plugin
            kwargs = {
                #'base_dir': base_dir,
                #'manifest': self.xml.to_string(),
                'code': "%s_data" % project_code,
                'zip_path': to_data_path,
            }
     

            from tactic.command import PluginInstaller
            cmd = PluginInstaller(**kwargs)
            cmd.execute()



            # create zip of the project files
            if os.path.exists(to_file_path):
                from pyasm.common import ZipUtil
                zip_util = ZipUtil()
                asset_dir = Environment.get_asset_dir()
                to_file_dir = os.path.dirname(to_file_path)
                zip_util.extract(to_file_path, base_dir=asset_dir)





        except Exception as e:
            print("Error: ", str(e))
            raise
开发者ID:mincau,项目名称:TACTIC,代码行数:104,代码来源:sync_settings_wdg.py


注:本文中的pyasm.search.DatabaseImpl.clear_table_cache方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。