Skip to content
Browse files

* config: disabled the printing of a misleading exception.

* gather: fixed a bug where a non-keyword capable db would still be accessed
          like if it had the functionality.
* mongodb: all the known connection params should work now.
  • Loading branch information...
1 parent b2e9e00 commit 840a94cda0ed5486ebc766ed0ebd926d2b4b6301 @coh2 coh2 committed
Showing with 10 additions and 10 deletions.
  1. +2 −2 pastycake/config.py
  2. +4 −2 pastycake/gather.py
  3. +4 −6 pastycake/mongodb_backend.py
View
4 pastycake/config.py
@@ -27,8 +27,8 @@ def _do_load(package, section_name, epname):
try:
return load_entry_point(package, section_name, epname)
except ImportError as e:
- print >> sys.stderr, 'failed to load entry point %s: %s' % (epname,
- e)
+ #print >> sys.stderr, 'failed to load entry point %s: %s' % (
+ # epname, e)
return None
if not section_name:
View
6 pastycake/gather.py
@@ -74,8 +74,10 @@ def _load_conf(args=None):
conf['backend'] = _backend_or_exit(conf['backend'])
backend = conf['backend']
- for _ in conf['keywords']:
- backend.enable_keyword(_ if not hasattr(_, '__call__') else _.__name__)
+ if isinstance(backend, KeywordStorage):
+ for _ in conf['keywords']:
+ backend.enable_keyword(_ if not hasattr(_, '__call__')
+ else _.__name__)
conf['modefunc'](conf)
View
10 pastycake/mongodb_backend.py
@@ -15,11 +15,9 @@ class MongoBackend(StorageBackend):
DEFAULT_PORT = 27017
DEFAULT_DB = 'pastycake'
- def __init__(self, db_name=DEFAULT_DB, host=DEFAULT_HOST,
- port=DEFAULT_PORT):
- self._db_name = db_name
- self._host = host
- self._port = port
+ def __init__(self, kwargs):
+ self._mongo_kwargs = kwargs
+ self._db_name = kwargs.get('db_name', self.DEFAULT_DB)
self._connected = False
def already_visited_url(self, url):
@@ -48,7 +46,7 @@ def _do_save_url(self, url, match_text):
def connect(self):
try:
- self._con = M.Connection(self._host, self._port)
+ self._con = M.Connection(**self._mongo_kwargs)
self._db = self._con[self._db_name]
self._connected = True
except M.errors.PyMongoError as e:

0 comments on commit 840a94c

Please sign in to comment.
Something went wrong with that request. Please try again.