Commits

Jason R. Coombs committed c9b9d37

Updated to work with jaraco.util 4.0+

Comments (0)

Files changed (3)

jaraco/site/charts.py

 from jaraco.site import output, render
 from genshi import XML
 import itertools
-from jaraco.util.iter_ import flatten
+from jaraco.util.itertools import flatten
 import random
 
 def get_random_data_pairs():
-	range = (0,20)
+	range = (0, 20)
 	while True:
 		yield random.randint(*range), random.randint(*range)
 
 def get_data_set():
 	"get 10-15 datapoints"
-	return itertools.islice(get_random_data_pairs(), random.randint(1, 10)+5)
+	return itertools.islice(get_random_data_pairs(), random.randint(1, 10) + 5)
 
 class Charts(object):
 	@cherrypy.expose
 			y_title_text_direction = 'bt',
 		))
 		# add a few random datasets
-		for n in range(1,4):
+		for n in range(1, 4):
 			g.add_data(dict(
 				data = flatten(get_data_set()),
 				title = 'series %d' % n,

jaraco/site/controllers.py

 import urllib2
 import binascii
 import codecs
-from jaraco.util import PasswordGenerator
+from jaraco.util import auth
 from jaraco.site.charts import Charts
 from jaraco.site.openid import OpenID
 from jaraco.site import render, output
 		from jaraco.site.sysadmin import NTUser
 		try:
 			if not new_password:
-				raise ValueError, "Blank passwords not allowed"
+				raise ValueError("Blank passwords not allowed")
 			if not new_password == new_password_confirm:
-				raise ValueError, "Passwords don't match"
+				raise ValueError("Passwords don't match")
 			nt = NTUser(username, system or '.')
 			nt.reset(old_password, new_password)
 		except ValueError, e:
 			response_messages = ['Password change for %(name)s was successful!' % vars()]
 		return render(response_messages=response_messages)
 
-
 	@cherrypy.expose
 	@output('password gen')
 	def password_gen(self, length=None):
 		password = None
+
 		class userstr(str): pass
 		if length:
-			newpass = PasswordGenerator.make_password(int(length), encoding=None)
+			newpass = auth.PasswordGenerator.make_password(int(length), encoding=None)
 			password = userstr(binascii.b2a_hex(newpass))
 			password.alternatives = []
 			for encoding in ('base-64',):
 				encoded, newlen = codecs.getencoder(encoding)(password)
 				password.alternatives.append((encoded, encoding))
 		else:
-			length=8
+			length = 8
 		return render(password=password, length=length)
 
 class IPTool(object):
 
 
 Root.acctmgmt = AcctMgmt()
-Root.ip = IPTool()
+Root.ip = IPTool()
 		"lxml >= 2.1.2",
 		"isapi-wsgi >= 0.4",
 		"svg.charts",
+		'jaraco.util>=4.0',
 	],
 	zip_safe=False,
 	packages=find_packages(),