當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。