Re: Help needed for Plone 5
espen <[email protected]>
| Newsgroups | gmane.comp.web.zope.plone.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi... 15. des. 2014 kl. 09:10 skrev Timo Stollenwerk-2 [via Plone] <ml-node+s293351n7573035h38-PKuAHvtXa09l57MIdRCFDg@public.gmane.org>: > 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 = '[hidden email]' > >> mailhost.smtp_pass = 'secret' > >> > >> portal.email_from_address = '[hidden email]' > >> 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'[hidden email]' > >> mail_settings.smtp_pass = u'secret' > >> mail_settings.email_from_address = '[hidden email]' > >> mail_settings.email_from_name = u'plone@rulez' Is this better than using plone.api ? I tcould be done like this: from plone import api someThing = api.portal.get_registry_record(‘ISomeSchema.somefield') ? > >> > > > > 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 > _______________________________________________ > Plone-developers mailing list > [hidden email] > https://lists.sourceforge.net/lists/listinfo/plone-developers > > > If you reply to this email, your message will be added to the discussion below: > http://plone.293351.n2.nabble.com/Help-needed-for-Plone-5-tp7573020p7573035.html > To start a new topic under Core Developers, email ml-node+s293351n293355h58-PKuAHvtXa09l57MIdRCFDg@public.gmane.org > To unsubscribe from Plone, click here. > NAML -- View this message in context: http://plone.293351.n2.nabble.com/Help-needed-for-Plone-5-tp7573020p7573039.html Sent from the Core Developers mailing list archive at Nabble.com. ------------------------------------------------------------------------------ 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 _______________________________________________ Plone-developers mailing list Plone-developers-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org https://lists.sourceforge.net/lists/listinfo/plone-developers