[issue3244] multipart/form-data encoding

2010-06-03 Thread Forest Bond

Forest Bond  added the comment:

Hi,

I believe the attached implementation is reasonable.  I'm not sure if it should 
be called "email.mime.formdata", "rfc2388", etc.

I'd be happy to attach a proper patch with tests given some quick feedback.

Thanks,
Forest

--
nosy: +forest_atq
Added file: http://bugs.python.org/file17543/rfc2388.py

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



[issue3244] multipart/form-data encoding

2010-06-03 Thread Forest Bond

Forest Bond  added the comment:

Oh, hm, looks like I left a hard-coded name="files" in attach_file.  I'll fix 
that in the patch after I've received any other feedback.

--

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



[issue3244] multipart/form-data encoding

2010-06-04 Thread Forest Bond

Forest Bond  added the comment:

I haven't yet touched Python 3.0, and may not have time to dig in at the 
moment.  It wouldn't be suitable to provide a patch against 2.7?

--

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



[issue3244] multipart/form-data encoding

2010-06-04 Thread Forest Bond

Forest Bond  added the comment:

Okay, I'll submit against py3k.

--

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



[issue3244] multipart/form-data encoding

2010-06-04 Thread Forest Bond

Forest Bond  added the comment:

Should the module be called rfc2388 or should it go into email.mime as 
formdata?  It seems odd to put something HTML/HTTP related into email.mime, but 
maybe that would be fine.  In any case, httplib docs should probably point to 
this module with an example, right?

--

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



[issue3244] multipart/form-data encoding

2010-06-04 Thread Forest Bond

Forest Bond  added the comment:

As http.formdata?

--

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



[issue3244] multipart/form-data encoding

2010-06-04 Thread Forest Bond

Forest Bond  added the comment:

Hi,

Patch attached.  Let me know what needs fixing.

I had to fix a bug in email.encoders for my tests to pass.  I have not run the 
full test suite at this point (need to build py3k to do that, maybe I'll have 
time later today, but if someone else has time, feel free).

Thanks,
Forest

--
keywords: +patch
Added file: http://bugs.python.org/file17546/http_formdata.patch

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



[issue3244] multipart/form-data encoding

2010-06-04 Thread Forest Bond

Forest Bond  added the comment:

Éric,

Sorry, I just read your message.

I'll post a new patch with a module docstring.

I believe cgi.FieldStorage is only useful for parsing (i.e. on the server 
side).  MIMEMultipartFormData is for generating multipart/form-data messages 
(i.e. on the client side).

Thanks,
Forest

--

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



[issue3244] multipart/form-data encoding

2010-06-04 Thread Forest Bond

Forest Bond  added the comment:

Here's a new patch.

--
Added file: http://bugs.python.org/file17547/http_formdata.patch

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



[issue3244] multipart/form-data encoding

2010-06-04 Thread Forest Bond

Forest Bond  added the comment:

Hm, there is one issue.  The example in the docstring wouldn't work.

You have to get the headers *after* the body, because the boundary isn't 
generated until the body has been.  So this would work:

  body = msg.get_body()
  headers = dict(msg)

But this won't:

  headers = dict(msg)
  body = msg.get_body()

I'm not sure what the best way to deal with this is.  Maybe instead of get_body 
we should have get_request_data which returns both headers and body.  That 
would provide simpler semantics.

Thoughts?

Thanks,
Forest

--

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



[issue3244] multipart/form-data encoding

2010-06-04 Thread Forest Bond

Forest Bond  added the comment:

New patch:

* Renames class to FormData.
* Replaces method get_body with get_request_data to simplify semantics.
* Drops changes to email.encoders.  I'll create a new ticket to deal with that 
bug.  Note that tests here fail without that fix.

--
Added file: http://bugs.python.org/file17548/http_formdata.patch

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



[issue8896] email.encoders.encode_base64 sets payload to bytes, should set to str

2010-06-04 Thread Forest Bond

New submission from Forest Bond :

Ran into this while tackling issue3244.  Encoded payload members should not be 
bytes.  In the case of base64, we should have an ascii string.

--
components: Library (Lib)
files: python-email-encoders-base64-str.patch
keywords: patch
messages: 107055
nosy: forest_atq
priority: normal
severity: normal
status: open
title: email.encoders.encode_base64 sets payload to bytes, should set to str
versions: Python 3.1, Python 3.2, Python 3.3
Added file: 
http://bugs.python.org/file17550/python-email-encoders-base64-str.patch

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



[issue3244] multipart/form-data encoding

2010-06-04 Thread Forest Bond

Forest Bond  added the comment:

See issue8896 for email.encoders fix.

--

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



[issue3244] multipart/form-data encoding

