Commits

prologic  committed 01aa15a

Fixed use of *args in do/execute in db library
Renamed LJUSTIFY, RJUSTIFY in io.Table module

  • Participants
  • Parent commits 7a9861f
  • Tags 3.3.2

Comments (0)

Files changed (2)

File pymills/db.py

 						sql,
 						str(args),
 						str(kwargs)))
-				self._cu.execute(sql, *args, **kwargs)
+				self._cu.execute(sql, args)
 				fields = self.__getFields__()
 				if fields == []:
 					r = []

File pymills/io.py

 	and add a bunch of rows, then print it.
 	"""
 
-	LJUSTIFY = -1
+	LEFT = -1
 	CENTER = 0
-	RJUSTIFY = 1
+	RIGHT = 1
 
 	def __init__(self, headers):
 		"""Initialize Table Object
 		self._rows = []
 
 		for title, length, justify in headers:
-			if justify == LJUSTIFY:
+			if justify == Table.LEFT:
 				self._header += title.ljust(length)
-			elif justify == CENTER:
+			elif justify == Table.CENTER:
 				self._header += title.center(length)
-			elif justify == RJUSTIFY:
+			elif justify == Table.RIGHT:
 				self._header += title.rjust(length)
 			else:
 				self._header += title.ljust(length)
 
 	def _convert(self, header, value):
 		length, justify = header[1:]
-		if justify == LJUSTIFY:
+		if justify == Table.LEFT:
 			return value.ljust(length)
-		elif justify == CENTER:
+		elif justify == Table.CENTER:
 			return value.center(length)
-		elif justify == RJUSTIFY:
+		elif justify == Table.RIGHT:
 			return value.rjust(length)
 
 	def add(self, row):
 	"""
 
 	headers = [
-		("id", 4, LJUSTIFY),
-		("Name", 10, LJUSTIFY),
-		("Age", 3, LJUSTIFY)]
+		("id", 4, Table.LEFT),
+		("Name", 10, Table.LEFT),
+		("Age", 3, Table.LEFT)]
 	table = Table(headers)
 	table.add([0, "James", 21])
 	print table