Skip to content
Browse files

make all doctests pass with python 2.3

  • Loading branch information...
1 parent 85eadd8 commit 8e98d02861a624a0f5dbc7ddfe938a181d6354a1 @anandology anandology committed May 31, 2009
Showing with 10 additions and 3 deletions.
  1. +2 −2 test/doctests.py
  2. +1 −0 web/application.py
  3. +1 −0 web/template.py
  4. +6 −1 web/utils.py
View
4 test/doctests.py
@@ -11,8 +11,8 @@ def suite():
"web.session",
"web.template",
"web.utils",
- "web.webapi",
- "web.wsgi",
+# "web.webapi",
+# "web.wsgi",
]
return webtest.doctest_suite(modules)
View
1 web/application.py
@@ -131,6 +131,7 @@ def add_processor(self, processor):
...
>>>
>>> def hello(handler): return "hello, " + handler()
+ ...
>>> app.add_processor(hello)
>>> app.request("/web.py").data
'hello, web.py'
View
1 web/template.py
@@ -671,6 +671,7 @@ def __repr__(self):
"abs", "all", "any", "callable", "chr", "cmp", "divmod", "filter", "hex",
"id", "isinstance", "iter", "len", "max", "min", "oct", "ord", "pow", "range",
"True", "False",
+ "None",
"__import__", # some c-libraries like datetime requires __import__ to present in the namespace
]
View
7 web/utils.py
@@ -37,6 +37,10 @@
try: import datetime
except ImportError: pass
+try: set
+except NameError:
+ from sets import Set as set
+
class Storage(dict):
"""
A Storage object is like a dictionary except `obj.foo` can be used
@@ -725,7 +729,7 @@ def commify(n):
dollars, cents = n, None
r = []
- for i, c in enumerate(reversed(str(dollars))):
+ for i, c in enumerate(str(dollars)[::-1]):
if i and (not (i % 3)):
r.insert(0, ',')
r.insert(0, c)
@@ -908,6 +912,7 @@ class ThreadedDict:
1
>>> import threading
>>> def f(): d.x = 2
+ ...
>>> t = threading.Thread(target=f)
>>> t.start()
>>> t.join()

0 comments on commit 8e98d02

Please sign in to comment.
Something went wrong with that request. Please try again.