Пример #1
0
def email(to, subject, body):
 """Sends email, doing all the (not so) heavy lifting."""
 try:
  s = _SMTP('localhost')
  msg = _MIMEText(body)
  msg['from'] = 'Driver Mail Subsystem <noreply@%s>' % _getfqdn()
  msg['to'] = to
  msg['subject'] = subject
  s.sendmail(msg['from'], msg['to'], msg.as_string())
  s.quit()
  logger.info('Sent mail to %s with subject %s.', msg['to'], msg['subject'])
 except Exception as e:
  logger.exception(e)
Пример #2
0
#      README file.
#   
# $Id$
# Time-stamp: <01/05/04 13:27:45 smulloni>
########################################################################

import SkunkWeb.ServiceRegistry
SkunkWeb.ServiceRegistry.registerService("httpd")


from SkunkWeb import Configuration, Hooks
from socket import getfqdn as _getfqdn
Configuration.mergeDefaults(lookupHTTPRemoteHost=0,
                            HTTPKeepAliveTimeout=0,
                            HTTPListenPorts=['TCP::8080'],
                            ServerName=_getfqdn())

class _hooker:
    def __init__(self, handler, adder, ports):
        self.adder=adder
        self.handler=handler
        self.ports=ports

    def __call__(self, *a, **kw):
        self.adder(self.handler, self.ports)
    
if Configuration.HTTPListenPorts:
    import requestHandler.requestHandler as rh
    import protocol as prot
    httpProt=prot.HTTPProtocol()
Пример #3
0
#      Public License or the SkunkWeb License, as specified in the
#      README file.
#
# $Id: __init__.py,v 1.5 2004/03/01 16:27:04 smulloni Exp $
# Time-stamp: <01/05/04 13:27:45 smulloni>
########################################################################

import SkunkWeb.ServiceRegistry
SkunkWeb.ServiceRegistry.registerService("httpd")

from SkunkWeb import Configuration, Hooks
from socket import getfqdn as _getfqdn
Configuration.mergeDefaults(lookupHTTPRemoteHost=0,
                            HTTPKeepAliveTimeout=0,
                            HTTPListenPorts=['TCP::8080'],
                            ServerName=_getfqdn())


class _hooker:
    def __init__(self, handler, adder, ports):
        self.adder = adder
        self.handler = handler
        self.ports = ports

    def __call__(self, *a, **kw):
        self.adder(self.handler, self.ports)


if Configuration.HTTPListenPorts:
    import requestHandler.requestHandler as rh
    import protocol as prot