Skip to content

Commit 954714f

Browse files
committed
plug cache to app
1 parent fad4fb9 commit 954714f

File tree

5 files changed

+5
-8
lines changed

5 files changed

+5
-8
lines changed

slack_bot/app.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ def create_app(config=None):
3030

3131
redis_store.init_app(app)
3232
cache.init_app(app)
33+
app.cache = cache
3334
app.plugin_modules = plugin_modules
3435

3536
slackbot = SlackBot(app)

slack_bot/plugins/baidumap.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import cPickle as pickle
77
from datetime import datetime
88

9-
from flask import current_app
9+
from flask import current_app as app
1010
import requests
1111

1212
from utils import to_pinyin
@@ -195,7 +195,6 @@ def test(data):
195195

196196

197197
def handle(data):
198-
app = current_app
199198
if app is None:
200199
ak = '18691b8e4206238f331ad2e1ca88357e'
201200
else:

slack_bot/plugins/dianping.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import hashlib
44
from functools import partial
55

6-
from flask import current_app
6+
from flask import current_app as app
77
import requests
88

99
from baidumap import address2geo
@@ -112,7 +112,6 @@ def test(data):
112112

113113

114114
def handle(data):
115-
app = current_app
116115
message = data['message']
117116
if app is None:
118117
appkey = '41502445'

slack_bot/plugins/github_issue.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env python
22
# -*- coding: utf-8 -*-
3-
from flask import current_app
3+
from flask import current_app as app
44
import requests
55

66
description = """
@@ -17,7 +17,6 @@ def test(data):
1717

1818

1919
def handle(data):
20-
app = current_app
2120
org_name = app.config.get('ORG_NAME', 'python-cn')
2221
repos = requests.get(REPO_API.format(org=org_name)).json()
2322
rv = ''

slack_bot/plugins/movie.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# coding=utf-8
22

3-
from flask import current_app
3+
from flask import current_app as app
44
import requests
55
from bs4 import BeautifulSoup
66

@@ -62,7 +62,6 @@ def test(data):
6262

6363

6464
def handle(data):
65-
app = current_app
6665
message = data['message']
6766
if not isinstance(message, unicode):
6867
message = message.decode('utf-8')

0 commit comments

Comments
 (0)