[Grok-dev] grokcore.view

Sebastian Ware sebastian at urbantalk.se
Thu Jun 3 07:04:41 EDT 2010


I can confirm your findings. Test code below.

  http://localhost:8080/test
 
outputs: "Default: http://localhost:8080/test/@@/teststatic"

  http://localhost:8080/++skin++spider/test

outputs: "Spider: http://localhost:8080/++skin++spider/test/@@/teststatic"

  http://localhost:8080/++skin++other/test

error: "TypeError: 'NoneType' object is not callable"

import grok

class Teststatic(grok.Application, grok.Container):
    pass
    
class SpiderLayer(grok.IDefaultBrowserLayer):
    grok.skin('spider')

class OtherLayer(grok.IBrowserRequest):
    grok.skin('other')

        
class Index(grok.View):
    def render(self):
        # This works
        return "Default: %s" % self.static()
        
class SpiderIndex(grok.View):
    grok.layer(SpiderLayer)
    grok.name('index')
    
    def render(self):
        # This won't work
        return "Spider: %s" % self.static()
        
class OtherIndex(grok.View):
    grok.layer(OtherLayer)
    grok.name('index')

    def render(self):
        # This won't work
        return "Other: %s" % self.static()


Mvh Sebastian

3 jun 2010 kl. 12.24 skrev Souheil CHELFOUH:

> Ah. I found the error.
> Your skin layer must implement zope.publisher.interfaces.browser
> IDefaultBrowserLayer
> you can inherit from grokcore.view.interfaces.IDefaultBrowserLayer,
> and it will work.
> 
> I'll add the test and some notes, but, this is working as expected.
> 
> Can you confirm this ?
> 
> 2010/6/3 Souheil CHELFOUH <trollfot at gmail.com>:
>> Sebastian, I wrote a test that demonstrate that you were right.
>> In fact, the adaptation of the layer doesn't provide the static folder.
>> I'll try to get that sorted out, today.
>> i'll keep you tuned
>> 
>> 2010/6/3 Sebastian Ware <sebastian at urbantalk.se>:
>>> I was getting excited by your subtle description... ;)
>>> 
>>> Mvh Sebastian
>>> 
>>> 3 jun 2010 kl. 10.29 skrev Souheil CHELFOUH:
>>> 
>>>> Unfortunately no, I didn't get time, yet, to look at your issue. i'll
>>>> find time today, promise
>>>> 
>>>> 2010/6/3 Sebastian Ware <sebastian at urbantalk.se>:
>>>>> Does this by any chance have anything to do with my issue with self.static? :)
>>>>> 
>>>>> Mvh Sebastian
>>>>> 
>>>>> 2 jun 2010 kl. 22.11 skrev Souheil CHELFOUH:
>>>>> 
>>>>>> Hello,
>>>>>> 
>>>>>> I commited a small patch to grokcore.view tonight.
>>>>>> Can anyone release it or grant me the right to do so ?
>>>>>> It's a minor fix but it's an annoying behavior :)
>>>>>> 
>>>>>> - Souheil
>>>>>> _______________________________________________
>>>>>> Grok-dev mailing list
>>>>>> Grok-dev at zope.org
>>>>>> https://mail.zope.org/mailman/listinfo/grok-dev
>>>>> 
>>>>> 
>>> 
>>> 
>> 



More information about the Grok-dev mailing list