Excerpts from Bzouchir's message of Wed Aug 11 10:16:21 -0300 2010:
> hi guys,
> I am trying to setup TurboMail 3 with Pylons 1.0
>
> Followed the docs
> http://packages.python.org/TurboMail/chapters/detailed.html#pylons
>
> I have added this to the development.ini
>
> ******************
> [DEFAULT]
> ...
> mail.on = true
> mail.manager = immediate
> mail.transport = smtp
> mail.smtp.server = localhost
>
> ******************
>
> and my app_globals.py looks like:
>
>
> ******************
> """The application's Globals object"""
>
> from beaker.cache import CacheManager
> from beaker.util import parse_cache_config_options
>
> class Globals(object):
>
> def __init__(self, config):
> self.cache =
> CacheManager(**parse_cache_config_options(config))
>
> from turbomail.adapters import tm_pylons
> tm_pylons.start_extension()
> ******************
>
> My controller has this method:
>
>
> ******************
> def submit(self):
> message = Message("[email protected]", "[email protected]", "Hello
> World")
> message.plain = "TurboMail is really easy to use."
> message.send()
> ******************
>
>
> The problem is that I am getting this error when message.send() is
> been called:
>
> MailNotEnabledException: An attempt was made to use a facility of the
> TurboMail framework but outbound mail hasn't been enabled in the
> config file [via mail.on]
>
> I don't know what am I missing here? It all seems right according to
> the docs!
>
> Thanks
>
I have it working (TurboMail 3.0.3)
This is my app_globals:
******************
"""The application's Globals object"""
from beaker.cache import CacheManager
from beaker.util import parse_cache_config_options
class Globals(object):
"""Globals acts as a container for objects available throughout the
life of the application
"""
def __init__(self, config):
"""One instance of Globals is created during application
initialization and is available during requests via the
'app_globals' variable
"""
self.cache = CacheManager(**parse_cache_config_options(config))
from turbomail.adapters import tm_pylons
tm_pylons.start_extension(config)
******************
I also recall (or at least I think I remember doing it) modifying the adapter
source code and adding the "config" option:
******************
/TurboMail-3.0.3-py2.6/turbomail/adapters/tm_pylons.py
def start_extension(config):
# There is no guarantee that atexit calls shutdown but Pylons does not
# provide other mechanisms!
atexit.register(shutdown_extension)
# interface.start will exit immediately if TurboMail is not enabled.
interface.start(FakeConfigObj(config))
******************
I think that's all I did.
Mariano
--
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/pylons-discuss?hl=en.