@property
def intro(self):
intros = filter(lambda x:True if x else False,
[self.author,self.publisher,self.price])
return ' / '.join(intros)
这一段代码出错了
报错:
File "F:\O-BOOK\O-BOOK\app\templates\search_result.html", line 1, in top-level template code
{% extends "base.html" %}
File "F:\O-BOOK\O-BOOK\app\templates\base.html", line 97, in top-level template code
{% block content %} {% endblock %}
File "F:\O-BOOK\O-BOOK\app\templates\search_result.html", line 28, in block "content"
{{book.intro}}
File "F:\flasklearn\blog\venv\lib\site-packages\jinja2\environment.py", line 430, in getattr
return getattr(obj, attribute)
File "F:\O-BOOK\O-BOOK\app\view_models\book.py", line 16, in intro
return ' / '.join(intros)
TypeError: sequence item 0: expected str instance, tuple found