Update to config.py.example
This commit is contained in:
@@ -110,16 +110,14 @@ try:
|
|||||||
os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = \
|
os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = \
|
||||||
app.config['GCLOUD_APP_CREDENTIALS']
|
app.config['GCLOUD_APP_CREDENTIALS']
|
||||||
except KeyError:
|
except KeyError:
|
||||||
raise SystemExit('GOOGLE_APPLICATION_CREDENTIALS configuration is missing')
|
raise SystemExit('GCLOUD_APP_CREDENTIALS configuration is missing')
|
||||||
|
|
||||||
# Storage backend (GCS)
|
# Storage backend (GCS)
|
||||||
try:
|
try:
|
||||||
os.environ['GCLOUD_PROJECT'] = \
|
os.environ['GCLOUD_PROJECT'] = app.config['GCLOUD_PROJECT']
|
||||||
app.config['GCLOUD_PROJECT']
|
|
||||||
except KeyError:
|
except KeyError:
|
||||||
raise SystemExit('GCLOUD_PROJECT configuration value is missing')
|
raise SystemExit('GCLOUD_PROJECT configuration value is missing')
|
||||||
|
|
||||||
|
|
||||||
# Algolia search
|
# Algolia search
|
||||||
if 'ALGOLIA_USER' in app.config:
|
if 'ALGOLIA_USER' in app.config:
|
||||||
client = algoliasearch.Client(
|
client = algoliasearch.Client(
|
||||||
|
@@ -6,15 +6,11 @@ def notification_parse(notification):
|
|||||||
# notification = dict(a='n')
|
# notification = dict(a='n')
|
||||||
# TODO: finish fixing this
|
# TODO: finish fixing this
|
||||||
activities_collection = app.data.driver.db['activities']
|
activities_collection = app.data.driver.db['activities']
|
||||||
activities_subscriptions_collection = app.data.driver.db['activities-subscriptions']
|
activities_subscriptions_collection = \
|
||||||
|
app.data.driver.db['activities-subscriptions']
|
||||||
users_collection = app.data.driver.db['users']
|
users_collection = app.data.driver.db['users']
|
||||||
nodes_collection = app.data.driver.db['nodes']
|
nodes_collection = app.data.driver.db['nodes']
|
||||||
activity = activities_collection.find_one({'_id': notification['activity']})
|
activity = activities_collection.find_one({'_id': notification['activity']})
|
||||||
# actor = users_collection.find_one({'_id': activity['actor_user']})
|
|
||||||
# Context is optional
|
|
||||||
context_object_type = None
|
|
||||||
context_object_name = None
|
|
||||||
context_object_url = None
|
|
||||||
|
|
||||||
if activity['object_type'] != 'node':
|
if activity['object_type'] != 'node':
|
||||||
return
|
return
|
||||||
@@ -30,7 +26,6 @@ def notification_parse(notification):
|
|||||||
if node['parent']['user'] == g.current_user['user_id']:
|
if node['parent']['user'] == g.current_user['user_id']:
|
||||||
owner = "your {0}".format(node['parent']['node_type'])
|
owner = "your {0}".format(node['parent']['node_type'])
|
||||||
else:
|
else:
|
||||||
|
|
||||||
parent_comment_user = users_collection.find_one(
|
parent_comment_user = users_collection.find_one(
|
||||||
{'_id': node['parent']['user']})
|
{'_id': node['parent']['user']})
|
||||||
owner = "{0}'s {1}".format(parent_comment_user['username'],
|
owner = "{0}'s {1}".format(parent_comment_user['username'],
|
||||||
@@ -51,7 +46,6 @@ def notification_parse(notification):
|
|||||||
'context_object_type': 'node',
|
'context_object_type': 'node',
|
||||||
'context_object': context_object_id,
|
'context_object': context_object_id,
|
||||||
}
|
}
|
||||||
|
|
||||||
subscription = activities_subscriptions_collection.find_one(lookup)
|
subscription = activities_subscriptions_collection.find_one(lookup)
|
||||||
if subscription and subscription['notifications']['web'] == True:
|
if subscription and subscription['notifications']['web'] == True:
|
||||||
is_subscribed = True
|
is_subscribed = True
|
||||||
|
@@ -56,7 +56,7 @@ def validate_token():
|
|||||||
flask.g object, so that permissions and access to a resource can be defined
|
flask.g object, so that permissions and access to a resource can be defined
|
||||||
from it.
|
from it.
|
||||||
|
|
||||||
When the token is succesfully validated, sets `g.current_user` to contain
|
When the token is successfully validated, sets `g.current_user` to contain
|
||||||
the user information.
|
the user information.
|
||||||
|
|
||||||
@returns True iff the user is logged in with a valid Blender ID token.
|
@returns True iff the user is logged in with a valid Blender ID token.
|
||||||
|
@@ -25,8 +25,10 @@ class Development(object):
|
|||||||
|
|
||||||
# Credentials to access project on the Google Cloud where Google Cloud
|
# Credentials to access project on the Google Cloud where Google Cloud
|
||||||
# Storage is enabled (Pillar will automatically create and manage buckets)
|
# Storage is enabled (Pillar will automatically create and manage buckets)
|
||||||
GOOGLE_APPLICATION_CREDENTIALS = os.environ.get(
|
GCLOUD_APP_CREDENTIALS = os.environ.get(
|
||||||
'GOOGLE_APPLICATION_CREDENTIALS', '/data/config/google_app.json')
|
'GOOGLE_APPLICATION_CREDENTIALS', '/data/config/google_app.json')
|
||||||
|
GCLOUD_PROJECT = os.environ.get('GCLOUD_PROJECT', 'blender-cloud')
|
||||||
|
|
||||||
|
|
||||||
# Fill in only if we plan to sign our urls using a the CDN
|
# Fill in only if we plan to sign our urls using a the CDN
|
||||||
CDN_USE_URL_SIGNING = False
|
CDN_USE_URL_SIGNING = False
|
||||||
|
Reference in New Issue
Block a user