Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(784)

Unified Diff: third_party/twisted_8_1/twisted/web/rewrite.py

Issue 12261012: Remove third_party/twisted_8_1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/twisted_8_1/twisted/web/resource.py ('k') | third_party/twisted_8_1/twisted/web/script.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/twisted_8_1/twisted/web/rewrite.py
diff --git a/third_party/twisted_8_1/twisted/web/rewrite.py b/third_party/twisted_8_1/twisted/web/rewrite.py
deleted file mode 100644
index b41ca00347cad8bd9455491025528a71894400d9..0000000000000000000000000000000000000000
--- a/third_party/twisted_8_1/twisted/web/rewrite.py
+++ /dev/null
@@ -1,52 +0,0 @@
-# Copyright (c) 2001-2004 Twisted Matrix Laboratories.
-# See LICENSE for details.
-
-#
-from twisted.web import resource
-
-class RewriterResource(resource.Resource):
-
- def __init__(self, orig, *rewriteRules):
- resource.Resource.__init__(self)
- self.resource = orig
- self.rewriteRules = list(rewriteRules)
-
- def _rewrite(self, request):
- for rewriteRule in self.rewriteRules:
- rewriteRule(request)
-
- def getChild(self, path, request):
- request.postpath.insert(0, path)
- request.prepath.pop()
- self._rewrite(request)
- path = request.postpath.pop(0)
- request.prepath.append(path)
- return self.resource.getChildWithDefault(path, request)
-
- def render(self, request):
- self._rewrite(request)
- return self.resource.render(request)
-
-
-def tildeToUsers(request):
- if request.postpath and request.postpath[0][:1]=='~':
- request.postpath[:1] = ['users', request.postpath[0][1:]]
- request.path = '/'+'/'.join(request.prepath+request.postpath)
-
-def alias(aliasPath, sourcePath):
- """
- I am not a very good aliaser. But I'm the best I can be. If I'm
- aliasing to a Resource that generates links, and it uses any parts
- of request.prepath to do so, the links will not be relative to the
- aliased path, but rather to the aliased-to path. That I can't
- alias static.File directory listings that nicely. However, I can
- still be useful, as many resources will play nice.
- """
- sourcePath = sourcePath.split('/')
- aliasPath = aliasPath.split('/')
- def rewriter(request):
- if request.postpath[:len(aliasPath)] == aliasPath:
- after = request.postpath[len(aliasPath):]
- request.postpath = sourcePath + after
- request.path = '/'+'/'.join(request.prepath+request.postpath)
- return rewriter
« no previous file with comments | « third_party/twisted_8_1/twisted/web/resource.py ('k') | third_party/twisted_8_1/twisted/web/script.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698