First name |
1.5.2.1 ===
if data is not None: data = Info(*data)
return data
-
-lookup=Lookup()
=== Removed File Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5/ContactInfoView.py ===
=== Removed File Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5/ContactViewPresentation.py ===
From jim at zope.com Fri Jun 7 11:17:41 2002
From: jim at zope.com (Jim Fulton)
Date: Sun Aug 10 16:40:36 2008
Subject: [Zope-book] CVS: Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1 - slides.sdd.gz:1.4
Message-ID: <200206071517.g57FHfS26137@cvs.baymountain.com>
Update of /cvs-repository/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1
In directory cvs.zope.org:/tmp/cvs-serv26130
Modified Files:
slides.sdd.gz
Log Message:
Updated to reflect "Wonderland" changes.
=== Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/slides.sdd.gz 1.3 => 1.4 ===
From jim at zope.com Mon Jun 10 08:07:46 2002
From: jim at zope.com (Jim Fulton)
Date: Sun Aug 10 16:40:36 2008
Subject: [Zope-book] CVS: Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5 - Contact.py:1.3 Contact.zcml:1.8 ContactEditView.py:1.2 IContact.py:1.3 IContactEdit.py:1.2 IContactInfo.py:1.2 __init__.py:1.4 edit.pt:1.6 stubpostal.py:1.6 ContactInfoView.py:NONE ContactViewPresentation.py:NONE
Message-ID: <200206101207.g5AC7kf12885@cvs.baymountain.com>
Update of /cvs-repository/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5
In directory cvs.zope.org:/tmp/cvs-serv12870
Modified Files:
Contact.py Contact.zcml ContactEditView.py IContact.py
IContactEdit.py IContactInfo.py __init__.py edit.pt
stubpostal.py
Removed Files:
ContactInfoView.py ContactViewPresentation.py
Log Message:
Merged in changes from Wonderland branch
=== Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5/Contact.py 1.2 => 1.3 ===
import Persistence
+from IContact import IContact
class Contact (Persistence.Persistent):
- """Contacts keep track of personal data, such as name, email
- and postal address. All methods are protected."""
+ """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)
=== Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5/Contact.zcml 1.7 => 1.8 ===
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
-
+
+
+
-
-
+ factory=".stubpostal.Lookup"
+ provides=".IPostal.IPostalLookup"
+ permission="Zope.Public" />
-
+ factory=".ContactCityState."
+ provides=".IPostal.IPostalInfo"
+ for=".IContact.IContactInfo"
+ permission="Zope.Public"
+ />
=== Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5/ContactEditView.py 1.1 => 1.2 ===
-from Zope.PageTemplate import PageTemplateFile
-from IContactEdit import IContactEdit
-
-class ContactEditView(AttributePublisher):
- """Provide an interface for editing a contact
- """
-
- # Boiler plate
- def __init__(self, context):
- self._context=context
-
- def getContext(self):
- return self._context
-
- # Assert that we can only be applied to IContactEdit
- __used_for__=IContactEdit
+from Zope.App.PageTemplate import ViewPageTemplateFile
+from Zope.Publisher.Browser.BrowserView import BrowserView
+from IContact import IContact
+
+class ContactEditView(BrowserView):
+ "Provide a user interface for editing a contact"
+
+ # Assert that we can only be applied to IContact
+ __used_for__ = IContact
# Input form
- index = PageTemplateFile('edit.pt', globals())
+ editForm = ViewPageTemplateFile('edit.pt')
# action method
- def action(self, first, last, email, address, pc, REQUEST):
+ def edit(self, first, last, email, address, pc):
"Edit a contact"
- self.getContext().update(first, last, email, address, pc)
- return self.index(REQUEST)
+ self.context.update(first, last, email, address, pc)
+ return self.editForm()
=== Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5/IContact.py 1.2 => 1.3 ===
+from Interface import Interface
-# Local Package imports
-from Contact import Contact
+class IContactInfo(Interface):
+ "Provides access to basic contact information."
-class IContact(Interface):
- "Marker for objects that provide specific behavior"
+ 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"
-implements(Contact, IContact)
+ 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.
+ """
=== Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5/IContactEdit.py 1.1 => 1.2 ===
from Contact import Contact
-from Interface import implements
+from Interface.Implements import implements
class IContactEdit(IContactInfo):
"Provides the ability to change basic contact information."
=== Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5/IContactInfo.py 1.1 => 1.2 ===
+from Interface import Interface
+from Interface.Implements import implements
# Local Package imports
from Contact import Contact
=== Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5/__init__.py 1.3 => 1.4 ===
=== Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5/edit.pt 1.5 => 1.6 ===
Enter the information about the contact.
- |