[issue1698] urlparse and usernames containing @

2007-12-26 Thread Senthil

Senthil added the comment:

Hi ocroquette,

Even though I have seen ftp sites requesting email addresses as user
names, I would rather put this issue for discussion as this not per any RFC.

urlparse is based upon RFC1808 and it points to RFC1738 for the URL
Syntax. RFC1738 specifically says (line 225) that:

The user name (and password), if present, are followed by a commercial
at-sign "@". Within the user and password field, any ":", "@" or "/"
must be encoded.



>>> url = "ftp://[EMAIL PROTECTED]@host/dir"
>>> from urlparse import urlparse
>>> p = urlparse(url)
>>> print p.username
user
>>> print p.hostname
[EMAIL PROTECTED]
>>> corr_url = "ftp://[EMAIL PROTECTED]/dir"
>>> q = urlparse(corr_url)
>>> print q.username
user%40xyz
>>> print q.hostname
host
>>>

So, it is upon the user/client to encode the @sign in the user name, if
he has to be compliant with RFC. 
urlparse is not at fault here.
What shall we do with this issue?

--
nosy: +orsenthil

__
Tracker <[EMAIL PROTECTED]>

__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1698] urlparse and usernames containing @

2007-12-26 Thread Olivier Croquette

Olivier Croquette added the comment:

Hi!

Thanks for the reply!

The problem right now is that urlparse parses silently an URL which is
not compliant, but does the wrong thing with it (since usernames can
contain @, and hostname can not, it's a more logical thing to parse from
the right using rsplit instead of split).

I see two possibilities to address that:

1. return a parse error if the URL contains two raw @
This way users and app developers will notice the problem rapidly

2. still accept this malformed URLs, but do what the user expects

Both solutions seem to me better than the current behaviour, so I would
say a change is necessary anyways.

PS: will urlparse transform an encoded "@" in the username when
.username is called, or does the application have to decode explicitely?

Olivier

__
Tracker <[EMAIL PROTECTED]>

__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1698] urlparse and usernames containing @

2007-12-26 Thread Olivier Croquette

Olivier Croquette added the comment:

See also the related bug on duplicity:
http://savannah.nongnu.org/bugs/?21475

__
Tracker <[EMAIL PROTECTED]>

__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1698] urlparse and usernames containing @

2007-12-26 Thread Olivier Croquette

Olivier Croquette added the comment:

And about the decoding, sorry, it's clear from your snippets that
urlparse doesn't do it:
>>> print q.username
user%40xyz

Maybe it should do it, I am not sure. What do you think? It would save
work for the module user.

__
Tracker <[EMAIL PROTECTED]>

__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1205] urllib fail to read URL contents, urllib2 crash Python

2007-12-26 Thread Senthil

Senthil added the comment:

Irrespective of the patch, this issue is reproducable with the code in the
trunk for Python 2.6. Should we close this then?

