[Zope3-Users] practical example of migrating from services to
utilities
Duncan McGreggor
duncan.mcgreggor at gmail.com
Tue Aug 9 09:13:13 EDT 2005
On Aug 8, 2005, at 2:52 PM, Andreas Reuleaux wrote:
>> Here's the modified example that I'd want to check if I am doing
>> correctly:
>>
>> def alternateViews(self):
>> browser_menu = zapi.getUtility(IBrowserMenu, 'alternate_views')
>> return browser_menu.getMenuItems(self.context, self.request)
>>
>> Am I doing this properly?
>> ...
>
> I haven't tried your solution
>
> zapi.getUtility(IBrowserMenu, 'alternate_views')
>
> (I doubt it works)
Well, to get the code, I traced through what the old version did (line
by line) and what the new version does, and when I tested it on
Philipp's code, it worked...
> but I had the same problem some time ago, and
> Philipp had pointed out to me that there are simpler solutions now -
> both of them worked fine for me (his original e-mail to me in German
> below, the English translation is mine):
Wow -- thanks for taking the time to translate that :-) Very cool of
you. Good info, too.
d
More information about the Zope3-users
mailing list