speedplane
speedplane

Reputation: 16121

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:

class 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?

Upvotes: 1

Views: 344

Answers (1)

Robert Kluin
Robert Kluin

Reputation: 8292

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)

Upvotes: 3

Related Questions