Search code examples
pythongoogle-app-enginelong-integercherrypy

Long not converting to String


I'm trying to get this function working in Google App Engine using Python:

def textarea(id):
    variable = brfsscodegenerator.Variable.get_by_id(int(id))
    varID = variable.key().id()
    textarea = ("<tr><td>" + variable.name + "</td><td>" + variable.year + 
            "</td><td><textarea id='textarea' name='qtext_" + str(varID) + "'>" )
    return textarea

But I get this error (I'm using CherryPy):

TypeError: coercing to Unicode: need string or buffer, long found

I've tested to see that varID is actually returning a number, but it still doesn't seem to want to convert, and I know my quotation marks are in order as well. Any help would be appreciated.


Solution

  • Make sure variable.year is a string or convert it too.