Re: Help needed for Plone 5
Timo Stollenwerk <tisto-z4DKO/[email protected]>
| Newsgroups | gmane.comp.web.zope.plone.devel |
|---|---|
| Message-ID | <[email protected]> |
Am 15.12.2014 um 08:40 schrieb Yuri: > 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? Because that would mean we would still have two different ways of doing things. We want to clean up the code base. Also we did not want to touch the MailHost code because it is still used by other projects as well. > 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? Please, go ahead and implement this in order to keep backwards compatibility. This would be something very useful. We should just make sure we add a deprecation message to that function. Timo ------------------------------------------------------------------------------ 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