Let AUTHFILE be absolute path
This commit is contained in:
parent
27bc683f8f
commit
feb8c93737
@ -1,5 +1,4 @@
|
|||||||
from flask import current_app, g
|
from flask import current_app, g
|
||||||
import os
|
|
||||||
|
|
||||||
|
|
||||||
def get_users():
|
def get_users():
|
||||||
@ -9,10 +8,10 @@ def get_users():
|
|||||||
|
|
||||||
current_app.logger.debug('Reading %s for users', authfile)
|
current_app.logger.debug('Reading %s for users', authfile)
|
||||||
|
|
||||||
with current_app.open_resource(os.path.join("..",
|
with current_app.open_resource(authfile) as f:
|
||||||
authfile)) as f:
|
|
||||||
for entry in f:
|
for entry in f:
|
||||||
users.update({tuple(entry.decode('ascii').strip().split(':', 1))})
|
users.update({
|
||||||
|
tuple(entry.decode('ascii').strip().split(':', 1))})
|
||||||
g.users = users
|
g.users = users
|
||||||
current_app.logger.debug(g.users)
|
current_app.logger.debug(g.users)
|
||||||
return g.users
|
return g.users
|
||||||
|
@ -8,7 +8,7 @@ def app():
|
|||||||
app.config.update({
|
app.config.update({
|
||||||
"TESTING": True,
|
"TESTING": True,
|
||||||
"SECRET_KEY": 'Testing',
|
"SECRET_KEY": 'Testing',
|
||||||
"AUTHFILE": 'tests/users-test.txt'
|
"AUTHFILE": '../tests/users-test.txt'
|
||||||
})
|
})
|
||||||
|
|
||||||
# other setup can go here
|
# other setup can go here
|
||||||
|
Loading…
x
Reference in New Issue
Block a user