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


Python Router.defaults方法代码示例

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


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

示例1:

# 需要导入模块: from salmon.routing import Router [as 别名]
# 或者: from salmon.routing.Router import defaults [as 别名]
from salmon import queue
from salmon.routing import Router
import logging
import logging.config
import os

logging.config.fileConfig("config/logging.conf")


Router.defaults(**{})
Router.load(['app.server'])
Router.RELOAD=False
Router.LOG_EXCEPTIONS=True
Router.UNDELIVERABLE_QUEUE=queue.Queue("run/undeliverable")
开发者ID:cloudfleet,项目名称:despatch,代码行数:16,代码来源:boot.py

示例2: to

# 需要导入模块: from salmon.routing import Router [as 别名]
# 或者: from salmon.routing.Router import defaults [as 别名]
import jinja2
import logging
import logging.config
import os

# configure logging to go to a log file
logging.config.fileConfig("config/test_logging.conf")

# the relay host to actually send the final message to (set debug=1 to see what
# the relay is saying to the log server).
settings.relay = Relay(host=settings.relay_config['host'], 
                       port=settings.relay_config['port'], debug=0)


settings.receiver = None


Router.defaults(**settings.router_defaults)
Router.load(settings.handlers + settings.queue_handlers)
Router.RELOAD=True

view.LOADER = jinja2.Environment(
    loader=jinja2.PackageLoader(settings.template_config['dir'], 
                                settings.template_config['module']))

# if you have pyenchant and enchant installed then the template tests will do
# spell checking for you, but you need to tell pyenchant where to find itself
if 'PYENCHANT_LIBRARY_PATH' not in os.environ:
    os.environ['PYENCHANT_LIBRARY_PATH'] = '/opt/local/lib/libenchant.dylib'

开发者ID:claytondaley,项目名称:salmon,代码行数:31,代码来源:testing.py

示例3: simple_key_gen

# 需要导入模块: from salmon.routing import Router [as 别名]
# 或者: from salmon.routing.Router import defaults [as 别名]
from __future__ import print_function

from salmon.routing import Router, nolocking, route, route_like, state_key_generator, stateless


@state_key_generator
def simple_key_gen(module_name, message):
    return module_name


# common routing capture regexes go in here, you can override them in @route
Router.defaults(host="localhost",
                action="[a-zA-Z0-9]+",
                list_name="[a-zA-Z.0-9]+")


@route("(list_name)-(action)@(host)")
def START(message, list_name=None, action=None, host=None):
    print("START", message, list_name, action, host)
    if action == 'explode':
        print("EXPLODE!")
        raise RuntimeError("Exploded on purpose.")
    return CONFIRM


@route("(list_name)-confirm-(id_number)@(host)", id_number="[0-9]+")
def CONFIRM(message, list_name=None, id_number=None, host=None):
    print("CONFIRM", message, list_name, id_number, host)
    return POSTING

开发者ID:moggers87,项目名称:salmon,代码行数:31,代码来源:simple_fsm_mod.py


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