Environment
I've installed the latest ZWiki 0-24-0 with the latest Zope Version 2.7.b3, which I needed because I run my server with Python 2.3.2 (under linux).
Description
If I visit one of the provides pages, which are generated with adding a new Wiki, an AttributeError? in Line 2334 is raised. ( AttributeError?: class DateTime? has no attribute 'SyntaxError?')
This Error appears in the code (WikiPage?.py) like this
:: try:
...
The problem is, in Zope 2.6, SyntaxError? was only a string attribute at the class. Now in 2.7 it became a Exceptionclass derived from DateTimeError? which is defined in DateTime?/DateTime?.py (quite on top), so it doesn't exist anymore as an attribute.
Solution
At the moment I don't have a good idea
property change --SimonMichael, Thu, 20 Nov 2003 13:36:26 -0800 reply
Title: 'IssueNo0649? ZWiki + Zope 2.7.x' => 'IssueNo0649? pages give an AttributeError? with Zope 2.7' Severity: critical => serious
? --DanMcmullen, Tue, 25 Nov 2003 11:23:03 -0800 reply
there must be something i'm not getting. why doesn't this work?:
import DateTime try: ... except( AttributeError, hasattr(DateTime,'SyntaxError') and DateTime.SyntaxError or DateTime.SyntaxError() ):
? --Simon Michael, Tue, 25 Nov 2003 12:24:22 -0800 reply
Thanks Dan! Wouldn't your hasattr always be true ? Based on what you've written it looks like this might work:
from App.Common import absattr ... except (AttributeError, absattr(DateTime.SyntaxError)):
ie if SyntaxError? is a class we just need to instantiate it (absattr calls something if it's callable). Could someone with 2.7 installed give this a quick test ?
fix checked in for 0.25 rc, unconfirmed --SimonMichael, Tue, 25 Nov 2003 12:53:38 -0800 reply
Status: open => pending
? --dan mcmullen, Tue, 25 Nov 2003 13:26:57 -0800 reply
Simon Michael wrote:
> Thanks Dan! Wouldn't your hasattr always be true ?
i was assuming SytaxError? is defined outside the DateTime? class, but in the DateTime? package. i don't have the 2.7 sources here at present, so i'm just guessing. would that make a difference?
... --Tue, 25 Nov 2003 17:49:33 -0800 reply
This is what I find;
in Zope 2.7 b2, DateTime?.py;
SyntaxError? ='Invalid Date-Time String'
In Zope 2.7 b3 DateTime?.py
It was a string, now it's a class.
another report --SimonMichael, Thu, 04 Dec 2003 16:55:20 -0800 reply
We have a report on GD that 0.24 worked with 2.7 but 0.25 doesn't.
my workaround: --Drew, Thu, 04 Dec 2003 17:34:58 -0800 reply
I just changed the except clause in ZWikiPage.py to catch everything.
my workaround: --SimonMichael, Thu, 04 Dec 2003 17:56:50 -0800 reply
Thanks.
Someone out there must know how to reference the DateTime? SyntaxError? exception properly in zope 2.7.. ? I'd upgrade now except I refuse to mess with a beta of 2.7 at this stage..
my workaround: --SimonMichael, Thu, 04 Dec 2003 18:04:28 -0800 reply
Reminder: the need is for a try: except: that catches DateTime? exceptions in both zope <=2.6 and zope >= 2.7, and my guess (that's in 0.25) was this:
DateTimeSyntaxError = absattr(DateTime.SyntaxError)
and actually I'd quite like to see a traceback to understand why that doesn't work.
my workaround: --dan mcmullen, Thu, 04 Dec 2003 18:37:55 -0800 reply
SimonMichael wrote:
> Reminder: the need is for a try: except: that catches DateTime? > exceptions in both zope <=2.6 and zope >= 2.7, and my guess (that's in > 0.25) was this:: > > DateTimeSyntaxError? = absattr(DateTime?.SyntaxError?) > > and actually I'd quite like to see a traceback to understand why that > doesn't work.<<<
i just dl'd 2.7b3. DateTime?.py has this schema:
class DateTimeError( Exception ): pass class SyntaxError( DateTimeError ): pass ... class DateTime:
seems to me that class SyntaxError? is not declared inside class DateTime? and would not be one of it's attributes? would this make absattr() fail?
i'll install 2.7b3 tomorrow & check this out unless there's some progress.
property change --SimonMichael, Thu, 04 Dec 2003 19:39:41 -0800 reply
Title: 'IssueNo0649? pages give an AttributeError? with Zope 2.7' => 'IssueNo0649? zwiki fails to initialize with zope 2.7/pages give an AttributeError? with Zope 2.7' Status: pending => open
my workaround: --SimonMichael, Thu, 04 Dec 2003 20:52:18 -0800 reply
Dan - exactly, it's a module attribute.. we just figured this out on #zwiki but were stuck with an inexplicable import problem.
I've just checked in a slightly newer version which centralises this in one place (Utils.py) and has a better chance of being right I can't remember if except takes instances or classes right now.
just checked.. --Fri, 05 Dec 2003 07:41:52 -0800 reply
and in Zope-2_7-branch the following works:
from DateTime? import DateTime?
try: raise DateTime?.SyntaxError? except DateTime?.SyntaxError?: print 'bla'
prints bla.
Fixed --Fri, 05 Dec 2003 08:37:59 -0800 reply
This is fixed in Zope 2.7 CVS today.
-- Alexander Limi
Fixed --Thu, 11 Dec 2003 18:45:52 -0800 reply
Excellent. So, Zwiki will definitely work with 2.7-cvs; indications are that current Zwiki-cvs does work with 2.7b3; when 2.7 final is out I'll revert this code to the way it has always been.
property change --Thu, 11 Dec 2003 18:46:11 -0800 reply
Status: open => closed
my workaround --FlorianKonnertz, Thu, 18 Dec 2003 06:39:08 -0800 reply
I had that issue with 2.7b2 and 0.26cvs; i just copied the current DateTime?.py from cvs to the 2.7b2 tree. - Fine. (up to now).
my workaround --Samotnik, Thu, 18 Dec 2003 16:56:39 -0800 reply
Yesterday I had similar problem with Zope 2.7.b2 widows distribution. A lot of python modules are missing in this distribution. So, I installed Python 2.3.2 separately and copied all missing Python stuff to Zope.
Request clarification . . . --Fri, 26 Dec 2003 17:43:26 -0800 reply
I'm a duffer at python, zope, plone, and know pretty much nothing about zwiki.
I tried to install zwiki, and after unpacking it in the Zope Products, upon a Zope restart attempt, I got the error mentioned above. I can about halfway follow this discussion. If I understand it correctly, it's really a glitch in the current Zope version, and because the more advanced Zope in cvs has the issue fixed, then at the next Zope stable release this problem will vanish. Have I understood this correctly?
-- Arthur Cronos (The Bloggard, http://www.bloggard.com)
Still trouble --Sat, 27 Dec 2003 23:08:12 -0800 reply
We're using the 2.7b3 (tarball and cvs from the 2,7branch) of ZoPe and the 0.26cvs branch of ZWiki. I get:
... File "/Library/Zope/Products/ZWiki/Utils.py", line 20, in ? DateTimeSyntaxError = DateTime.SyntaxError() AttributeError: class DateTime has no attribute 'SyntaxError'
when starting up ZoPe. Looked at Util.py and it has the try/except patch and DateTime?.py has DateTimeError?/SyntaxError? declared as classes as mentioned above. Just a little confused why this isn't finding it as an attribute now.
Slight Correction --Sun, 28 Dec 2003 00:15:43 -0800 reply
If I look at the latest cvs for 2.7 there is an additional few lines in DateTime?.py:
# Make class-specific exceptions available as attributes. DateError = DateError TimeError = TimeError DateTimeError = DateTimeError SyntaxError = SyntaxError
It works fine when this version of DateTime?.py is there. __version__='$Revision: 1.85.12.6 $'[11:-2]? Sorry for the alarm
property change --SimonMichael, Thu, 05 Feb 2004 14:27:32 -0800 reply
Title: 'IssueNo0649? zwiki fails to initialize with zope 2.7/pages give an AttributeError? with Zope 2.7' => 'IssueNo0649? zwiki fails to initialize/pages give AttributeError? with Zope 2.7b3'
Why is it closed? --Thu, 10 Jun 2004 08:59:20 -0700 reply
Why is this issue closed when the problem still persists as I stupidly replicated in http://zwiki.org/IssueNo0845InstallationProblemWithDateTimeModule There I was advised to upgrade from 2.7.0b3 to 2.7.0 but I don't want to.
Why is it closed? --simon, Thu, 10 Jun 2004 17:05:24 -0700 reply
There's no point in spending more time and complicating zwiki code to support a broken zope 2.7 beta. If you don't want to upgrade zope, you can see from the above that zwiki had a special workaround for this situation at one point - you'd have to look through CVSRepository to find which one. This is closed as far as I'm concerned, but good luck.
... --EmmaLaurijssens, Thu, 20 Apr 2006 05:14:52 -0700 reply
Name: '#649 bjPZkDENml' => '#649 Zwiki fails to initialize/pages give AttributeError? with Zope 2.7b3' Status: open => closed
Irrelevant