2010-06-04 Thread Forest Bond

Forest Bond  added the comment:

I don't think Python trunk has the encoders issue, as that is related to the 
base64 moving to the bytes type.

--

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



[issue4768] email.generator.Generator object bytes/str crash - b64encode() bug?

2010-06-04 Thread Forest Bond

Forest Bond  added the comment:

Attaching patch from reported duplicate issue8896.

--
nosy: +forest_atq
Added file: 
http://bugs.python.org/file17551/python-email-encoders-base64-str.patch

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



[issue8896] email.encoders.encode_base64 sets payload to bytes, should set to str

2010-06-04 Thread Forest Bond

Forest Bond  added the comment:

Duplicate.  See issue4768.

--
status: open -> closed

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



[issue4768] email.generator.Generator object bytes/str crash - b64encode() bug?

2010-06-04 Thread Forest Bond

Forest Bond  added the comment:

Note that my patch is roughly the same as the original posted by haypo.

--

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



[issue3244] multipart/form-data encoding

2011-02-15 Thread Forest Bond

Forest Bond  added the comment:

Hi,

Sorry for the long delay.  I have tested against a Python web application using 
restish via various WSGI web servers (CherryPy, wsgiref) and I have not seen 
problems.  It may cause problems with other server-side implementations.

I will not have time to do broad testing against many different server-side 
implementations.  Is there harm in applying the patch and fixing bugs that get 
reported?

Thanks,
Forest

--

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



[issue3244] multipart/form-data encoding

2011-02-15 Thread Forest Bond

Forest Bond  added the comment:

Looks like bgamari and I stepped on each other's requests.

--

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



[issue3244] multipart/form-data encoding

2011-02-15 Thread Forest Bond

Forest Bond  added the comment:

Hi,

So is the following enough to get this applied?  If so, I'm game.

* Review RFC and enforce Content-Encoding: binary if applicable [checat].
* Generate CR+LF line endings [checat].
* Review RFC and address "line-splitting and header-folding" if applicable 
[checat].
* Write documentation.

I can have this done in a week or so, but I'd like to have some confidence that 
it will be applied if I spend the time on it.

Thanks,
Forest

--

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



[issue3244] multipart/form-data encoding

2012-05-24 Thread Forest Bond

Forest Bond  added the comment:

Sure thing. I'll send it via e-mail later today.

--

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



[issue3244] multipart/form-data encoding

2012-05-24 Thread Forest Bond

Forest Bond  added the comment:

Okay, Contributor Agreement sent.

--

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



[issue3244] multipart/form-data encoding

2012-06-25 Thread Forest Bond

Forest Bond  added the comment:

Hi Senthil Kumaran,

Thanks for the feedback & patch.

I agree having support in urllib probably makes some sense. But why not 
implement basic support elsewhere and then tie it into urllib so those of us 
using something else can also use it? I'm using httplib in my application.

Thanks,
Forest

--

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



[issue3244] multipart/form-data encoding

2011-08-11 Thread Forest Bond

Forest Bond  added the comment:

Hi, Johannes.  You can assume the Python license for this patch.

-Forest

--

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



[issue1488934] file.write + closed pipe = no error

2009-10-07 Thread Forest Bond

Changes by Forest Bond :


--
nosy: +forest_atq
versions: +Python 2.6

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



[issue7527] Standard Library documentation fails to mention that string.Formatter, etc. are new in Python 2.6

2009-12-16 Thread Forest Bond

New submission from Forest Bond :

This page:

  http://docs.python.org/library/string.html

... should mention that the Formatter class and any associated functions
are new in Python 2.6.

--
assignee: georg.brandl
components: Documentation
messages: 96493
nosy: forest_atq, georg.brandl
severity: normal
status: open
title: Standard Library documentation fails to mention that string.Formatter, 
etc. are new in Python 2.6

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



[issue7527] Standard Library documentation fails to mention that string.Formatter, etc. are new in Python 2.6

2009-12-16 Thread Forest Bond

Forest Bond  added the comment:

Ah, I didn't see it there.  Oh well, do what seems right.

--

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



[issue3751] str.rpartition fails silently with unicode argument

2008-09-01 Thread Forest Bond

New submission from Forest Bond <[EMAIL PROTECTED]>:

Python 2.5.2 (r252:60911, Jul 31 2008, 17:28:52) 
[GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> u'/foo/bar'.rpartition(u'/')
(u'/foo', u'/', u'bar')
>>> '/foo/bar'.rpartition(u'/')
(u'', u'/', u'foo/bar')

--
components: None
messages: 72259
nosy: forest_atq
severity: normal
status: open
title: str.rpartition fails silently with unicode argument
versions: Python 2.5

___
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue3751>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com