zope.interface py3

python3
inpos 2016-06-08 20:38:12 +03:00
parent f2a43a948a
commit 7318e52b94
3 changed files with 9 additions and 16 deletions

View File

@ -6,7 +6,7 @@ from twisted.python import failure
from twisted.internet import reactor, defer
from twisted.internet.task import LoopingCall
from zope.interface import implements
from zope.interface import implementer
from mech_smtp import SerpentSMTPFactory, smtp_portal
from mech_imap import SerpentIMAPFactory, imap_portal
@ -14,10 +14,10 @@ from serpent.usrpwd import dbs
from serpent.queue import squeue
from serpent.config import conf
@implementer(ICredentialsChecker)
class CredChecker(object):
'''Класс проверки данных авторизации.
Параметром в конструктор передаётся список (list()) объектов баз пользователей.'''
implements(ICredentialsChecker)
credentialInterfaces = (credentials.IUsernamePassword,
credentials.IUsernameHashedPassword)

View File

@ -2,7 +2,7 @@
import os
from zope.interface import implements
from zope.interface import implementer
from twisted.cred import portal
from twisted.internet import protocol, ssl
@ -13,9 +13,8 @@ from serpent.imap.mailbox import ExtendedMaildir
from serpent.misc import IMAP_HDELIM, IMAP_MBOX_REG, IMAP_ACC_CONN_NUM
from shutil import rmtree, move
@implementer(imap4.IAccount)
class IMAPUserAccount(object):
implements(imap4.IAccount)
def __init__(self, mdir):
if not os.path.exists(mdir):
os.makedirs(mdir)
@ -146,9 +145,8 @@ class IMAPUserAccount(object):
inferiors.append(infname)
return inferiors
@implementer(portal.IRealm)
class SerpentIMAPRealm(object):
implements(portal.IRealm)
def requestAvatar(self, avatarId, mind, *interfaces):
if imap4.IAccount not in interfaces:
raise NotImplementedError(

View File

@ -6,7 +6,7 @@ from serpent.queue import squeue
from email.header import Header
from zope.interface import implements
from zope.interface import implementer
from twisted.internet import defer, ssl
from twisted.mail import smtp
@ -16,10 +16,8 @@ from twisted.cred.portal import IRealm, Portal
@implementer(smtp.IMessageDelivery)
class SmtpMessageDelivery:
implements(smtp.IMessageDelivery)
def __init__(self, avatarId = None):
self.avatarId = avatarId
@ -59,9 +57,8 @@ class SmtpMessageDelivery:
}
return lambda: SmtpMessage(msg)
@implementer(smtp.IMessage)
class SmtpMessage:
implements(smtp.IMessage)
def __init__(self, msg):
self.lines = []
self.size = 0
@ -126,10 +123,8 @@ class SerpentSMTPFactory(smtp.SMTPFactory):
return p
@implementer(IRealm)
class SmtpRealm:
implements(IRealm)
def requestAvatar(self, avatarId, mind, *interfaces):
if smtp.IMessageDelivery in interfaces:
return smtp.IMessageDelivery, SmtpMessageDelivery(avatarId), lambda: None