File tree Expand file tree Collapse file tree 3 files changed +14
-6
lines changed Expand file tree Collapse file tree 3 files changed +14
-6
lines changed Original file line number Diff line number Diff line change 6
6
env :
7
7
- FLASK_VERSION=0.9 REDIS_VERSION=2.6.2
8
8
- FLASK_VERSION=0.9 REDIS_VERSION=2.7.4
9
+ - FLASK_VERSION=0.9 REDIS_VERSION=2.10.3
9
10
- FLASK_VERSION=0.10 REDIS_VERSION=2.6.2
10
11
- FLASK_VERSION=0.10 REDIS_VERSION=2.7.4
12
+ - FLASK_VERSION=0.10 REDIS_VERSION=2.10.3
11
13
install :
12
14
- " pip install -r requirements.txt"
13
15
- " pip install -I Flask==$FLASK_VERSION"
@@ -19,3 +21,5 @@ matrix:
19
21
env : FLASK_VERSION=0.9 REDIS_VERSION=2.6.2
20
22
- python : " 3.3"
21
23
env : FLASK_VERSION=0.9 REDIS_VERSION=2.7.4
24
+ - python : " 3.3"
25
+ env : FLASK_VERSION=0.9 REDIS_VERSION=2.10.3
Original file line number Diff line number Diff line change 5
5
6
6
class Redis (object ):
7
7
8
- converters = {'port' : int }
9
-
10
8
def __init__ (self , app = None , config_prefix = None ):
11
9
"""
12
10
Constructor for non-factory Flask applications
@@ -29,13 +27,9 @@ def init_app(self, app):
29
27
)
30
28
31
29
self .app .config .setdefault (self .key ('URL' ), 'redis://localhost:6379' )
32
- self .app .config .setdefault (self .key ('DATABASE' ), 0 )
33
30
34
31
db = self .app .config .get (self .key ('DATABASE' ))
35
32
36
- if not str (db ).isdigit () or not isinstance (db , int ):
37
- raise ValueError ('A valid DB must be supplied' )
38
-
39
33
self .connection = connection = RedisClass .from_url (
40
34
self .app .config .get (self .key ('URL' )),
41
35
db = db ,
Original file line number Diff line number Diff line change @@ -32,5 +32,15 @@ def test_custom_prefix(self):
32
32
self .app .config ['DB2_DATABASE' ] = 1
33
33
self .db2_redis .init_app (self .app )
34
34
35
+ self .db3_redis = Redis (config_prefix = 'DB3' )
36
+ self .app .config ['DB3_URL' ] = "redis://localhost:6379"
37
+ self .db3_redis .init_app (self .app )
38
+
39
+ self .db4_redis = Redis (config_prefix = 'DB4' )
40
+ self .app .config ['DB4_URL' ] = "redis://localhost:6379/5"
41
+ self .db4_redis .init_app (self .app )
42
+
35
43
assert self .db1_redis .get ('potato' ) is None
36
44
assert self .db2_redis .get ('potato' ) is None
45
+ assert self .db3_redis .get ('potato' ) is None
46
+ assert self .db4_redis .get ('potato' ) is None
You can’t perform that action at this time.
0 commit comments