Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
157 commits
Select commit Hold shift + click to select a range
3806d17
2to3-3.4
perkinslr Feb 11, 2016
1a84e14
implements -> @implementer
perkinslr Feb 11, 2016
92586a1
implements -> @implementer
perkinslr Feb 11, 2016
cda8e9a
implements -> @implementer
perkinslr Feb 11, 2016
157e9e6
[].sort(k)->[].stort(key=k)
perkinslr Feb 11, 2016
82d04c7
[].sort(k)->[].stort(key=k)
perkinslr Feb 11, 2016
28985aa
__builtin__ -> __builtins__
perkinslr Feb 11, 2016
e27eb19
__builtin__ -> builtins
perkinslr Feb 11, 2016
7b7629d
cStringIO -> io.StringIO
perkinslr Feb 11, 2016
297b586
remove FileTransfer (based on pb)
perkinslr Feb 11, 2016
ba24e0e
remove FileTransfer (based on pb)
perkinslr Feb 11, 2016
ab81fcf
remove FileTransfer (based on pb)
perkinslr Feb 11, 2016
eff328b
remove microdom use
perkinslr Feb 11, 2016
61afe42
inevow
perkinslr Feb 11, 2016
c7d8454
inevow->iformless
perkinslr Feb 11, 2016
3884d2d
remove microdom flatteners
perkinslr Feb 11, 2016
9e260ee
create types.NoneType
perkinslr Feb 11, 2016
1acd899
remove long
perkinslr Feb 11, 2016
882303f
fix itertools
perkinslr Feb 11, 2016
177bf23
fix _sorter
perkinslr Feb 11, 2016
fdb7d25
perkinslr Feb 11, 2016
cf0e2ba
perkinslr Feb 11, 2016
cd96c01
perkinslr Feb 11, 2016
ed28cb3
fixed stupid 2to3 unicode issues
perkinslr Feb 11, 2016
530cd29
perkinslr Feb 11, 2016
84ab05e
more stupid unicode issues
perkinslr Feb 11, 2016
4b75ee1
more stupid unicode issues
perkinslr Feb 11, 2016
e43adc5
more stupid unicode issues
perkinslr Feb 11, 2016
edd33ae
more stupid unicode issues
perkinslr Feb 11, 2016
6751993
next is now a builtin function
perkinslr Feb 11, 2016
fc3a1ec
pass None context to render_liveglue
perkinslr Feb 11, 2016
366992e
more stupid unicode issues
perkinslr Feb 11, 2016
d92f3f5
more stupid unicode issues
perkinslr Feb 11, 2016
04bed30
more stupid unicode issues
perkinslr Feb 11, 2016
1b129d6
more stupid unicode issues
perkinslr Feb 11, 2016
e3fce56
more stupid unicode issues
perkinslr Feb 11, 2016
0859a14
perkinslr Feb 11, 2016
cc073e6
unicode issues + remove support for oldstyle classes
perkinslr Feb 11, 2016
ae8ddb3
more stupid unicode issues
perkinslr Feb 11, 2016
a009d4f
more stupid unicode issues
perkinslr Feb 11, 2016
e51161a
file -> open
perkinslr Feb 11, 2016
51ff2a4
more stupid unicode issues
perkinslr Feb 11, 2016
feba60f
more stupid unicode issues
perkinslr Feb 11, 2016
1ab3b18
more stupid unicode issues
perkinslr Feb 11, 2016
60d2a20
more stupid unicode issues
perkinslr Feb 11, 2016
ccf5bcb
more stupid unicode issues
perkinslr Feb 11, 2016
a504c13
more stupid unicode issues
perkinslr Feb 11, 2016
2af728e
more stupid unicode issues
perkinslr Feb 11, 2016
5ae9b69
more stupid unicode issues
perkinslr Feb 11, 2016
b38390e
more stupid unicode issues
perkinslr Feb 11, 2016
bb28ec1
more stupid unicode issues
perkinslr Feb 11, 2016
020dbd0
more stupid unicode issues
perkinslr Feb 11, 2016
d80b10f
more stupid unicode issues
perkinslr Feb 11, 2016
61c40e2
more stupid unicode issues
perkinslr Feb 11, 2016
43f5ec8
more stupid unicode issues
perkinslr Feb 11, 2016
1ca9907
more stupid unicode issues
perkinslr Feb 11, 2016
f4e8b9d
more stupid unicode issues
perkinslr Feb 11, 2016
24b13c9
more stupid unicode issues
perkinslr Feb 11, 2016
165525c
more stupid unicode issues
perkinslr Feb 11, 2016
6eee43d
more stupid unicode issues
perkinslr Feb 11, 2016
e7d052c
more stupid unicode issues
perkinslr Feb 11, 2016
a59b36a
more stupid unicode issues
perkinslr Feb 11, 2016
ddf6a3b
more stupid unicode issues
perkinslr Feb 11, 2016
10d1566
more stupid unicode issues
perkinslr Feb 11, 2016
d73d2ae
more stupid unicode issues
perkinslr Feb 11, 2016
2a496d9
more stupid unicode issues
perkinslr Feb 11, 2016
ae2b929
more stupid unicode issues
perkinslr Feb 11, 2016
e9f3740
more stupid unicode issues
perkinslr Feb 11, 2016
a08b177
more stupid unicode issues
perkinslr Feb 11, 2016
8bd3875
more stupid unicode issues
perkinslr Feb 11, 2016
2a4b5d8
more stupid unicode issues
perkinslr Feb 11, 2016
edb5ce2
more stupid unicode issues
perkinslr Feb 11, 2016
d4ab53c
more stupid unicode issues
perkinslr Feb 11, 2016
cbf82e3
more stupid unicode issues
perkinslr Feb 11, 2016
64ad9d2
more stupid unicode issues
perkinslr Feb 11, 2016
53e74bd
more stupid unicode issues
perkinslr Feb 11, 2016
b80a056
more stupid unicode issues
perkinslr Feb 11, 2016
8c26178
more stupid unicode issues
perkinslr Feb 11, 2016
c28a655
more stupid unicode issues
perkinslr Feb 11, 2016
7ceadfc
more stupid unicode issues
perkinslr Feb 11, 2016
597b83d
more stupid unicode issues
perkinslr Feb 11, 2016
cd47c62
more stupid unicode issues
perkinslr Feb 11, 2016
5ee8bc7
more stupid unicode issues
perkinslr Feb 11, 2016
7117ead
more stupid unicode issues
perkinslr Feb 11, 2016
4cd76c3
more stupid unicode issues
perkinslr Feb 11, 2016
8731405
more stupid unicode issues
perkinslr Feb 11, 2016
e492e74
more stupid unicode issues
perkinslr Feb 11, 2016
cc0cf7e
more stupid unicode issues
perkinslr Feb 11, 2016
5a738ea
more stupid unicode issues
perkinslr Feb 11, 2016
f6f9808
more stupid unicode issues
perkinslr Feb 11, 2016
f27fc1d
more stupid unicode issues
perkinslr Feb 11, 2016
d5e2c89
more stupid unicode issues
perkinslr Feb 11, 2016
c3e0ee4
more stupid unicode issues
perkinslr Feb 11, 2016
c40b23d
more stupid unicode issues
perkinslr Feb 11, 2016
769164d
more stupid unicode issues
perkinslr Feb 11, 2016
7832ff8
more stupid unicode issues
perkinslr Feb 11, 2016
de20dd2
more stupid unicode issues
perkinslr Feb 11, 2016
51ba698
more stupid unicode issues
perkinslr Feb 11, 2016
35b39f2
more stupid unicode issues
perkinslr Feb 11, 2016
c1ebc04
more stupid unicode issues
perkinslr Feb 11, 2016
f92e008
more stupid unicode issues
perkinslr Feb 11, 2016
a45fa02
more stupid unicode issues
perkinslr Feb 11, 2016
af9c80a
more stupid unicode issues
perkinslr Feb 11, 2016
e2ed60d
more stupid unicode issues
perkinslr Feb 11, 2016
d9c73a3
more stupid unicode issues
perkinslr Feb 11, 2016
3548dc9
more stupid unicode issues
perkinslr Feb 11, 2016
54590b4
more stupid unicode issues
perkinslr Feb 11, 2016
9d8850c
more stupid unicode issues
perkinslr Feb 11, 2016
58d95ed
more stupid unicode issues
perkinslr Feb 11, 2016
8dbcd37
more stupid unicode issues
perkinslr Feb 11, 2016
a296c70
more stupid unicode issues
perkinslr Feb 11, 2016
cd43f58
more stupid unicode issues
perkinslr Feb 11, 2016
b2203e2
more stupid unicode issues
perkinslr Feb 11, 2016
2e1b998
more stupid unicode issues
perkinslr Feb 11, 2016
d5d1cfe
more stupid unicode issues
perkinslr Feb 11, 2016
d5305db
more stupid unicode issues
perkinslr Feb 11, 2016
ec0562a
more stupid unicode issues
perkinslr Feb 11, 2016
0239389
more stupid unicode issues
perkinslr Feb 11, 2016
e03d7ca
more stupid unicode issues
perkinslr Feb 11, 2016
19db1e2
more stupid unicode issues
perkinslr Feb 11, 2016
62cabd7
more stupid unicode issues
perkinslr Feb 11, 2016
b1e08ae
more stupid unicode issues
perkinslr Feb 11, 2016
0e4308b
more stupid unicode issues
perkinslr Feb 11, 2016
b737a67
more stupid unicode issues
perkinslr Feb 11, 2016
5f14508
more stupid unicode issues
perkinslr Feb 11, 2016
f1960b1
more stupid unicode issues
perkinslr Feb 11, 2016
a6677e5
more stupid unicode issues
perkinslr Feb 11, 2016
adedf83
more stupid unicode issues
perkinslr Feb 11, 2016
fa1131a
more stupid unicode issues
perkinslr Feb 11, 2016
64700bd
more stupid unicode issues
perkinslr Feb 11, 2016
4c2ade1
more stupid unicode issues
perkinslr Feb 11, 2016
fd9bdf1
more stupid unicode issues
perkinslr Feb 11, 2016
f313263
more stupid unicode issues
perkinslr Feb 11, 2016
dd16b22
more stupid unicode issues
perkinslr Feb 11, 2016
113f393
more stupid unicode issues
perkinslr Feb 11, 2016
51b28e9
more stupid unicode issues
perkinslr Feb 11, 2016
9322b64
more stupid unicode issues
perkinslr Feb 11, 2016
b9b91dc
more stupid unicode issues
perkinslr Feb 11, 2016
32ed80e
more stupid unicode issues
perkinslr Feb 11, 2016
900b237
more stupid unicode issues
perkinslr Feb 11, 2016
24a2f1f
remove debugging prints
perkinslr Feb 11, 2016
6e4abb8
hacks to make more parts run on py3
Mar 4, 2016
ec7f814
more stuff to support py3
perkinslr Mar 23, 2016
72e25c2
more stuff to support py3
perkinslr Mar 23, 2016
72ba79b
more stuff to support py3
perkinslr Mar 23, 2016
859cabc
extend timeout
perkinslr Mar 30, 2016
5d0e7a4
extend timeout
perkinslr Mar 30, 2016
f2dd526
explicitly pass event object for firefox
perkinslr Jun 24, 2016
2d96fc2
guess at file encoding
perkinslr Jun 29, 2016
a15e8df
guess at file encoding
perkinslr Jun 29, 2016
d9daae2
guess at file encoding
perkinslr Jun 29, 2016
48e6370
add event to event handlers
perkinslr Jun 29, 2016
7e16640
more py3 fixes
perkinslr Oct 17, 2016
026f7b1
Update loaders.py
perkinslr Jul 4, 2017
8351539
Update athena.py
perkinslr Jul 4, 2017
dc68842
Update json.py
perkinslr Jul 4, 2017
69c7a64
Update json.py
perkinslr Jul 4, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions benchmarks/json_string_tokenizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def postOptions(self):
self['scale'] = int(self['scale'])


