I have a db.Model which has a string property on it, email_type. Now I've the values for type defined in a readonly class. When I save this to the datastore I get the string instead of "Register", it also raises a BadValueError. How do I get it to save as a string, not as a property.
Here's the (slimmed down) code:
class EmailTypes(object):
def __init__(self):
self.__reg = "Register"
self.__news = "NewsLetter"
@property
def Register(self):
return self.__reg
@property
def NewsLetter(self):
return self.__news
class Email(db.Model):
to = db.StringProperty()
email_type = db.StringProperty()
class Example(object)
def do_stuff(self):
e = Email()
e.to = '[email protected]'
# This should be saving as 'Register' not a ref to the objects address
e.email_type = EmailTypes().Register
do = Example()
do.do_stuff()