Re: Help needed for Plone 5
Yuri <[email protected]>
| Newsgroups | gmane.comp.web.zope.plone.devel |
|---|---|
| Message-ID | <[email protected]> |
Il 13/12/2014 09:07, Timo Stollenwerk ha scritto: > Hi, > > do you want to help making Plone 5 ready for a beta release by working > on some easy tasks? You will also learn some things about how Plone 5 works! > > Here is how it goes: > > The mail control panel has been moved from storing its settings in the > mailhost and portal object to storing the settings in plone.app.registry. > > The old way of setting/getting the mailhost settings was: > > from Products.CMFCore.utils import getToolByName > from zope.component.hooks import getSite > > portal = getSite() > mailhost = getToolByName(portal, 'MailHost') > mailhost.smtp_host = 'localhost' > mailhost.smtp_port = 25 > mailhost.smtp_user_id = '[email protected]' > mailhost.smtp_pass = 'secret' > > portal.email_from_address = 'dummyme-zndaEfzHj/[email protected]' > portal.email_from_name = 'me' > > The new way is: > > from Products.CMFPlone.interfaces import IMailSchema > from plone.registry.interfaces import IRegistry > from zope.component import getUtility > > registry = getUtility(IRegistry) > mail_settings = registry.forInterface(IMailSchema, prefix='plone') > mail_settings.smtp_host = u'localhost' > mail_settings.smtp_port = 25 > mail_settings.smtp_user_id = u'[email protected]' > mail_settings.smtp_pass = u'secret' > mail_settings.email_from_address = '[email protected]' > mail_settings.email_from_name = u'plone@rulez' > Why don't change the MailHost code, so : mailhost.smtp_host = 'localhost' will produce the mail_settings.smtp_host = u'localhost' call? This mean change the smtp_host attribute of the mailhost object to a function that read/write to the correct registry. So no code changes needed. Can upgrade be a problem, with this kind of approach? ------------------------------------------------------------------------------ Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration & more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk