<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -10,8 +10,6 @@
 urllib2 caching handler
 Modified from http://code.activestate.com/recipes/491261/
 &quot;&quot;&quot;
-from __future__ import with_statement
-
 __author__ = &quot;dbr/Ben&quot;
 __version__ = &quot;1.2.1&quot;
 
@@ -26,84 +24,6 @@ from threading import RLock
 
 cache_lock = RLock()
 
-class FileLockException(Exception):
-    pass
-
-class FileLock(object):
-    &quot;&quot;&quot; A file locking mechanism that has context-manager support so
-        you can use it in a with statement. This should be relatively cross
-        compatible as it doesn't rely on msvcrt or fcntl for the locking.
-
-        Modified from http://www.evanfosmark.com/2009/01/cross-platform-file-locking-support-in-python/
-    &quot;&quot;&quot;
-
-    def __init__(self, file_name, timeout=10, delay=.05, lock_folder = False):
-        &quot;&quot;&quot; Prepare the file locker. Specify the file to lock and optionally
-            the maximum timeout and the delay between each attempt to lock.
-        &quot;&quot;&quot;
-        self.is_locked = False
-        if lock_folder:
-            enclosing_dir, dirname = os.path.split(os.path.split(file_name)[0])
-            self.lockfile = os.path.join(enclosing_dir, &quot;%s.lock&quot; % dirname)
-        else:
-            dirname = os.path.split(os.path.abspath(file_name))[0]
-            print file_name
-            self.lockfile = os.path.join(dirname, &quot;%s.lock&quot; % file_name)
-
-        self.file_name = file_name
-        self.timeout = timeout
-        self.delay = delay
-
-    def acquire(self):
-        &quot;&quot;&quot; Acquire the lock, if possible. If the lock is in use, it check again
-            every `wait` seconds. It does this until it either gets the lock or
-            exceeds `timeout` number of seconds, in which case it throws
-            an exception.
-        &quot;&quot;&quot;
-        start_time = time.time()
-        while True:
-            try:
-                self.fd = os.open(self.lockfile, os.O_CREAT|os.O_EXCL|os.O_RDWR)
-                break;
-            except OSError, e:
-                if e.errno != errno.EEXIST:
-                    raise e
-                if (time.time() - start_time) &gt;= self.timeout:
-                    raise FileLockException(&quot;Timeout occured.&quot;)
-                time.sleep(self.delay)
-        self.is_locked = True
-
-    def release(self):
-        &quot;&quot;&quot; Get rid of the lock by deleting the lockfile.
-            When working in a `with` statement, this gets automatically
-            called at the end.
-        &quot;&quot;&quot;
-        if self.is_locked:
-            os.close(self.fd)
-            os.unlink(self.lockfile)
-            self.is_locked = False
-
-    def __enter__(self):
-        &quot;&quot;&quot; Activated when used in the with statement.
-            Should automatically acquire a lock to be used in the with block.
-        &quot;&quot;&quot;
-        if not self.is_locked:
-            self.acquire()
-        return self
-
-    def __exit__(self, type, value, traceback):
-        &quot;&quot;&quot; Activated at the end of the with statement.
-            It automatically releases the lock if it isn't locked.
-        &quot;&quot;&quot;
-        if self.is_locked:
-            self.release()
-
-    def __del__(self):
-        &quot;&quot;&quot; Make sure that the FileLock instance doesn't leave a lockfile
-            lying around.
-        &quot;&quot;&quot;
-        self.release()
-
 def locked_function(origfunc):
     &quot;&quot;&quot;Decorator to execute function under lock&quot;&quot;&quot;
     def wrapped(*args, **kwargs):
@@ -178,9 +98,8 @@ class CacheHandler(urllib2.BaseHandler):
         &quot;&quot;&quot;The location of the cache directory&quot;&quot;&quot;
         self.max_age = max_age
         self.cache_location = cache_location
-        with FileLock(self.cache_location, lock_folder = True):
-            if not os.path.exists(self.cache_location):
-                os.mkdir(self.cache_location)
+        if not os.path.exists(self.cache_location):
+            os.mkdir(self.cache_location)
 
     def default_open(self, request):
         &quot;&quot;&quot;Handles GET requests, if the response is cached it returns it</diff>
      <filename>cache.py</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>b43669a5d799c859a5504da16932e03b8cad4e88</id>
    </parent>
  </parents>
  <author>
    <name>dbr</name>
    <email>dbr.onix@gmail.com</email>
  </author>
  <url>http://github.com/dbr/zp_grabber/commit/e2da44a2ce01f2c45f8c5301c8fa03a1afdce63c</url>
  <id>e2da44a2ce01f2c45f8c5301c8fa03a1afdce63c</id>
  <committed-date>2009-10-18T18:17:11-07:00</committed-date>
  <authored-date>2009-10-18T18:17:11-07:00</authored-date>
  <message>Removed FileLock from cache.py, as it was causing errors and is unnecessary for this code</message>
  <tree>863e2e98333277595270007bf222d5df9006da64</tree>
  <committer>
    <name>dbr</name>
    <email>dbr.onix@gmail.com</email>
  </committer>
</commit>
