SVN: r20968 - trunk/quixote

Andrew Kuchling <akuchlin-fVcApmY9cLvQ3/1i3zOLAti2O/[email protected]> Wed, 05 Mar 2003 14:24:08 -0500
Newsgroups gmane.comp.web.quixote.cvs
Message-ID <[email protected]>
Author: akuchlin
Date: 2003-03-05 14:24:07 -0500 (Wed, 05 Mar 2003)
New Revision: 20968

Modified:
   trunk/quixote/util.py
Log:
Expand symlinks so that the following isdir() and isfile() checks work

Modified: trunk/quixote/util.py
==============================================================================
--- trunk/quixote/util.py	(original)
+++ trunk/quixote/util.py	2003-03-05 14:24:08.000000000 -0500
@@ -175,8 +175,13 @@
         else:
             # Get item from filesystem; cache it if caching is in use.
             item_filepath = os.path.join(self.path, name)
-            if os.path.islink(item_filepath) and not self.follow_symlinks:
-                raise errors.TraversalError
+            while os.path.islink(item_filepath):
+                if not self.follow_symlinks:
+                    raise errors.TraversalError
+                else:
+                    dest = os.readlink(item_filepath)
+                    item_filepath = os.path.join(self.path, dest)
+
             if os.path.isdir(item_filepath):
                 item = StaticFilesFolder(item_filepath, self.use_cache,
                         self.list_folder, self.follow_symlinks)