Hi there,

I'm trying to prepend a string to a field.  While, this works:

>>> db(db.person.id>0).update(name = db.person.name + "x")

This does not:

>>> db(db.person.id>0).update(name = "x" + db.person.name)
Traceback (most recent call last):
  File "<string>", line 1, in <fragment>
TypeError: cannot concatenate 'str' and 'Expression' objects

I have found a work-around, but it is pretty ugly:

>>> db(db.person.id>0).update(name = db.person.name[0:0] + "x" + db.person.name)

Does anyone have a better solution?

Thanks
Russell

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.

Reply via email to