Only convert db port if it's there and use asint to do it (better errors if failing)
This commit is contained in:
parent
0ce26c370c
commit
a1eb1f6051
@ -18,7 +18,7 @@ import urllib
|
|||||||
|
|
||||||
import routes
|
import routes
|
||||||
import mongokit
|
import mongokit
|
||||||
from paste.deploy.converters import asbool
|
from paste.deploy.converters import asint
|
||||||
from webob import Request, exc
|
from webob import Request, exc
|
||||||
|
|
||||||
from mediagoblin import routing, util, models, storage, staticdirect
|
from mediagoblin import routing, util, models, storage, staticdirect
|
||||||
@ -114,7 +114,9 @@ class MediaGoblinApp(object):
|
|||||||
|
|
||||||
def paste_app_factory(global_config, **app_config):
|
def paste_app_factory(global_config, **app_config):
|
||||||
# Get the database connection
|
# Get the database connection
|
||||||
port = int(app_config.get('db_port'))
|
port = app_config.get('db_port')
|
||||||
|
if port:
|
||||||
|
port = asint(port)
|
||||||
connection = mongokit.Connection(
|
connection = mongokit.Connection(
|
||||||
app_config.get('db_host'), port)
|
app_config.get('db_host'), port)
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@ import os
|
|||||||
|
|
||||||
import mongokit
|
import mongokit
|
||||||
from paste.deploy.loadwsgi import NicerConfigParser
|
from paste.deploy.loadwsgi import NicerConfigParser
|
||||||
|
from paste.deploy.converters import asint
|
||||||
|
|
||||||
from mediagoblin import storage, models
|
from mediagoblin import storage, models
|
||||||
from mediagoblin.celery_setup import setup_celery_from_config
|
from mediagoblin.celery_setup import setup_celery_from_config
|
||||||
@ -67,8 +68,11 @@ def setup_self(setup_globals_func=setup_globals):
|
|||||||
settings_module=OUR_MODULENAME,
|
settings_module=OUR_MODULENAME,
|
||||||
set_environ=False)
|
set_environ=False)
|
||||||
|
|
||||||
|
port = mgoblin_section.get('db_port')
|
||||||
|
if port:
|
||||||
|
port = asint(port)
|
||||||
connection = mongokit.Connection(
|
connection = mongokit.Connection(
|
||||||
mgoblin_section.get('db_host'), mgoblin_section.get('db_port'))
|
mgoblin_section.get('db_host'), port)
|
||||||
db = connection[mgoblin_section.get('db_name', 'mediagoblin')]
|
db = connection[mgoblin_section.get('db_name', 'mediagoblin')]
|
||||||
models.register_models(connection)
|
models.register_models(connection)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user