BadRequestError: BLOB, ENITY_PROTO or TEXT property concise_topics must be in a raw_property field
<p>Here is the code for my model. </p>

<pre><code>from google.appengine.ext import ndb
from modules.admin.models.Author import Author
from modules.hod.models.Concept import Concept


class Post(ndb.Model):
    author_key = ndb.KeyProperty(kind=Author)
    content = ndb.StringProperty(indexed=False)
    created = ndb.DateTimeProperty(auto_now_add=True)
    title = ndb.StringProperty(indexed=True)
    topics = ndb.StructuredProperty(Concept, repeated=True)

    def get_important_topics(self):
        return filter(lambda x: x.occurrences &gt; 1, self.topics)

    concise_topics = ndb.ComputedProperty(get_important_topics, repeated=True)
</code></pre>

<p>Here is the route which creates the model.</p>

<pre><code>@admin_home_routes.route('/SavePost', methods=['POST'])
@authenticate_admin
def save_new_post():
    post_data = request.form['newpost']
    new_post = Post(parent=posts_key())
    author = get_author_by_email(users.get_current_user().email())
    if len(author) &gt; 0:
        new_post.author_key = author[0].key
    else:
        author = Author(parent=author_key())
        author.email = users.get_current_user().email()
        author.name = users.get_current_user().email()
        author.identity = users.get_current_user().user_id()
        key = author.put()
        new_post.author_key = key
    new_post.content = post_data
    concepts = get_topics(post_data)
    _concepts = []
    if len(concepts) &gt; 0:
        for concept in concepts['concepts']:
            temp_concept = Concept(name=concept['concept'], occurrences=concept['occurrences'])
            _concepts.append(temp_concept)
    new_post.topics = _concepts
    new_post.put()
    return redirect('/Admin/Posts')
</code></pre>

<p>The error I get is </p>

<pre><code>WARNING  2016-09-19 20:44:47,227 urlfetch_stub.py:540] Stripped prohibited headers from URLFetch request: ['Host', 'Content-Length']
WARNING  2016-09-19 10:44:48,937 tasklets.py:468] suspended generator _put_tasklet(context.py:358) raised BadRequestError(BLOB, ENITY_PROTO or TEXT property concise_topics must be in a raw_property field)
WARNING  2016-09-19 10:44:48,937 tasklets.py:468] suspended generator put(context.py:824) raised BadRequestError(BLOB, ENITY_PROTO or TEXT property concise_topics must be in a raw_property field)
ERROR    2016-09-19 10:44:48,941 app.py:1587] Exception on /Admin/SavePost [POST]
Traceback (most recent call last):
  File "C:\Code\zion-alpha\lib\flask\app.py", line 1988, in wsgi_app
    response = self.full_dispatch_request()
  File "C:\Code\zion-alpha\lib\flask\app.py", line 1641, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "C:\Code\zion-alpha\lib\flask\app.py", line 1544, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "C:\Code\zion-alpha\lib\flask\app.py", line 1639, in full_dispatch_request
    rv = self.dispatch_request()
  File "C:\Code\zion-alpha\lib\flask\app.py", line 1625, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "C:\Code\zion-alpha\modules\admin\decorators\authentication.py", line 16, in authenticate_and_call
    return func(*args, **kwargs)
  File "C:\Code\zion-alpha\modules\admin\routes\admin_routes.py", line 72, in save_new_post
    new_post.put()
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\ext\ndb\model.py", line 3451, in _put
    return self._put_async(**ctx_options).get_result()
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\ext\ndb\tasklets.py", line 383, in get_result
    self.check_success()
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\ext\ndb\tasklets.py", line 427, in _help_tasklet_along
    value = gen.throw(exc.__class__, exc, tb)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\ext\ndb\context.py", line 824, in put
    key = yield self._put_batcher.add(entity, options)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\ext\ndb\tasklets.py", line 427, in _help_tasklet_along
    value = gen.throw(exc.__class__, exc, tb)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\ext\ndb\context.py", line 358, in _put_tasklet
    keys = yield self._conn.async_put(options, datastore_entities)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\ext\ndb\tasklets.py", line 513, in _on_rpc_completion
    result = rpc.get_result()
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\api\apiproxy_stub_map.py", line 613, in get_result
    return self.__get_result_hook(self)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\datastore\datastore_rpc.py", line 1881, in __put_hook
    self.check_rpc_success(rpc)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\datastore\datastore_rpc.py", line 1373, in check_rpc_success
    raise _ToDatastoreError(err)
BadRequestError: BLOB, ENITY_PROTO or TEXT property concise_topics must be in a raw_property field
INFO     2016-09-19 20:44:49,036 module.py:788] default: "POST /Admin/SavePost HTTP/1.1" 500 291
INFO     2016-09-19 20:45:04,424 module.py:402] [default] Detected file changes:
</code></pre>

<p>I would use <code>_pre_put_hook</code> instead of <code>ComputedProperty</code></p>

<pre><code>topics = ndb.StructuredProperty(Concept, repeated=True)
concise_topics = ndb.StructuredProperty(Concept, repeated=True)

def _pre_put_hook(self):
    self.concise_topics = filter(lambda x: x.occurrences &gt; 1, self.topics)
</code></pre>

python python-2.7 google-app-engine