[ python-Bugs-1403349 ] in email can't get attachments' filenames using get_filename

2006-01-12 Thread SourceForge.net
Bugs item #1403349, was opened at 2006-01-11 22:47
Message generated for change (Settings changed) made by birkenfeld
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1403349&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Michal P. (mpasniew)
>Assigned to: Barry A. Warsaw (bwarsaw)
Summary: in email can't get attachments' filenames using get_filename

Initial Comment:
in the email package (2.4.1) the get_filename() method
returns the MIME field "filename" but some messages
have 'name' field instead, for example:

USUALLY THE HEADER IS:
Content-Type: application/octet-stream;
name="XX.pdf"
Content-Transfer-Encoding: base64
Content-Description: XX.pdf
Content-Disposition: attachment;
filename="XX.pdf"

BUT SOMETIMES THE HEADER IS:
Content-type: application/octet-stream; name="XX.xls"
Content-transfer-encoding: base64

For this to work properly I had to code a hack along
these lines:
filename = part.get_filename()
if not filename:
   ct = part.get("Content-type")
   m = re.compile('name=\"(\S+)\"').search(ct, 1)
   if m: filename=m.group(1)

But it would be helpful to code this in the get_filename()

Michal

--

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1403349&group_id=5470
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[ python-Bugs-1404213 ] os.getlogin() goes **poof**

2006-01-12 Thread SourceForge.net
Bugs item #1404213, was opened at 2006-01-12 20:59
Message generated for change (Comment added) made by wilson1442
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1404213&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Jim Wilson (wilson1442)
Assigned to: Nobody/Anonymous (nobody)
Summary: os.getlogin() goes **poof**

Initial Comment:
"python -c "import os; getlogin()" rears its ugly head
again.  It complains it can't open "" (Python
2.4.1, FC4).

Strace confirms it:

