|
@@ -13,7 +13,6 @@ import logging
|
|
|
import whoosh
|
|
|
from flask_whooshee import AbstractWhoosheer
|
|
|
|
|
|
-from flaskbb._compat import text_type
|
|
|
from flaskbb.forum.models import Forum, Topic, Post
|
|
|
from flaskbb.user.models import User
|
|
|
|
|
@@ -35,18 +34,18 @@ class PostWhoosheer(AbstractWhoosheer):
|
|
|
def update_post(cls, writer, post):
|
|
|
writer.update_document(
|
|
|
post_id=post.id,
|
|
|
- username=text_type(post.username),
|
|
|
- modified_by=text_type(post.modified_by),
|
|
|
- content=text_type(post.content)
|
|
|
+ username=str(post.username),
|
|
|
+ modified_by=str(post.modified_by),
|
|
|
+ content=str(post.content)
|
|
|
)
|
|
|
|
|
|
@classmethod
|
|
|
def insert_post(cls, writer, post):
|
|
|
writer.add_document(
|
|
|
post_id=post.id,
|
|
|
- username=text_type(post.username),
|
|
|
- modified_by=text_type(post.modified_by),
|
|
|
- content=text_type(post.content)
|
|
|
+ username=str(post.username),
|
|
|
+ modified_by=str(post.modified_by),
|
|
|
+ content=str(post.content)
|
|
|
)
|
|
|
|
|
|
@classmethod
|
|
@@ -68,18 +67,18 @@ class TopicWhoosheer(AbstractWhoosheer):
|
|
|
def update_topic(cls, writer, topic):
|
|
|
writer.update_document(
|
|
|
topic_id=topic.id,
|
|
|
- title=text_type(topic.title),
|
|
|
- username=text_type(topic.username),
|
|
|
- content=text_type(getattr(topic.first_post, 'content', None))
|
|
|
+ title=str(topic.title),
|
|
|
+ username=str(topic.username),
|
|
|
+ content=str(getattr(topic.first_post, 'content', None))
|
|
|
)
|
|
|
|
|
|
@classmethod
|
|
|
def insert_topic(cls, writer, topic):
|
|
|
writer.add_document(
|
|
|
topic_id=topic.id,
|
|
|
- title=text_type(topic.title),
|
|
|
- username=text_type(topic.username),
|
|
|
- content=text_type(getattr(topic.first_post, 'content', None))
|
|
|
+ title=str(topic.title),
|
|
|
+ username=str(topic.username),
|
|
|
+ content=str(getattr(topic.first_post, 'content', None))
|
|
|
)
|
|
|
|
|
|
@classmethod
|
|
@@ -100,16 +99,16 @@ class ForumWhoosheer(AbstractWhoosheer):
|
|
|
def update_forum(cls, writer, forum):
|
|
|
writer.update_document(
|
|
|
forum_id=forum.id,
|
|
|
- title=text_type(forum.title),
|
|
|
- description=text_type(forum.description)
|
|
|
+ title=str(forum.title),
|
|
|
+ description=str(forum.description)
|
|
|
)
|
|
|
|
|
|
@classmethod
|
|
|
def insert_forum(cls, writer, forum):
|
|
|
writer.add_document(
|
|
|
forum_id=forum.id,
|
|
|
- title=text_type(forum.title),
|
|
|
- description=text_type(forum.description)
|
|
|
+ title=str(forum.title),
|
|
|
+ description=str(forum.description)
|
|
|
)
|
|
|
|
|
|
@classmethod
|
|
@@ -130,16 +129,16 @@ class UserWhoosheer(AbstractWhoosheer):
|
|
|
def update_user(cls, writer, user):
|
|
|
writer.update_document(
|
|
|
user_id=user.id,
|
|
|
- username=text_type(user.username),
|
|
|
- email=text_type(user.email)
|
|
|
+ username=str(user.username),
|
|
|
+ email=str(user.email)
|
|
|
)
|
|
|
|
|
|
@classmethod
|
|
|
def insert_user(cls, writer, user):
|
|
|
writer.add_document(
|
|
|
user_id=user.id,
|
|
|
- username=text_type(user.username),
|
|
|
- email=text_type(user.email)
|
|
|
+ username=str(user.username),
|
|
|
+ email=str(user.email)
|
|
|
)
|
|
|
|
|
|
@classmethod
|