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

    def render(self):
        pass
コード例 #2
0
ファイル: view_lookup.py プロジェクト: gyst/grokcore.json
class SecondMammothView(grok.JSON):
    grok.context(Mammoth)

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

    def public(self):
        return {'will': 'be registered'}
コード例 #3
0
ファイル: view_lookup.py プロジェクト: gyst/grokcore.json
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
ファイル: json_layers.py プロジェクト: gyst/grokcore.json
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
ファイル: json_layers.py プロジェクト: gyst/grokcore.json
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
ファイル: json_layers.py プロジェクト: gyst/grokcore.json
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'}