n 2.6a0 (trunk:59600M, Dec 25 2007, 13:54:34)
[GCC 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import urllib2
>>> import urllib
>>> url = "http://www.recherche.fr/encyclopedie/Thomas-Robert_Bugeaud";
>>> a = urllib.urlopen(url)
>>> b = urllib2.urlopen(url)
>>> c = a.read(1024 * 1024 * 2)
>>> c[63000:64000]
'UA-321207-2";\nurchinTracker();\n\n \n  \nLe
contenu de cette page (Thomas-Robert Bugeaud) est un minuscule extrait de
l\'encyclopi\xc3\xa9die gratuite en ligne http://fr.wikipedia.org";>WIKIPEDIA\nle webmaster de ce site n\'est
pas l\'auteur de cet article (Thomas-Robert Bugeaud). Vous pouvez retrouver
l\'original de cet article (Thomas-Robert Bugeaud) à http://fr.wikipedia.org/wiki/Thomas-Robert_Bugeaud";>cette adresse et
la liste des auteurs http://fr.wikipedia.org/w/index.php?title=Thomas-Robert_Bugeaud&action=history";>ici\nVous
pouvez http://fr.wikipedia.org/w/index.php?title=Thomas-Robert_Bugeaud&action=edit";>modifier
ou compl\xc3\xa9ter cet article mais \xc3\xa9galement http://fr.wikipedia.org/w/index.php?title=Discuter:Thomas-Robert_Bugeaud&action=edit";>discuter
de son contenu (Thomas-Robert Bugeaud) sur le site de http://fr.wikipedia.org";>WIKIPEDIA France - Contenu (Thomas-Robert B'
>>> c = b.read(1024 * 1024 * 2)
>>> c[63000:64000]
'acct = "UA-321207-2";\nurchinTracker();\n\n \n
\nLe contenu de cette page (Thomas-Robert Bugeaud) est un minuscule extrait
de l\'encyclopi\xc3\xa9die gratuite en ligne http://fr.wikipedia.org";>WIKIPEDIA\nle webmaster de ce site n\'est
pas l\'auteur de cet article (Thomas-Robert Bugeaud). Vous pouvez retrouver
l\'original de cet article (Thomas-Robert Bugeaud) à http://fr.wikipedia.org/wiki/Thomas-Robert_Bugeaud";>cette adresse et
la liste des auteurs http://fr.wikipedia.org/w/index.php?title=Thomas-Robert_Bugeaud&action=history";>ici\nVous
pouvez http://fr.wikipedia.org/w/index.php?title=Thomas-Robert_Bugeaud&action=edit";>modifier
ou compl\xc3\xa9ter cet article mais \xc3\xa9galement http://fr.wikipedia.org/w/index.php?title=Discuter:Thomas-Robert_Bugeaud&action=edit";>discuter
de son contenu (Thomas-Robert Bugeaud) sur le site de http://fr.wikipedia.org";>WIKIPEDIA France - Contenu (Thomas-'
>>>

--
nosy: +orsenthil

__
Tracker <[EMAIL PROTECTED]>

__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1205] urllib fail to read URL contents, urllib2 crash Python

2007-12-26 Thread Senthil

Senthil added the comment:

> 
> Senthil added the comment:
> 
> Irrespective of the patch, this issue is reproducable with the code in the
> trunk for Python 2.6. Should we close this then?
> __

Sorry, I meant to say "NOT Reproducable".

__
Tracker <[EMAIL PROTECTED]>

__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1698] urlparse and usernames containing @

2007-12-26 Thread Senthil

Senthil added the comment:

> Olivier Croquette added the comment:
> 
> 
> The problem right now is that urlparse parses silently an URL which is
> not compliant, but does the wrong thing with it (since usernames can
> contain @, and hostname can not, it's a more logical thing to parse from
> the right using rsplit instead of split).
> 
> I see two possibilities to address that:
> 
> 1. return a parse error if the URL contains two raw @
> This way users and app developers will notice the problem rapidly
> 
> 2. still accept this malformed URLs, but do what the user expects
> 
> Both solutions seem to me better than the current behaviour, so I would
> say a change is necessary anyways.

I am inclined towards the option 2, wherein even if the non-conformant URL is
given, which has "@" in the user name, the urlparse should be able atleast
recognize the hostname correctly. In this case, using rsplit instead of split
does the trick.

Attached is the patch against the trunk, which adds this. I notice duplicity
project also retorting to the same.

Unless anyone has an objection, we should commit this change.

Added file: http://bugs.python.org/file9030/urlparse_issue1698.patch

__
Tracker <[EMAIL PROTECTED]>

__Index: Lib/urlparse.py
===
--- Lib/urlparse.py (revision 59600)
+++ Lib/urlparse.py (working copy)
@@ -82,7 +82,7 @@
 def username(self):
 netloc = self.netloc
 if "@" in netloc:
-userinfo = netloc.split("@", 1)[0]
+userinfo = netloc.rsplit("@", 1)[0]
 if ":" in userinfo:
 userinfo = userinfo.split(":", 1)[0]
 return userinfo
@@ -92,7 +92,7 @@
 def password(self):
 netloc = self.netloc
 if "@" in netloc:
-userinfo = netloc.split("@", 1)[0]
+userinfo = netloc.rsplit("@", 1)[0]
 if ":" in userinfo:
 return userinfo.split(":", 1)[1]
 return None
@@ -101,7 +101,7 @@
 def hostname(self):
 netloc = self.netloc
 if "@" in netloc:
-netloc = netloc.split("@", 1)[1]
+netloc = netloc.rsplit("@", 1)[1]
 if ":" in netloc:
 netloc = netloc.split(":", 1)[0]
 return netloc.lower() or None
