class MyOtherTile(tiles.Tile): grok.context(IDummyContext) grok.require('dummy.ViewPermission') grok.name('my.tile') grok.title(u"My title") tiles.add_permission('dummy.AddPermission')
class TabBlock(Block): grok.name('tab-content') grok.title('Tabular content') grok.order(21) silvaconf.icon('tabs.png') def __init__(self): self.identifier = unicode(uuid.uuid1())
class MyTile(tiles.PersistentTile): grok.context(IDummyContext) grok.require('dummy.ViewPermission') grok.name('my.tile') grok.title(u"My title") grok.description(u"My description") tiles.add_permission(DummyAddPermission) tiles.schema(IDummySchema)
class MyOtherTile(tiles.Tile): grok.context(IDummyContext) grok.require('dummy.ViewPermission') grok.name('my.tile') grok.title(u"My title") tiles.add_permission('dummy.AddPermission') def render(self): return '<html><body><b>Good bye %s</b></body></html>' % self.id
class Hazard(Base): grok.title("Hazard") portal_type = "hazard" __tablename__ = 'hazards' id = Column('id', String(50), primary_key=True) type = Column('name', String(50)) timespan = Column('category', String(50)) product_id = Column('product_id', Integer, ForeignKey('products.id')) product = relation("Product", backref="hazards") def reindexObject(self, *args, **kwargs): pass
class PresentationPage(contentlayout.Design): grok.name('presentationpage') grok.title('Multi Column Presentation Page') @Lazy def page_title(self): return self.content.get_title() slots = { 'topbox': contentlayout.Slot(css_class='twocolumn'), 'whybox': contentlayout.Slot(css_class='fourcolumn'), 'featuresbox': contentlayout.Slot(css_class='threecolumn listing'), 'aboutbox': contentlayout.Slot(css_class='threecolumn listing') } markers = [INoNavigationLayout]
class Product(Base): grok.title("Product") portal_type = "product" __tablename__ = 'products' id = Column('id', Integer, primary_key=True) name = Column('name', String(50)) product_id = Column('product_id', String(50)) producer_id = Column('producer_id', Integer, ForeignKey('producers.id')) categories = relationship("Category", secondary='products_categories', collection_class=set) def getId(self): return self.name
class Producer(Base): grok.title("Producer") portal_type = "producer" __tablename__ = 'producers' id = Column('id', Integer, primary_key=True) name = Column('name', String(50)) street = Column('street', String(50)) city = Column('city', String(50)) zip = Column('zip', String(50)) www = Column('hompage', String(50)) email = Column('email', String(50)) products = relation("Product", backref="producer") def getId(self): return self.name
class FullPage(contentlayout.Design): grok.name('fullpage') grok.title('Full Page') slots = {'fullpage': contentlayout.Slot(css_class='content')} markers = [INoNavigationLayout]
class DummyAddPermission(grok.Permission): grok.name('dummy.AddPermission') grok.title(u'Dummy add permission')
class DummyViewPermission(grok.Permission): grok.name('dummy.ViewPermission') grok.title(u'Dummy view permission')