Hi there.

I get the following error only on production: BadRequestError: BLOB, 
ENITY_PROTO or TEXT properties must be in a raw_property field

It happens when I put() a instance of the Receipt class (extends ndb.Model)

Below, I attach the model and the handler where the code breaks (only in 
production)


class Receipt(RModel):
ownerId = ndb.IntegerProperty()
houseId = ndb.IntegerProperty()
renterId = ndb.IntegerProperty()
 year = ndb.IntegerProperty()
month_number = ndb.IntegerProperty()
 code = ndb.StringProperty()
description = ndb.StringProperty()
value = ndb.StringProperty()

owner = ndb.ComputedProperty(lambda self: Owner.get_by_id(self.ownerId))
house = ndb.ComputedProperty(lambda self: House.get_by_id(self.houseId))
renter = ndb.ComputedProperty(lambda self: Renter.get_by_id(self.renterId))
month = ndb.ComputedProperty(lambda self: 
month_number_to_string(self.month_number))


class RModel(ndb.Model):
created = ndb.DateTimeProperty(auto_now_add = True)
changed = ndb.DateTimeProperty(auto_now_add = True)
creatorId = ndb.IntegerProperty()
changerId = ndb.IntegerProperty()

#def to_dict(self):
# return ndb.to_dict(self, {'id':self.key().id()})

def set_attributes(self, **attrs):
props = self.properties()
for prop in props.values():
if prop.name in attrs:
prop.__set__(self, attrs[prop.name])


class ReceiptNew(BaseHandler):
def Get(self):
user_id = self.get_user_id()
owner = Owner.get_by_id(user_id)
receipt = Receipt(value="")
houses = list(House.gql("where ownerId = :1", owner.key.id()))
renters = list(Renter.gql("where ownerId = :1", owner.key.id()))
context = {'receipt': receipt, 'houses': houses, 'renters': renters, 'new': 
True}
self.render_response('receipt-edit.html', **context)

def post(self):
user_id = self.get_user_id()
owner = Owner.get_by_id(user_id)

data = {
'year': self.request.get('year'),
'month': self.request.get('month'),
'house': self.request.get('house'),
'renter': self.request.get('renter'),
'value': self.request.get('value'),
'paid': self.request.get('paid')
}

receipt = Receipt()
receipt.year = int(data.get('year'))
receipt.month_number = int(data.get('month'))
receipt.houseId = int(data.get('house'))
receipt.renterId = int(data.get('renter'))
receipt.value = data.get('value')
receipt.ownerId = owner.key.id()
receipt.put() # code breaks here, only in production
self.redirect('/receipts')

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-appengine/-/GALrTUBIhTsJ.
To post to this group, send email to google-appengine@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to