Skip to content

Commit

Permalink
Update bot class to work fine with web code entirely removed
Browse files Browse the repository at this point in the history
  • Loading branch information
dmptrluke committed Apr 3, 2015
1 parent d76a54d commit 91ce4ba
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions cloudbot/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@

try:
from cloudbot.web.main import WebInterface
web_installed = True
except ImportError:
WebInterface = None
web_installed = False

logger = logging.getLogger("cloudbot")

Expand Down Expand Up @@ -98,7 +99,7 @@ def __init__(self, loop=asyncio.get_event_loop()):
self.db_base = declarative_base(metadata=self.db_metadata, bind=self.db_engine)

# create web interface
if self.config.get("web", {}).get("enabled", False):
if self.config.get("web", {}).get("enabled", False) and web_installed:
self.web = WebInterface(self)

# set botvars so plugins can access when loading
Expand Down Expand Up @@ -205,7 +206,7 @@ def _init_routine(self):
yield from asyncio.gather(*[conn.connect() for conn in self.connections.values()], loop=self.loop)

# Activate web interface.
if self.config.get("web", {}).get("enabled", False):
if self.config.get("web", {}).get("enabled", False) and web_installed:
self.web.start()

# Run a manual garbage collection cycle, to clean up any unused objects created during initialization
Expand Down
2 changes: 1 addition & 1 deletion cloudbot/web/templates/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ <h4 class="modal-title">About {{ bot_name }}</h4>
<script src="/s/js/bootstrap-sortable.js"></script>
<script>
$(function () {
$('#theme-select').bootstrapThemeSwitcher({'defaultCssFile': '/s/css/bootstrap.min.css', 'excludeBootswatch': 'Paper,Superhero,Simplex,Sandstone,Spacelab'});
$('#theme-select').bootstrapThemeSwitcher({'defaultCssFile': '/s/css/bootstrap.min.css', 'excludeBootswatch': 'Paper,superhero,simplex,Sandstone,Spacelab'});
$().bootstrapThemeSwitcher('loadThemeFromCookie');
$('[data-toggle="tooltip"]').tooltip();
$('[data-toggle="popover"]').popover();
Expand Down

0 comments on commit 91ce4ba

Please sign in to comment.