I'm using python, django and google app engine and I'm getting the error below. However, bookdescription
is a TextProperty
not a StringProperty
so I don't understand why the multi-line error is happening.
The error is intermittent, sometimes the page will render fine, sometimes not. I'm new to coding so any and all help is very much appreciated!
Model definition looks like this:
class Book(db.Model):
list = db.ReferenceProperty(List)
booktitle = db.StringProperty()
bookauthor = db.StringProperty()
bookdescription = db.TextProperty()
added = db.DateTimeProperty(auto_now_add=True)
Full error:
Property bookdescription is not multi-line
Traceback (most recent call last):
File "/base/python_runtime/python_lib/versions/1/google/appengine/
ext/webapp/__init__.py", line 511, in __call__
handler.get(*groups)
File "/base/data/home/apps/7-books/3.345967110627358311/7books.py",
line 279, in get
self.response.out.write(template.render(path, template_values))
File "/base/python_runtime/python_lib/versions/1/google/appengine/
ext/webapp/template.py", line 81, in render
return t.render(Context(template_dict))
File "/base/python_runtime/python_lib/versions/1/google/appengine/
ext/webapp/template.py", line 121, in wrap_render
return orig_render(context)
File "/base/python_runtime/python_lib/versions/third_party/
django-0.96/django/template/__init__.py", line 168, in render
return self.nodelist.render(context)
File "/base/python_runtime/python_lib/versions/third_party/
django-0.96/django/template/__init__.py", line 705, in render
bits.append(self.render_node(node, context))
File "/base/python_runtime/python_lib/versions/third_party/
django-0.96/django/template/__init__.py", line 718, in render_node
return(node.render(context))
File "/base/python_runtime/python_lib/versions/third_party/
django-0.96/django/template/loader_tags.py", line 82, in render
return compiled_parent.render(context)
File "/base/python_runtime/python_lib/versions/third_party/
django-0.96/django/template/__init__.py", line 168, in render
return self.nodelist.render(context)
File "/base/python_runtime/python_lib/versions/third_party/
django-0.96/django/template/__init__.py", line 705, in render
bits.append(self.render_node(node, context))
File "/base/python_runtime/python_lib/versions/third_party/
django-0.96/django/template/__init__.py", line 718, in render_node
return(node.render(context))
File "/base/python_runtime/python_lib/versions/third_party/
django-0.96/django/template/loader_tags.py", line 23, in render
result = self.nodelist.render(context)
File "/base/python_runtime/python_lib/versions/third_party/
django-0.开发者_运维百科96/django/template/__init__.py", line 705, in render
bits.append(self.render_node(node, context))
File "/base/python_runtime/python_lib/versions/third_party/
django-0.96/django/template/__init__.py", line 718, in render_node
return(node.render(context))
File "/base/python_runtime/python_lib/versions/third_party/
django-0.96/django/template/defaulttags.py", line 99, in render
values = list(values)
File "/base/python_runtime/python_lib/versions/1/google/appengine/
ext/db/__init__.py", line 2012, in next
return self.__model_class.from_entity(self.__iterator.next())
File "/base/python_runtime/python_lib/versions/1/google/appengine/
ext/db/__init__.py", line 1239, in from_entity
instance = cls(None, _from_entity=True, **entity_values)
File "/base/python_runtime/python_lib/versions/1/google/appengine/
ext/db/__init__.py", line 813, in __init__
prop.__set__(self, value)
File "/base/python_runtime/python_lib/versions/1/google/appengine/
ext/db/__init__.py", line 542, in __set__
value = self.validate(value)
File "/base/python_runtime/python_lib/versions/1/google/appengine/
ext/db/__init__.py", line 2453, in validate
raise BadValueError('Property %s is not multi-line' % self.name)
BadValueError: Property bookdescription is not multi-line
Class looks like this:
class Displaylist(webapp.RequestHandler):
def get(self, id):
booklist = List.get_by_id(int(id))
books = booklist.book_set
list = booklist
creator = booklist.user
location = getip(self.request.remote_addr)
tld = gettld(location)
aff = getaff(location)
user = users.get_current_user()
if user:
loginout = users.create_logout_url("/")
username = user.email()
else:
loginout = users.create_login_url("/")
username = ''
template_values = {
'list': list,
'creator': creator,
'books': books,
'email': username,
'loginout': loginout,
'tld': tld,
'aff': aff,
}
path = os.path.join(os.path.dirname(__file__), 'templates/list.html')
self.response.out.write(template.render(path, template_values))
It seems like the runtime environment is somehow referring to a different definition of the Book
model which has bookdescription
defined as a StringProperty
because the error is being raised from the StringProperty.validate()
function.
Do you have the Book
model defined in multiple places by any chance?
精彩评论