[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [38543] trunk/blender/release/scripts/ modules/bpy/utils.py: fix [#27922] using preset_paths() with an absolute path returns twice the same thing

Campbell Barton ideasman42 at gmail.com
Wed Jul 20 17:33:27 CEST 2011


Revision: 38543
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38543
Author:   campbellbarton
Date:     2011-07-20 15:33:27 +0000 (Wed, 20 Jul 2011)
Log Message:
-----------
fix [#27922] using preset_paths() with an absolute path returns twice the same thing 
raise an error when an invalid subdir is passed to preset_paths()

Modified Paths:
--------------
    trunk/blender/release/scripts/modules/bpy/utils.py

Modified: trunk/blender/release/scripts/modules/bpy/utils.py
===================================================================
--- trunk/blender/release/scripts/modules/bpy/utils.py	2011-07-20 15:02:49 UTC (rev 38542)
+++ trunk/blender/release/scripts/modules/bpy/utils.py	2011-07-20 15:33:27 UTC (rev 38543)
@@ -298,11 +298,18 @@
 def preset_paths(subdir):
     """
     Returns a list of paths for a specific preset.
+
+    :arg subdir: preset subdirectory (must not be an absolute path).
+    :type subdir: string
+    :return: script paths.
+    :rtype: list
     """
     dirs = []
     for path in script_paths("presets", all=True):
         directory = _os.path.join(path, subdir)
-        if _os.path.isdir(directory):
+        if not directory.startswith(path):
+            raise Exception("invalid subdir given %r" % subdir)
+        elif _os.path.isdir(directory):
             dirs.append(directory)
     return dirs
 




More information about the Bf-blender-cvs mailing list