Esempio n. 1
0
class MultipleJSON(grok.JSON):
    grok.context(zope.interface.Interface)
    grok.require(One)
    grok.require(Two)

    def render(self):
        pass
Esempio n. 2
0
class SecondMammothView(grok.JSON):
    grok.context(Mammoth)

    def _private(self):
        return {'should': 'not be registered'}

    def public(self):
        return {'will': 'be registered'}
Esempio n. 3
0
class MammothView(grok.JSON):
    grok.context(Mammoth)

    def run(self):
        return {'me': 'grok'}

    def another(self):
        return {'another': 'grok'}
Esempio n. 4
0
class MissingPermission(grok.JSON):
    grok.context(zope.interface.Interface)

    grok.require('doesnt.exist')

    @grok.require(Permission)
    def foo(self):
        pass
Esempio n. 5
0
class MammothView(grok.JSON):
    grok.context(Mammoth)

    def run(self):
        return {'me': 'grok'}

    def public(self):
        return {'public': 'only availble on the default layer'}
Esempio n. 6
0
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'}
Esempio n. 7
0
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'}