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


Python Install_Log.log方法代码示例

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


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

示例1: __safe_call__

# 需要导入模块: import Install_Log [as 别名]
# 或者: from Install_Log import log [as 别名]
    def __safe_call__ (self):
        app_id   = CTK.cfg.get_val('tmp!market!install!app!application_id')
        app_name = CTK.cfg.get_val('tmp!market!install!app!application_name')

        info = {'cherokee_version': VERSION,
                'system':           SystemInfo.get_info()}

        xmlrpc = XmlRpcServer (OWS_APPS_INSTALL, user=OWS_Login.login_user, password=OWS_Login.login_password)
        install_info = xmlrpc.get_install_info (app_id, info)

        Install_Log.log ("Waiting for the payment acknowledge…")

        box = CTK.Box()
        if install_info.get('due_payment'):
            set_timeout_js = "setTimeout (reload_druid, %s);" %(PAYMENT_CHECK_TIMEOUT)
            box += CTK.RawHTML ("<h2>%s %s</h2>"%(_('Checking out'), app_name))
            box += CTK.RawHTML ('<h1>%s</h1>' %(_("Waiting for the payment acknowledge…")))
            box += CTK.RawHTML (js="function reload_druid() {%s %s}" %(CTK.DruidContent__JS_to_goto (box.id, URL_INSTALL_PAY_CHECK), set_timeout_js))
            box += CTK.RawHTML (js=set_timeout_js)

            buttons = CTK.DruidButtonsPanel()
            buttons += CTK.DruidButton_Close(_('Cancel'))
            box += buttons

        else:
            Install_Log.log ("Payment ACK!")

            # Invalidate 'My Library' cache
            MyLibrary.Invalidate_Cache()

            # Move on
            CTK.cfg['tmp!market!install!download'] = install_info['url']
            box += CTK.DruidContent__JS_to_goto (box.id, URL_INSTALL_DOWNLOAD)

        return box.Render().toStr()
开发者ID:chetan,项目名称:cherokee,代码行数:37,代码来源:Install.py

示例2: __safe_call__

# 需要导入模块: import Install_Log [as 别名]
# 或者: from Install_Log import log [as 别名]
    def __safe_call__(self):
        app_id = CTK.cfg.get_val("tmp!market!install!app!application_id")
        app_name = CTK.cfg.get_val("tmp!market!install!app!application_name")

        # URL Package
        index = Distro.Index()
        pkg = index.get_package(app_id, "package")

        repo_url = CTK.cfg.get_val("admin!ows!repository", REPO_MAIN)
        url_download = os.path.join(repo_url, app_id, pkg["filename"])
        CTK.cfg["tmp!market!install!download"] = url_download

        # Local storage shortcut
        pkg_filename_full = url_download.split("/")[-1]
        pkg_filename = pkg_filename_full.split("_")[0]
        pkg_revision = 0

        pkg_repo_fp = os.path.join(CHEROKEE_OWS_DIR, "packages", app_id)
        if os.access(pkg_repo_fp, os.X_OK):
            for f in os.listdir(pkg_repo_fp):
                tmp = re.findall("^%s_(\d+)" % (pkg_filename), f)
                if tmp:
                    pkg_revision = max(pkg_revision, int(tmp[0]))

        if pkg_revision > 0:
            pkg_fullpath = os.path.join(
                CHEROKEE_OWS_DIR, "packages", app_id, "%s_%d.cpk" % (pkg_filename, pkg_revision)
            )
            CTK.cfg["tmp!market!install!local_package"] = pkg_fullpath

            Install_Log.log("Using local repository package: %s" % (pkg_fullpath))

            box = CTK.Box()
            box += CTK.RawHTML(js=CTK.DruidContent__JS_to_goto(box.id, URL_INSTALL_SETUP))
            return box.Render().toStr()

        # Instance a Downloader
        downloader = CTK.Downloader("package", url_download)
        downloader.bind("stopped", CTK.DruidContent__JS_to_close(downloader.id))
        downloader.bind("finished", CTK.DruidContent__JS_to_goto(downloader.id, URL_INSTALL_SETUP))
        downloader.bind("error", CTK.DruidContent__JS_to_goto(downloader.id, URL_INSTALL_DOWNLOAD_ERROR))

        stop = CTK.Button(_("Cancel"))
        stop.bind("click", downloader.JS_to_stop())
        buttons = CTK.DruidButtonsPanel()
        buttons += stop

        Install_Log.log("Downloading %s" % (url_download))

        cont = CTK.Container()
        cont += CTK.RawHTML("<h2>%s %s</h2>" % (_("Installing"), app_name))
        cont += CTK.RawHTML("<p>%s</p>" % (_("The application is being downloaded. Hold on tight!")))
        cont += downloader
        cont += buttons
        cont += CTK.RawHTML(js=downloader.JS_to_start())

        return cont.Render().toStr()
