0
0
mirror of https://github.com/django/django.git synced 2024-11-30 15:10:46 +01:00

Removed a bunch of annoying trailing whitespace.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@5068 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Malcolm Tredinnick 2007-04-25 07:25:22 +00:00
parent 76005c917f
commit 535535a45e
3 changed files with 14 additions and 15 deletions

View File

@ -86,7 +86,7 @@ def patch_response_headers(response, cache_timeout=None):
def add_never_cache_headers(response):
"""
Add headers to a response to indicate that
Add headers to a response to indicate that
a page should never be cached.
"""
patch_response_headers(response, cache_timeout=-1)

View File

@ -16,9 +16,9 @@ class MergeDict(object):
def __contains__(self, key):
return self.has_key(key)
def __copy__(self):
return self.__class__(*self.dicts)
def __copy__(self):
return self.__class__(*self.dicts)
def get(self, key, default=None):
try:
@ -45,9 +45,9 @@ class MergeDict(object):
if dict.has_key(key):
return True
return False
def copy(self):
""" returns a copy of this object"""
def copy(self):
""" returns a copy of this object"""
return self.__copy__()
class SortedDict(dict):

View File

@ -1,6 +1,6 @@
"""
Synchronization primitives:
- reader-writer lock (preference to writers)
(Contributed to Django by eugene@lazutkin.com)
@ -14,17 +14,16 @@ except ImportError:
class RWLock:
"""
Classic implementation of reader-writer lock with preference to writers.
Readers can access a resource simultaneously.
Writers get an exclusive access.
API is self-descriptive:
reader_enters()
reader_leaves()
writer_enters()
writer_leaves()
"""
def __init__(self):
self.mutex = threading.RLock()
self.can_read = threading.Semaphore(0)
@ -33,7 +32,7 @@ class RWLock:
self.active_writers = 0
self.waiting_readers = 0
self.waiting_writers = 0
def reader_enters(self):
self.mutex.acquire()
try:
@ -45,7 +44,7 @@ class RWLock:
finally:
self.mutex.release()
self.can_read.acquire()
def reader_leaves(self):
self.mutex.acquire()
try:
@ -56,7 +55,7 @@ class RWLock:
self.can_write.release()
finally:
self.mutex.release()
def writer_enters(self):
self.mutex.acquire()
try:
@ -68,7 +67,7 @@ class RWLock:
finally:
self.mutex.release()
self.can_write.acquire()
def writer_leaves(self):
self.mutex.acquire()
try: