update to python3

This commit is contained in:
Nils Schneider 2012-06-05 17:40:21 +02:00
parent 9a2b79cb60
commit 33ba6a6d33
3 changed files with 5 additions and 16 deletions

View file

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python3
# TODO # TODO
# Gatewayliste # Gatewayliste
@ -36,4 +36,4 @@ db.import_wikigps("http://freifunk.metameute.de/Knoten")
m = GeoMapBuilder(db) m = GeoMapBuilder(db)
print(m.build().encode("utf8")) print(m.build())

View file

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python3
# TODO # TODO
# Gatewayliste # Gatewayliste

View file

@ -3,18 +3,7 @@ from node import Node
from link import Link from link import Link
from bs4 import BeautifulSoup from bs4 import BeautifulSoup
# Python2/3 compatiblity hacks
try:
from urllib.request import urlopen from urllib.request import urlopen
except ImportError:
from urllib import urlopen
try:
basestring
except NameError:
basestring = str
class NodeDB: class NodeDB:
def __init__(self): def __init__(self):
@ -170,7 +159,7 @@ class NodeDB:
data = [] data = []
def maybe_strip(x): def maybe_strip(x):
if isinstance(x.string, basestring): if isinstance(x.string, str):
return x.string.strip() return x.string.strip()
else: else:
return "" return ""