From cvs-admin at zope.org Fri Nov 21 11:51:06 2003 From: cvs-admin at zope.org (Philipp von Weitershausen) Date: Sun Aug 10 16:40:37 2008 Subject: [Zope-book] CVS: Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1 - slides.sxi:1.20 Message-ID: <200311211651.hALGp6NL026451@cvs.zope.org> Update of /cvs-repository/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1 In directory cvs.zope.org:/tmp/cvs-serv26297 Modified Files: slides.sxi Log Message: Update slides according to recent changes in Zope3. === Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/slides.sxi 1.19 => 1.20 === From cvs-admin at zope.org Fri Nov 21 11:51:42 2003 From: cvs-admin at zope.org (Philipp von Weitershausen) Date: Sun Aug 10 16:40:37 2008 Subject: [Zope-book] CVS: Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step7 - browser.py:1.2 contact.py:1.3 Message-ID: <200311211651.hALGpgU5026567@cvs.zope.org> Update of /cvs-repository/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step7 In directory cvs.zope.org:/tmp/cvs-serv26466/Step7 Modified Files: browser.py contact.py Log Message: Update horribly out-of-date examples. This is just a first step, I'm not done yet. === Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step7/browser.py 1.1 => 1.2 === --- Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step7/browser.py:1.1 Tue Dec 31 15:17:52 2002 +++ Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step7/browser.py Fri Nov 21 11:51:42 2003 @@ -1,4 +1,4 @@ -from zope.component import getAdapter +from zope.app import zapi from zope.app.event import publish from zope.app.event.objectevent import ObjectModifiedEvent from zope.app.interfaces.container import IAdding @@ -13,12 +13,11 @@ def __init__(self, context, request): self.context = context self.request = request - - self.info = getAdapter(context, IPostalInfo) - + self.info = zapi.getAdapter(context, IPostalInfo) + def city(self): return self.info.city() - + def state(self): return self.info.state() === Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step7/contact.py 1.2 => 1.3 === --- Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step7/contact.py:1.2 Mon Apr 7 06:53:17 2003 +++ Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step7/contact.py Fri Nov 21 11:51:42 2003 @@ -1,10 +1,12 @@ import persistence -from interfaces import IContact, IContactInfo, IContactAdd -from interfaces import IPostalLookup, IPostalInfo +from zope.interface import implements +from zope.app import zapi from zope.app.interfaces.container import IAdding from zope.app.event import publish from zope.app.event.objectevent import ObjectCreatedEvent -from zope.component import getUtility + +from interfaces import IContact, IContactInfo, IContactAdd +from interfaces import IPostalLookup, IPostalInfo class Contact (persistence.Persistent): """Personal contact information @@ -12,8 +14,7 @@ Contacts keep track of personal data, such as name, email and postal address. All methods are protected. """ - - __implements__ = IContact + implements(IContact) def __init__(self, first='', last='', email='', address='', pc=''): self.update(first, last, email, address, pc) @@ -51,12 +52,9 @@ class ContactAdd: "Provide a user interface for adding a contact" - - # Assert that we can only be applied to IAdding + implements(IContactAdd) __used_for__ = IAdding - __implements__ = IContactAdd - def __init__(self, context): self.context = context @@ -69,13 +67,12 @@ class ContactCityState: "Provide access to city and state information for a contact" - __implements__ = IPostalInfo - + implements(IPostalInfo) __used_for__ = IContactInfo def __init__(self, contact): self._contact = contact - lookup = getUtility(contact, IPostalLookup) + lookup = zapi.getUtility(contact, IPostalLookup) info = lookup.lookup(contact.postal_code()) if info is None: self._city, self._state = '', '' From cvs-admin at zope.org Fri Nov 21 11:52:09 2003 From: cvs-admin at zope.org (Philipp von Weitershausen) Date: Sun Aug 10 16:40:37 2008 Subject: [Zope-book] CVS: Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step1 - configure.zcml:1.3 products.zcml:1.4 Message-ID: <200311211652.hALGq908026719@cvs.zope.org> Update of /cvs-repository/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step1 In directory cvs.zope.org:/tmp/cvs-serv26466/Step1 Modified Files: configure.zcml products.zcml Log Message: Update horribly out-of-date examples. This is just a first step, I'm not done yet. === Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step1/configure.zcml 1.2 => 1.3 === --- Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step1/configure.zcml:1.2 Mon Mar 24 12:16:45 2003 +++ Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step1/configure.zcml Fri Nov 21 11:51:39 2003 @@ -1,4 +1,4 @@ - @@ -22,4 +22,4 @@ permission="zopeproducts.contact.ManageContacts" /> - + === Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step1/products.zcml 1.3 => 1.4 === --- Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step1/products.zcml:1.3 Sun Dec 8 03:40:00 2002 +++ Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step1/products.zcml Fri Nov 21 11:51:39 2003 @@ -1,4 +1,4 @@ - - + From cvs-admin at zope.org Fri Nov 21 11:52:10 2003 From: cvs-admin at zope.org (Philipp von Weitershausen) Date: Sun Aug 10 16:40:37 2008 Subject: [Zope-book] CVS: Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step2 - configure.zcml:1.3 products.zcml:1.4 Message-ID: <200311211652.hALGqAkN026725@cvs.zope.org> Update of /cvs-repository/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step2 In directory cvs.zope.org:/tmp/cvs-serv26466/Step2 Modified Files: configure.zcml products.zcml Log Message: Update horribly out-of-date examples. This is just a first step, I'm not done yet. === Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step2/configure.zcml 1.2 => 1.3 === --- Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step2/configure.zcml:1.2 Mon Mar 24 12:46:15 2003 +++ Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step2/configure.zcml Fri Nov 21 11:51:39 2003 @@ -1,4 +1,4 @@ - @@ -23,4 +23,4 @@ action="zopeproducts.contact.Contact" /> - + === Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step2/products.zcml 1.3 => 1.4 === --- Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step2/products.zcml:1.3 Sun Dec 8 03:40:22 2002 +++ Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step2/products.zcml Fri Nov 21 11:51:39 2003 @@ -1,8 +1,8 @@ - - + From cvs-admin at zope.org Fri Nov 21 11:52:10 2003 From: cvs-admin at zope.org (Philipp von Weitershausen) Date: Sun Aug 10 16:40:37 2008 Subject: [Zope-book] CVS: Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step3 - configure.zcml:1.4 contact.py:1.2 products.zcml:1.3 Message-ID: <200311211652.hALGqAg2026732@cvs.zope.org> Update of /cvs-repository/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step3 In directory cvs.zope.org:/tmp/cvs-serv26466/Step3 Modified Files: configure.zcml contact.py products.zcml Log Message: Update horribly out-of-date examples. This is just a first step, I'm not done yet. === Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step3/configure.zcml 1.3 => 1.4 === --- Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step3/configure.zcml:1.3 Mon Mar 24 13:33:01 2003 +++ Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step3/configure.zcml Fri Nov 21 11:51:40 2003 @@ -1,4 +1,4 @@ - @@ -32,4 +32,4 @@ title="View" permission="zope.View" /> - + === Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step3/contact.py 1.1 => 1.2 === --- Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step3/contact.py:1.1 Mon Mar 24 13:26:04 2003 +++ Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step3/contact.py Fri Nov 21 11:51:40 2003 @@ -1,15 +1,16 @@ import persistence +from zope.interface import implements from interface import IContact -class Contact (persistence.Persistent): +class Contact(persistence.Persistent): """Personal contact information Contacts keep track of personal data, such as name, email and postal address. All methods are protected. """ - __implements__ = IContact + implements(IContact) def __init__(self, first='', last='', email='', address='', pc=''): self.update(first, last, email, address, pc) === Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step3/products.zcml 1.2 => 1.3 === --- Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step3/products.zcml:1.2 Sun Dec 8 03:40:37 2002 +++ Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step3/products.zcml Fri Nov 21 11:51:40 2003 @@ -1,4 +1,4 @@ - - + From cvs-admin at zope.org Fri Nov 21 11:52:12 2003 From: cvs-admin at zope.org (Philipp von Weitershausen) Date: Sun Aug 10 16:40:37 2008 Subject: [Zope-book] CVS: Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5 - browser.py:1.1 contact.py:1.1 interfaces.py:1.1 configure.zcml:1.4 products.zcml:1.3 stubpostal.py:1.8 Contact.py:NONE ContactCityState.py:NONE ContactEditView.py:NONE ContactInfoView.py:NONE IContact.py:NONE IPostal.py:NONE Message-ID: <200311211652.hALGqC7R026746@cvs.zope.org> Update of /cvs-repository/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5 In directory cvs.zope.org:/tmp/cvs-serv26466/Step5 Modified Files: configure.zcml products.zcml stubpostal.py Added Files: browser.py contact.py interfaces.py Removed Files: Contact.py ContactCityState.py ContactEditView.py ContactInfoView.py IContact.py IPostal.py Log Message: Update horribly out-of-date examples. This is just a first step, I'm not done yet. === Added File Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5/browser.py === from zope.app import zapi from interfaces import IContactInfo, IPostalInfo from zope.publisher.browser.browserview import BrowserView class ContactInfoView: """Provide an interface for viewing a contact """ __used_for__ = IContactInfo def __init__(self, context, request): self.context = context self.request = request self.info = zapi.getAdapter(context, IPostalInfo) def city(self): return self.info.city() def state(self): return self.info.state() class ContactEditView(BrowserView): "Provide a user interface for editing a contact" # Assert that we can only be applied to IContact __used_for__ = IContact # action method def action(self, first, last, email, address, pc): "Edit a contact" self.context.update(first, last, email, address, pc) self.request.response.redirect('.') === Added File Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5/contact.py === import persistence from zope.app import zapi from interfaces import IContact, IContactInfo, IPostalLookup, IPostalInfo class Contact(persistence.Persistent): """Personal contact information Contacts keep track of personal data, such as name, email and postal address. All methods are protected. """ __implements__ = IContact def __init__(self, first='', last='', email='', address='', pc=''): self.update(first, last, email, address, pc) def name(self): return "%s %s" % (self._first, self._last) def first(self): return self._first def last(self): return self._last def email(self): return self._email def address(self): return self._address def postal_code(self): return self._pc def update(self, first=None, last=None, email=None, address=None, pc=None): if first is not None: self._first = first if last is not None: self._last = last if email is not None: self._email = email if address is not None: self._address = address if pc is not None: self._pc = pc class ContactCityState: "Provide access to city and state information for a contact" implements(IPostalInfo) __used_for__ = IContactInfo def __init__(self, contact): self._contact = contact lookup = zapi.getUtility(contact, IPostalLookup) info = lookup.lookup(contact.postal_code()) if info is None: self._city, self._state = '', '' else: self._city, self._state = info.city(), info.state() def city(self): return self._city def state(self): return self._state === Added File Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5/interfaces.py === from zope.interface import Interface class IContactInfo(Interface): "Provides access to basic contact information." def first(): "Get the first name" def last(): "Get the last name" def email(): "Get the electronic mail address" def address(): "Get the postal address" def postal_code(): "Get the postal code" def name(): """Gets the contact name. The contact name is the first and last name""" class IContact(IContactInfo): "Provides the ability to change contact information." def update(first, last, email, address, pc): """Modifies contact data 'None' values are ignored. """ class IPostalInfo(Interface): "Provide information for postal codes" def city(): """Return the city associated with the postal code. An empty string is returned if the city is unknown. """ def state(): """Return the state associated with the postal code. An empty string is returned if the state is unknown. """ class IPostalLookup(Interface): "Provide postal code lookup" def lookup(postal_code): """Lookup information for a postal code. An IPostalInfo is returned if the postal code is known. None is returned otherwise. """ === Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5/configure.zcml 1.3 => 1.4 === --- Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5/configure.zcml:1.3 Thu Jun 20 16:24:27 2002 +++ Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5/configure.zcml Fri Nov 21 11:51:41 2003 @@ -1,66 +1,72 @@ - - + + permission="zope.View" + interface=".interface.IContactInfo." /> - + action="zopeproducts.Contact"/> - + + class=".browser.ContactInfoView" + permission="zope.View" /> + for=".interface.IContact" + factory=".browser.ContactEditView" + permission="zopeproducts.contact.ManageContacts" > - + - + - + + provides=".interface.IPostalLookup" + permission="zope.Public" /> + factory=".contact.ContactCityState" + provides=".interface.IPostalInfo" + for=".interface.IContactInfo" + permission="zope.Public" /> - + === Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5/products.zcml 1.2 => 1.3 === --- Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5/products.zcml:1.2 Tue Jun 18 13:59:39 2002 +++ Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5/products.zcml Fri Nov 21 11:51:41 2003 @@ -1,4 +1,4 @@ - - + === Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5/stubpostal.py 1.7 => 1.8 === --- Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5/stubpostal.py:1.7 Tue Jun 18 13:53:51 2002 +++ Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5/stubpostal.py Fri Nov 21 11:51:41 2003 @@ -1,9 +1,9 @@ # Stub postal utility implemantation +from zope.interface import implements from IPostal import IPostalLookup, IPostalInfo class Info: - - __implements__ = IPostalInfo + implements(IPostalInfo) def __init__(self, city, state): self._city, self._state = city, state @@ -13,8 +13,7 @@ def state(self): return self._state class Lookup: - - __implements__ = IPostalLookup + implements(IPostalLookup) _data = { '22401': ('Fredericksburg', 'Virginia'), === Removed File Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5/Contact.py === === Removed File Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5/ContactCityState.py === === Removed File Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5/ContactEditView.py === === Removed File Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5/ContactInfoView.py === === Removed File Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5/IContact.py === === Removed File Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5/IPostal.py === From cvs-admin at zope.org Fri Nov 21 11:52:12 2003 From: cvs-admin at zope.org (Philipp von Weitershausen) Date: Sun Aug 10 16:40:37 2008 Subject: [Zope-book] CVS: Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step6 - configure.zcml:1.3 Message-ID: <200311211652.hALGqCPY026751@cvs.zope.org> Update of /cvs-repository/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step6 In directory cvs.zope.org:/tmp/cvs-serv26466/Step6 Modified Files: configure.zcml Log Message: Update horribly out-of-date examples. This is just a first step, I'm not done yet. === Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step6/configure.zcml 1.2 => 1.3 === --- Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step6/configure.zcml:1.2 Sun Dec 8 03:47:32 2002 +++ Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step6/configure.zcml Fri Nov 21 11:51:41 2003 @@ -1,26 +1,27 @@ - - + + id="zopeproducts.Contact" + permission="zopeproducts.contact.ManageContacts" /> - + action="zopeproducts.Contact"/> - + - + @@ -72,4 +78,4 @@ for=".IContact.IContactInfo" permission="Zope.Public" /> - + From cvs-admin at zope.org Fri Nov 21 11:52:11 2003 From: cvs-admin at zope.org (Philipp von Weitershausen) Date: Sun Aug 10 16:40:37 2008 Subject: [Zope-book] CVS: Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step4 - configure.zcml:1.3 contact.py:1.2 products.zcml:1.3 Message-ID: <200311211652.hALGqB3F026739@cvs.zope.org> Update of /cvs-repository/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step4 In directory cvs.zope.org:/tmp/cvs-serv26466/Step4 Modified Files: configure.zcml contact.py products.zcml Log Message: Update horribly out-of-date examples. This is just a first step, I'm not done yet. === Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step4/configure.zcml 1.2 => 1.3 === --- Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step4/configure.zcml:1.2 Tue Mar 25 03:35:17 2003 +++ Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step4/configure.zcml Fri Nov 21 11:51:40 2003 @@ -1,4 +1,4 @@ - @@ -6,14 +6,14 @@ id="zopeproducts.contact.ManageContacts" title="Manage Contacts" /> - + + interface=".interface.IContactInfo" /> @@ -21,15 +21,17 @@ - + @@ -55,6 +57,9 @@ /> - + - + === Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step4/contact.py 1.1 => 1.2 === --- Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step4/contact.py:1.1 Tue Mar 25 03:35:17 2003 +++ Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step4/contact.py Fri Nov 21 11:51:40 2003 @@ -1,5 +1,6 @@ from persistence import Persistent +from zope.interface import implements from interface import IContact class Contact(Persistent): @@ -9,7 +10,7 @@ and postal address. All methods are protected. """ - __implements__ = IContact + implements(IContact) def __init__(self, first='', last='', email='', address='', pc=''): self.update(first, last, email, address, pc) === Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step4/products.zcml 1.2 => 1.3 === --- Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step4/products.zcml:1.2 Fri Jun 21 04:48:33 2002 +++ Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step4/products.zcml Fri Nov 21 11:51:40 2003 @@ -1,10 +1,10 @@ - - + - + From cvs-admin at zope.org Mon Nov 24 02:26:15 2003 From: cvs-admin at zope.org (Philipp von Weitershausen) Date: Sun Aug 10 16:40:37 2008 Subject: [Zope-book] CVS: Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step3 - products.zcml:1.4 Message-ID: <200311240726.hAO7QFT8003459@cvs.zope.org> Update of /cvs-repository/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step3 In directory cvs.zope.org:/tmp/cvs-serv3331/Step3 Modified Files: products.zcml Log Message: Use new package naming in products.zcml example file. === Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step3/products.zcml 1.3 => 1.4 === --- Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step3/products.zcml:1.3 Fri Nov 21 11:51:40 2003 +++ Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step3/products.zcml Mon Nov 24 02:26:14 2003 @@ -5,6 +5,6 @@ xmlns:browser='http://namespaces.zope.org/browser' > - + From cvs-admin at zope.org Mon Nov 24 02:26:40 2003 From: cvs-admin at zope.org (Philipp von Weitershausen) Date: Sun Aug 10 16:40:37 2008 Subject: [Zope-book] CVS: Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step4 - README.txt:1.8 Message-ID: <200311240726.hAO7Qedg003560@cvs.zope.org> Update of /cvs-repository/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step4 In directory cvs.zope.org:/tmp/cvs-serv3547 Modified Files: README.txt Log Message: Change docs to new interface declarations. === Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step4/README.txt 1.7 => 1.8 === --- Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step4/README.txt:1.7 Thu Feb 14 17:59:57 2002 +++ Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step4/README.txt Mon Nov 24 02:26:39 2003 @@ -10,7 +10,7 @@ class AttributePublisher: - __implements__ = IBrowserPublisher + implements(IBrowserPublisher) def browser_traverse(self, request, name): @@ -25,8 +25,8 @@ This base class provides three things: - An assertion that instances of the class implement the - 'IBrowserPublisher' interface by defining the '__implements__' - attribute. This example illustrates how to assert interfaces in a + 'IBrowserPublisher' interface by declaring the implements() + descriptor This example illustrates how to assert interfaces in a class definition. - An implementation of the 'browser_traverse' method of the From cvs-admin at zope.org Mon Nov 24 02:26:43 2003 From: cvs-admin at zope.org (Philipp von Weitershausen) Date: Sun Aug 10 16:40:37 2008 Subject: [Zope-book] CVS: Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step4 - products.zcml:1.4 Message-ID: <200311240726.hAO7QhQ9003567@cvs.zope.org> Update of /cvs-repository/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step4 In directory cvs.zope.org:/tmp/cvs-serv3331/Step4 Modified Files: products.zcml Log Message: Use new package naming in products.zcml example file. === Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step4/products.zcml 1.3 => 1.4 === --- Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step4/products.zcml:1.3 Fri Nov 21 11:51:40 2003 +++ Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step4/products.zcml Mon Nov 24 02:26:03 2003 @@ -5,6 +5,6 @@ xmlns:browser='http://namespaces.zope.org/browser' > - + From cvs-admin at zope.org Mon Nov 24 02:26:44 2003 From: cvs-admin at zope.org (Philipp von Weitershausen) Date: Sun Aug 10 16:40:37 2008 Subject: [Zope-book] CVS: Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step1 - products.zcml:1.5 Message-ID: <200311240726.hAO7Qi3B003572@cvs.zope.org> Update of /cvs-repository/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step1 In directory cvs.zope.org:/tmp/cvs-serv3331/Step1 Modified Files: products.zcml Log Message: Use new package naming in products.zcml example file. === Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step1/products.zcml 1.4 => 1.5 === --- Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step1/products.zcml:1.4 Fri Nov 21 11:51:39 2003 +++ Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step1/products.zcml Mon Nov 24 02:26:13 2003 @@ -5,6 +5,6 @@ xmlns:browser='http://namespaces.zope.org/browser' > - + From cvs-admin at zope.org Mon Nov 24 02:26:45 2003 From: cvs-admin at zope.org (Philipp von Weitershausen) Date: Sun Aug 10 16:40:37 2008 Subject: [Zope-book] CVS: Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step2 - products.zcml:1.5 Message-ID: <200311240726.hAO7Qj2f003577@cvs.zope.org> Update of /cvs-repository/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step2 In directory cvs.zope.org:/tmp/cvs-serv3331/Step2 Modified Files: products.zcml Log Message: Use new package naming in products.zcml example file. === Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step2/products.zcml 1.4 => 1.5 === --- Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step2/products.zcml:1.4 Fri Nov 21 11:51:39 2003 +++ Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step2/products.zcml Mon Nov 24 02:26:14 2003 @@ -1,8 +1,10 @@ - + From cvs-admin at zope.org Mon Nov 24 02:27:16 2003 From: cvs-admin at zope.org (Philipp von Weitershausen) Date: Sun Aug 10 16:40:37 2008 Subject: [Zope-book] CVS: Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1 - README.txt:1.4 Message-ID: <200311240727.hAO7RGFH003768@cvs.zope.org> Update of /cvs-repository/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1 In directory cvs.zope.org:/tmp/cvs-serv3755 Modified Files: README.txt Log Message: Typos and consistency with the slides === Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/README.txt 1.3 => 1.4 === --- Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/README.txt:1.3 Thu Nov 15 18:49:44 2001 +++ Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/README.txt Mon Nov 24 02:27:16 2003 @@ -11,19 +11,23 @@ Step1, minimal contact class - Step2, security asertions to make contact objects usable + Step2, security assertions to make contact objects usable Step3, a simple contact presentation Step4, providing editing capabilities - Step5, adding features and utilities + Step5, application functionality + + Step6, custom creation views + + Step7, Dublin Core, events, and annotations Summary This chapter showed how to develop basic components with Python modules. The facilities demonstrated address a number of the - component architecture goals: + component architecture goals: - Make it much easier to create objects that are usable in Zope: From cvs-admin at zope.org Mon Nov 24 02:28:05 2003 From: cvs-admin at zope.org (Philipp von Weitershausen) Date: Sun Aug 10 16:40:37 2008 Subject: [Zope-book] CVS: Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5 - contact.py:1.2 products.zcml:1.4 stubpostal.py:1.9 Message-ID: <200311240728.hAO7S5OH003971@cvs.zope.org> Update of /cvs-repository/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5 In directory cvs.zope.org:/tmp/cvs-serv3819 Modified Files: contact.py products.zcml stubpostal.py Log Message: - new naming conventions - new interface declarations === Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5/contact.py 1.1 => 1.2 === --- Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5/contact.py:1.1 Fri Nov 21 11:51:41 2003 +++ Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5/contact.py Mon Nov 24 02:28:04 2003 @@ -1,5 +1,6 @@ import persistence +from zope.interface import implements from zope.app import zapi from interfaces import IContact, IContactInfo, IPostalLookup, IPostalInfo @@ -10,7 +11,7 @@ and postal address. All methods are protected. """ - __implements__ = IContact + implements(IContact) def __init__(self, first='', last='', email='', address='', pc=''): self.update(first, last, email, address, pc) === Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5/products.zcml 1.3 => 1.4 === --- Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5/products.zcml:1.3 Fri Nov 21 11:51:41 2003 +++ Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5/products.zcml Mon Nov 24 02:28:04 2003 @@ -1,10 +1,10 @@ - + === Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5/stubpostal.py 1.8 => 1.9 === --- Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5/stubpostal.py:1.8 Fri Nov 21 11:51:41 2003 +++ Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5/stubpostal.py Mon Nov 24 02:28:04 2003 @@ -1,6 +1,6 @@ # Stub postal utility implemantation from zope.interface import implements -from IPostal import IPostalLookup, IPostalInfo +from interfaces import IPostalLookup, IPostalInfo class Info: implements(IPostalInfo) From cvs-admin at zope.org Mon Nov 24 02:28:35 2003 From: cvs-admin at zope.org (Philipp von Weitershausen) Date: Sun Aug 10 16:40:37 2008 Subject: [Zope-book] CVS: Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step6 - browser.py:1.1 contact.py:1.1 interfaces.py:1.1 configure.zcml:1.4 products.zcml:1.4 stubpostal.py:1.4 Contact.py:NONE ContactAddView.py:NONE ContactCityState.py:NONE ContactEditView.py:NONE ContactInfoView.py:NONE IContact.py:NONE IPostal.py:NONE Message-ID: <200311240728.hAO7SZqN004024@cvs.zope.org> Update of /cvs-repository/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step6 In directory cvs.zope.org:/tmp/cvs-serv3994 Modified Files: configure.zcml products.zcml stubpostal.py Added Files: browser.py contact.py interfaces.py Removed Files: Contact.py ContactAddView.py ContactCityState.py ContactEditView.py ContactInfoView.py IContact.py IPostal.py Log Message: Converted step 6. It was still based on pre-namegeddon code! === Added File Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step6/browser.py === from zope.app import zapi from zope.publisher.browser.browserview import BrowserView from zope.app.interfaces.container import IAdding from contact import Contact from interfaces import IContactInfo, IPostalInfo class ContactInfoView: """Provide an interface for viewing a contact """ __used_for__ = IContactInfo def __init__(self, context, request): self.context = context self.request = request self.info = zapi.getAdapter(context, IPostalInfo) def city(self): return self.info.city() def state(self): return self.info.state() class ContactEditView(BrowserView): "Provide a user interface for editing a contact" # Assert that we can only be applied to IContact __used_for__ = IContact # action method def action(self, first, last, email, address, pc): "Edit a contact" self.context.update(first, last, email, address, pc) self.request.response.redirect('.') class ContactAddView(BrowserView): "Provide a user interface for adding a contact" # Assert that we can only be applied to IAdding __used_for__ = IAdding # action method def action(self, first, last, email, address, pc): "Add a contact" contact = Contact() contact.update(first, last, email, address, pc) self.context.add(contact) self.request.response.redirect(self.context.nextURL()) === Added File Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step6/contact.py === import persistence from zope.interface import implements from zope.app import zapi from interfaces import IContact, IContactInfo, IPostalLookup, IPostalInfo class Contact(persistence.Persistent): """Personal contact information Contacts keep track of personal data, such as name, email and postal address. All methods are protected. """ implements(IContact) def __init__(self, first='', last='', email='', address='', pc=''): self.update(first, last, email, address, pc) def name(self): return "%s %s" % (self._first, self._last) def first(self): return self._first def last(self): return self._last def email(self): return self._email def address(self): return self._address def postal_code(self): return self._pc def update(self, first=None, last=None, email=None, address=None, pc=None): if first is not None: self._first = first if last is not None: self._last = last if email is not None: self._email = email if address is not None: self._address = address if pc is not None: self._pc = pc class ContactCityState: "Provide access to city and state information for a contact" implements(IPostalInfo) __used_for__ = IContactInfo def __init__(self, contact): self._contact = contact lookup = zapi.getUtility(contact, IPostalLookup) info = lookup.lookup(contact.postal_code()) if info is None: self._city, self._state = '', '' else: self._city, self._state = info.city(), info.state() def city(self): return self._city def state(self): return self._state === Added File Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step6/interfaces.py === from zope.interface import Interface class IContactInfo(Interface): "Provides access to basic contact information." def first(): "Get the first name" def last(): "Get the last name" def email(): "Get the electronic mail address" def address(): "Get the postal address" def postal_code(): "Get the postal code" def name(): """Gets the contact name. The contact name is the first and last name""" class IContact(IContactInfo): "Provides the ability to change contact information." def update(first, last, email, address, pc): """Modifies contact data 'None' values are ignored. """ class IPostalInfo(Interface): "Provide information for postal codes" def city(): """Return the city associated with the postal code. An empty string is returned if the city is unknown. """ def state(): """Return the state associated with the postal code. An empty string is returned if the state is unknown. """ class IPostalLookup(Interface): "Provide postal code lookup" def lookup(postal_code): """Lookup information for a postal code. An IPostalInfo is returned if the postal code is known. None is returned otherwise. """ === Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step6/configure.zcml 1.3 => 1.4 === --- Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step6/configure.zcml:1.3 Fri Nov 21 11:51:41 2003 +++ Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step6/configure.zcml Mon Nov 24 02:28:34 2003 @@ -12,7 +12,7 @@ permission="zopeproducts.contact.ManageContacts" /> + interface=".interfaces.IContactInfo." /> === Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step6/products.zcml 1.3 => 1.4 === --- Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step6/products.zcml:1.3 Thu Jun 20 17:49:28 2002 +++ Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step6/products.zcml Mon Nov 24 02:28:34 2003 @@ -1,10 +1,10 @@ - - + - + === Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step6/stubpostal.py 1.3 => 1.4 === --- Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step6/stubpostal.py:1.3 Thu Jun 20 17:49:28 2002 +++ Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step6/stubpostal.py Mon Nov 24 02:28:34 2003 @@ -1,9 +1,9 @@ # Stub postal utility implemantation -from IPostal import IPostalLookup, IPostalInfo +from zope.interface import implements +from interfaces import IPostalLookup, IPostalInfo class Info: - - __implements__ = IPostalInfo + implements(IPostalInfo) def __init__(self, city, state): self._city, self._state = city, state @@ -13,8 +13,7 @@ def state(self): return self._state class Lookup: - - __implements__ = IPostalLookup + implements(IPostalLookup) _data = { '22401': ('Fredericksburg', 'Virginia'), === Removed File Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step6/Contact.py === === Removed File Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step6/ContactAddView.py === === Removed File Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step6/ContactCityState.py === === Removed File Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step6/ContactEditView.py === === Removed File Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step6/ContactInfoView.py === === Removed File Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step6/IContact.py === === Removed File Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step6/IPostal.py === From cvs-admin at zope.org Mon Nov 24 02:29:25 2003 From: cvs-admin at zope.org (Philipp von Weitershausen) Date: Sun Aug 10 16:40:37 2008 Subject: [Zope-book] CVS: Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step7 - browser.py:1.3 contact.py:1.4 products.zcml:1.3 stubpostal.py:1.3 Message-ID: <200311240729.hAO7TPN5004223@cvs.zope.org> Update of /cvs-repository/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step7 In directory cvs.zope.org:/tmp/cvs-serv4204 Modified Files: browser.py contact.py products.zcml stubpostal.py Log Message: - new interface declarations - zapi === Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step7/browser.py 1.2 => 1.3 === --- Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step7/browser.py:1.2 Fri Nov 21 11:51:42 2003 +++ Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step7/browser.py Mon Nov 24 02:29:24 2003 @@ -20,11 +20,10 @@ def state(self): return self.info.state() - class ContactEditView: "Provide a user interface for editing a contact" - + # Assert that we can only be applied to IContact __used_for__ = IContact @@ -37,13 +36,13 @@ class ContactAddView: "Provide a user interface for adding a contact" - + # Assert that we can only be applied to IAdding __used_for__ = IAdding # action method def action(self, first, last, email, address, pc): "Add a contact" - getAdapter(self.context, IContactAdd).add( + zapi.getAdapter(self.context, IContactAdd).add( first, last, email, address, pc) self.request.response.redirect(self.context.nextURL()) === Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step7/contact.py 1.3 => 1.4 === --- Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step7/contact.py:1.3 Fri Nov 21 11:51:42 2003 +++ Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step7/contact.py Mon Nov 24 02:29:24 2003 @@ -8,7 +8,7 @@ from interfaces import IContact, IContactInfo, IContactAdd from interfaces import IPostalLookup, IPostalInfo -class Contact (persistence.Persistent): +class Contact(persistence.Persistent): """Personal contact information Contacts keep track of personal data, such as name, email @@ -68,6 +68,7 @@ "Provide access to city and state information for a contact" implements(IPostalInfo) + __used_for__ = IContactInfo def __init__(self, contact): === Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step7/products.zcml 1.2 => 1.3 === --- Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step7/products.zcml:1.2 Sun Apr 6 16:36:10 2003 +++ Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step7/products.zcml Mon Nov 24 02:29:24 2003 @@ -1,7 +1,10 @@ - - + === Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step7/stubpostal.py 1.2 => 1.3 === --- Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step7/stubpostal.py:1.2 Tue Dec 31 15:17:52 2002 +++ Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step7/stubpostal.py Mon Nov 24 02:29:24 2003 @@ -1,9 +1,10 @@ # Stub postal utility implemantation +from zope.interface import implements from interfaces import IPostalLookup, IPostalInfo class Info: - __implements__ = IPostalInfo + implements(IPostalInfo) def __init__(self, city, state): self._city, self._state = city, state @@ -14,7 +15,7 @@ class Lookup: - __implements__ = IPostalLookup + implements(IPostalLookup) _data = { '22401': ('Fredericksburg', 'Virginia'), From cvs-admin at zope.org Mon Nov 24 02:30:29 2003 From: cvs-admin at zope.org (Philipp von Weitershausen) Date: Sun Aug 10 16:40:37 2008 Subject: [Zope-book] CVS: Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1 - slides.sxi:1.21 Message-ID: <200311240730.hAO7UTgu004410@cvs.zope.org> Update of /cvs-repository/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1 In directory cvs.zope.org:/tmp/cvs-serv4250 Modified Files: slides.sxi Log Message: Fixed typos and updated according to recent changes in Zope head. === Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/slides.sxi 1.20 => 1.21 ===