BASE = u'Hello, world. "Quotes".'
BASE = 'Hello, world. "Quotes".'
def benchmark(iterations, scale):
"""
Deserialize a string C{iterations} times. Make the string longer based
Expand All @@ -32,10 +32,10 @@ def benchmark(iterations, scale):
"""
s = serialize(BASE * scale)
before = time()
for i in xrange(iterations):
for i in range(iterations):
parse(s)
after = time()
print (after - before) / iterations, 'per call'
print((after - before) / iterations, 'per call')



Expand Down
16 changes: 8 additions & 8 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@
master_doc = 'index'

# General information about the project.
project = u'Nevow'
copyright = u'2014, Twisted developers'
project = 'Nevow'
copyright = '2014, Twisted developers'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
Expand Down Expand Up @@ -205,8 +205,8 @@
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
('index', 'Nevow.tex', u'Nevow Documentation',
u'Twisted developers', 'manual'),
('index', 'Nevow.tex', 'Nevow Documentation',
'Twisted developers', 'manual'),
]

# The name of an image file (relative to this directory) to place at the top of
Expand Down Expand Up @@ -235,8 +235,8 @@
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'nevow', u'Nevow Documentation',
[u'Twisted developers'], 1)
('index', 'nevow', 'Nevow Documentation',
['Twisted developers'], 1)
]

