meshy / django-conman

NOT READY: Work in progress. A content management system for django
BSD 2-Clause "Simplified" License
3 stars 5 forks source link

split_path helper function undefined behaviour #32

Closed LilyFoote closed 10 years ago

LilyFoote commented 10 years ago

The split_path function in conman.nav_tree.utils splits a url path into sub-paths. What is the expected behaviour if the given path does not start with '/'? The current behaviour is:

>>> split_path('foo/bar/')
['/', 'foo/bar/', 'foo/']

This does not seem useful. Should split_path reject input without a leading '/' or should one be prepended?

meshy commented 10 years ago

Yes, this does seem odd, but it should never be called with that sort of input.

I suppose that we could assert path[0] == '/', but it does seem a little brutish to me.