[ckan-dev] Problem setting up E-mail Notifications

Vitor Baptista vitor at vitorbaptista.com
Tue Nov 19 00:19:50 UTC 2013


Hi all,

I'm trying to set up e-mails notifications. When I run "paster
--plugin=ckan post -c development.ini
/api/action/send_email_notifications", it just hangs in there forever. If I
hit CTRL+C, I get:

Error - <type 'exceptions.KeyboardInterrupt'>:

URL: http://localhost/api/action/send_email_notifications?-c

File '/usr/local/lib/python2.7/dist-packages/weberror/errormiddleware.py',
> line 162 in __call__

  app_iter = self.application(environ, sr_checker)

File '/usr/local/lib/python2.7/dist-packages/webob/dec.py', line 147 in
> __call__

  resp = self.call_func(req, *args, **self.kwargs)

File '/usr/local/lib/python2.7/dist-packages/webob/dec.py', line 208 in
> call_func

  return self.func(req, *args, **kwargs)

File '/usr/local/lib/python2.7/dist-packages/fanstatic/publisher.py', line
> 234 in __call__

  return request.get_response(self.app)

File '/usr/local/lib/python2.7/dist-packages/webob/request.py', line 1053
> in get_response

  application, catch_exc_info=False)

File '/usr/local/lib/python2.7/dist-packages/webob/request.py', line 1022
> in call_application

  app_iter = application(self.environ, start_response)

File '/usr/local/lib/python2.7/dist-packages/webob/dec.py', line 147 in
> __call__

  resp = self.call_func(req, *args, **self.kwargs)

File '/usr/local/lib/python2.7/dist-packages/webob/dec.py', line 208 in
> call_func

  return self.func(req, *args, **kwargs)

File '/usr/local/lib/python2.7/dist-packages/fanstatic/injector.py', line
> 54 in __call__

  response = request.get_response(self.app)

File '/usr/local/lib/python2.7/dist-packages/webob/request.py', line 1053
> in get_response

  application, catch_exc_info=False)

File '/usr/local/lib/python2.7/dist-packages/webob/request.py', line 1022
> in call_application

  app_iter = application(self.environ, start_response)

File '/usr/local/lib/python2.7/dist-packages/beaker/middleware.py', line 73
> in __call__

  return self.app(environ, start_response)

File '/usr/local/lib/python2.7/dist-packages/beaker/middleware.py', line
> 155 in __call__

  return self.wrap_app(environ, session_start_response)

File '/usr/local/lib/python2.7/dist-packages/routes/middleware.py', line
> 131 in __call__

  response = self.app(environ, start_response)

File '/usr/local/lib/python2.7/dist-packages/pylons/wsgiapp.py', line 125
> in __call__

  response = self.dispatch(controller, environ, start_response)

File '/usr/local/lib/python2.7/dist-packages/pylons/wsgiapp.py', line 324
> in dispatch

  return controller(environ, start_response)

File '/usr/lib/ckan/default/src/ckan/ckan/controllers/api.py', line 70 in
> __call__

  return base.BaseController.__call__(self, environ, start_response)

File '/usr/lib/ckan/default/src/ckan/ckan/lib/base.py', line 346 in __call__

  res = WSGIController.__call__(self, environ, start_response)

File '/usr/local/lib/python2.7/dist-packages/pylons/controllers/core.py',
> line 221 in __call__

  response = self._dispatch_call()

File '/usr/local/lib/python2.7/dist-packages/pylons/controllers/core.py',
> line 172 in _dispatch_call

  response = self._inspect_call(func)

File '/usr/local/lib/python2.7/dist-packages/pylons/controllers/core.py',
> line 107 in _inspect_call

  result = self._perform_call(func, args)

File '/usr/local/lib/python2.7/dist-packages/pylons/controllers/core.py',
> line 60 in _perform_call

  return func(**args)

File '/usr/lib/ckan/default/src/ckan/ckan/controllers/api.py', line 173 in
> action

  side_effect_free)

File '/usr/lib/ckan/default/src/ckan/ckan/controllers/api.py', line 862 in
> _get_request_data

  request_data = request.body

File '/usr/lib/ckan/default/src/ckan/ckan/lib/maintain.py', line 81 in
> custom__getattr__

  return __old_getattr__(self, name)

File '/usr/local/lib/python2.7/dist-packages/paste/registry.py', line 137
> in __getattr__

  return getattr(self._current_obj(), attr)

File '/usr/local/lib/python2.7/dist-packages/webob/request.py', line 483 in
> _body__get

  self.make_body_seekable() # we need this to have content_length

File '/usr/local/lib/python2.7/dist-packages/webob/request.py', line 739 in
> make_body_seekable

  self.copy_body()

File '/usr/local/lib/python2.7/dist-packages/webob/request.py', line 762 in
> copy_body

  self.body = self.body_file_raw.read(self.content_length)

KeyboardInterrupt:

CGI Variables
>
>
>                                       [7/4650]
> -------------
>   CKAN_CURRENT_URL: '/api/action/send_email_notifications?-c'
>   CKAN_LANG: 'es'
>   CKAN_LANG_IS_DEFAULT: True
>   CONTENT_LENGTH: '-1'
>   CONTENT_TYPE: 'text/plain; charset=utf-8'
>   HTTP_ACCEPT: 'text/plain;q=1.0, */*;q=0.1'
>   HTTP_HOST: 'localhost'
>   PATH_INFO: '/api/action/send_email_notifications'
>   QUERY_STRING: '-c'
>   REQUEST_METHOD: 'POST'
>   SERVER_NAME: 'localhost'
>   SERVER_PORT: '80'
>   SERVER_PROTOCOL: 'HTTP/1.0'
>
> WSGI Variables
> --------------
>   application: <fanstatic.publisher.Delegator object at 0x46dead0>
>   beaker.cache: <beaker.cache.CacheManager object at 0x46def10>
>   beaker.get_session: <bound method SessionMiddleware._get_session of
> <beaker.middleware.SessionMiddleware object at 0x46deed0>>
>   beaker.session: {'_accessed_time': 1384820105.1413, '_creation_time':
> 1384820105.1413}
>   fanstatic.needed: <fanstatic.core.NeededResources object at 0x4d97390>
>   paste.command_request: True
>   paste.cookies: (<SimpleCookie: >, '')
>   paste.parsed_dict_querystring: (MultiDict([('-c', '')]), '-c')
>   paste.parsed_querystring: ([('-c', '')], '-c')
>   paste.registry: <paste.registry.Registry object at 0x2143990>
>   paste.throw_errors: True
>   pylons.action_method: <bound method ApiController.action of
> <ckan.controllers.api.ApiController object at 0x4d97e90>>
>   pylons.controller: <ckan.controllers.api.ApiController object at
> 0x4d97e90>
>   pylons.environ_config: {'session': 'beaker.session', 'cache':
> 'beaker.cache'}
>   pylons.pylons: <pylons.util.PylonsContext object at 0x4d97d50>
>   pylons.routes_dict: {'action': u'action', 'controller': u'api', 'ver':
> 3, 'logic_function': u'send_email_notifications'}
>   pylons.status_code_redirect: True
>   repoze.who.logger: <logging.Logger object at 0x4c36950>
>   repoze.who.plugins: {'openid': <OpenIdIdentificationPlugin 79914640>,
> 'friendlyform': <FriendlyFormPlugin 74372880>,
> 'ckan.lib.authenticator:UsernamePasswordAuthenticator':
> <ckan.lib.authenticator.UsernamePasswordAuthenticator object at 0x4d92a90>,
> 'auth_tkt': <AuthTktCoo
> kiePlugin 74373776>, 'ckan.lib.authenticator:OpenIDAuthenticator':
> <ckan.lib.authenticator.OpenIDAuthenticator object at 0x4d92a50>}
>   routes.route: <routes.route.Route object at 0x4a71e50>
>   routes.url: <routes.util.URLGenerator object at 0x4d97c50>
>   webob._parsed_query_vars: (GET([('-c', '')]), '-c')
>   webob.adhoc_attrs: {'response': <Response at 0x4d97490 200 OK>,
> 'language': 'en-us'}
>   wsgi process: 'Non-concurrent CGI'
>   wsgiorg.routing_args: (<routes.util.URLGenerator object at 0x4d97c50>,
> {'action': u'action', 'controller': u'api', 'ver': 3, 'logic_function':
> u'send_email_notifications'})
> ------------------------------------------------------------
>             <p>Additionally an error occurred while sending the
> <weberror.reporter.EmailReporter object at 0x4f2b750> report:
>             <pre>Traceback (most recent call last):
>   File
> "/usr/local/lib/python2.7/dist-packages/weberror/errormiddleware.py", line
> 450, in send_report
>     rep.report(exc_data)
>   File "/usr/local/lib/python2.7/dist-packages/weberror/reporter.py", line
> 45, in report
>     server = smtplib.SMTP(self.smtp_server)
>   File "/usr/lib/python2.7/smtplib.py", line 249, in __init__
>     (code, msg) = self.connect(host, port)
>   File "/usr/lib/python2.7/smtplib.py", line 309, in connect
>     self.sock = self._get_socket(host, port, self.timeout)
>   File "/usr/lib/python2.7/smtplib.py", line 284, in _get_socket
>     return socket.create_connection((port, host), timeout)
>   File "/usr/lib/python2.7/socket.py", line 571, in create_connection
>     raise err
> error: [Errno 111] Connection refused
> </pre>
>             </p>
>     <html>
>     <head>
>     <title>Server Error</title>
>
>     </head>
>     <body>
>     <h1>Server Error</h1>
>     An internal server error occurred
>
>     </body>
>     </html>


The e-mail configurations are correct: if I open "paster --plugin=pylons
shell development.ini" and do:

> import ckan.lib.email_notifications as email
> email.get_and_send_notifications_for_all_users()


The notifications are delivered correctly.

I'm at commit f8edc00aa7a0ee5f2c498b4f2bdf48f0cbb86760 (master). What else
could be wrong?

Cheers,

-- 

Vítor Baptista

Developer  |  http://vitorbaptista.com |
LinkedIn<http://www.linkedin.com/in/vitorbaptista>|
@vitorbaptista <http://twitter.com/vitorbaptista>

The Open Knowledge Foundation <http://okfn.org>

*Empowering through Open Knowledge*

http://okfn.org/  |  @okfn <http://twitter.com/okfn>  |  OKF on
Facebook<https://www.facebook.com/OKFNetwork> |
Blog <http://blog.okfn.org/>  |  Newsletter<http://okfn.org/about/newsletter/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20131118/3b7b3661/attachment-0002.html>


More information about the ckan-dev mailing list