# If true, show URL addresses after external links.
Expand All @@ -249,8 +249,8 @@
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
('index', 'Nevow', u'Nevow Documentation',
u'Twisted developers', 'Nevow', 'One line description of project.',
('index', 'Nevow', 'Nevow Documentation',
'Twisted developers', 'Nevow', 'One line description of project.',
'Miscellaneous'),
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
class EchoElement(LiveElement):

docFactory = xmlfile(sibpath(__file__, 'template.html'))
jsClass = u'EchoThing.EchoWidget'
jsClass = 'EchoThing.EchoWidget'

def say(self, message):
self.callRemote('addText', message)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def makeChatter(self):
class ChatterElement(LiveElement):

docFactory = xmlfile(sibpath(__file__, 'template.html'))
jsClass = u'ChatThing.ChatterWidget'
jsClass = 'ChatThing.ChatterWidget'

def __init__(self, room):
self.room = room
Expand Down
6 changes: 3 additions & 3 deletions examples/advanced_manualform/advanced_manualform.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def redirectAfterPost(aspects):
magicCookie = str(now())
refpath = refpath.replace('_nevow_carryover_', magicCookie)
_CARRYOVER[magicCookie] = C = tpc.Componentized()
for k, v in aspects.iteritems():
for k, v in aspects.items():
C.setComponent(k, v)
request.redirect(str(refpath))
from nevow import static
Expand Down Expand Up @@ -99,8 +99,8 @@ class Page(ManualFormMixin, rend.Page):
def form_post_btn1(self, what=None):
# 'what' is a keyword argument, and must be the same name that you
# give to the widget.
print "btn1:", what
print("btn1:", what)

def form_post_btn2(self, what=None):
# see above for 'what'.
print "btn2:", what
print("btn2:", what)
4 changes: 2 additions & 2 deletions examples/athenademo/benchmark.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

from __future__ import division


from twisted.python import filepath

Expand Down Expand Up @@ -31,7 +31,7 @@ def render_body(self, ctx, data):
yield top

class InitializationBenchmark(athena.LiveFragment):
jsClass = u'Nevow.Benchmarks.InitializationBenchmark'
jsClass = 'Nevow.Benchmarks.InitializationBenchmark'

docFactory = loaders.stan(
tags.div(render=tags.directive('liveFragment'))[
Expand Down
4 changes: 4 additions & 0 deletions examples/athenademo/calculator.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@

<table class="calculator" id="calculator" n:pattern="CalculatorPattern" n:render="liveElement"
xmlns:athena="http://divmod.org/ns/athena/0.7">
<div n:render="subcalc"> test </div>

<div class="subcalc" id="subcalc" n:pattern="subcalcPattern" n:render="liveElement" xmlns:athena="http://divmod.org/ns/athena/0.7"><athena:handler event="onclick" handler="subclicked" />hello world</div>

<tr>
<td colspan="4" class="output" id="output">0</td>
</tr>
Expand Down
3 changes: 3 additions & 0 deletions examples/athenademo/calculator.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ CalculatorDemo.Calculator.methods(
/**
* Handle click events on any of the calculator buttons.
*/
function subclicked(self, node){
alert(10);
},
function buttonClicked(self, node) {
var symbol = node.value;
d = self.callRemote("buttonClicked", symbol);
Expand Down
24 changes: 18 additions & 6 deletions examples/athenademo/calculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from nevow.athena import LivePage, LiveElement, expose
from nevow.loaders import xmlfile
from nevow.appserver import NevowSite
from nevow.page import renderer

# Handy helper for finding external resources nearby.
sibling = FilePath(__file__).sibling
Expand All @@ -28,8 +29,8 @@ class Calculator(object):
entered into the calculator. For example, if the buttons '3', '5', and
'+' have been pressed (in that order), C{expression} will be C{'35+'}.
"""
defaultExpression = u'0'
errorExpression = u'E'
defaultExpression = '0'
errorExpression = 'E'

def __init__(self):
self.expression = self.defaultExpression
Expand Down Expand Up @@ -57,7 +58,7 @@ def buttonClicked(self, symbol):
# Evaluate the expression
if symbol == '=':
try:
self.expression = unicode(eval(self.expression))
self.expression = str(eval(self.expression))
except ZeroDivisionError:
self.expression = self.errorExpression
return self.expression
Expand All @@ -69,6 +70,13 @@ def buttonClicked(self, symbol):
return self.expression


class SubCal(LiveElement):
docFactory = xmlfile(sibling('calculator.html').path, 'subcalcPattern')

jsClass = u"CalculatorDemo.Calculator"
def __init__(self, par):
self.setFragmentParent(par)


class CalculatorElement(LiveElement):
"""
Expand All @@ -94,7 +102,10 @@ def __init__(self, calc):
LiveElement.__init__(self)
self.calc = calc


@renderer
def subcalc(self, *args):
return SubCal(self)

def buttonClicked(self, symbol):
"""
Accept a symbol from the browser, perform input validation on it,
Expand Down Expand Up @@ -123,7 +134,7 @@ def __init__(self, *a, **kw):
# Update the mapping of known JavaScript modules so that the
# client-side code for this example can be found and served to the
# browser.
self.jsModules.mapping[u'CalculatorDemo'] = sibling(
self.jsModules.mapping['CalculatorDemo'] = sibling(
'calculator.js').path


Expand All @@ -135,12 +146,13 @@ def render_calculator(self, ctx, data):
c.setFragmentParent(self)
return c




def main():
log.startLogging(sys.stdout)
site = NevowSite(CalculatorParentPage(calc=Calculator()))
reactor.listenTCP(8080, site)
reactor.listenTCP(8081, site)
reactor.run()


Expand Down
18 changes: 9 additions & 9 deletions examples/athenademo/typeahead.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
from formless import annotate, webform
from twisted.python import util

animals = {u'elf' : u'Pointy ears. Bad attitude regarding trees.',
u'chipmunk': u'Cute. Fuzzy. Sings horribly.',
u'chupacabra': u'It sucks goats.',
u'ninja': u'Stealthy and invisible, and technically an animal.',
animals = {'elf' : 'Pointy ears. Bad attitude regarding trees.',
'chipmunk': 'Cute. Fuzzy. Sings horribly.',
'chupacabra': 'It sucks goats.',
'ninja': 'Stealthy and invisible, and technically an animal.',
}


Expand All @@ -26,18 +26,18 @@ class TypeAheadFieldFragment(athena.LiveFragment):
])

def loadDescription(self, typed):
if typed == u'':
return None, u'--'
if typed == '':
return None, '--'
matches = []
for key in animals:
if key.startswith(typed):
matches.append(key)
if len(matches) == 1:
return matches[0], animals[matches[0]]
elif len(matches) > 1:
return None, u"(Multiple found)"
return None, "(Multiple found)"
else:
return None, u'--'
return None, '--'
athena.expose(loadDescription)

class DataEntry(rend.Page):
Expand Down Expand Up @@ -75,7 +75,7 @@ def animals(self, animal, description):
return url.here

def data_animals(self, ctx, data):
return animals.keys()
return list(animals.keys())

def child_typeahead(self, ctx):
return TypeAheadPage(None, None)
Expand Down
6 changes: 3 additions & 3 deletions examples/athenademo/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from nevow import athena, loaders, static

class Clock(athena.LiveFragment):
jsClass = u"WidgetDemo.Clock"
jsClass = "WidgetDemo.Clock"

docFactory = loaders.xmlstr('''\
<div xmlns:nevow="http://nevow.com/ns/nevow/0.1"
Expand Down Expand Up @@ -49,7 +49,7 @@ def _oops(self, err):
self.running = False

def updateTime(self):
self.callRemote('setTime', unicode(time.ctime(), 'ascii')).addErrback(self._oops)
self.callRemote('setTime', str(time.ctime(), 'ascii')).addErrback(self._oops)

class WidgetPage(athena.LivePage):
docFactory = loaders.xmlstr("""\
Expand All @@ -73,7 +73,7 @@ class WidgetPage(athena.LivePage):

def __init__(self, *a, **kw):
super(WidgetPage, self).__init__(*a, **kw)
self.jsModules.mapping[u'WidgetDemo'] = util.sibpath(__file__, 'widgets.js')
self.jsModules.mapping['WidgetDemo'] = util.sibpath(__file__, 'widgets.js')

def childFactory(self, ctx, name):
ch = super(WidgetPage, self).childFactory(ctx, name)
Expand Down
12 changes: 6 additions & 6 deletions examples/blogengine/axiomstore.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from iblogengine import IBlog
from zope.interface import implements
from zope.interface import implementer
from axiom import item, store, attributes, sequence
from epsilon.extime import Time

Expand All @@ -24,8 +24,8 @@ def __init__(self, **kw):
def setModified(self):
self.modified = Time()

@implementer(IBlog)
class Blog(item.Item, item.InstallableMixin):
implements(IBlog)

typeName = "BlogengineBlog"
schemaVersion = 1
Expand All @@ -38,10 +38,10 @@ def __init__(self, **kw):
self.posts = sequence.List(store=self.store)
post = Post(store=self.store,
id=self.getNextId(),
author=u'mike',
title=u'FIRST POST!!!!',
category=u'Test',
content=u'I guess it worked.')
author='mike',
title='FIRST POST!!!!',
category='Test',
content='I guess it worked.')
self.addNewPost(post)

def installOn(self, other):
Expand Down
6 changes: 3 additions & 3 deletions examples/blogengine/email_client.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import sys, smtplib

fromaddr = raw_input("From: ")
toaddrs = raw_input("To: ").split(',')
print "Enter message, end with ^D:"
fromaddr = input("From: ")
toaddrs = input("To: ").split(',')
print("Enter message, end with ^D:")
msg = ''
while 1:
line = sys.stdin.readline()
Expand Down
Loading