Skip to content

Commit

Permalink
Rewrite print statements to function to work under Python 3.
Browse files Browse the repository at this point in the history
  • Loading branch information
sallner committed Sep 29, 2016
1 parent 678ea04 commit cfea895
Show file tree
Hide file tree
Showing 28 changed files with 65 additions and 65 deletions.
4 changes: 2 additions & 2 deletions src/grokcore/view/ftests/contentprovider/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
>>> browser = Browser()
>>> browser.handleErrors = False
>>> browser.open("http://localhost/cave")
>>> print browser.contents
>>> print(browser.contents)
Hi
>>> browser.open("http://localhost/cave/@@secondindex")
>>> print browser.contents
>>> print(browser.contents)
Hi
"""
Expand Down
4 changes: 2 additions & 2 deletions src/grokcore/view/ftests/contentprovider/layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
>>> browser = Browser()
>>> browser.handleErrors = False
>>> browser.open("http://localhost/wilma/@@caveview")
>>> print browser.contents
>>> print(browser.contents)
Soup pot
Traverse to the view on the model object. We get the content provider
registered for the "boneskin" layer::
>>> browser.open("http://localhost/++skin++boneskin/wilma/@@caveview")
>>> print browser.contents
>>> print(browser.contents)
Layered pot
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
>>> browser = Browser()
>>> browser.handleErrors = False
>>> browser.open("http://localhost/cave/@@index")
>>> print browser.contents
>>> print(browser.contents)
<grokcore.view.ftests.contentprovider.template_namespaces.Cave object at ...>
<grokcore.view.ftests.contentprovider.template_namespaces.Index object at ...>
<grokcore.view.ftests.contentprovider.template_namespaces.CavewomenContentProvider object at ...>
Expand All @@ -22,7 +22,7 @@
Let's look at a template for too:
>>> browser.open("http://localhost/cave/@@necklace")
>>> print browser.contents
>>> print(browser.contents)
<grokcore.view.ftests.contentprovider.template_namespaces.Cave object at ...>
<grokcore.view.ftests.contentprovider.template_namespaces.Necklace object at ...>
<grokcore.view.ftests.contentprovider.template_namespaces.CavewomenContentProviderWithTemplate object at ...>
Expand Down
14 changes: 7 additions & 7 deletions src/grokcore/view/ftests/directoryresource/dirresource.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
>>> browser.open(
... 'http://localhost/@@/'
... 'grokcore.view.ftests.directoryresource.fixture.resource/file.txt')
>>> print browser.contents
>>> print(browser.contents)
Foo resource file's content.
Directoryresource registrations can be differentiated based on layers (and
Expand All @@ -18,7 +18,7 @@
>>> browser.open(
... 'http://localhost/++skin++another/@@/'
... 'grokcore.view.ftests.directoryresource.fixture.resource/file.txt')
>>> print browser.contents
>>> print(browser.contents)
Anotherfoo resource file's content.
This resource is only available on the particular layer::
Expand All @@ -27,7 +27,7 @@
... 'http://localhost/++skin++another/@@/'
... 'grokcore.view.ftests.directoryresource.fixture.resource/'
... 'anotherfile.txt')
>>> print browser.contents
>>> print(browser.contents)
Anotherfoo resource anotherfile's content.
>>> browser.handleErrors = True
Expand All @@ -43,25 +43,25 @@
>>> browser.handleErrors = False
>>> browser.open('http://localhost/@@/fropple/file.txt')
>>> print browser.contents
>>> print(browser.contents)
Bar resource file's content.
Subdirectories are published as directoryresources recusively::
>>> browser.open('http://localhost/@@/fropple/baz/file.txt')
>>> print browser.contents
>>> print(browser.contents)
Baz resource file's content.
A relative path to a directory with resources::
>>> browser.open('http://localhost/@@/frepple/file.txt')
>>> print browser.contents
>>> print(browser.contents)
Baz resource file's content.
An absolute path to a directory with resources::
>>> browser.open('http://localhost/@@/frupple/file.txt')
>>> print browser.contents
>>> print(browser.contents)
Baz resource file's content.
"""
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ Testing the plugging in of a template language
The template on the base view should return the url of the resource:

>>> view = component.getMultiAdapter((cave, request), name='caveview')
>>> print view()
>>> print(view())
http://127.0.0.1/@@/grokcore.view.ftests.static.notemplates_nooverridestatic.original/resource.css


The template on the inheriting view should return the url of the resource of the base view:

>>> view = component.getMultiAdapter((cave, request), name='palaceview')
>>> print view()
>>> print(view())
http://127.0.0.1/@@/grokcore.view.ftests.static.notemplates_nooverridestatic.original/resource.css

Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ Testing the plugging in of a template language
The template on the base view should return the url of the resource:

