Commit 40e83ab4 authored by Andreas Jung's avatar Andreas Jung

- using isinstance() instead of type(..) == type(...)

parent cbcfbd1f
...@@ -241,6 +241,7 @@ if swhome != 'INSERT_SOFTWARE_HOME': ...@@ -241,6 +241,7 @@ if swhome != 'INSERT_SOFTWARE_HOME':
import os, sys, getopt, codecs, string import os, sys, getopt, codecs, string
from types import StringType, IntType
# workaround to allow unicode encoding conversions in DTML # workaround to allow unicode encoding conversions in DTML
dummy = codecs.lookup('iso-8859-1') dummy = codecs.lookup('iso-8859-1')
...@@ -352,7 +353,7 @@ def server_info(old, v, offset=0): ...@@ -352,7 +353,7 @@ def server_info(old, v, offset=0):
v=v+offset v=v+offset
except: raise 'Invalid port', v except: raise 'Invalid port', v
if type(old) is type(0): old=[(a,v)] if isinstance(old, IntType): old=[(a,v)]
else: old.append((a,v)) else: old.append((a,v))
return old return old
...@@ -624,7 +625,7 @@ try: ...@@ -624,7 +625,7 @@ try:
# HTTP Server # HTTP Server
if HTTP_PORT: if HTTP_PORT:
if type(HTTP_PORT) is type(0): HTTP_PORT=((IP_ADDRESS, HTTP_PORT),) if isinstance(HTTP_PORT, IntType): HTTP_PORT=((IP_ADDRESS, HTTP_PORT),)
for address, port in HTTP_PORT: for address, port in HTTP_PORT:
hs = zhttp_server( hs = zhttp_server(
ip=address, ip=address,
...@@ -650,7 +651,7 @@ try: ...@@ -650,7 +651,7 @@ try:
# WebDAV source Server (runs HTTP, but munges request to return # WebDAV source Server (runs HTTP, but munges request to return
# 'manage_FTPget'). # 'manage_FTPget').
if WEBDAV_SOURCE_PORT: if WEBDAV_SOURCE_PORT:
if type(WEBDAV_SOURCE_PORT) is type(0): if isinstance(WEBDAV_SOURCE_PORT, IntType):
WEBDAV_SOURCE_PORT=((IP_ADDRESS, WEBDAV_SOURCE_PORT),) WEBDAV_SOURCE_PORT=((IP_ADDRESS, WEBDAV_SOURCE_PORT),)
for address, port in WEBDAV_SOURCE_PORT: for address, port in WEBDAV_SOURCE_PORT:
hs = zhttp_server( hs = zhttp_server(
...@@ -685,7 +686,7 @@ try: ...@@ -685,7 +686,7 @@ try:
# FTP Server # FTP Server
if FTP_PORT: if FTP_PORT:
if type(FTP_PORT) is type(0): FTP_PORT=((IP_ADDRESS, FTP_PORT),) if isinstance(FTP_PORT, IntType): FTP_PORT=((IP_ADDRESS, FTP_PORT),)
for address, port in FTP_PORT: for address, port in FTP_PORT:
FTPServer( FTPServer(
module=MODULE, module=MODULE,
...@@ -732,7 +733,7 @@ try: ...@@ -732,7 +733,7 @@ try:
zLOG.LOG("z2", zLOG.WARNING, 'Monitor server not started' zLOG.LOG("z2", zLOG.WARNING, 'Monitor server not started'
' because no emergency user exists.') ' because no emergency user exists.')
if pw: if pw:
if type(MONITOR_PORT) is type(0): if ininstance(MONITOR_PORT, IntType):
MONITOR_PORT=((IP_ADDRESS, MONITOR_PORT),) MONITOR_PORT=((IP_ADDRESS, MONITOR_PORT),)
for address, port in MONITOR_PORT: for address, port in MONITOR_PORT:
monitor=secure_monitor_server( monitor=secure_monitor_server(
...@@ -741,7 +742,7 @@ try: ...@@ -741,7 +742,7 @@ try:
port=port) port=port)
if ICP_PORT: if ICP_PORT:
if type(ICP_PORT) is type(0): ICP_PORT=((IP_ADDRESS, ICP_PORT),) if instrance(ICP_PORT, IntType): ICP_PORT=((IP_ADDRESS, ICP_PORT),)
from ZServer.ICPServer import ICPServer from ZServer.ICPServer import ICPServer
for address, port in ICP_PORT: for address, port in ICP_PORT:
ICPServer(address,port) ICPServer(address,port)
...@@ -791,10 +792,10 @@ try: ...@@ -791,10 +792,10 @@ try:
try: UID = string.atoi(UID) try: UID = string.atoi(UID)
except: pass except: pass
gid = None gid = None
if type(UID) == type(""): if instance(UID, StringType):
uid = pwd.getpwnam(UID)[2] uid = pwd.getpwnam(UID)[2]
gid = pwd.getpwnam(UID)[3] gid = pwd.getpwnam(UID)[3]
elif type(UID) == type(1): elif instance(UID, IntType):
uid = pwd.getpwuid(UID)[2] uid = pwd.getpwuid(UID)[2]
gid = pwd.getpwuid(UID)[3] gid = pwd.getpwuid(UID)[3]
UID = pwd.getpwuid(UID)[0] UID = pwd.getpwuid(UID)[0]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment