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


Python WebService.link_update方法代码示例

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


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

示例1: _check_information

# 需要导入模块: from stoqlib.lib.webservice import WebService [as 别名]
# 或者: from stoqlib.lib.webservice.WebService import link_update [as 别名]
    def _check_information(self):
        """Check some information with Stoq Web API

        - Check if there are new versions of Stoq Available
        - Check if this Stoq Instance uses Stoq Link (and send data to us if
          it does).
        """
        # Check version
        self._version_checker = VersionChecker(self.store, self)
        self._version_checker.check_new_version()
        if not api.sysparam.get_bool('ONLINE_SERVICES'):
            return
        # Check Stoq Link usage
        webapi = WebService()
        webapi.link_update(self.store)
开发者ID:fuinha,项目名称:stoq,代码行数:17,代码来源:shellwindow.py

示例2: ShellBootstrap

# 需要导入模块: from stoqlib.lib.webservice import WebService [as 别名]
# 或者: from stoqlib.lib.webservice.WebService import link_update [as 别名]

#.........这里部分代码省略.........
        settings = get_settings()
        lang = settings.get('user-locale', None)
        if not lang:
            return

        lang += '.UTF-8'
        try:
            locale.setlocale(locale.LC_ALL, lang)
        except locale.Error as err:
            msg = _("Could not set locale to %s. Make sure that you have "
                    "the packages for this locale installed.") % lang[:-6]
            self._locale_error = (msg, err)
            log.warning(msg)
        else:
            os.environ['LC_ALL'] = lang
            os.environ['LANGUAGE'] = lang

    def _setup_autoreload(self):
        if not self._options.autoreload:
            return

        from stoqlib.lib.autoreload import install_autoreload
        install_autoreload()

    def _setup_stoq_link(self):
        from stoqlib.domain.events import SaleStatusChangedEvent
        from stoqlib.lib.webservice import WebService
        self._api = WebService()
        SaleStatusChangedEvent.connect(self._update_stoq_link)

    def _update_stoq_link(self, sale, old_status):
        if sale.status != sale.STATUS_CONFIRMED:
            return
        self._api.link_update(sale.store)

    def _prepare_logfiles(self):
        from stoqlib.lib.osutils import get_application_dir

        stoqdir = get_application_dir("stoq")
        log_dir = os.path.join(stoqdir, 'logs', time.strftime('%Y'),
                               time.strftime('%m'))
        if not os.path.exists(log_dir):
            os.makedirs(log_dir)

        filename = 'stoq_%s.%s.log' % (time.strftime('%Y-%m-%d_%H-%M-%S'), os.getpid())
        self._log_filename = os.path.join(log_dir, filename)

        from kiwi.log import set_log_file
        self._stream = set_log_file(self._log_filename, 'stoq*')

        if hasattr(os, 'symlink'):
            link_file = os.path.join(stoqdir, 'stoq.log')
            if os.path.exists(link_file):
                os.unlink(link_file)
            os.symlink(self._log_filename, link_file)

        # We want developers to see deprecation warnings.
        from stoqlib.lib.environment import is_developer_mode
        if is_developer_mode():
            import warnings
            if self._options.non_fatal_warnings:
                action = "default"
            else:
                action = "error"
            warnings.filterwarnings(
                action, category=DeprecationWarning,
开发者ID:amaurihamasu,项目名称:stoq,代码行数:70,代码来源:bootstrap.py


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