class MultipleJSON(grok.JSON): grok.context(zope.interface.Interface) grok.require(One) grok.require(Two) def render(self): pass
class SecondMammothView(grok.JSON): grok.context(Mammoth) def _private(self): return {'should': 'not be registered'} def public(self): return {'will': 'be registered'}
class MammothView(grok.JSON): grok.context(Mammoth) def run(self): return {'me': 'grok'} def another(self): return {'another': 'grok'}
class MissingPermission(grok.JSON): grok.context(zope.interface.Interface) grok.require('doesnt.exist') @grok.require(Permission) def foo(self): pass
class MammothView(grok.JSON): grok.context(Mammoth) def run(self): return {'me': 'grok'} def public(self): return {'public': 'only availble on the default layer'}
class AnotherMammothView(grok.JSON): grok.context(Mammoth) grok.layer(IMyJSONLayer) def run(self): return {'shadows': 'run on the default layer'} def another(self): return {'another': 'only available on my json layer'}
class YetAnotherMammothView(grok.JSON): grok.context(Mammoth) grok.layer(IMySecondJSONLayer) def run(self): return {'shadows': 'run on the IMyJSONLayer layer'} def yetanother(self): return {'another': 'only available on my second json layer'}