Skip to content
Browse files

Fixed some deprecation warnings. Code should be compatible with Pytho…

…n 2.5 and Twisted 8.2.0 or later.
  • Loading branch information...
1 parent 63f6cdf commit cc746dbdad6c041db6dcd2b9f8f324d64c36cefd @kkszysiu committed
Showing with 14 additions and 9 deletions.
  1. +3 −2 aztk/api/Contacts.py
  2. +5 −2 aztk/bin/aztk_nanny
  3. +5 −4 aztk/lib/aztk_main.py
  4. +1 −1 aztk/servers/ZSPServer.py
View
5 aztk/api/Contacts.py
@@ -8,7 +8,7 @@
"""
## STD LIBS
import datetime
-import time, md5, re
+import time, hashlib, re
from pprint import pformat
## OUR LIBS
@@ -87,7 +87,8 @@ def handle_username(result):
def do_send(void, address):
return self.app.api.emailer.send('en', 'invite', owner_userid, address, **kwargs)
- hash = md5.md5(result[1]).hexdigest()
+ hash = hashlib.md5(result[1]).hexdigest()
+
kwargs = {
'sender_name': sender_name,
'sender_email': sender_email,
View
7 aztk/bin/aztk_nanny
@@ -12,7 +12,7 @@ Sandbox Hacks by Trey Stout
import sys
sys.path += ['/zoto/aztk', '/zoto/aztk/lib']
-import os, time, aztk_config, socket, signal
+import os, subprocess, time, aztk_config, socket, signal
from twisted.internet import reactor
from twisted.internet.protocol import Factory
from twisted.internet import threads
@@ -321,7 +321,10 @@ if __name__ == "__main__":
else:
# see if another nanny is running
nanny_port = aztk_config.setup.getint('ports', 'nanny')
- pin, pout = os.popen4("/bin/fuser %d/tcp" % nanny_port)
+ #pin, pout = os.popen4("/bin/fuser %d/tcp" % nanny_port)
+ p = subprocess.Popen("/bin/fuser %d/tcp" % nanny_port, shell=True, bufsize=0,
+ stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, close_fds=True)
+ (pin, pout) = (p.stdin, p.stdout)
results = pout.read()
pin.close()
pout.close()
View
9 aztk/lib/aztk_main.py
@@ -126,7 +126,8 @@ def critical(self, msg):
###################
from twisted.python import threadable
from twisted.internet import reactor
-from twisted.names import client
+#from twisted.names import client
+from twisted.internet import base
from AZTKServer import AZTKServer
from AZTKAPI import AZTKAPI
from InstancePackage import ServerInstancePackage, APIInstancePackage
@@ -136,7 +137,7 @@ def critical(self, msg):
## Main Imports ##
##################
try:
- import xmlrpclib, datetime, types, time, gc, random, sha, socket, version
+ import xmlrpclib, datetime, types, time, gc, random, hashlib, socket, version
import twisted, aztk_config, SimplePBProxy
import api
import plugins
@@ -187,7 +188,7 @@ def dump_number(self, value, write):
############################
## Random Seed Generation ##
############################
-random.seed(sha.sha(str(time.time())).hexdigest())
+random.seed(hashlib.sha1(str(time.time())).hexdigest())
#############################
## Setup Twisted Threading ##
@@ -206,7 +207,7 @@ def dump_number(self, value, write):
##################################
## Setup Threaded Name Resolver ##
##################################
-reactor.installResolver(client.ThreadedResolver(reactor))
+reactor.installResolver(base.ThreadedResolver(reactor))
View
2 aztk/servers/ZSPServer.py
@@ -3,7 +3,7 @@
from AZTKServer import AZTKServer
import Image, ImageFile, sys, errors, validation, pprint, md5, time, socket, zsp_packets
from twisted.internet.protocol import Factory
-from twisted.internet.app import Application
+#from twisted.internet.app import Application
from twisted.internet import defer, reactor
from twisted.protocols import basic
from twisted.protocols import policies

0 comments on commit cc746db

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