J
Jon Bowlas
Hi listers,
I wrote this script in Zope some time ago and it worked for a while, but now
I'm getting the following error:
TypeError: coercing to Unicode: need string or buffer, NoneType found
Here's my script:
results = context.module_retriever().tuples() # call to ZSQLMethod
converted = []
for result in results:
result = list(result) # make a list from the tuple
for i in range(len(result)):
# for each element in the listified tuple, make decode to a
# unicode from the latin-1 string
result = unicode(result, 'latin-1')
converted.append(tuple(result)) # tuplify again
return converted
Where module_retriever is a simple Z SQL method that returns a module title
and a module code.
So results = context.module_retriever().tuples() returns:
[('Developmental Neurobiology', 'ANAT2008'), ('Neuroanatomy',
'ANAT2009'),('etc...', 'etc..'),..]So I was hoping someone might be able to
identify what I've done wrong here. It is a little mistifying as to why it's
suddenly stopped working though.CheersJon
I wrote this script in Zope some time ago and it worked for a while, but now
I'm getting the following error:
TypeError: coercing to Unicode: need string or buffer, NoneType found
Here's my script:
results = context.module_retriever().tuples() # call to ZSQLMethod
converted = []
for result in results:
result = list(result) # make a list from the tuple
for i in range(len(result)):
# for each element in the listified tuple, make decode to a
# unicode from the latin-1 string
result = unicode(result, 'latin-1')
converted.append(tuple(result)) # tuplify again
return converted
Where module_retriever is a simple Z SQL method that returns a module title
and a module code.
So results = context.module_retriever().tuples() returns:
[('Developmental Neurobiology', 'ANAT2008'), ('Neuroanatomy',
'ANAT2009'),('etc...', 'etc..'),..]So I was hoping someone might be able to
identify what I've done wrong here. It is a little mistifying as to why it's
suddenly stopped working though.CheersJon