# HG changeset patch # User Ralph Meijer # Date 1169128359 0 # Node ID 40d931ed15b91baa2b19d9ba5a2e477044193c86 # Parent 1701c0e2c7070e255e2013d3b73a3fdcd7b754a3 Make imports work with Twisted 0.5.0. Author: ralphm Fixes #3 diff -r 1701c0e2c707 -r 40d931ed15b9 idavoll/idavoll.py --- a/idavoll/idavoll.py Thu Sep 07 11:13:46 2006 +0000 +++ b/idavoll/idavoll.py Thu Jan 18 13:52:39 2007 +0000 @@ -4,11 +4,14 @@ from twisted.words.protocols.jabber import component, error from twisted.application import service from twisted.internet import defer -import backend -import pubsub + import disco +import pubsub -import sys +try: + from twisted.words.protocols.jabber.ijabber import IService +except ImportError: + from twisted.words.protocols.jabber.component import IService __version__ = '0.5.0' @@ -52,7 +55,7 @@ node = iq.query.getAttribute("node") for c in self.parent: - if component.IService.providedBy(c): + if IService.providedBy(c): if hasattr(c, "get_disco_info"): dl.append(c.get_disco_info(node)) d = defer.DeferredList(dl, fireOnOneErrback=1, consumeErrors=1) @@ -91,7 +94,7 @@ node = iq.query.getAttribute("node") for c in self.parent: - if component.IService.providedBy(c): + if IService.providedBy(c): if hasattr(c, "get_disco_items"): dl.append(c.get_disco_items(node)) d = defer.DeferredList(dl, fireOnOneErrback=1, consumeErrors=1) @@ -153,41 +156,41 @@ import generic_backend as b bs = b.BackendService(st) - c = component.IService(bs) + c = IService(bs) c.setServiceParent(sm) c.hide_nodes = config["hide-nodes"] bsc = b.PublishService() bsc.setServiceParent(bs) - component.IService(bsc).setServiceParent(sm) + IService(bsc).setServiceParent(sm) bsc = b.NotificationService() bsc.setServiceParent(bs) - component.IService(bsc).setServiceParent(sm) + IService(bsc).setServiceParent(sm) bsc = b.SubscriptionService() bsc.setServiceParent(bs) - component.IService(bsc).setServiceParent(sm) + IService(bsc).setServiceParent(sm) bsc = b.NodeCreationService() bsc.setServiceParent(bs) - component.IService(bsc).setServiceParent(sm) + IService(bsc).setServiceParent(sm) bsc = b.AffiliationsService() bsc.setServiceParent(bs) - component.IService(bsc).setServiceParent(sm) + IService(bsc).setServiceParent(sm) bsc = b.ItemRetrievalService() bsc.setServiceParent(bs) - component.IService(bsc).setServiceParent(sm) + IService(bsc).setServiceParent(sm) bsc = b.RetractionService() bsc.setServiceParent(bs) - component.IService(bsc).setServiceParent(sm) + IService(bsc).setServiceParent(sm) bsc = b.NodeDeletionService() bsc.setServiceParent(bs) - component.IService(bsc).setServiceParent(sm) + IService(bsc).setServiceParent(sm) s = IdavollService() s.setServiceParent(sm) diff -r 1701c0e2c707 -r 40d931ed15b9 idavoll/pubsub.py --- a/idavoll/pubsub.py Thu Sep 07 11:13:46 2006 +0000 +++ b/idavoll/pubsub.py Thu Jan 18 13:52:39 2007 +0000 @@ -1,17 +1,23 @@ # Copyright (c) 2003-2006 Ralph Meijer # See LICENSE for details. +from zope.interface import implements + from twisted.words.protocols.jabber import component, jid, error -from twisted.words.xish import utility, domish +from twisted.words.xish import domish from twisted.python import components from twisted.internet import defer -from zope.interface import implements import backend import storage import disco import data_form +try: + from twisted.words.protocols.jabber.ijabber import IService +except ImportError: + from twisted.words.protocols.jabber.component import IService + if issubclass(domish.SerializedXML, str): # Work around bug # in twisted Xish class SerializedXML(unicode): @@ -86,7 +92,7 @@ class Service(component.Service): - implements(component.IService) + implements(IService) def __init__(self, backend): self.backend = backend @@ -203,7 +209,7 @@ components.registerAdapter(ComponentServiceFromService, backend.IBackendService, - component.IService) + IService) class ComponentServiceFromNotificationService(Service): @@ -232,7 +238,7 @@ components.registerAdapter(ComponentServiceFromNotificationService, backend.INotificationService, - component.IService) + IService) class ComponentServiceFromPublishService(Service): @@ -266,7 +272,7 @@ components.registerAdapter(ComponentServiceFromPublishService, backend.IPublishService, - component.IService) + IService) class ComponentServiceFromSubscriptionService(Service): @@ -357,7 +363,7 @@ components.registerAdapter(ComponentServiceFromSubscriptionService, backend.ISubscriptionService, - component.IService) + IService) class ComponentServiceFromNodeCreationService(Service): @@ -486,7 +492,7 @@ components.registerAdapter(ComponentServiceFromNodeCreationService, backend.INodeCreationService, - component.IService) + IService) class ComponentServiceFromAffiliationsService(Service): @@ -521,7 +527,7 @@ components.registerAdapter(ComponentServiceFromAffiliationsService, backend.IAffiliationsService, - component.IService) + IService) class ComponentServiceFromItemRetrievalService(Service): @@ -579,7 +585,7 @@ components.registerAdapter(ComponentServiceFromItemRetrievalService, backend.IItemRetrievalService, - component.IService) + IService) class ComponentServiceFromRetractionService(Service): @@ -631,7 +637,7 @@ components.registerAdapter(ComponentServiceFromRetractionService, backend.IRetractionService, - component.IService) + IService) class ComponentServiceFromNodeDeletionService(Service): @@ -685,4 +691,4 @@ components.registerAdapter(ComponentServiceFromNodeDeletionService, backend.INodeDeletionService, - component.IService) + IService)