Exemplo n.º 1
0
class CaveManager2(grok.ViewletManager):
    grok.view(OrderView2)
    grok.name('cave')

    def sort(self, viewlets):
        # Alphabetical-by-name, reversed.
        return sorted(viewlets, reverse=True)
Exemplo n.º 2
0
class LadyViewlet(grok.Viewlet):
    grok.context(Interface)
    grok.viewletmanager(Pot)
    grok.view(FireView)

    def render(self):
        return u"Lady Viewlet"
Exemplo n.º 3
0
class CaveManager(grok.ViewletManager):
    grok.view(OrderView)
    grok.name('cave')
Exemplo n.º 4
0
class CavewomenViewletManagerWithTemplate(grok.ViewletManager):
    grok.name('manage.cavewomenwithtemplate')
    grok.template('mirandaviewletmanager')
    grok.view(Necklace)
Exemplo n.º 5
0
class MirandaViewlet(grok.Viewlet):
    grok.template('mirandaviewlet')
    grok.view(Index)
    grok.viewletmanager(CavewomenViewletManager)
Exemplo n.º 6
0
class CavewomenViewletManager(grok.ViewletManager):
    grok.name('manage.cavewomen')
    grok.view(Index)
Exemplo n.º 7
0
# -*- coding: utf-8 -*-

import grokcore.viewlet as grok
from grokui.base import Header, Footer, Messages, IUIPanel, IGrokUIRealm
from grokcore.message.utils import receive
from zope.browsermenu.interfaces import IBrowserMenu
from zope.authentication.interfaces import IUnauthenticatedPrincipal
from zope.component import getUtility

grok.view(IUIPanel)
grok.context(IGrokUIRealm)
grok.templatedir("templates")


class Banner(grok.Viewlet):
    grok.order(10)
    grok.name('grokui.banner')
    grok.viewletmanager(Header)


class LoginInformation(grok.Viewlet):
    grok.order(20)
    grok.name('grokui.login')
    grok.viewletmanager(Header)

    @property
    def is_authenticated(self):
        """Check, wether we are authenticated.
        """
        return not IUnauthenticatedPrincipal.providedBy(self.request.principal)
Exemplo n.º 8
0
  >>> browser = Browser()
  >>> browser.handleErrors = False
  >>> browser.open("http://localhost/fred/@@boneview")
  Traceback (most recent call last):
  ...
  ContentProviderLookupError: cave

"""

import grokcore.viewlet as grok


class Fred(grok.Context):
    pass


class CaveView(grok.View):
    def render(self):
        return u"Cave"


class BoneView(grok.View):
    pass


grok.view(CaveView)


class CaveManager(grok.ViewletManager):
    grok.name("cave")
Exemplo n.º 9
0
  >>> browser = Browser()
  >>> browser.handleErrors = False
  >>> browser.open("http://localhost/fred/@@boneview")
  Traceback (most recent call last):
  ...
  zope.contentprovider.interfaces.ContentProviderLookupError: cave

"""

import grokcore.viewlet as grok


class Fred(grok.Context):
    pass


class CaveView(grok.View):
    def render(self):
        return u"Cave"


class BoneView(grok.View):
    pass


grok.view(CaveView)


class CaveManager(grok.ViewletManager):
    grok.name('cave')