@@ -110,7 +110,7 @@
 def port(self):
 netloc = self.netloc
 if "@" in netloc:
-netloc = netloc.split("@", 1)[1]
+netloc = netloc.rsplit("@", 1)[1]
 if ":" in netloc:
 port = netloc.split(":", 1)[1]
 return int(port, 10)

___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1698] urlparse and usernames containing @

2007-12-26 Thread Senthil

Senthil added the comment:

> 
> Olivier Croquette added the comment:
> 
> And about the decoding, sorry, it's clear from your snippets that
> urlparse doesn't do it:
> >>> print q.username
> user%40xyz
> 
> Maybe it should do it, I am not sure. What do you think? It would save
> work for the module user.

No, urlparse does not have any method for encoding/decoding.
It has been left to urllib2 in urlencode, urldecode, quote, unquote etc.
Strangely though, user should use urllib2 for that purpose.

And yeah, there is been an effort to merge the urlparse and urllib2
functionality and I am slowly upto it. :)
Before more requests come this way, I guess I have to show some progress.

__
Tracker <[EMAIL PROTECTED]>

__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1701] svn checkout does not work

2007-12-26 Thread hjmjohnson

New submission from hjmjohnson:

===

ping svn.python.org
PING svn.python.org (82.94.237.220): 56 data bytes
64 bytes from 82.94.237.220: icmp_seq=0 ttl=49 time=107.208 ms


svn co http://svn.python.org/projects/python/trunk python-svn
svn: PROPFIND request failed on '/projects/python/trunk'
svn: PROPFIND of '/projects/python/trunk': could not connect to server 
(http://svn.python.org)
==

It appears that the apache access to the svn repository is down.

--
components: Build
messages: 59003
nosy: hjmjohnson
severity: critical
status: open
title: svn checkout does not work
type: behavior
versions: Python 2.5

__
Tracker <[EMAIL PROTECTED]>

__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1701] svn checkout does not work

2007-12-26 Thread Martin v. Löwis

Martin v. Löwis added the comment:

Fixed.

--
nosy: +loewis
resolution:  -> fixed
status: open -> closed

__
Tracker <[EMAIL PROTECTED]>

__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1350] IDLE - CallTips enhancement - show full doc-string in new window

2007-12-26 Thread Kurt B. Kaiser

Kurt B. Kaiser added the comment:

I deleted the extra files.

You aren't making this easy!  I was expecting a relatively small update to 
the original patch.

Did you backport my 3.0 revision of CallTips.py or did you come up with 
your own version which uses inspect.py?

Right now, the patch includes two unrelated developments, which 
(following 
our normal procedures) wouldn't be combined as you have done.

__
Tracker <[EMAIL PROTECTED]>

__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1745108] 2.5.1 curses panel segfault in new_panel on aix 5.3

2007-12-26 Thread Paul Smedley

Paul Smedley added the comment:

I see similar problems here on OS/2 with Python 2.5.1 and Ncurses 5.6.

Problem is causes as win->win is uninitialised when passed to new_panel.

Initialising win->win to a value makes the new_panel call work.  Not
sure why this works on other platforms but fails on OS/2 and AIX.

--
nosy: +psmedley

_
Tracker <[EMAIL PROTECTED]>

_
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1702] Word "alias" used in confusing way to compare open() and file()

2007-12-26 Thread Devin Jeanpierre

New submission from Devin Jeanpierre:

I was slightly misled by the wording of part of the docs 
(http://docs.python.org/lib/bltin-file-objects.html):
"file() is new in Python 2.2. The older built-in open() is an alias 
for file()."

I actually thought it meant that open was an alias of file, so 
that 'open is file'. However, 
>>> open is file
False

I feel that "alias" is the wrong word to use here, though I don't know 
a suitable replacement.

--
components: Documentation
messages: 59007
nosy: Devin Jeanpierre
severity: minor
status: open
title: Word "alias" used in confusing way to compare open() and file()
type: rfe

__
Tracker <[EMAIL PROTECTED]>

__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1702] Word "alias" used in confusing way to compare open() and file()

2007-12-26 Thread Richard Cohen

Changes by Richard Cohen:


--
nosy: +vmlinuz

__
Tracker <[EMAIL PROTECTED]>

__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com