Closed twisted-trac closed 20 years ago
Automation removed owner |
---|
@itamarst commented |
---|
#!html
<pre>
Once more, copy/pasting moshez's patch into emacs and then attempting to apply
it with patch failed. I decided deprecation warnings might be a better way to go
for now, we can remove the code in a release or three, and this way code that
uses it (i.e. explicityly old app code that will get explicit "this is
deprecated so fix it") won't break. Oh wait, no more "theApplication". Oh well,
guess I *am* deleting this.
</pre>
@moshez commented |
---|
#!html
<pre>
Here is a reference patch for just leaving the registry in and removing
traces of old application from it:
Index: twisted/web/static.py
===================================================================
RCS file: /cvs/Twisted/twisted/web/static.py,v
retrieving revision 1.113
diff -u -r1.113 static.py
--- twisted/web/static.py 24 Sep 2003 08:58:20 -0000 1.113
+++ twisted/web/static.py 13 Oct 2003 08:28:28 -0000
@@ -39,7 +39,7 @@
# Twisted Imports
from twisted.protocols import http
from twisted.python import threadable, log, components, failure, filepath
-from twisted.internet import abstract, interfaces, defer
+from twisted.internet import abstract
from twisted.spread import pb
from twisted.persisted import styles
from twisted.python.util import InsensitiveDict
@@ -83,9 +83,6 @@
def render(self, request):
return redirectTo(self.url, request)
-from twisted.internet.interfaces import IServiceCollection
-from twisted.internet.app import ApplicationService
-
class Registry(components.Componentized, styles.Versioned):
"""
I am a Componentized object that will be made available to internal Twisted
@@ -107,54 +104,6 @@
def getCachedPath(self, path):
return self._pathCache.get(path)
- def _grabService(self, svc, sclas):
- """
- Find an instance of a particular class in a service collection and all
- subcollections.
- """
- for s in svc.services.values():
- if isinstance(s, sclas):
- return s
- if components.implements(s, IServiceCollection):
- ss = self._grabService(s, sclas)
- if ss:
- return ss
-
- def getComponent(self, interface, registry=None):
- """
- Very similar to Componentized.getComponent, with a little magic.
-
- This adds the additional default behavior that if no component already
- exists and 'interface' is a subclass of
- L{twisted.internet.app.ApplicationService}, it will automatically scan
- through twisted.internet.app.theApplication and look for instances of
- 'interface'.
-
- This has the general effect that if your web script (in an RPY, EPY, or
- anywhere else that a Registry is present) wishes to locate a Service in
- a default webserver, it can say 'registry.getComponent(MyServiceClass)'
- and if there is a service of that type registered with the Application,
- it will be found. Additionally, in a more complex server, the registry
- can be explicitly given a service to locate for that interface using
- setComponent(MyServiceClass, myServiceInstance). Separate File
- instances can be used to represent access to different services.
- """
- c = components.Componentized.getComponent(self, interface, registry)
- if c is not None:
- return c
- elif issubclass(interface, ApplicationService):
- from twisted.internet.app import theApplication
- gs = self._grabService(theApplication, interface)
- if gs:
- self.setComponent(interface, gs)
- return gs
-
-
-def _upgradeRegistry(registry):
- from twisted.internet import app
- registry.setComponent(interfaces.IServiceCollection,
- app.theApplication)
-
def loadMimeTypes(mimetype_locations=['/etc/mime.types']):
"""
@@ -251,8 +200,6 @@
def upgradeToVersion5(self):
if not isinstance(self.registry, Registry):
self.registry = Registry()
- from twisted.internet import reactor
- reactor.callLater(0, _upgradeRegistry, self.registry)
def upgradeToVersion4(self):
if not hasattr(self, 'registry'):
</pre>
Searchable metadata
``` trac-id__328 328 type__defect defect reporter__itamarst itamarst priority__highest highest milestone__ branch__ branch_author__ status__closed closed resolution__fixed fixed component__ftp ftp keywords__ time__1065908149000000 1065908149000000 changetime__1066209283000000 1066209283000000 version__ owner__ cc__radix cc__itamarst cc__dp cc__moshez ```