本文介绍了EmailProperty如何与StringProperty不同?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何 EmailProperty StringProperty 不同?考虑这两个例子:

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

# example 1: store an e-mail address in an EmailProperty
class MyModel(db.Model):
  email_address = db.EmailProperty()
m = MyModel()
m.email_address = db.Email("[email protected]")

# example 2: store an e-mail address in a StringProperty
class MyModel(db.Model):
  email_address = db.StringProperty()
m = MyModel()
m.email_address = "[email protected]"


推荐答案

如果您调用 entity.to_xml(),EmailProperty将以不提供电子邮件地址格式的自动验证。

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

这篇关于EmailProperty如何与StringProperty不同?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-24 01:53