Ning Sun avatar Ning Sun committed 3c71f54

code reorganized

Comments (0)

Files changed (3)


 from bottle import Bottle, mako_view, request, debug, redirect
-from pymongo import Connection
 import random
-def load_config():
-    c = ConfigParser.RawConfigParser()
-    return c
+from common import config,dbconn
-config = load_config()
-dbconn = Connection(config.get('MongoDB', 'mongo_host'), config.getint('MongoDB', 'mongo_port'))
-dbconn.chrino.authenticate(config.get('MongoDB', 'mongo_username'), config.get('MongoDB', 'mongo_password'))
 MAX_CITIES = dbconn.chrino.cities.count()
 cityapp = Bottle()
+import ConfigParser
+from pymongo import Connection
+def load_config():
+    c = ConfigParser.RawConfigParser()
+    return c
+config = load_config()
+dbconn = Connection(config.get('MongoDB', 'mongo_host'), config.getint('MongoDB', 'mongo_port'))
+dbconn.chrino.authenticate(config.get('MongoDB', 'mongo_username'), config.get('MongoDB', 'mongo_password'))


 from bottle import Bottle, request, redirect, debug, mako_view, redirect, run
 from openid.consumer import consumer
 from import filestore
-from pymongo import Connection as mongo
-def load_config():
-    config = ConfigParser.RawConfigParser()
-    return config
+from common import config,dbconn as m
-config = load_config()
-m = mongo(config.get('MongoDB', 'mongo_host'), config.getint('MongoDB', 'mongo_port'))
-m.chrino.authenticate(config.get('MongoDB', 'mongo_username'), config.get('MongoDB', 'mongo_password'))
 userapp = Bottle()
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.