當前位置: 首頁>>代碼示例>>Python>>正文


Python Router.defaults方法代碼示例

本文整理匯總了Python中lamson.routing.Router.defaults方法的典型用法代碼示例。如果您正苦於以下問題:Python Router.defaults方法的具體用法?Python Router.defaults怎麽用?Python Router.defaults使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在lamson.routing.Router的用法示例。


在下文中一共展示了Router.defaults方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: _settings_loader

# 需要導入模塊: from lamson.routing import Router [as 別名]
# 或者: from lamson.routing.Router import defaults [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
開發者ID:fitoria,項目名稱:django-lamson,代碼行數:41,代碼來源:lamson_start.py

示例2: Relay

# 需要導入模塊: from lamson.routing import Router [as 別名]
# 或者: from lamson.routing.Router import defaults [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']))

開發者ID:3kwa,項目名稱:lamson,代碼行數:28,代碼來源:forward.py

示例3: Relay

# 需要導入模塊: from lamson.routing import Router [as 別名]
# 或者: from lamson.routing.Router import defaults [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'])
開發者ID:emulbreh,項目名稱:ecs,代碼行數:25,代碼來源:mailconf.py


注:本文中的lamson.routing.Router.defaults方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。