[ZCM] [ZC] 1074/ 5 Assign "Cant declare classes in Scripts with 2.7
and Python 2.3"
Collector: Zope Bugs, Features,
and Patches ...
zope-coders-admin at zope.org
Tue Jan 6 16:46:11 EST 2004
Issue #1074 Update (Assign) "Cant declare classes in Scripts with 2.7 and Python 2.3"
Status Accepted, Zope/bug medium
To followup, visit:
http://collector.zope.org/Zope/1074
==============================================================
= Assign - Entry #5 by evan on Jan 6, 2004 4:46 pm
Status: Resolved => Accepted
Supporters added: evan
Setting __name__ to the Id of the Script, my original "fix", fails if the Id contains a period ('.'). This causes wacky import problems, which leads to hair-tearingly opaque security problems.
Solution #1: Omit or replace periods in the __name__
Solution #2: Set the __name__ to None
Solution #Inf: Get this fixed in Python 2.3.4
I actually like #2 the best, since it is immune to weird Script names and produces class repr's that look like "<class ?.foo at 0x41696bfc>"
________________________________________
= Resolve - Entry #4 by evan on Nov 4, 2003 2:46 pm
Status: Pending => Resolved
Fixed in HEAD and 2.7 branch.
________________________________________
= Comment - Entry #3 by leper on Oct 7, 2003 11:00 pm
Yeah, defining it does fix the bug for script objects, but what
should __name__ in the globals dict be defined as?
________________________________________
= Comment - Entry #2 by tim_one on Oct 6, 2003 10:03 am
On zope-dev, Fred L. Drake, Jr. said:
"""
In Python 2.3.x, when a class is defined the __name__ of the
encompassing module is looked up. I suspect Python Scripts can be
fixed by defining __name__ in the globals dictionary in which the code is executed.
"""
________________________________________
= Request - Entry #1 by mcdonc on Oct 5, 2003 10:15 am
Jamie Heilman reports:
In 2.3 you can no longer declare new classes in a Script object. It
> bitches about a lack of __name__ attribute. I haven't really had the
> time to look into it closely, but it does effect the examples shipped
> with zope, and actually its just a very useful thing to be able to do.
> Whatever this problem stems from, there will probably be more because
> of it.
==============================================================
More information about the Zope-Collector-Monitor
mailing list