>>> view = component.getMultiAdapter((cave, request), name='caveview')
>>> print view()
>>> print(view())
http://127.0.0.1/@@/grokcore.view.ftests.static.notemplates_overridestatic.original/resource.css


The template on the inheriting view should return the url of the resource of the base view:

>>> view = component.getMultiAdapter((cave, request), name='palaceview')
>>> print view()
>>> print(view())
http://127.0.0.1/@@/grokcore.view.ftests.static.notemplates_overridestatic.original/resource.css

Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ Testing the plugging in of a template language
The template on the base view should return the url of the resource:

>>> view = component.getMultiAdapter((cave, request), name='caveview')
>>> print view()
>>> print(view())
Cave view
http://127.0.0.1/@@/grokcore.view.ftests.static.overridetemplates_overridestatic.original/resource.css


The template on the inheriting view should return the url of the resource of the base view:

>>> view = component.getMultiAdapter((cave, request), name='palaceview')
>>> print view()
>>> print(view())
Palace view
http://127.0.0.1/@@/grokcore.view.ftests.static.overridetemplates_overridestatic.override/resource.css

2 changes: 1 addition & 1 deletion src/grokcore/view/ftests/static/simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
>>> from grokcore.view.ftests.static.simple_fixture.ellie import Mammoth
>>> root[u'ellie'] = Mammoth()
>>> browser.open('http://localhost/ellie')
>>> print browser.contents
>>> print(browser.contents)
<html>
<body>
<a href="dummy:/file.txt">Some text in a file</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ Testing the plugging in of a template language
The template on the base view should return the url of the resource:

>>> view = component.getMultiAdapter((cave, request), name='caveview')
>>> print view()
>>> print(view())
Cave view
http://127.0.0.1/@@/grokcore.view.ftests.static.templates_nooverridestatic.original/resource.css


The template on the inheriting view should return the url of the resource of the base view:

>>> view = component.getMultiAdapter((cave, request), name='palaceview')
>>> print view()
>>> print(view())
Cave view
http://127.0.0.1/@@/grokcore.view.ftests.static.templates_nooverridestatic.original/resource.css

