[Twisted-Python] Re: Insecure Jelly exception in daemon mode (John Toohey)
Matthew Sherborne
miracle at slingshot.co.nz
Mon Jul 12 17:20:56 MDT 2004
Turn the data into nice types, with pg you might get PgInt types from
your data, and each row of the database is in a special list & dict type
allowing numeric or nomical access the value of each column.
Easy way:
tosend = []
for row in data:
newRow = tuple([str(item) for item in row])
tosend.append(newRow)
Better way?
Surposing your data is returned as an int, a date/time, an interval
(mx.datetimedelta) and a string...
tosend = []
for myint, mydate, mydelta, mystr in data:
tosend.append((int(myint), packageDate(mydate),
packageDateTimeDelta(mydelta), str(mystr)))
def packageDate(d):
return d.year, d.month, d.day, d.hour, d.minute, d.second
def unpackageDate(d):
from mx.DateTime import DateTime
return DateTime(*d)
I will leave the rest as an exercise for the reader.
See
*http://twisted.sourceforge.net/TwistedDocs-1.2.1alpha1/howto/pb-copyable.html
May God bless you and your family
Matthew Sherborne
www.sherborneinternational.com
*
More information about the Twisted-Python
mailing list