Re: [Python-Dev] New PyPI broken package editing
Martin v. Löwis wrote: Walter Dörwald wrote: The register command in 2.4 (and current CVS) simply does a value = str(value) in post_to_server() so the encoded bytes sent depend on the default encoding. Would it be sufficient to change this to value = unicode(value).encode(utf-8) Indeed. I think this can go into 2.4.2. OK, I've checked this into HEAD and release24-maint (including the change to the Content-Type header). Another solution might be to include the encoding in the Content-type header of the request. IMHO the best solution would be to do both: Always use UTF-8 as the encoding and include this in the Content-type header in the request. PyPI should honor this encoding when it finds it and should fall back to whatever it used before if it doesn't. Yeah, well :-) Content-type in form upload is a mess, as you certainly know. It should be honored, but commonly isn't. This, in turn, causes browsers to ignore it. Fortunately we have both ends under control (except for old Python versions). PyPI uses the CGI module. It currently decodes anything that doesn't have a filename attribute to UTF-8, causing rejection of anything that doesn't send UTF-8. This could be fixed/extended, but I think that would be best done in the CGI module, for consumption by any application that uses form upload. For example, doing cgi.FieldStorage(..., encoding=UTF-8) should cause a) decoding of every field that has an encoding= in its content type b) decoding of every field that is not a file to UTF-8. It is a file if it I) has a filename, or II) cannot be decoded to the target decoding For backwards compatibility, a) can only be enabled if the CGI application explicitly tells what encoding it expects. I'd like to state contributions are welcome, although others may think differently. OK, I'll see, if I can give this a try. Bye, Walter Dörwald ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] Pickling instances of nested classes
Martin v. Löwis wrote: Walter Dörwald wrote: So is this change wanted? useful? implementable with reasonable effort? Or just not worth it? I think it is just not worth it. This means I won't attempt to implement it. I think I defined originally the __module__ attribute for classes to support better pickling (and defined it to be a string to avoid cycles); we considered the nested classes case at the time and concluded oh well, don't do that then. This sounds like this change would have a far greater chance of getting into Python if a patch existed (I guess, this is the case for all changes ;)). Bye, Walter Dörwald ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
python.org/sf URLs aren't working? Re: [Python-Dev] Weekly Python Patch/Bug Summary
I get 500 Internal Server Error messages when I try to access the URLs in the recent patch summary. Is this happening to anybody else? Jeff pgpOUL7H5Sr5t.pgp Description: PGP signature ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: python.org/sf URLs aren't working? Re: [Python-Dev] Weekly Python Patch/Bug Summary
On Thu, Mar 31, 2005 at 09:37:27AM -0600, Jeff Epler wrote: I get 500 Internal Server Error messages when I try to access the URLs in the recent patch summary. Is this happening to anybody else? Just visited http://python.org/sf/754022 to test - no problems, normal redirect to the SF tracker. Can you show an URL that's not working? Oleg. -- Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED] Programmers don't die, they just GOSUB without RETURN. ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: python.org/sf URLs aren't working? Re: [Python-Dev] Weekly Python Patch/Bug Summary
Jeff Epler [EMAIL PROTECTED] writes: I get 500 Internal Server Error messages when I try to access the URLs in the recent patch summary. Yes, it seems that the python.org/sf/ special facility is having a problem. IDs over 1 100 000 or so don't work. I sent a message to [EMAIL PROTECTED] since I don't know who wrote that code. -- KBK ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: python.org/sf URLs aren't working? Re: [Python-Dev] Weekly Python Patch/Bug Summary
Jeff == Jeff Epler [EMAIL PROTECTED] writes: Jeff I get 500 Internal Server Error messages when I try to access the Jeff URLs in the recent patch summary. Jeff Is this happening to anybody else? Yup. I don't have time to look into the problem, however... Here's a traceback: Traceback (most recent call last): File /usr/local/apache/cgi-bin/sf, line 82, in ? log_type(report, tracker) File /usr/local/apache/cgi-bin/sf, line 42, in log_type os.unlink(idsfile+.lck) OSError: [Errno 2] No such file or directory: '/tmp/sourceforge-ids.txt.lck' and here's the script. It looks like lock file creation is failing but log_type() isn't returning, so in the finally clause deletion fails. Skip sf Description: Binary data ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: python.org/sf URLs aren't working? Re: [Python-Dev] Weekly Python Patch/Bug Summary
I forwarded this to MvL, who wrote the code; he'll look into it but probably not before Sunday. On Thu, 31 Mar 2005 11:37:40 -0500, Kurt B. Kaiser [EMAIL PROTECTED] wrote: Jeff Epler [EMAIL PROTECTED] writes: I get 500 Internal Server Error messages when I try to access the URLs in the recent patch summary. Yes, it seems that the python.org/sf/ special facility is having a problem. IDs over 1 100 000 or so don't work. I sent a message to [EMAIL PROTECTED] since I don't know who wrote that code. -- KBK ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/guido%40python.org -- --Guido van Rossum (home page: http://www.python.org/~guido/) ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] Pickling instances of nested classes
Walter Dörwald wrote: Samuele Pedroni wrote: Walter Dörwald wrote: [User cases for pickling instances of nested classes] So is this change wanted? useful? implementable with reasonable effort? Or just not worth it? notice that in this cases often metaclasses are involved or could easely be, so if pickling would honor __reduce__ or __reduce_ex__ on metaclasses (which right now it doesn't treating their instances as normal classes) one could roll her own solution without the burden for the language of implementing pickling of nested classes in general, so I think that would make more sense, to add support to honor __reduce__/__reduce_ex__ for metaclasses. Sorry, I don't understand: In most cases it can be possible to work around the nested classes problem by implementing custom pickling functionality (getstate/setstate/reduce/reduce_ex). But it is probably impossible to implement this once and for all in a common base class, because there's no way to find the real name of the nested class (or any other handle that makes it possible to retrieve the class from the module on unpickling). And having the full name of the class available would certainly help in debugging. that's probably the only plus point but the names would be confusing wrt modules vs. classes. My point was that enabling reduce hooks at the metaclass level has propably other interesting applications, is far less complicated than your proposal to implement, it does not further complicate the notion of what happens at class creation time, and indeed avoids the implementation costs (for all python impls) of your proposal and still allows fairly generic solutions to the problem at hand because the solution can be formulated at the metaclass level. If pickle.py is patched along these lines [*] (strawman impl, not much tested but test_pickle.py still passes, needs further work to support __reduce_ex__ and cPickle would need similar changes) then this example works: class HierarchMeta(type): metaclass such that inner classes know their outer class, with pickling support def __new__(cls, name, bases, dic): sub = [x for x in dic.values() if isinstance(x,HierarchMeta)] newtype = type.__new__(cls, name, bases, dic) for x in sub: x._outer_ = newtype return newtype def __reduce__(cls): if hasattr(cls, '_outer_'): return getattr, (cls._outer_, cls.__name__) else: return cls.__name__ # uses the HierarchMeta metaclass class Elm: __metaclass__ = HierarchMeta def __init__(self, **stuff): self.__dict__.update(stuff) def __repr__(self): return %s %s % (self.__class__.__name__, self.__dict__) # example class X(Elm): class Y(Elm): pass class Z(Elm): pass import pickle x = X(a=1) y = X.Y(b=2) z = X.Z(c=3) xs = pickle.dumps(x) ys = pickle.dumps(y) zs = pickle.dumps(z) print pickle.loads(xs) print pickle.loads(ys) print pickle.loads(zs) pedronis$ python2.4 example.py X {'a': 1} Y {'b': 2} Z {'c': 3} [*]: --- pickle.py.orig Wed Mar 30 20:37:14 2005 +++ pickle.py Thu Mar 31 21:09:41 2005 @@ -298,12 +298,19 @@ issc = issubclass(t, TypeType) except TypeError: # t is not a class (old Boost; see SF #502085) issc = 0 +reduce = None if issc: -self.save_global(obj) -return +for x in t.__mro__: +if x is not object and '__reduce__' in x.__dict__: +reduce = x.__dict__['__reduce__'] +break +else: +self.save_global(obj) +return # Check copy_reg.dispatch_table -reduce = dispatch_table.get(t) +if not reduce: +reduce = dispatch_table.get(t) if reduce: rv = reduce(obj) else: ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: python.org/sf URLs aren't working? Re: [Python-Dev] Weekly Python Patch/Bug Summary
Skip Montanaro wrote: Here's a traceback: Traceback (most recent call last): File /usr/local/apache/cgi-bin/sf, line 82, in ? log_type(report, tracker) File /usr/local/apache/cgi-bin/sf, line 42, in log_type os.unlink(idsfile+.lck) OSError: [Errno 2] No such file or directory: '/tmp/sourceforge-ids.txt.lck' and here's the script. It looks like lock file creation is failing but log_type() isn't returning, so in the finally clause deletion fails. Somebody took world write permission on /tmp away; I don't know whether this was intentional - I have restored them for a moment. The script actually has two errors: it is not os.sleep, but time.sleep (so it would only try one time, not ten times); plus (and I'm glad you did not catch that, either :-) the finally block is always executed, even if the file was not created, and even if the function is left through return. I've fixed the script, however, if somebody takes away o+w on /tmp again, it will mean that the caching silently stops. Regards, Martin ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: python.org/sf URLs aren't working? Re: [Python-Dev] Weekly Python Patch/Bug Summary
Guido van Rossum wrote: I forwarded this to MvL, who wrote the code; he'll look into it but probably not before Sunday. Actually, now that I saw that it is a permission problem, it turned out to be fixable quite easily. Regards, Martin ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: python.org/sf URLs aren't working? Re: [Python-Dev] Weekly Python Patch/Bug Summary
It's working again for me now. thanks! Jeff pgpVnAYyEVx3l.pgp Description: PGP signature ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] RE: [Python-checkins] python/dist/src/Lib/logging handlers.py, 1.19, 1.19.2.1
On Friday 01 April 2005 07:00, Raymond Hettinger wrote: Tag: release24-maint handlers.py Log Message: Added optional encoding argument to File based handlers and improved error handling for SysLogHandler Are you sure you want to backport an API change and new feature? What Raymond said. Please don't add new features to the maintenance branch. Anthony -- Anthony Baxter [EMAIL PROTECTED] It's never too late to have a happy childhood. ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com