示例#1
0
class MultipleJSON(grok.JSON):
    grok.context(zope.interface.Interface)
    grok.require(One)
    grok.require(Two)

    def render(self):
        pass
示例#2
0
class SecondMammothView(grok.JSON):
    grok.context(Mammoth)

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

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

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

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

    grok.require('doesnt.exist')

    @grok.require(Permission)
    def foo(self):
        pass
示例#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'}
示例#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'}
示例#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'}