Skip to content

Commit

Permalink
Merge branch 'conversations-plugin' into 'master'
Browse files Browse the repository at this point in the history
* conversations-plugin:
  Add option to run plugin migrations for the default plugins
  Remove conversations models from sphinx docs
  Add conversations plugin to requirements.txt
  Small refinements
  Add added hooks to docs
  Remove conversations migration
  Add some more hooks
  Remove more conversations related files and references
  Move conversations related things into a plugin
  • Loading branch information
sh4nks committed Mar 1, 2018
2 parents 30a6c1e + a7314ad commit 32a1f94
Show file tree
Hide file tree
Showing 34 changed files with 267 additions and 1,315 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -139,3 +139,4 @@ whoosh_index
.sass-cache
bower_components
node_modules
.DS_Store
5 changes: 5 additions & 0 deletions docs/hooks.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,13 @@ Template Hooks

.. autofunction:: flaskbb_tpl_before_navigation
.. autofunction:: flaskbb_tpl_after_navigation
.. autofunction:: flaskbb_tpl_before_user_nav_loggedin
.. autofunction:: flaskbb_tpl_after_user_nav_loggedin
.. autofunction:: flaskbb_tpl_before_registration_form
.. autofunction:: flaskbb_tpl_after_registration_form
.. autofunction:: flaskbb_tpl_before_user_details_form
.. autofunction:: flaskbb_tpl_after_user_details_form
.. autofunction:: flaskbb_tpl_profile_settings_menu
.. autofunction:: flaskbb_tpl_profile_sidebar_stats
.. autofunction:: flaskbb_tpl_before_post_author_info
.. autofunction:: flaskbb_tpl_after_post_author_info
14 changes: 0 additions & 14 deletions docs/models.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,20 +62,6 @@ The user modules contains all related models for the users.
:members:


Message Models
--------------

.. module:: flaskbb.message.models

The message modules contains all the related models for the conversations

.. autoclass:: Conversation
:members:

.. autoclass:: Message
:members:


Management Models
-----------------

Expand Down
10 changes: 5 additions & 5 deletions flaskbb/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
redis_store, themes, whooshee)
from flaskbb.forum.views import forum
from flaskbb.management.views import management
from flaskbb.message.views import message
from flaskbb.plugins import spec
from flaskbb.plugins.manager import FlaskBBPluginManager
from flaskbb.plugins.models import PluginRegistry
Expand Down Expand Up @@ -59,6 +58,7 @@
from flaskbb.utils.settings import flaskbb_config
from flaskbb.utils.translations import FlaskBBDomain


logger = logging.getLogger(__name__)


Expand Down Expand Up @@ -162,9 +162,6 @@ def configure_blueprints(app):
app.register_blueprint(
management, url_prefix=app.config["ADMIN_URL_PREFIX"]
)
app.register_blueprint(
message, url_prefix=app.config["MESSAGE_URL_PREFIX"]
)

app.pluggy.hook.flaskbb_load_blueprints(app=app)

Expand Down Expand Up @@ -219,7 +216,6 @@ def configure_extensions(app):
@login_manager.user_loader
def load_user(user_id):
"""Loads the user. Required by the `login` extension."""

user_instance = User.query.filter_by(id=user_id).first()
if user_instance:
return user_instance
Expand Down Expand Up @@ -429,6 +425,10 @@ def load_plugins(app):
except (OperationalError, ProgrammingError) as exc:
logger.debug("Database is not setup correctly or has not been "
"setup yet.", exc_info=exc)
# load plugins even though the database isn't setup correctly
# i.e. when creating the initial database and wanting to install
# the plugins migration as well
app.pluggy.load_setuptools_entrypoints('flaskbb_plugins')
return

for plugin in plugins:
Expand Down
48 changes: 28 additions & 20 deletions flaskbb/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,35 +8,35 @@
:copyright: (c) 2016 by the FlaskBB Team.
:license: BSD, see LICENSE for more details.
"""
import sys
import binascii
import logging
import os
import sys
import time
import requests
import binascii
import traceback
import logging
from datetime import datetime

import click
import click_log
import requests
from celery.bin.celery import CeleryCommand
from werkzeug.utils import import_string
from jinja2 import Environment, FileSystemLoader
from flask import current_app
from flask.cli import FlaskGroup, ScriptInfo, with_appcontext
from sqlalchemy_utils.functions import database_exists
from flask_alembic import alembic_click
from jinja2 import Environment, FileSystemLoader
from sqlalchemy_utils.functions import database_exists
from werkzeug.utils import import_string

from flaskbb import create_app
from flaskbb.extensions import db, whooshee, celery, alembic
from flaskbb.cli.utils import (prompt_save_user, prompt_config_path,
write_config, get_version, FlaskBBCLIError,
EmailType)
from flaskbb.utils.populate import (create_test_data, create_welcome_forum,
create_default_groups,
create_default_settings, insert_bulk_data,
update_settings_from_fixture,
create_latest_db)
from flaskbb.cli.utils import (EmailType, FlaskBBCLIError, get_version,
prompt_config_path, prompt_save_user,
write_config)
from flaskbb.extensions import alembic, celery, db, whooshee
from flaskbb.utils.populate import (create_default_groups,
create_default_settings, create_latest_db,
create_test_data, create_welcome_forum,
insert_bulk_data, run_plugin_migrations,
update_settings_from_fixture)
from flaskbb.utils.translations import compile_translations


Expand Down Expand Up @@ -125,8 +125,10 @@ def flaskbb(ctx):
@click.option("--email", "-e", type=EmailType(),
help="The email address of the user.")
@click.option("--password", "-p", help="The password of the user.")
@click.option("--no-plugins", "-n", default=False, is_flag=True,
help="Don't run the migrations for the default plugins.")
@with_appcontext
def install(welcome, force, username, email, password):
def install(welcome, force, username, email, password, no_plugins):
"""Installs flaskbb. If no arguments are used, an interactive setup
will be run.
"""
Expand Down Expand Up @@ -154,6 +156,10 @@ def install(welcome, force, username, email, password):
click.secho("[+] Creating welcome forum...", fg="cyan")
create_welcome_forum()

if not no_plugins:
click.secho("[+] Installing default plugins...", fg="cyan")
run_plugin_migrations()

click.secho("[+] Compiling translations...", fg="cyan")
compile_translations()

Expand Down Expand Up @@ -187,6 +193,7 @@ def populate(bulk_data, test_data, posts, topics, force, initdb):
if initdb:
click.secho("[+] Initializing database...", fg="cyan")
create_latest_db()
run_plugin_migrations()

if test_data:
click.secho("[+] Adding some test data...", fg="cyan")
Expand Down Expand Up @@ -243,9 +250,10 @@ def upgrade(all_latest, fixture, force):
count = update_settings_from_fixture(
fixture=settings, overwrite_group=force, overwrite_setting=force
)
click.secho("[+] {settings} settings in {groups} setting groups updated.".format(
groups=len(count), settings=sum(len(settings) for settings in count.values())), fg="green"
)
click.secho("[+] {settings} settings in {groups} setting groups "
"updated.".format(groups=len(count), settings=sum(
len(settings) for settings in count.values())
), fg="green")


@flaskbb.command("celery", add_help_option=False,
Expand Down
3 changes: 0 additions & 3 deletions flaskbb/message/__init__.py

This file was deleted.

79 changes: 0 additions & 79 deletions flaskbb/message/forms.py

This file was deleted.

123 changes: 0 additions & 123 deletions flaskbb/message/models.py

This file was deleted.

Loading

0 comments on commit 32a1f94

Please sign in to comment.