[CalendarServer-changes] [6506] CalendarServer/branches/users/glyph/sharedpool/twistedcaldav/mail.py

source_changes at macosforge.org source_changes at macosforge.org
Mon Nov 1 14:16:19 PDT 2010


Revision: 6506
          http://trac.macosforge.org/projects/calendarserver/changeset/6506
Author:   glyph at apple.com
Date:     2010-11-01 14:16:16 -0700 (Mon, 01 Nov 2010)
Log Message:
-----------
pyflakes, minor refactor

Modified Paths:
--------------
    CalendarServer/branches/users/glyph/sharedpool/twistedcaldav/mail.py

Modified: CalendarServer/branches/users/glyph/sharedpool/twistedcaldav/mail.py
===================================================================
--- CalendarServer/branches/users/glyph/sharedpool/twistedcaldav/mail.py	2010-11-01 21:15:58 UTC (rev 6505)
+++ CalendarServer/branches/users/glyph/sharedpool/twistedcaldav/mail.py	2010-11-01 21:16:16 UTC (rev 6506)
@@ -27,6 +27,7 @@
 
 try:
     from cStringIO import StringIO
+    StringIO
 except ImportError:
     from StringIO import StringIO
 
@@ -37,7 +38,7 @@
 from zope.interface import implements
 
 from twisted.application import internet, service
-from twisted.internet import protocol, defer, ssl, reactor
+from twisted.internet import protocol, defer, ssl, reactor as _reactor
 from twisted.internet.defer import inlineCallbacks, returnValue, succeed
 from twisted.mail import pop3client, imap4
 from twisted.mail.smtp import messageid, rfc822date, ESMTPSenderFactory
@@ -60,7 +61,7 @@
 from twistedcaldav.config import config
 from twistedcaldav.directory.util import transactionFromRequest
 from twistedcaldav.ical import Property
-from twistedcaldav.localization import translationTo
+from twistedcaldav.localization import translationTo, _
 from twistedcaldav.resource import CalDAVResource
 from twistedcaldav.schedule import deliverSchedulePrivilegeSet
 from twistedcaldav.scheduling.cuaddress import normalizeCUAddr
@@ -350,7 +351,7 @@
 def injectMessage(organizer, attendee, calendar, msgId, reactor=None):
 
     if reactor is None:
-        from twisted.internet import reactor
+        reactor = _reactor
 
     headers = {
         'Content-Type' : 'text/calendar',
@@ -589,7 +590,7 @@
 #
 # ISchedule Inbox
 #
-class IScheduleService(service.Service, LoggingMixIn):
+class IScheduleService(service.MultiService, LoggingMixIn):
 
     def __init__(self, settings, mailer):
         self.settings = settings
@@ -604,16 +605,12 @@
         self.factory = HTTPFactory(server.Site(rootResource))
         self.server = internet.TCPServer(settings['MailGatewayPort'],
             self.factory)
+        self.server.setServiceParent(self)
 
-    def startService(self):
-        self.server.startService()
 
-    def stopService(self):
-        self.server.stopService()
 
 
 
-
 class MailHandler(LoggingMixIn):
 
     def __init__(self, dataRoot=None):
@@ -767,7 +764,7 @@
                 requireTransportSecurity=settings["UseSSL"],
             )
 
-            reactor.connectTCP(settings["Server"], settings["Port"], factory)
+            _reactor.connectTCP(settings["Server"], settings["Port"], factory)
             return deferred
 
 
@@ -954,7 +951,7 @@
                 requireAuthentication=False,
                 requireTransportSecurity=settings["UseSSL"])
 
-            reactor.connectTCP(settings['Server'], settings['Port'], factory)
+            _reactor.connectTCP(settings['Server'], settings['Port'], factory)
             deferred.addCallback(_success, msgId, fromAddr, toAddr)
             deferred.addErrback(_failure, msgId, fromAddr, toAddr)
             return deferred
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20101101/2e877acc/attachment.html>


More information about the calendarserver-changes mailing list