aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcedricbonhomme <devnull@localhost>2012-03-09 08:13:21 +0100
committercedricbonhomme <devnull@localhost>2012-03-09 08:13:21 +0100
commit0e8780ff6ba24cc0b370037e71a9c6aa25bca192 (patch)
tree75cea6d48e04faed448a42562bb9a692af1f8442
parentUpdated revision date. (diff)
downloadnewspipe-0e8780ff6ba24cc0b370037e71a9c6aa25bca192.tar.gz
newspipe-0e8780ff6ba24cc0b370037e71a9c6aa25bca192.tar.bz2
newspipe-0e8780ff6ba24cc0b370037e71a9c6aa25bca192.zip
MongoDB configuration (address, port, username and password) is loaded at launch.
-rwxr-xr-xcfg/pyAggr3g470r.cfg-sample2
-rwxr-xr-xpyAggr3g470r.py2
-rwxr-xr-xutils.py11
3 files changed, 12 insertions, 3 deletions
diff --git a/cfg/pyAggr3g470r.cfg-sample b/cfg/pyAggr3g470r.cfg-sample
index ae749b11..2e90df68 100755
--- a/cfg/pyAggr3g470r.cfg-sample
+++ b/cfg/pyAggr3g470r.cfg-sample
@@ -4,7 +4,7 @@ max_nb_articles = 50
[MongoDB]
address = 127.0.0.1
port = 27017
-username = nickname
+user = username
password = pwd
[mail]
mail_from = pyAggr3g470r@no-reply.com
diff --git a/pyAggr3g470r.py b/pyAggr3g470r.py
index aeb28558..ae7af2d4 100755
--- a/pyAggr3g470r.py
+++ b/pyAggr3g470r.py
@@ -109,7 +109,7 @@ class Root:
def __init__(self):
"""
"""
- self.mongo = mongodb.Articles()
+ self.mongo = mongodb.Articles(utils.MONGODB_ADDRESS, utils.MONGODB_PORT)
def index(self):
"""
diff --git a/utils.py b/utils.py
index 07f39808..2c16f50c 100755
--- a/utils.py
+++ b/utils.py
@@ -72,15 +72,24 @@ try:
except:
config.read("./cfg/pyAggr3g470r.cfg-sample")
path = os.path.abspath(".")
+
+MONGODB_ADDRESS = config.get('MongoDB', 'address')
+MONGODB_PORT = int(config.get('MongoDB', 'port'))
+MONGODB_USER = config.get('MongoDB', 'user')
+MONGODB_PASSWORD = config.get('MongoDB', 'password')
+
sqlite_base = os.path.abspath(config.get('global', 'sqlitebase'))
+
MAX_NB_ARTICLES = int(config.get('global', 'max_nb_articles'))
-DIASPORA_POD = config.get('misc', 'diaspora_pod')
+
mail_from = config.get('mail','mail_from')
mail_to = config.get('mail','mail_to')
smtp_server = config.get('mail','smtp')
username = config.get('mail','username')
password = config.get('mail','password')
+DIASPORA_POD = config.get('misc', 'diaspora_pod')
+
# regular expression to chech URL
url_finders = [ \
re.compile("([0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}|(((news|telnet|nttp|file|http|ftp|https)://)|(www|ftp)[-A-Za-z0-9]*\\.)[-A-Za-z0-9\\.]+)(:[0-9]*)?/[-A-Za-z0-9_\\$\\.\\+\\!\\*\\(\\),;:@&=\\?/~\\#\\%]*[^]'\\.}>\\),\\\"]"), \
bgstack15