You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by jo...@apache.org on 2013/01/29 21:28:07 UTC
[4/5] git commit: [#5699] cleanup of unused untested util functions
[#5699] cleanup of unused untested util functions
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/eb93a4bf
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/eb93a4bf
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/eb93a4bf
Branch: refs/heads/master
Commit: eb93a4bfa682ec658c293868e742df6bd1ae7280
Parents: a27f351
Author: Dave Brondsema <db...@geek.net>
Authored: Tue Jan 29 16:19:10 2013 +0000
Committer: Cory Johns <jo...@geek.net>
Committed: Tue Jan 29 20:27:50 2013 +0000
----------------------------------------------------------------------
Allura/allura/lib/utils.py | 43 ---------------------------------------
1 files changed, 0 insertions(+), 43 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/eb93a4bf/Allura/allura/lib/utils.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/utils.py b/Allura/allura/lib/utils.py
index f23f0c1..fa63b38 100644
--- a/Allura/allura/lib/utils.py
+++ b/Allura/allura/lib/utils.py
@@ -35,41 +35,6 @@ def permanent_redirect(url):
except exc.HTTPFound, err:
raise exc.HTTPMovedPermanently(location=err.location)
-def cache_forever():
- headers = [
- (k,v) for k,v in response.headers.items()
- if k.lower() not in ('pragma', 'cache-control') ]
- delta = CACHE_CONTROL.apply(
- headers,
- public=True,
- max_age=60*60*24*365)
- EXPIRES.update(headers, delta=delta)
- response.headers.pop('cache-control', None)
- response.headers.pop('pragma', None)
- response.headers.update(headers)
-
-class memoize_on_request(object):
-
- def __init__(self, *key, **kwargs):
- self.key = key
- self.include_func_in_key = kwargs.pop(
- 'include_func_in_key', False)
- assert not kwargs, 'Extra args'
-
- def __call__(self, func):
- def wrapper(*args, **kwargs):
- cache = c.memoize_cache
- if self.include_func_in_key:
- key = (func, self.key, args, tuple(kwargs.iteritems()))
- else:
- key = (self.key, args, tuple(kwargs.iteritems()))
- if key in cache:
- result = cache[key]
- else:
- result = cache[key] = func(*args, **kwargs)
- return result
- wrapper.__name__ = 'wrap(%s)' % func.__name__
- return wrapper
def guess_mime_type(filename):
'''Guess MIME type based on filename.
@@ -475,11 +440,3 @@ def take_while_true(source):
yield x
x = source()
-def index_matching(pred, seq):
- '''Return the index of the first item from seq matching the predicate.
-
- If no items match the predicate, None is returned instead.'''
- for i,x in enumerate(seq):
- if pred(x):
- return i
- return None