app.py: Need to pass in port number as 'int'
authorSebastian Spaeth <Sebastian@SSpaeth.de>
Sun, 8 May 2011 09:12:38 +0000 (11:12 +0200)
committerSebastian Spaeth <Sebastian@SSpaeth.de>
Sun, 8 May 2011 09:12:38 +0000 (11:12 +0200)
When we configured an explicite db_port in mediagoblin.ini, paster would
crash claiming that the port number must be an int. Given that we don't
have a "get_conf_int()" function or something similar (yet?), simply
convert the port number to int before passing it to the mongo Connection
instance.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
mediagoblin/app.py

index e93e0c4e31e62c3bf7ec2bc38c67addd5bac3147..5c094f382029960e1afeb3a59954a4bc49bbdea5 100644 (file)
@@ -114,8 +114,9 @@ class MediaGoblinApp(object):
 
 def paste_app_factory(global_config, **app_config):
     # Get the database connection
+    port = int(app_config.get('db_port'))
     connection = mongokit.Connection(
-        app_config.get('db_host'), app_config.get('db_port'))
+        app_config.get('db_host'), port)
 
     # Set up the storage systems.
     public_store = storage.storage_system_from_paste_config(