[Grok-dev] Re: issue #226555: viewlet.url() and how to solve it

Kevin Smith kevin at mcweekly.com
Thu May 8 16:04:11 EDT 2008


Leonardo Rochael Almeida wrote:
> On Thu, May 8, 2008 at 4:39 PM, Jan-Wijbrand Kolman
> <janwijbrand at gmail.com> wrote:
>   
>> Leonardo Rochael Almeida wrote:
>>     
>>> On Thu, May 8, 2008 at 3:48 PM, Kevin Smith <kevin at mcweekly.com> wrote:
>>>       
>>>> [...]
>>>> class ViewletBase(BrowserView):
>>>>  """Viewlet adapter class used in meta directive as a mixin class."""
>>>>
>>>>  zope.interface.implements(interfaces.IViewlet)
>>>>
>>>>  def __init__(self, context, request, view, manager):
>>>>      super(ViewletBase, self).__init__(context, request)
>>>>      self.__parent__ = view
>>>>      self.context = context
>>>>      self.request = request
>>>>      self.manager = manager
>>>>
>>>> Looks like __parent__ is the view, and manager is the viewletmanager....
>>>> I'm
>>>> not sure the viewlet is actually accessible here at all.
>>>>         
>>> The viewlet is accessible as "self" :-) the view is
>>> self.__parent__.__parent__, right?
>>>       
>> I would say, self.__parent__ is the view the viewlet was registered for.
>>     
>
> Ah, yes, of course
>   
Looks like a viewlet wart. You and I expect the __parent__ of a viewlet 
to be it's viewletmanager .  That makes a good case for 'view' being the 
view, 'viewlet' being the viewlet, and 'manager' being the viewletmanager.


> _______________________________________________
> Grok-dev mailing list
> Grok-dev at zope.org
> http://mail.zope.org/mailman/listinfo/grok-dev
>
>
>   
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/grok-dev/attachments/20080508/1d7cfdbb/attachment-0001.html


More information about the Grok-dev mailing list