James Tauber's Blog 2005/05/24


blog > 2005 > 05 >


Almost Ready for Leonardo 0.6 Release

Tonight I finished the remaining items I wanted to get done for the release of Leonardo 0.6.

That puts me ahead as I wasn't planning on a release candidate until the weekend and I should get it out tomorrow.

Will give me more time the rest of the week to work on editing the Atlanta reality show pilot.

by : Created on May 24, 2005 : Last modified May 24, 2005 : (permalink)


Checkpoint at 31.5

Just went past the half-way mark between being 31 and 32.

On my 31st birthday, I posted a list of goals for my 32nd year. Let's see how I'm going:

Overall, not looking good but having spent months away from home, I have an excuse for some of them.

What am I most pleased with my progress on? Definitely Leonardo!

by : Created on May 24, 2005 : Last modified May 24, 2005 : (permalink)


Testing For Directories Outside the Tree

In Leonardo, I have a case where I am concatenating a fixed directory x and a relative path y.

I want to avoid the result being outside the directory tree rooted by x.

Any ideas?

Is

root = os.path.abspath(x) path = os.path.abspath(os.path.join(x, y)) assert path.startswith(root)

a reasonable approach?

Actually, I should clarify: y isn't a relative path as such. y can be '/' which should taken to mean x. So perhaps what I want is:

root = os.path.abspath(x) path = os.path.abspath(os.path.normpath(x + os.sep + y)) assert path.startswith(root)

I ruled out

assert os.path.normpath(x + os.sep + y).startswith(x)

For the case where 'x' is itself relative.

by : Created on May 24, 2005 : Last modified May 24, 2005 : (permalink)