コード例 #1
0
def on_topic_update(app, topic=None):
    from services import topicService

    cache.delete_memoized(topicService.topic_by_id, topicService, topic.id)
    cache.delete_memoized(topicService.first_load_artifact_ids, topicService,
                          topic.id, 10)
    es_index_topic(topic.id)
コード例 #2
0
def on_artifact_update(app, artifact=None):
    from services import artifactService

    cache.delete_memoized(artifactService.artifact_by_id, artifactService,
                          artifact.id)
    cache.delete_memoized(artifactService.artifact_by_userid, artifactService,
                          artifact.user_id)
    es_index_artifact(artifact.id)
コード例 #3
0
def on_asset_html5_url_update(app,
                              artifact_id=None,
                              media_file=None,
                              view_url=None):
    from services import artifactService
    from models import ArtifactAsset

    if artifact_id and media_file and view_url:
        db.session.query(ArtifactAsset). \
            filter(ArtifactAsset.artifact_id == artifact_id, ArtifactAsset.media_file == media_file). \
            update({'view_url': view_url})
        db.session.commit()
        cache.delete_memoized(artifactService.artifact_by_id, artifactService,
                              artifact_id)
コード例 #4
0
def on_asset_boxview_url_update(app,
                                artifact_id=None,
                                media_file=None,
                                view_url=None):
    from services import artifactService
    from models import ArtifactAsset

    # print "artifact_asset_view_url_update_signal:", artifact_id, media_file, view_url
    if artifact_id and media_file and view_url:
        boxview_url = show_boxview_uri + "?" + view_url
        db.session.query(ArtifactAsset). \
            filter(ArtifactAsset.artifact_id == artifact_id, ArtifactAsset.media_file == media_file). \
            update({'view_url': boxview_url})
        db.session.commit()
        cache.delete_memoized(artifactService.artifact_by_id, artifactService,
                              artifact_id)
コード例 #5
0
def on_user_deleted(app, user_id=None):
    from services import userService, topicService, artifactService

    cache.delete_memoized(userService.user_by_id, userService, user_id)
    cache.delete_memoized(userService.first_load_artifact_ids, userService,
                          user_id, 10)
    cache.delete_memoized(userService.user_comment_count, userService, user_id)
    es_delete_user(user_id)

    topic_ids = topicService.topic_ids_by_userid(user_id)
    if topic_ids:
        for topic_id in topic_ids:
            cache.delete_memoized(topicService.topic_by_id, topicService,
                                  topic_id)

        cache.delete_memoized(topicService.topic_ids_by_userid, topicService,
                              user_id)

    user_artifact = artifactService.artifact_by_userid(user_id)
    if user_artifact["artifact_ids"]:
        for artifact_id in user_artifact["artifact_ids"]:
            cache.delete_memoized(artifactService.artifact_by_id,
                                  artifactService, artifact_id)

    cache.delete_memoized(artifactService.artifact_by_userid, artifactService,
                          user_id)
コード例 #6
0
def on_user_update(app, user_id=None, user=None):
    from services import userService

    user_id = user_id or user.id
    cache.delete_memoized(userService.user_by_id, userService, user_id)
    es_index_user(user_id)
コード例 #7
0
def on_user_comment_remove(app, comment=None):
    from services import userService

    cache.delete_memoized(userService.user_comment_count, userService,
                          comment.commenter_id)
    es_delete_comment(comment)
コード例 #8
0
def on_user_top_10_artifact_update(app, user_id=None):
    from services import userService

    cache.delete_memoized(userService.first_load_artifact_ids, userService,
                          user_id, 10)
コード例 #9
0
def on_topic_create(app, topic=None):
    from services import topicService

    cache.delete_memoized(topicService.topic_ids_by_userid, topicService,
                          topic.user_id)
    es_index_topic(topic.id)
コード例 #10
0
def on_artifact_praised(app, artifact_id=None, scorer_id=None):
    from services import artifactService

    cache.delete_memoized(artifactService.artifact_praised_by_userid,
                          artifactService, artifact_id, scorer_id)