开发者ID:hikikomorime,项目名称:webserver,代码行数:59,代码来源:Install.py

示例3: Render

# 需要导入模块: import Install_Log [as 别名]
# 或者: from Install_Log import log [as 别名]
    def Render (self):
        # Add replacement keys to the log
        for k in self.keys:
            Install_Log.log ("  ${%s} -> '%s'" %(k, self.keys[k]))

        # Start thread
        self.thread.start()

        # Render
        return CTK.Box.Render (self)
开发者ID:woodbunny,项目名称:ArbiterThreadApp,代码行数:12,代码来源:CommandProgress.py

示例4: __safe_call__

# 需要导入模块: import Install_Log [as 别名]
# 或者: from Install_Log import log [as 别名]
    def __safe_call__ (self):
        app_name = CTK.cfg.get_val('tmp!market!install!app!application_name')

        Install_Log.log ("Downloading Error: %s" %(url_download))

        cont = CTK.Container()
        cont += CTK.RawHTML ('<h2>%s %s</h2>' %(_("Installing"), app_name))
        cont += CTK.RawHTML (_("There was an error downloading the application. Please contact us if the problem persists."))

        buttons = CTK.DruidButtonsPanel()
        buttons += CTK.DruidButton_Close(_('Cancel'))
        cont += buttons

        return cont.Render().toStr()
开发者ID:Daniel15,项目名称:webserver,代码行数:16,代码来源:Install.py

示例5: __call__

# 需要导入模块: import Install_Log [as 别名]
# 或者: from Install_Log import log [as 别名]
    def __call__(self):
        try:
            return self.__safe_call__()
        except Exception, e:
            # Log the exception
            exception_str = traceback.format_exc()
            print exception_str
            Install_Log.log("EXCEPTION!\n" + exception_str)

            # Reset 'unfinished installations' cache
            Maintenance.Invalidate_Cache()

            # Present an alternative response
            cont = Exception_Handler(exception_str)
            return cont.Render().toStr()
开发者ID:hikikomorime,项目名称:webserver,代码行数:17,代码来源:Install.py

示例6: __safe_call__

# 需要导入模块: import Install_Log [as 别名]
# 或者: from Install_Log import log [as 别名]
    def __safe_call__ (self):
        app_id   = CTK.cfg.get_val('tmp!market!install!app!application_id')
        app_name = CTK.cfg.get_val('tmp!market!install!app!application_name')

        info = {'cherokee_version': VERSION,
                'system':           SystemInfo.get_info()}

        cont = CTK.Box()
        xmlrpc = XmlRpcServer (OWS_APPS_INSTALL, user=OWS_Login.login_user, password=OWS_Login.login_password)
        install_info = xmlrpc.get_install_info (app_id, info)

        if install_info.get('error'):
            title  = install_info['error']['error_title']
            errors = install_info['error']['error_strings']

            cont += CTK.RawHTML ("<h2>%s</h2>"%(_(title)))
            for error in errors:
                cont += CTK.RawHTML ("<p>%s</p>"%(_(error)))

            buttons = CTK.DruidButtonsPanel()
            buttons += CTK.DruidButton_Close(_('Close'))
            cont += buttons

        elif install_info['installable']:
            # Do not change this log line. It is used by the
            # Maintenance.py file to figure out the app name
            Install_Log.log ("Checking: %s, ID: %s = Installable, URL=%s" %(app_name, app_id, install_info['url']))

            CTK.cfg['tmp!market!install!download'] = install_info['url']
            cont += CTK.RawHTML (js = CTK.DruidContent__JS_to_goto (cont.id, URL_INSTALL_DOWNLOAD))

        else:
            Install_Log.log ("Checking: %s, ID: %s = Must check out first" %(app_name, app_id))

            cont += CTK.RawHTML ("<h2>%s %s</h2>"%(_('Checking out'), app_name))
            cont += CTK.RawHTML ("<p>%s</p>"  %(_(NOTE_ALL_READY_TO_BUY_1)))
            cont += CTK.RawHTML ("<p>%s</p>"  %(_(NOTE_ALL_READY_TO_BUY_2)))

            checkout = CTK.Button (_("Check Out"))
            checkout.bind ('click', CTK.DruidContent__JS_to_goto (cont.id, URL_INSTALL_PAY_CHECK) +
                                    CTK.JS.OpenWindow('%s/order/%s' %(OWS_STATIC, app_id)))

            buttons = CTK.DruidButtonsPanel()
            buttons += CTK.DruidButton_Close(_('Cancel'))
            buttons += checkout
            cont += buttons

        return cont.Render().toStr()
