So, I'm able to get nevow to work on python2.2 with some minor changes.
The things that are used in python 2.3 that don't exist in python2.2
that I had to change:
1) generators available without explicit import
2) itertools
3) basestring
4) extended slice-n-dice "[::-1]" on builtin sequences
The only change here that isn't really usable directly is commenting
out lines in components.wsv. I don't know what needs to be done to make
that compatible with 2.2 without losing functionality with 2.3. Maybe
ignore missing classes while loading? If it was code instead of a .wsv
file you could simply put an if around the new classes...
It would be nice if nevow was explicitly supported on python2.2 since
the differences are very minimal, and there is no python2.3 for debian
stable.
Note: you need to set your PYTHONPATH to something that includes only
the "atop" and "nevow" directories from quotient, or else python will
magically try (and fail) to load other parts of quotient.
James
Index: atop/wsvload.py
===================================================================
RCS file: /cvs/Quotient/atop/wsvload.py,v
retrieving revision 1.6
diff -u -r1.6 wsvload.py
--- atop/wsvload.py 21 Nov 2003 20:27:58 -0000 1.6
+++ atop/wsvload.py 17 Dec 2003 21:19:22 -0000
@@ -4,6 +4,8 @@
# Public License as published by the Free Software Foundation.
# objects that should be in tpython
+from __future__ import generators
+
def getAOI(fObj):
for line in fObj:
line = line.strip()
Index: nevow/components.wsv
===================================================================
RCS file: /cvs/Quotient/nevow/components.wsv,v
retrieving revision 1.20
diff -u -r1.20 components.wsv
--- nevow/components.wsv 17 Dec 2003 01:45:05 -0000 1.20
+++ nevow/components.wsv 17 Dec 2003 21:19:22 -0000
@@ -26,7 +26,7 @@
nevow.serial.flatstan.StringCastSerializer types.IntType
nevow.iwoven.ISerializable
nevow.serial.flatstan.StringCastSerializer types.FloatType
nevow.iwoven.ISerializable
nevow.serial.flatstan.StringCastSerializer types.LongType
nevow.iwoven.ISerializable
-nevow.serial.flatstan.StringCastSerializer types.BooleanType
nevow.iwoven.ISerializable
+#nevow.serial.flatstan.StringCastSerializer types.BooleanType
nevow.iwoven.ISerializable
nevow.serial.flatstan.ListSerializer types.ListType
nevow.iwoven.ISerializable
nevow.serial.flatstan.StringCastSerializer types.DictType
nevow.iwoven.ISerializable
nevow.serial.flatstan.ListSerializer types.TupleType
nevow.iwoven.ISerializable
@@ -43,18 +43,18 @@
nevow.url.URLOverlaySerializer nevow.url.URLOverlay
nevow.iwoven.ISerializable
# Itertools uses special types
-nevow.serial.flatstan.ListSerializer itertools.chain
nevow.iwoven.ISerializable
-nevow.serial.flatstan.ListSerializer itertools.count
nevow.iwoven.ISerializable
-nevow.serial.flatstan.ListSerializer itertools.cycle
nevow.iwoven.ISerializable
-nevow.serial.flatstan.ListSerializer itertools.dropwhile
nevow.iwoven.ISerializable
-nevow.serial.flatstan.ListSerializer itertools.ifilter
nevow.iwoven.ISerializable
-nevow.serial.flatstan.ListSerializer itertools.ifilterfalse
nevow.iwoven.ISerializable
-nevow.serial.flatstan.ListSerializer itertools.imap
nevow.iwoven.ISerializable
-nevow.serial.flatstan.ListSerializer itertools.islice
nevow.iwoven.ISerializable
-nevow.serial.flatstan.ListSerializer itertools.izip
nevow.iwoven.ISerializable
-nevow.serial.flatstan.ListSerializer itertools.repeat
nevow.iwoven.ISerializable
-nevow.serial.flatstan.ListSerializer itertools.starmap
nevow.iwoven.ISerializable
-nevow.serial.flatstan.ListSerializer itertools.takewhile
nevow.iwoven.ISerializable
+# nevow.serial.flatstan.ListSerializer itertools.chain
nevow.iwoven.ISerializable
+# nevow.serial.flatstan.ListSerializer itertools.count
nevow.iwoven.ISerializable
+# nevow.serial.flatstan.ListSerializer itertools.cycle
nevow.iwoven.ISerializable
+# nevow.serial.flatstan.ListSerializer itertools.dropwhile
nevow.iwoven.ISerializable
+# nevow.serial.flatstan.ListSerializer itertools.ifilter
nevow.iwoven.ISerializable
+# nevow.serial.flatstan.ListSerializer itertools.ifilterfalse
nevow.iwoven.ISerializable
+# nevow.serial.flatstan.ListSerializer itertools.imap
nevow.iwoven.ISerializable
+# nevow.serial.flatstan.ListSerializer itertools.islice
nevow.iwoven.ISerializable
+# nevow.serial.flatstan.ListSerializer itertools.izip
nevow.iwoven.ISerializable
+# nevow.serial.flatstan.ListSerializer itertools.repeat
nevow.iwoven.ISerializable
+# nevow.serial.flatstan.ListSerializer itertools.starmap
nevow.iwoven.ISerializable
+# nevow.serial.flatstan.ListSerializer itertools.takewhile
nevow.iwoven.ISerializable
# object
# list
Index: nevow/context.py
===================================================================
RCS file: /cvs/Quotient/nevow/context.py,v
retrieving revision 1.14
diff -u -r1.14 context.py
--- nevow/context.py 11 Dec 2003 21:34:27 -0000 1.14
+++ nevow/context.py 17 Dec 2003 21:19:22 -0000
@@ -3,6 +3,8 @@
# and/or modify it under the terms of version 2.1 of the GNU Lesser
General
# Public License as published by the Free Software Foundation.
+from __future__ import generators
+
import warnings
from twisted.python import components
Index: formless.py
===================================================================
RCS file: /cvs/Quotient/nevow/formless.py,v
retrieving revision 1.31
diff -u -r1.31 formless.py
--- formless.py 2 Dec 2003 17:54:01 -0000 1.31
+++ formless.py 17 Dec 2003 21:43:42 -0000
@@ -20,10 +20,19 @@
from twisted.internet import reactor, defer
-import itertools
+#import itertools
-nextId = itertools.count().next
+#nextId = itertools.count().next
+
+class count(object):
+ def __init__(self):
+ self.id = 0
+ def next(self):
+ self.id += 1
+ return self.id
+
+nextId = count().next
class InputError(Exception):
@@ -562,7 +571,8 @@
"""
copied = copy.deepcopy(self.typedValue.arguments)
curid = 0
- for arg in copied[::-1]:
+ for n in xrange(len(copied)-1, -1, -1):
+ arg=copied[n]
curid = arg.id
if isinstance(arg, Button):
break
Index: nevow/renderer.py
===================================================================
RCS file: /cvs/Quotient/nevow/renderer.py,v
retrieving revision 1.27
diff -u -r1.27 renderer.py
--- nevow/renderer.py 11 Dec 2003 00:48:24 -0000 1.27
+++ nevow/renderer.py 17 Dec 2003 21:19:22 -0000
@@ -4,6 +4,8 @@
# and/or modify it under the terms of version 2.1 of the GNU Lesser
General
# Public License as published by the Free Software Foundation.
+from __future__ import generators
+
import os
import stat
import time
Index: nevow/stan.py
===================================================================
RCS file: /cvs/Quotient/nevow/stan.py,v
retrieving revision 1.14
diff -u -r1.14 stan.py
--- nevow/stan.py 11 Dec 2003 21:34:27 -0000 1.14
+++ nevow/stan.py 17 Dec 2003 21:19:22 -0000
@@ -3,6 +3,8 @@
# and/or modify it under the terms of version 2.1 of the GNU Lesser
General
# Public License as published by the Free Software Foundation.
+from __future__ import generators
+
class Proto(str):
"""Proto is a string subclass. Instances of Proto, which are
constructed
Index: nevow/url.py
===================================================================
RCS file: /cvs/Quotient/nevow/url.py,v
retrieving revision 1.1
diff -u -r1.1 url.py
--- nevow/url.py 17 Dec 2003 01:45:05 -0000 1.1
+++ nevow/url.py 17 Dec 2003 21:19:22 -0000
@@ -1,4 +1,4 @@
-
+from __future__ import generators
import urllib
from nevow import iwoven
Index: nevow/serial/flatmdom.py
===================================================================
RCS file: /cvs/Quotient/nevow/serial/flatmdom.py,v
retrieving revision 1.10
diff -u -r1.10 flatmdom.py
--- nevow/serial/flatmdom.py 11 Dec 2003 03:22:04 -0000 1.10
+++ nevow/serial/flatmdom.py 17 Dec 2003 21:19:22 -0000
@@ -3,6 +3,8 @@
# and/or modify it under the terms of version 2.1 of the GNU Lesser
General
# Public License as published by the Free Software Foundation.
+from __future__ import generators
+
from nevow.iwoven import ISerializable
from nevow.stan import Tag, xml, directive
Index: nevow/serial/flatstan.py
===================================================================
RCS file: /cvs/Quotient/nevow/serial/flatstan.py,v
retrieving revision 1.18
diff -u -r1.18 flatstan.py
--- nevow/serial/flatstan.py 17 Dec 2003 01:44:39 -0000 1.18
+++ nevow/serial/flatstan.py 17 Dec 2003 21:19:22 -0000
@@ -3,7 +3,8 @@
# and/or modify it under the terms of version 2.1 of the GNU Lesser
General
# Public License as published by the Free Software Foundation.
-
+from __future__ import generators
+from types import StringType
import types
import warnings
@@ -50,7 +51,7 @@
flat =
flatten(ISerializable(v).serialize(context, stream))
if flat:
val = flat[0]
- if isinstance(val, basestring):
+ if isinstance(val, StringType):
val = val.replace('"', '"')
yield xml(val)
yield xml('"')
Index: nevow/test/test_disktemplate.py
===================================================================
RCS file: /cvs/Quotient/nevow/test/test_disktemplate.py,v
retrieving revision 1.16
diff -u -r1.16 test_disktemplate.py
--- nevow/test/test_disktemplate.py 11 Dec 2003 01:04:10 -0000
1.16
+++ nevow/test/test_disktemplate.py 17 Dec 2003 21:19:22 -0000
@@ -3,6 +3,7 @@
# and/or modify it under the terms of version 2.1 of the GNU Lesser
General
# Public License as published by the Free Software Foundation.
+from __future__ import generators
from nevow import renderer
from nevow import util
Index: nevow/test/test_flatstan.py
===================================================================
RCS file: /cvs/Quotient/nevow/test/test_flatstan.py,v
retrieving revision 1.15
diff -u -r1.15 test_flatstan.py
--- nevow/test/test_flatstan.py 10 Dec 2003 19:48:49 -0000 1.15
+++ nevow/test/test_flatstan.py 17 Dec 2003 21:19:22 -0000
@@ -3,6 +3,8 @@
# and/or modify it under the terms of version 2.1 of the GNU Lesser
General
# Public License as published by the Free Software Foundation.
+from __future__ import generators
+
from twisted.python import reflect
from twisted.web.resource import IResource