Re: [Python-Dev] Path object design

2006-11-06 Thread Andrew Dalke
Martin: It still should be possible to come up with examples for these as well, no? For example, if you pass a relative URI as the base URI, what would you like to see happen? Until two days ago I didn't even realize that was an incorrect use of urljoin. I can't be the only one. Hence, raise

Re: [Python-Dev] Path object design

2006-11-06 Thread Fredrik Lundh
Martin v. Löwis wrote: Andrew Dalke schrieb: urlparse.urljoin(http://blah.com/;, ..) 'http://blah.com/' urlparse.urljoin(http://blah.com/;, ../) 'http://blah.com/../' urlparse.urljoin(http://blah.com/;, ../..) 'http://blah.com/' Does the result make sense to you? Does it make sense

Re: [Python-Dev] Path object design

2006-11-06 Thread Andrew Dalke
Andrew: urlparse.urljoin(http://blah.com/;, ..) 'http://blah.com/' urlparse.urljoin(http://blah.com/;, ../) 'http://blah.com/../' urlparse.urljoin(http://blah.com/;, ../..) 'http://blah.com/' /F: as I said, today's urljoin doesn't guarantee that the output is the *shortest* possible

Re: [Python-Dev] Path object design

2006-11-06 Thread Martin v. Löwis
Andrew Dalke schrieb: Hence I would say to just grab their library. And perhaps update the naming scheme. Unfortunately, this is not an option. *You* can just grab their library; the Python distribution can't. Doing so would mean to fork, and history tells that forks cause problems in the long

Re: [Python-Dev] Path object design

2006-11-06 Thread Martin v. Löwis
Fredrik Lundh schrieb: urlparse.urljoin(http://blah.com/;, ../) should also give 'http://blah.com/'. make that: could also give 'http://blah.com/'. How so? If that would implement RFC 3986, you can get only a single outcome, if urljoin is meant to implement section 5 of that RFC. Regards,

Re: [Python-Dev] Path object design

2006-11-06 Thread Steve Holden
Fredrik Lundh wrote: Andrew Dalke wrote: as I said, today's urljoin doesn't guarantee that the output is the *shortest* possible way to represent the resulting URI. I didn't think anyone was making that claim. The module claims RFC 1808 compliance. From the docstring: DESCRIPTION

Re: [Python-Dev] Path object design

2006-11-05 Thread stephen
Michael Urman writes: Ah, but how do you know when that's wrong? At least under ftp:// your root is often a mid-level directory until you change up out of it. http:// will tend to treat the targets as roots, but I don't know that there's any requirement for a /.. to be meaningless (even

Re: [Python-Dev] Path object design

2006-11-05 Thread Mike Orr
On 11/5/06, Andrew Dalke [EMAIL PROTECTED] wrote: I agree that supporting non-filesystem directories (zip files, CSV/Subversion sandboxes, URLs) would be nice, but we already have a big enough project without that. What constraints should a Path object keep in mind in order to be

Re: [Python-Dev] Path object design

2006-11-05 Thread Martin v. Löwis
Andrew Dalke schrieb: I have looked at the spec, and can't figure out how its explanation matches the observed urljoin results. Steve's excerpt trimmed out the strangest example. Unfortunately, you didn't say which of these you want explained. As it is tedious to write down even a single one,

Re: [Python-Dev] Path object design

2006-11-05 Thread Andrew Dalke
Martin: Unfortunately, you didn't say which of these you want explained. As it is tedious to write down even a single one, I restrain to the one with the What?! remark. urlparse.urljoin(http://blah.com/a/b/c;, ../../../..) # What?! 'http://blah.com/' The What?! is in context with the

Re: [Python-Dev] Path object design

2006-11-05 Thread Martin v. Löwis
Andrew Dalke schrieb: urlparse.urljoin(http://blah.com/;, ..) 'http://blah.com/' urlparse.urljoin(http://blah.com/;, ../) 'http://blah.com/../' urlparse.urljoin(http://blah.com/;, ../..) 'http://blah.com/' Does the result make sense to you? Does it make sense that the last of these is

Re: [Python-Dev] Path object design

2006-11-05 Thread Andrew Dalke
Me [Andrew]: As this is not a bug, I have added the feature request 1591035 to SF titled update urlparse to RFC 3986. Nothing else appeared to exist on that specific topic. Martin: Thanks. It always helps to be more specific; being less specific often hurts. So does being more specific.

Re: [Python-Dev] Path object design

2006-11-05 Thread Martin v. Löwis
Andrew Dalke schrieb: I find there is a difference between urllib behaves non-intuitively and urllib gives result A for parameters B and C, but should give result D instead. Can you please add specific examples to your report that demonstrate the difference between implemented and expected

Re: [Python-Dev] Path object design

2006-11-04 Thread Michael Urman
On 11/3/06, Steve Holden [EMAIL PROTECTED] wrote: Having said this, Andrew *did* demonstrate quite convincingly that the current urljoin has some fairly egregious directory traversal glitches. Is it really right to punt obvious gotchas like urlparse.urljoin(http://blah.com/a/b/c;,

Re: [Python-Dev] Path object design

2006-11-04 Thread Steve Holden
Michael Urman wrote: On 11/3/06, Steve Holden [EMAIL PROTECTED] wrote: Having said this, Andrew *did* demonstrate quite convincingly that the current urljoin has some fairly egregious directory traversal glitches. Is it really right to punt obvious gotchas like

Re: [Python-Dev] Path object design

2006-11-04 Thread Fredrik Lundh
Steve Holden wrote: Ah, but how do you know when that's wrong? At least under ftp:// your root is often a mid-level directory until you change up out of it. http:// will tend to treat the targets as roots, but I don't know that there's any requirement for a /.. to be meaningless (even if it

Re: [Python-Dev] Path object design

2006-11-03 Thread Andrew Dalke
glyph: Path manipulation: * This is confusing as heck: os.path.join(hello, /world) '/world' os.path.join(hello, slash/world) 'hello/slash/world' os.path.join(hello, slash//world) 'hello/slash//world' Trying to formulate a general rule for what the arguments to

Re: [Python-Dev] Path object design

2006-11-03 Thread Steve Holden
Andrew Dalke wrote: glyph: Path manipulation: * This is confusing as heck: os.path.join(hello, /world) '/world' os.path.join(hello, slash/world) 'hello/slash/world' os.path.join(hello, slash//world) 'hello/slash//world' Trying to formulate a general rule for what the

Re: [Python-Dev] Path object design

2006-11-03 Thread Fredrik Lundh
Steve Holden wrote: Although the last two smell like bugs, the point of urljoin is to make an absolute URL from an absolute (current page) URL also known as a base URL: http://www.w3.org/TR/html4/struct/links.html#h-12.4.1 (os.path.join's behaviour is also well-defined, btw; if any

Re: [Python-Dev] Path object design

2006-11-03 Thread Martin v. Löwis
Andrew Dalke schrieb: import urlparse urlparse.urljoin(hello, /world) '/world' urlparse.urljoin(hello, slash/world) 'slash/world' urlparse.urljoin(hello, slash//world) 'slash//world' It does not make sense to me that these should be different. Just in case this isn't clear

Re: [Python-Dev] Path object design

2006-11-03 Thread Andrew Dalke
Martin: Just in case this isn't clear from Steve's and Fredrik's post: The behaviour of this function is (or should be) specified, by an IETF RFC. If somebody finds that non-intuitive, that's likely because their mental model of relative URIs deviate's from the RFC's model. While I didn't

Re: [Python-Dev] Path object design

2006-11-03 Thread Phillip J. Eby
At 01:56 AM 11/4/2006 +0100, Andrew Dalke wrote: os.join assumes the base is a directory name when used in a join: inserting '/' as needed while RFC 1808 says The last segment of the base URL's path (anything following the rightmost slash /, or the entire path if no

Re: [Python-Dev] Path object design

2006-11-03 Thread Steve Holden
Phillip J. Eby wrote: At 01:56 AM 11/4/2006 +0100, Andrew Dalke wrote: os.join assumes the base is a directory name when used in a join: inserting '/' as needed while RFC 1808 says The last segment of the base URL's path (anything following the rightmost slash /, or the

Re: [Python-Dev] Path object design

2006-11-03 Thread Nick Coghlan
Steve Holden wrote: Having said this, Andrew *did* demonstrate quite convincingly that the current urljoin has some fairly egregious directory traversal glitches. Is it really right to punt obvious gotchas like urlparse.urljoin(http://blah.com/a/b/c;, ../../../../)

Re: [Python-Dev] Path object design

2006-11-02 Thread Greg Ewing
Mike Orr wrote: * This is confusing as heck: os.path.join(hello, /world) '/world' It's only confusing if you're not thinking of pathnames as abstract entities. There's a reason for this behaviour -- it's so you can do things like full_path = os.path.join(default_dir,

Re: [Python-Dev] Path object design

2006-11-02 Thread Greg Ewing
[EMAIL PROTECTED] wrote: os.path.join(hello, slash/world) 'hello/slash/world' os.path.join(hello, slash//world) 'hello/slash//world' Trying to formulate a general rule for what the arguments to os.path.join are supposed to be is really hard. If you're serious about

Re: [Python-Dev] Path object design

2006-11-02 Thread Greg Ewing
Mike Orr wrote: I have no idea why Microsoft thought it was a good idea to put the seven-odd device files in every directory. Why not force people to type the colon (CON:). Yes, this is a particularly stupid piece of braindamage on the part of the designers of MS-DOS. As far as I remember,

Re: [Python-Dev] Path object design

2006-11-02 Thread Greg Ewing
[EMAIL PROTECTED] wrote: Relative paths, if they should exist at all, should have to be explicitly linked as relative to something *else* (e.g. made absolute) before they can be used. If paths were opaque objects, this could be enforced by not having any way of constructing a path that

Re: [Python-Dev] Path object design

2006-11-02 Thread glyph
On 01:04 am, [EMAIL PROTECTED] wrote:[EMAIL PROTECTED] wrote:If you're serious about writing platform-agnosticpathname code, you don't put slashes in the argumentsat all. Instead you do os.path.join("hello", "slash", "world")Many of the other things you mention are also aresult of not treating

Re: [Python-Dev] Path object design

2006-11-02 Thread Steve Holden
Greg Ewing wrote: Mike Orr wrote: * This is confusing as heck: os.path.join(hello, /world) '/world' It's only confusing if you're not thinking of pathnames as abstract entities. There's a reason for this behaviour -- it's so you can do things like full_path =

Re: [Python-Dev] Path object design

2006-11-02 Thread Greg Ewing
Steve Holden wrote: Greg Ewing wrote: Having said that, I can see there could be an element of confusion in calling it join. Good point. relativise might be appropriate, Sounds like something to make my computer go at warp speed, which would be nice, but I won't be expecting a patch any

Re: [Python-Dev] Path object design

2006-11-02 Thread Talin
Steve Holden wrote: Greg Ewing wrote: Mike Orr wrote: Having said that, I can see there could be an element of confusion in calling it join. Good point. relativise might be appropriate, though something shorter would be better. regards Steve The term used in many languages for this

Re: [Python-Dev] Path object design

2006-11-01 Thread glyph
On 03:14 am, [EMAIL PROTECTED] wrote:One thing is sure -- we urgently need something better than os.path.It functions well but it makes hard-to-read and unpythonic code.I'm not so sure. The need is not any more "urgent" today than it was 5 years ago, when os.path was equally "unpythonic" and

Re: [Python-Dev] Path object design

2006-11-01 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: I am not addressing this message to the py3k list because its general message of extreme conservatism on new features is more applicable to python-dev. However, py3k designers might also take note: if py3k is going to do something in this area and drop support for

Re: [Python-Dev] Path object design

2006-11-01 Thread Georg Brandl
Fredrik Lundh wrote: Talin wrote: I'm right in the middle of typing up a largish post to go on the Python-3000 mailing list about this issue. Maybe we should move it over there, since its likely that any path reform will have to be targeted at Py3K...? I'd say that any proposal that

Re: [Python-Dev] Path object design

2006-11-01 Thread Georg Brandl
[EMAIL PROTECTED] wrote: On 03:14 am, [EMAIL PROTECTED] wrote: One thing is sure -- we urgently need something better than os.path. It functions well but it makes hard-to-read and unpythonic code. I'm not so sure. The need is not any more urgent today than it was 5 years ago, when

Re: [Python-Dev] Path object design

2006-11-01 Thread Jean-Paul Calderone
On Wed, 01 Nov 2006 11:06:14 +0100, Georg Brandl [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: On 03:14 am, [EMAIL PROTECTED] wrote: One thing is sure -- we urgently need something better than os.path. It functions well but it makes hard-to-read and unpythonic code. I'm not so sure.

Re: [Python-Dev] Path object design

2006-11-01 Thread glyph
On 10:06 am, [EMAIL PROTECTED] wrote:What a successor to os.path needs is not security, it's a better (more pythonic,if you like) interface to the old functionality.Why?I assert that it needs a better[1] interface because the current interface can lead to a variety of bugs through idiomatic,

Re: [Python-Dev] Path object design

2006-11-01 Thread Georg Brandl
[EMAIL PROTECTED] wrote: On 10:06 am, [EMAIL PROTECTED] wrote: What a successor to os.path needs is not security, it's a better (more pythonic, if you like) interface to the old functionality. Why? I assert that it needs a better[1] interface because the current interface can lead

Re: [Python-Dev] Path object design

2006-11-01 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: I assert that it needs a better[1] interface because the current interface can lead to a variety of bugs through idiomatic, apparently correct usage. All the more because many of those bugs are related to critical errors such as security and data integrity.

[Python-Dev] Path object design

2006-11-01 Thread Jim Jewett
On 10:06 am, g.brandl at gmx.net wrote: What a successor to os.path needs is not security, it's a better (more pythonic, if you like) interface to the old functionality. Glyph: Why? Rushing ... could exacerbate a very real problem, e.g. the security and data-integrity implications of

Re: [Python-Dev] Path object design

2006-11-01 Thread Mike Orr
Argh, it's difficult to respond to one topic that's now spiraling into two conversations on two lists. [EMAIL PROTECTED] wrote: On 03:14 am, [EMAIL PROTECTED] wrote: One thing is sure -- we urgently need something better than os.path. It functions well but it makes hard-to-read and unpythonic

Re: [Python-Dev] Path object design

2006-11-01 Thread glyph
On 06:14 pm, [EMAIL PROTECTED] wrote:[EMAIL PROTECTED] wrote: I assert that it needs a better[1] interface because the current interface can lead to a variety of bugs through idiomatic, apparently correct usage. All the more because many of those bugs are related to critical errors such as

Re: [Python-Dev] Path object design

2006-11-01 Thread glyph
On 08:14 pm, [EMAIL PROTECTED] wrote:Argh, it's difficult to respond to one topic that's now spiraling intotwo conversations on two lists.[EMAIL PROTECTED] wrote:(...) people have had to spend five years putting hard-to-reados.path functions in the code, or reinventing the wheel with their

Re: [Python-Dev] Path object design

2006-11-01 Thread Mike Orr
On 11/1/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: On 06:14 pm, [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: I assert that it needs a better[1] interface because the current interface can lead to a variety of bugs through idiomatic, apparently correct usage. All the more

Re: [Python-Dev] Path object design

2006-11-01 Thread Mike Orr
On 11/1/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: On 08:14 pm, [EMAIL PROTECTED] wrote: (...) people have had to spend five years putting hard-to-read os.path functions in the code, or reinventing the wheel with their own libraries that they're not sure they can trust. I started to use

Re: [Python-Dev] Path object design

2006-11-01 Thread glyph
On 01:46 am, [EMAIL PROTECTED] wrote:On 11/1/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:This is ironic coming from one of Python's celebrity geniuses. "Wemade this class but we don't know how it works." Actually, it'sdownright alarming coming from someone who knows Twisted inside andout yet

Re: [Python-Dev] Path object design

2006-11-01 Thread Mike Orr
On 11/1/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: On 01:46 am, [EMAIL PROTECTED] wrote: On 11/1/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: This is ironic coming from one of Python's celebrity geniuses. We made this class but we don't know how it works. Actually, it's downright

Re: [Python-Dev] Path object design

2006-10-31 Thread Fredrik Lundh
Talin wrote: I'm right in the middle of typing up a largish post to go on the Python-3000 mailing list about this issue. Maybe we should move it over there, since its likely that any path reform will have to be targeted at Py3K...? I'd say that any proposal that cannot be fit into the