开发者ID:woodbunny,项目名称:ArbiterThreadApp,代码行数:50,代码来源:Install.py

示例7: _run_function

# 需要导入模块: import Install_Log [as 别名]
# 或者: from Install_Log import log [as 别名]
    def _run_function (self, command_entry):
        function = command_entry['function']
        params   = command_entry.get ('params', {}).copy()

        Install_Log.log ("  Function: %s" %(function.__name__))
        if params:
            Install_Log.log ("    (PARAMS) -> %s" %(str(params)))

        try:
            ret = function (**params)
        except:
            ret = {'retcode': 1,
                   'stderr':  traceback.format_exc()}

        self.command_progress.last_popen_ret = ret

        if command_entry.get ('check_ret', True):
            if ret['retcode'] != 0:
                self._report_error (function.__name__, params, ret)
                return True
开发者ID:chetan,项目名称:cherokee,代码行数:22,代码来源:CommandProgress.py

示例8: _run_command

# 需要导入模块: import Install_Log [as 别名]
# 或者: from Install_Log import log [as 别名]
    def _run_command (self, command_entry):
        command = replacement_cmd (command_entry['command'])
        cd      = command_entry.get('cd')
        env     = command_entry.get('env')
        su      = command_entry.get('su')

        if cd:
            cd = replacement_cmd (cd)

        Install_Log.log ("  %s" %(command))
        if env:
            Install_Log.log ("    (CD)         -> %s" %(cd))
            Install_Log.log ("    (SU)         -> %s" %(su))
            Install_Log.log ("    (CUSTOM ENV) -> %s" %(str(env)))

        ret = popen.popen_sync (command, env=env, cd=cd, su=su)
        self.command_progress.last_popen_ret = ret

        if command_entry.get ('check_ret', True):
            if ret['retcode'] != 0:
                self._report_error (command, env, ret)
                return True
开发者ID:chetan,项目名称:cherokee,代码行数:24,代码来源:CommandProgress.py

示例9: _Setup_unpack

# 需要导入模块: import Install_Log [as 别名]
# 或者: from Install_Log import log [as 别名]
def _Setup_unpack():
    url_download = CTK.cfg.get_val("tmp!market!install!download")

    # has it been downloaded?
    pkg_filename = url_download.split("/")[-1]

    package_path = CTK.cfg.get_val("tmp!market!install!local_package")
    if not package_path or not os.path.exists(package_path):
        down_entry = CTK.DownloadEntry_Factory(url_download)
        package_path = down_entry.target_path

    # Create the local directory
    target_path = os.path.join(CHEROKEE_OWS_ROOT, str(int(time.time() * 100)))
    os.mkdir(target_path, 0700)
    CTK.cfg["tmp!market!install!root"] = target_path

    # Create the log file
    Install_Log.set_file(os.path.join(target_path, "install.log"))

    # Uncompress
    try:
        if sys.version_info < (
            2,
            5,
        ):  # tarfile module prior to 2.5 is useless to us: http://bugs.python.org/issue1509889
            raise tarfile.CompressionError

        Install_Log.log("Unpacking %s with Python" % (package_path))
        tar = tarfile.open(package_path, "r:gz")
        for tarinfo in tar:
            Install_Log.log("  %s" % (tarinfo.name))
            tar.extract(tarinfo, target_path)
        ret = {"retcode": 0}
    except tarfile.CompressionError:
        command = "gzip -dc '%s' | tar xfv -" % (package_path)
        Install_Log.log(
            "Unpacking %(package_path)s with the GZip binary (cd: %(target_path)s): %(command)s" % (locals())
        )
        ret = popen.popen_sync(command, cd=target_path)
        Install_Log.log(ret["stdout"])
        Install_Log.log(ret["stderr"])

    # Set default permission
    Install_Log.log("Setting default permission 755 for directory %s" % (target_path))
    os.chmod(
        target_path,
        stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR | stat.S_IRGRP | stat.S_IXGRP | stat.S_IROTH | stat.S_IXOTH,
    )

    # Remove the package
    if package_path.startswith(CHEROKEE_OWS_DIR):
        Install_Log.log("Skipping removal of: %s" % (package_path))
    else:
        Install_Log.log("Removing %s" % (package_path))
        os.unlink(package_path)

    return ret
开发者ID:hikikomorime,项目名称:webserver,代码行数:59,代码来源:Install.py


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