8 changes: 4 additions & 4 deletions src/grokcore/view/ftests/url/url.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
>>> browser = Browser()
>>> browser.handleErrors = False
>>> browser.open("http://localhost/herd/manfred/index")
>>> print browser.contents
>>> print(browser.contents)
http://localhost/herd/manfred/index
>>> browser.open("http://localhost/herd/manfred/another")
>>> print browser.contents
>>> print(browser.contents)
http://localhost/herd/manfred/another
>>> browser.open("http://localhost/herd/manfred/yetanother")
>>> print browser.contents
>>> print(browser.contents)
http://localhost/herd/manfred/yetanother
We get the views manually so we can do a greater variety of url() calls:
Expand Down Expand Up @@ -152,7 +152,7 @@
properly:
>>> result = index_view.url(data={'key':[u'\xe9',2]})
>>> print result
>>> print(result)
http://127.0.0.1/herd/manfred/index?key=%C3%A9&key=2
>>> from cgi import parse_qs
Expand Down
4 changes: 2 additions & 2 deletions src/grokcore/view/ftests/url/url_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
>>> browser = Browser()
>>> browser.handleErrors = False
>>> browser.open("http://localhost/herd/manfred/index")
>>> print browser.contents
>>> print(browser.contents)
http://localhost/herd/manfred/index
>>> browser.open("http://localhost/herd/manfred/another")
>>> print browser.contents
>>> print(browser.contents)
http://localhost/herd/manfred/another
We get the views manually so we can do a greater variety of url() calls:
Expand Down
8 changes: 4 additions & 4 deletions src/grokcore/view/ftests/view/argument.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
the render() method, should the method choose to take them:
>>> browser.open("http://localhost/manfred/render?message=Foo&another=Bar")
>>> print browser.contents
>>> print(browser.contents)
Message: Foo
Another: Bar
Supplying more arguments than those specified has no effect:
>>> browser.open("http://localhost/manfred/render?message=There&another=Is&last=More")
>>> print browser.contents
>>> print(browser.contents)
Message: There
Another: Is
Expand All @@ -30,13 +30,13 @@
The same works with views that define update():
>>> browser.open("http://localhost/manfred/update?message=Foo&another=Bar")
>>> print browser.contents
>>> print(browser.contents)
Coming to us from update():
Message: Foo
Another: Bar
>>> browser.open("http://localhost/manfred/update?message=There&another=Is&last=More")
>>> print browser.contents
>>> print(browser.contents)
Coming to us from update():
Message: There
Another: Is
Expand Down
2 changes: 1 addition & 1 deletion src/grokcore/view/ftests/view/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
>>> browser = Browser()
>>> browser.handleErrors = False
>>> browser.open("http://localhost/manfred")
>>> print browser.contents
>>> print(browser.contents)
<html>
<body>
<h1>Hello, world!</h1>
Expand Down
6 changes: 3 additions & 3 deletions src/grokcore/view/ftests/view/macros.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
>>> browser = Browser()
>>> browser.handleErrors = False
>>> browser.open("http://localhost/manfred/@@painting")
>>> print browser.contents
>>> print(browser.contents)
<html>
<body>
<h1>GROK MACRO!</h1>
Expand All @@ -25,7 +25,7 @@
shadows the view. XXX This should probably generate a warning at runtime.
>>> browser.open("http://localhost/manfred/@@grilldish")
>>> print browser.contents
>>> print(browser.contents)
<html>
Curry
</html>
Expand Down Expand Up @@ -56,7 +56,7 @@
>>> changed = before.replace('GROK', 'GROK RELOADED')
>>> open(template_file, 'w').write(changed)
>>> browser.open("http://localhost/manfred/@@painting")
>>> print browser.contents
>>> print(browser.contents)
<html>
<body>
<h1>GROK RELOADED MACRO!</h1>
Expand Down
4 changes: 2 additions & 2 deletions src/grokcore/view/ftests/view/require.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
>>> browser.addHeader('Authorization', 'Basic mgr:mgrpw')
>>> browser.handleErrors = False
>>> browser.open("http://localhost/@@painting")
>>> print browser.contents
>>> print(browser.contents)
What a beautiful painting.
A view protected with 'zope.Public' is always accessible:
>>> browser = Browser()
>>> browser.open("http://localhost/@@publicnudity")
>>> print browser.contents
>>> print(browser.contents)
Everybody can see this.
"""

Expand Down
6 changes: 3 additions & 3 deletions src/grokcore/view/ftests/view/skindirective.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@
>>> browser = Browser()
>>> browser.handleErrors = False
>>> browser.open("http://localhost/++skin++casual/manfred/@@hello")
>>> print browser.contents
>>> print(browser.contents)
<html>
<body>
<h1>Hi sir !</h1>
</body>
</html>
>>> browser.open("http://localhost/++skin++party/manfred/@@happy")
>>> print browser.contents
>>> print(browser.contents)
Hee yay !
>>> browser.open("http://localhost/++skin++rainy/manfred/@@sad")
>>> print browser.contents
>>> print(browser.contents)
Aw... It rains.
"""
Expand Down
2 changes: 1 addition & 1 deletion src/grokcore/view/ftests/view/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
>>> browser = Browser()
>>> browser.handleErrors = False
>>> browser.open("http://localhost/manfred/@@painting")
>>> print browser.contents
>>> print(browser.contents)
<html>
<body>
<h1>Hello, world!</h1>
Expand Down
8 changes: 4 additions & 4 deletions src/grokcore/view/tests/template/pluggability.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,22 @@
# The inline template should work:
>>> view = component.getMultiAdapter((cave, request), name='sebaayeni')
>>> print view()
>>> print(view())
<html><body>Sebaayeni is in South Africa</body></html>
# And the inline file template:
>>> view = component.getMultiAdapter((cave, request), name='lascaux')
>>> print view()
>>> print(view())
<html><body>Lascaux is in France</body></html>
# And the template directory template:
>>> view = component.getMultiAdapter((cave, request), name='kakadu')
>>> print view()
>>> print(view())
<html><body>Kakadu is in Australia</body></html>
# We should be able to extend the namespac in the view and
>>> view = component.getMultiAdapter((cave, request), name='sierra')
>>> print view()
>>> print(view())
<html><body>Sierra de San Fransisco is in Mexico</body></html>
"""
Expand Down
2 changes: 1 addition & 1 deletion src/grokcore/view/tests/template/zpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
>>> from zope.component import getMultiAdapter
>>> view = getMultiAdapter((cave, request), name='piepmatz')
>>> print view()
>>> print(view())
<p>Piep! Piep!</p>
"""
Expand Down
4 changes: 2 additions & 2 deletions src/grokcore/view/tests/view/dirtemplate.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
>>> request = TestRequest()
>>> from zope import component
>>> view = component.getMultiAdapter((manfred, request), name='cavepainting')
>>> print view()
>>> print(view())
<html>
<body>
A cave painting.
</body>
</html>
>>> view = component.getMultiAdapter((manfred, request), name='food')
>>> print view()
>>> print(view())
<html>
<body>
ME GROK EAT MAMMOTH!
Expand Down
Loading

0 comments on commit cfea895

Please sign in to comment.