[CMF-checkins] CVS: CMF/CMFCore - utils.py:1.27 DirectoryView.py:1.27

Shane Hathaway shane@zope.com
Mon, 05 Aug 2002 15:58:02 -0400


Chris Withers wrote:
> Update of /cvs-repository/CMF/CMFCore
> In directory cvs.zope.org:/tmp/cvs-serv28775/CMFCore
> 
> Modified Files:
> 	utils.py DirectoryView.py 
> Log Message:
> Hopefully fixed problems with DirectoryView's beign created on one platform and then imported from a .zexp on another.
> 
> === CMF/CMFCore/utils.py 1.26 => 1.27 ===
>      # Trims INSTANCE_HOME or SOFTWARE_HOME from a path.
>      p = os_path.abspath(p)
>      abs = normalize(p)
> -    l = len(normINSTANCE_HOME)
> -    if abs[:l] != normINSTANCE_HOME:
> -        l = len(normSOFTWARE_HOME)
> -        if abs[:l] != normSOFTWARE_HOME:
> -            # Can't minimize.
> -            return p
> -    p = p[l:]
> +    p = abs[abs.index('products'):]
>      while p[:1] in separators:
>          p = p[1:]
>      return p

Dude, this will only work on Windows. :-)  If you remove the normalize() 
call and change it to  "p = p[p.index('Products'):]", does it still work 
on Windows?

Note that until this change it was possible for skins to exist outside 
products.  You might want to use p.find(), though you're then expecting 
nothing else to have the word "Products" in it.  In any case, make sure 
you update the now obsoleted comments!

Shane