Google App Engine: LinkProperty to string
An embarrisingly simple question, which makes it all the more frustrating: how do I turn a db.LinkProperty into a string on the google app engine.
Suppose I have the following model:
c开发者_Python百科lass MyModel(db.Model):
link = db.LinkProperty()
m = MyModel()
m.link = db.Link("http://www.google.com/")
All I'd like to do is get the value of m.link. However, neither str(m.link) nor unicode(m.link) seems to do the trick.
Any idea?
You don't need to set the property using db.Link, that should happen for you.
The following works for me though:
class Test(db.Model):
link = db.LinkProperty()
t = Test()
t.link = 'http://google.com'
print str(t.link)
精彩评论