开发者

How does EmailProperty differ from StringProperty?

开发者 https://www.devze.com 2023-01-07 11:33 出处:网络
How does EmailProperty differ from StringProperty?Consider these two examples: # example 1: store an e-mail addre开发者_如何学Goss in an EmailProperty

How does EmailProperty differ from StringProperty? Consider these two examples:

# example 1: store an e-mail addre开发者_如何学Goss in an EmailProperty
class MyModel(db.Model):
  email_address = db.EmailProperty()
m = MyModel()
m.email_address = db.Email("larry@example.com")

# example 2: store an e-mail address in a StringProperty
class MyModel(db.Model):
  email_address = db.StringProperty()
m = MyModel()
m.email_address = "larry@example.com"


If you call entity.to_xml(), an EmailProperty will come back as gd:email in your entity's Atom representation.

Note that using an EmailProperty does not provide automatic validation of email address formatting.

0

精彩评论

暂无评论...
验证码 换一张
取 消