本文整理匯總了Python中lamson.routing.Router.load方法的典型用法代碼示例。如果您正苦於以下問題:Python Router.load方法的具體用法?Python Router.load怎麽用?Python Router.load使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類lamson.routing.Router
的用法示例。
在下文中一共展示了Router.load方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _settings_loader
# 需要導入模塊: from lamson.routing import Router [as 別名]
# 或者: from lamson.routing.Router import load [as 別名]
def _settings_loader():
from lamson.routing import Router
from lamson.server import Relay, SMTPReceiver
from lamson import view, queue
import logging
import logging.config
import jinja2
settings = Settings()
for attr_name in dir(django_settings):
if attr_name.startswith("LAMSON_"):
setattr(settings, attr_name.split("LAMSON_")[1].lower(),
getattr(django_settings, attr_name))
#logging.config.fileConfig("logging.conf")
# the relay host to actually send the final message to
#TODO make debug a parameter to the command
if hasattr(settings, 'relay_config'):
settings.relay = Relay(host=settings.relay_config['host'],
port=settings.relay_config['port'], debug=1)
# where to listen for incoming messages
settings.receiver = SMTPReceiver(settings.receiver_config['host'],
settings.receiver_config['port'])
Router.defaults(**settings.router_defaults)
Router.load(settings.handlers)
#TODO make this a parameter to the command
Router.RELOAD=True
#TODO make run a parameter to the command
Router.UNDELIVERABLE_QUEUE=queue.Queue("run/undeliverable")
if hasattr(settings, 'template_config'):
view.LOADER = jinja2.Environment(
loader=jinja2.PackageLoader(settings.template_config['dir'],
settings.template_config['module']))
return settings
示例2: Relay
# 需要導入模塊: from lamson.routing import Router [as 別名]
# 或者: from lamson.routing.Router import load [as 別名]
from config import settings
from lamson.routing import Router
from lamson.server import Relay, QueueReceiver
from lamson import view
import logging
import logging.config
import jinja2
# configure logging to go to a log file
logging.config.fileConfig("config/logging.conf")
# the relay host to actually send the final message to
settings.relay = Relay(host=settings.relay_config['host'],
port=settings.relay_config['port'], debug=1)
# where to listen for incoming messages
settings.receiver = QueueReceiver('run/undeliverable', settings.queue_config['sleep'])
Router.defaults(**settings.router_defaults)
Router.load(['lamson.handlers.forward'])
Router.RELOAD=True
Router.UNDELIVERABLE_QUEUE=None
view.LOADER = jinja2.Environment(
loader=jinja2.PackageLoader(settings.template_config['dir'],
settings.template_config['module']))
示例3: Relay
# 需要導入模塊: from lamson.routing import Router [as 別名]
# 或者: from lamson.routing.Router import load [as 別名]
from config import settings
from lamson.routing import Router
from lamson.server import Relay, QueueReceiver
from lamson import view
import logging
import logging.config
import jinja2
logging.config.fileConfig("config/logging.conf")
# the relay host to actually send the final message to
settings.relay = Relay(host=settings.relay_config['host'],
port=settings.relay_config['port'], debug=1)
# where to listen for incoming messages
settings.receiver = QueueReceiver(settings.alertsq_config['queue'],
settings.alertsq_config['sleep'])
Router.defaults(**settings.router_defaults)
Router.load(settings.alertsq_handlers)
Router.RELOAD=False
view.LOADER = jinja2.Environment(
loader=jinja2.PackageLoader(settings.template_config['dir'],
settings.template_config['module']))
示例4: to
# 需要導入模塊: from lamson.routing import Router [as 別名]
# 或者: from lamson.routing.Router import load [as 別名]
import lamson.testing
import jinja2
import logging
import logging.config
import os
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)
Router.RELOAD=True
Router.LOG_EXCEPTIONS=False
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'
#TODO: make something like this worklamson.testing.TEST_QUEUE = 'var/queue'
示例5: to
# 需要導入模塊: from lamson.routing import Router [as 別名]
# 或者: from lamson.routing.Router import load [as 別名]
from lamson.routing import Router
from lamson.server import Relay
import jinja2
import logging
import logging.config
import os
# configure logging to go to a log file
logging.config.fileConfig("tests/config/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=False
Router.LOG_EXCEPTIONS=False
view.LOADER = jinja2.Environment(loader=jinja2.PackageLoader('lamson_tests', 'templates'))
# 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'
示例6: Relay
# 需要導入模塊: from lamson.routing import Router [as 別名]
# 或者: from lamson.routing.Router import load [as 別名]
import os
import logging
import logging.config
from django.conf import settings
from lamson.routing import Router
from lamson.server import Relay, SMTPReceiver
from lamson import queue
import ecs.ecsmail.monkey
relay = Relay(host= settings.EMAIL_HOST, port= settings.EMAIL_PORT, starttls= settings.EMAIL_USE_TLS,
username = settings.EMAIL_HOST_USER, password= settings.EMAIL_HOST_PASSWORD)
# Monkey Patch deliver so it will use ecsmail settings (and django backends)
relay.deliver = ecs.ecsmail.monkey.deliver
receiver = SMTPReceiver(settings.ECSMAIL ['listen'], settings.ECSMAIL ['port'])
Router.defaults(host= '.+')
Router.load(settings.ECSMAIL ['handlers'])
Router.RELOAD = False
Router.UNDELIVERABLE_QUEUE = queue.Queue(settings.ECSMAIL ['queue_dir'])
示例7: setup
# 需要導入模塊: from lamson.routing import Router [as 別名]
# 或者: from lamson.routing.Router import load [as 別名]
def setup():
Router.clear_routes()
Router.clear_states()
Router.load(['lamson_tests.simple_fsm_mod'])