SetupΒΆ
Imagine a Grok module for holding Contact Info called
contact.py. By default, anyone is able to view the
ViewContact view.
from zope import component, interface, schema
import grok
class IContactInfo(interface.Interface):
""" Interface/Schema for Contact Information """
first_name = schema.Text(title=u'First Name')
last_name = schema.Text(title=u'Last Name')
email = schema.Text(title=u'E-mail')
class ContactInfo(grok.Model):
interface.implements(IContactInfo)
first_name = ''
last_name = ''
email = ''
class ViewContact(grok.View)
"""Display Contact Info, without e-mail.
Anyone can use this view, even unauthenticated users
over the internet
"""
def render(self):
contact = self.context
return 'Contact: ' + contact.first_name + contact.last_name