Opened 11 years ago

Closed 11 years ago

#5072 enhancement closed wontfix (wontfix)

Make filepath.FilePath.__str__ return filepath.FilePath.path

Reported by: Jonathan Stoppani Owned by:
Priority: low Milestone:
Component: core Keywords:
Cc: Branch:


Seems a logical shortcut to pass paths it around to libraries expecting paths as strings.

Change History (1)

comment:1 Changed 11 years ago by Jean-Paul Calderone

Keywords: easy removed
Resolution: wontfix
Status: newclosed

Paths aren't strings. That's why there's FilePath. Writing code that can't tell the difference between a path and a string is a good way to write broken code :/ Either broken because it will manipulate the paths incorrectly or because it will allow attackers to access paths you didn't want them to. You have to know that you're using FilePath, and that means you might as well just access the path attribute instead of passing the instance to str(). Also, the current __str__ makes it abundantly clear what kind of object you have; changing it to just return the path would obscure this.

Note: See TracTickets for help on using tickets.