open("", ...)  = -1 ENOENT (No such file or ...
open("", ...)  = -1 ENOENT ...
open("/usr/lib/python24.zip/", ...) = -1 ...
open("/usr/lib/python2.4/", ...) = -1 ...
open("/usr/lib/python2.4/plat-linux2/", ... 
open("/usr/lib/python2.4/lib-tk/", ...
open("/usr/lib/python2.4/lib-dynload/", ...
open("/usr/lib/python2.4/site-packages/", ... 
[/ snipped.]

I don't know what's in that "" file, but it
surely must be important.


--

>Comment By: Jim Wilson (wilson1442)
Date: 2006-01-12 21:17

Message:
Logged In: YES 
user_id=1191155

Er...  Of course, I intended:

python -c "import os; os.getlogin()"

diagnostic output was from:

strace -e trace=open python -c "import os; os.getlogin()"

--

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1404213&group_id=5470
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[ python-Bugs-1404213 ] os.getlogin() goes **poof**

2006-01-12 Thread SourceForge.net
Bugs item #1404213, was opened at 2006-01-12 20:59
Message generated for change (Comment added) made by wilson1442
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1404213&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.4
Status: Closed
Resolution: Invalid
Priority: 5
Submitted By: Jim Wilson (wilson1442)
Assigned to: Nobody/Anonymous (nobody)
Summary: os.getlogin() goes **poof**

Initial Comment:
"python -c "import os; getlogin()" rears its ugly head
again.  It complains it can't open "" (Python
2.4.1, FC4).

Strace confirms it:

open("", ...)  = -1 ENOENT (No such file or ...
open("", ...)  = -1 ENOENT ...
open("/usr/lib/python24.zip/", ...) = -1 ...
open("/usr/lib/python2.4/", ...) = -1 ...
open("/usr/lib/python2.4/plat-linux2/", ... 
open("/usr/lib/python2.4/lib-tk/", ...
open("/usr/lib/python2.4/lib-dynload/", ...
open("/usr/lib/python2.4/site-packages/", ... 
[/ snipped.]

I don't know what's in that "" file, but it
surely must be important.


--

>Comment By: Jim Wilson (wilson1442)
Date: 2006-01-12 21:58

Message:
Logged In: YES 
user_id=1191155

Actually, my diagnosis was meant to be jocular.  I don't
have a clue what's happening.  Someone else suggested using
strace when this problem was reported earlier.  Your
explanation makes perfect sense.

But ... that certainly narrows it down.  If it ain't
"os.getlogin()", that leaves only "import os;", right?

--

Comment By: Georg Brandl (birkenfeld)
Date: 2006-01-12 21:34

Message:
Logged In: YES 
user_id=1188172

Your diagnosis is incorrect. The system's getlogin() sets
errno 2, that is "No such file or directory". Thus
os.getlogin() raises an OSError with this description.

Python's "file name" for -c scripts is "", and
because Python wants to give you a traceback with lines and
code context, it looks for the file "". This has
nothing to do with getlogin.

--

Comment By: Jim Wilson (wilson1442)
Date: 2006-01-12 21:17

Message:
Logged In: YES 
user_id=1191155

Er...  Of course, I intended:

python -c "import os; os.getlogin()"

diagnostic output was from:

strace -e trace=open python -c "import os; os.getlogin()"

--

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1404213&group_id=5470
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[ python-Bugs-1404213 ] os.getlogin() goes **poof**

2006-01-12 Thread SourceForge.net
Bugs item #1404213, was opened at 2006-01-12 21:59
Message generated for change (Comment added) made by birkenfeld
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1404213&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.4
Status: Closed
Resolution: Invalid
Priority: 5
Submitted By: Jim Wilson (wilson1442)
Assigned to: Nobody/Anonymous (nobody)
Summary: os.getlogin() goes **poof**

Initial Comment:
"python -c "import os; getlogin()" rears its ugly head
again.  It complains it can't open "" (Python
2.4.1, FC4).

Strace confirms it:

open("", ...)  = -1 ENOENT (No such file or ...
open("", ...)  = -1 ENOENT ...
open("/usr/lib/python24.zip/", ...) = -1 ...
open("/usr/lib/python2.4/", ...) = -1 ...
open("/usr/lib/python2.4/plat-linux2/", ... 
open("/usr/lib/python2.4/lib-tk/", ...
open("/usr/lib/python2.4/lib-dynload/", ...
open("/usr/lib/python2.4/site-packages/", ... 
[/ snipped.]

I don't know what's in that "" file, but it
surely must be important.


--

>Comment By: Georg Brandl (birkenfeld)
Date: 2006-01-12 23:10

Message:
Logged In: YES 
user_id=1188172

It is os.getlogin(), but the search for  doesn't
have to do anything with it.

As for why getlogin() is failing, consult your local manpage
for details what getlogin() is doing (wrong).

--

Comment By: Jim Wilson (wilson1442)
Date: 2006-01-12 22:58

Message:
Logged In: YES 
user_id=1191155

Actually, my diagnosis was meant to be jocular.  I don't
have a clue what's happening.  Someone else suggested using
strace when this problem was reported earlier.  Your
explanation makes perfect sense.

But ... that certainly narrows it down.  If it ain't
"os.getlogin()", that leaves only "import os;", right?

--

Comment By: Georg Brandl (birkenfeld)
Date: 2006-01-12 22:34

Message:
Logged In: YES 
user_id=1188172

Your diagnosis is incorrect. The system's getlogin() sets
errno 2, that is "No such file or directory". Thus
os.getlogin() raises an OSError with this description.

Python's "file name" for -c scripts is "", and
because Python wants to give you a traceback with lines and
code context, it looks for the file "". This has
nothing to do with getlogin.

--

Comment By: Jim Wilson (wilson1442)
Date: 2006-01-12 22:17

Message:
Logged In: YES 
user_id=1191155

Er...  Of course, I intended:

python -c "import os; os.getlogin()"

diagnostic output was from:

strace -e trace=open python -c "import os; os.getlogin()"

--

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1404213&group_id=5470
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[ python-Bugs-1396543 ] urlparse is confused by /

2006-01-12 Thread SourceForge.net
Bugs item #1396543, was opened at 2006-01-04 05:57
Message generated for change (Comment added) made by pterk
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1396543&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: John Hansen (johnhansen)
Assigned to: Nobody/Anonymous (nobody)
Summary: urlparse is confused by /

Initial Comment:
If the parameter field of a URL contains a '/', urlparse does not enter date 
in the parameter field, but leaves it attached to the path.

The simplified example is:
>>> urlparse.urlparse("http://f/adi;s=a;c=b/";)
('http', 'f', '/adi;s=a;c=b/', '', '', '')

>>> urlparse.urlparse("http://f/adi;s=a;c=b";)
('http', 'f', '/adi', 's=a;c=b', '', '')

The realworld case was:

>>> urlparse.urlparse("http://ad.doubleclick.net/adi/
N3691.VibrantMedia/B1733031.2;sz=160x600;click=http%3A/
adforce.adtech.de/adlink%7C82%7C59111%7C1%7C168%7CAdId%
3D1023327%3BBnId%3D4%3Bitime%3D335264036%3Bku%3D12900%
3Bkey%3Dcomputing%2Bbetanews%5Fgeneral%3Blink%3D")
(''http'', 'ad.doubleclick.net/adi/N3691.VibrantMedia/
B1733031.2;sz=160x600;click=http%3A/adforce.adtech.de/adlink%
7C82%7C59111%7C1%7C168%7CAdId%3D1023327%3BBnId%3D4%3Bitime
%3D335264036%3Bku%3D12900%3Bkey%3Dcomputing%2Bbetanews%
5Fgeneral%3Blink%3D', '', '', '')

What's odd is that the code specifically says to do this:
def _splitparams(url):
if '/'  in url:
i = url.find(';', url.rfind('/'))
if i < 0:
return url, ''

Is there a reason for the rfind?

--

Comment By: Peter van Kampen (pterk)
Date: 2006-01-13 01:25

Message:
Logged In: YES 
user_id=174455

Looking at the testcases it appears the answers must be in
rfc's 1808 or 2396. http://www.ietf.org/rfc/rfc1808.txt and
http://www.ietf.org/rfc/rfc2396.txt See for example section
5.3 of 1808. I don't see why _splitparams does what is does
but I didn't exactly close-read the text either. Also be
sure to look at Lib/test/test_urlparse.py.



--

Comment By: John Hansen (johnhansen)
Date: 2006-01-04 17:31

Message:
Logged In: YES 
user_id=1418831

The first line should have read:

If the parameter field of a URL contains a '/', urlparse does not enter it 
into the parameter field, but leaves it attached to the path.

--

Comment By: John Hansen (johnhansen)
Date: 2006-01-04 06:00

Message:
Logged In: YES 
user_id=1418831

The first line should have read:

If the parameter field of a URL contains a '/', urlparse does not enter it 
into the parameter field, but leaves it attached to the path.

--

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1396543&group_id=5470
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com