From jim at zope.com Sat Mar 22 12:41:26 2003
From: jim at zope.com (Jim Fulton)
Date: Sun Aug 10 16:40:37 2008
Subject: [Zope-book] CVS: Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter2/Step1 - browser.py:1.1 contact.py:1.1 interfaces.py:1.1 configure.zcml:1.2 stubpostal.py:1.2 ContactAdd.py:NONE ContactAddView.py:NONE ContactInfoView.py:NONE IContact.py:NONE IPostal.py:NONE add.pt:NONE contact_product_uml.txt:NONE products.zcml:NONE
Message-ID: <200303221741.h2MHfQR18504@cvs.baymountain.com>
Update of /cvs-repository/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter2/Step1
In directory cvs.zope.org:/tmp/cvs-serv18348
Modified Files:
configure.zcml stubpostal.py
Added Files:
browser.py contact.py interfaces.py
Removed Files:
ContactAdd.py ContactAddView.py ContactInfoView.py IContact.py
IPostal.py add.pt contact_product_uml.txt products.zcml
Log Message:
Updated the schema example:
- Changed module names and imports to reflect the grand renaming
- Now use addform.
=== Added File Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter2/Step1/browser.py ===
from zope.component import getAdapter
from interfaces import IContact, IPostalInfo
class ContactInfoView:
"""Provide an interface for viewing a contact
"""
__used_for__ = IContact
def __init__(self, context, request):
self.context = context
self.request = request
self.info = getAdapter(context, IPostalInfo)
def city(self):
return self.info.city()
def state(self):
return self.info.state()
=== Added File Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter2/Step1/contact.py ===
import persistence
from interfaces import IContact
from interfaces import IPostalLookup, IPostalInfo
from zope.component import getUtility
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.first = first
self.last = last
self.email = email
self.address = address
self.postal_code = pc
def name(self):
return "%s %s" % (self._first, self._last)
class ContactCityState:
"Provide access to city and state information for a contact"
__implements__ = IPostalInfo
__used_for__ = IContact
def __init__(self, contact):
self._contact = contact
lookup = 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/Chapter2/Step1/interfaces.py ===
import re
from zope.interface import Interface
from zope.schema import Text, TextLine
class IContact(Interface):
"Provides access to basic contact information."
first = TextLine(title=u"First name")
last = TextLine(title=u"Last name")
email = TextLine(title=u"Electronic mail address")
address = Text(title=u"Postal address")
postal_code = TextLine(title=u"Postal code",
constraint=re.compile("\d{5,5}(-\d{4,4})?$").match)
def name():
"""Gets the contact name.
The contact name is the first and last name"""
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/Chapter2/Step1/configure.zcml 1.1 => 1.2 ===
--- Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter2/Step1/configure.zcml:1.1 Sun Dec 1 08:34:40 2002
+++ Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter2/Step1/configure.zcml Sat Mar 22 12:41:24 2003
@@ -1,82 +1,70 @@
+ xmlns='http://namespaces.zope.org/zope'
+ xmlns:browser='http://namespaces.zope.org/browser'>
-
-
+
+
+ id="zopeproducts.contact"
+ permission="zopeproducts.contact.ManageContacts" />
+ permission="zope.View"
+ interface=".interfaces.IContact" />
+ permission="zopeproducts.contact.ManageContacts"
+ set_schema=".interfaces.IContact" />
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
+
-
+
+ provides=".interfaces.IPostalLookup"
+ permission="zope.Public"
+ />
+ factory=".contact.ContactCityState"
+ provides=".interfaces.IPostalInfo"
+ for=".interfaces.IContact"
+ permission="zope.Public"
+ />
=== Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter2/Step1/stubpostal.py 1.1 => 1.2 ===
--- Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter2/Step1/stubpostal.py:1.1 Sun Dec 1 08:34:40 2002
+++ Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter2/Step1/stubpostal.py Sat Mar 22 12:41:24 2003
@@ -1,5 +1,5 @@
# Stub postal utility implemantation
-from IPostal import IPostalLookup, IPostalInfo
+from interfaces import IPostalLookup, IPostalInfo
class Info:
=== Removed File Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter2/Step1/ContactAdd.py ===
=== Removed File Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter2/Step1/ContactAddView.py ===
=== Removed File Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter2/Step1/ContactInfoView.py ===
=== Removed File Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter2/Step1/IContact.py ===
=== Removed File Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter2/Step1/IPostal.py ===
=== Removed File Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter2/Step1/add.pt ===
=== Removed File Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter2/Step1/contact_product_uml.txt ===
=== Removed File Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter2/Step1/products.zcml ===
From jim at zope.com Sat Mar 22 13:40:26 2003
From: jim at zope.com (Jim Fulton)
Date: Sun Aug 10 16:40:37 2008
Subject: [Zope-book] CVS: Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter2 - forms.sxi:1.2
Message-ID: <200303221840.h2MIeQL26265@cvs.baymountain.com>
Update of /cvs-repository/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter2
In directory cvs.zope.org:/tmp/cvs-serv26124
Modified Files:
forms.sxi
Log Message:
Updated to reflect the grand renaming.
Added an addform example.
Cleaned up some slides.
=== Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter2/forms.sxi 1.1 => 1.2 ===
From tseaver at zope.com Mon Mar 24 04:47:45 2003
From: tseaver at zope.com (Tres Seaver)
Date: Sun Aug 10 16:40:37 2008
Subject: [Zope-book] CVS: Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step1 - __init__.py:1.4
Message-ID: <200303240947.h2O9lj210589@cvs.baymountain.com>
Update of /cvs-repository/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step1
In directory cvs.zope.org:/tmp/cvs-serv10574
Modified Files:
__init__.py
Log Message:
=== Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step1/__init__.py 1.3 => 1.4 ===
--- Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step1/__init__.py:1.3 Thu Nov 15 18:11:47 2001
+++ Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step1/__init__.py Mon Mar 24 04:47:44 2003
@@ -0,0 +1 @@
+# Python package: Zope3 Tutorial, Chapter 1, Step 1
From tseaver at zope.com Mon Mar 24 12:16:46 2003
From: tseaver at zope.com (Tres Seaver)
Date: Sun Aug 10 16:40:37 2008
Subject: [Zope-book] CVS: Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step1 - contact.py:1.1 configure.zcml:1.2 Contact.py:NONE
Message-ID: <200303241716.h2OHGke06915@cvs.baymountain.com>
Update of /cvs-repository/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step1
In directory cvs.zope.org:/tmp/cvs-serv6746
Modified Files:
configure.zcml
Added Files:
contact.py
Removed Files:
Contact.py
Log Message:
Make Step1 examples work after Namegeddon:
- Rename the Content.py module to correspond with new guidelines.
- Import 'Persistent' from correct location.
- Use normalized names for permissions, etc.
=== Added File Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step1/contact.py ===
from persistence import Persistent
class Contact(Persistent):
"""Contacts keep track of personal data, such as name, email
and postal address. All methods are protected."""
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
=== Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step1/configure.zcml 1.1 => 1.2 ===
--- Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step1/configure.zcml:1.1 Thu Jun 20 18:33:53 2002
+++ Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step1/configure.zcml Mon Mar 24 12:16:45 2003
@@ -4,18 +4,22 @@
-
+
-
+
=== Removed File Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step1/Contact.py ===
From tseaver at zope.com Mon Mar 24 12:46:15 2003
From: tseaver at zope.com (Tres Seaver)
Date: Sun Aug 10 16:40:37 2008
Subject: [Zope-book] CVS: Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step2 - contact.py:1.1 configure.zcml:1.2 Contact.py:NONE
Message-ID: <200303241746.h2OHkFW10968@cvs.baymountain.com>
Update of /cvs-repository/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step2
In directory cvs.zope.org:/tmp/cvs-serv10692
Modified Files:
configure.zcml
Added Files:
contact.py
Removed Files:
Contact.py
Log Message:
Accomodate Namegeddon, etc:
- rename Contact.py -> contact.py.
- Import Persistent from right module.
- Use appropriate dotted names.
=== Added File Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step2/contact.py ===
from persistence import Persistent
class Contact(Persistent):
"""Contacts keep track of personal data, such as name, email
and postal address. All methods are protected."""
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
=== Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step2/configure.zcml 1.1 => 1.2 ===
--- Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step2/configure.zcml:1.1 Thu Jun 20 18:45:35 2002
+++ Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step2/configure.zcml Mon Mar 24 12:46:15 2003
@@ -3,21 +3,24 @@
xmlns:browser='http://namespaces.zope.org/browser'>
-
+
+ permission="zope.View"
+ attributes="name first last email address postal code" />
-
+
=== Removed File Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step2/Contact.py ===
From tseaver at zope.com Mon Mar 24 13:26:05 2003
From: tseaver at zope.com (Tres Seaver)
Date: Sun Aug 10 16:40:37 2008
Subject: [Zope-book] CVS: Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step3 - contact.py:1.1 interface.py:1.1 configure.zcml:1.2 Contact.py:NONE IContact.py:NONE
Message-ID: <200303241826.h2OIQ5s16385@cvs.baymountain.com>
Update of /cvs-repository/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step3
In directory cvs.zope.org:/tmp/cvs-serv16238
Modified Files:
configure.zcml
Added Files:
contact.py interface.py
Removed Files:
Contact.py IContact.py
Log Message:
Accomodate Namegeddon, etc:
- Rename Contact.py -> contact.py.
- Rename IContact.py -> interface.py
- Import Persistent from right module.
- Use appropriate dotted names.
=== Added File Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step3/contact.py ===
import persistence
from interface import IContact
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
=== Added File Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step3/interface.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.
"""
=== Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step3/configure.zcml 1.1 => 1.2 ===
--- Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step3/configure.zcml:1.1 Thu Jun 20 19:11:36 2002
+++ Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step3/configure.zcml Mon Mar 24 13:26:04 2003
@@ -3,29 +3,31 @@
xmlns:browser='http://namespaces.zope.org/browser'>
-
+
+ permission="zope.View"
+ interface=".interface.IContactInfo." />
-
+
-
+
-
+ permission="zope.View" />
=== Removed File Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step3/Contact.py ===
=== Removed File Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step3/IContact.py ===
From tseaver at zope.com Mon Mar 24 13:33:02 2003
From: tseaver at zope.com (Tres Seaver)
Date: Sun Aug 10 16:40:37 2008
Subject: [Zope-book] CVS: Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step3 - configure.zcml:1.3
Message-ID: <200303241833.h2OIX2R17305@cvs.baymountain.com>
Update of /cvs-repository/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step3
In directory cvs.zope.org:/tmp/cvs-serv17265
Modified Files:
configure.zcml
Log Message:
- Make the View action available on the menu.
=== Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step3/configure.zcml 1.2 => 1.3 ===
--- Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step3/configure.zcml:1.2 Mon Mar 24 13:26:04 2003
+++ Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step3/configure.zcml Mon Mar 24 13:33:01 2003
@@ -28,6 +28,8 @@
for=".interface.IContactInfo."
name="info.html"
template="info.pt"
+ menu="zmi_views"
+ title="View"
permission="zope.View" />
From tseaver at zope.com Tue Mar 25 03:35:18 2003
From: tseaver at zope.com (Tres Seaver)
Date: Sun Aug 10 16:40:37 2008
Subject: [Zope-book] CVS: Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step4 - browser.py:1.1 contact.py:1.1 interface.py:1.1 configure.zcml:1.2 Contact.py:NONE Contact.zcml:NONE ContactEditView.py:NONE IContact.py:NONE
Message-ID: <200303250835.h2P8ZIv30729@cvs.baymountain.com>
Update of /cvs-repository/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step4
In directory cvs.zope.org:/tmp/cvs-serv30322
Modified Files:
configure.zcml
Added Files:
browser.py contact.py interface.py
Removed Files:
Contact.py Contact.zcml ContactEditView.py IContact.py
Log Message:
Conform to Namegeddon guidelines:
- Import 'Persistent' from 'persistence'.
- Move interfaces into 'interface.py'.
- Move views into 'browser.py'.
- Rename modules.
- Remove old cruft (Contact.zcml).
=== Added File Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step4/browser.py ===
from zope.publisher.browser 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
# 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/Step4/contact.py ===
from persistence import Persistent
from interface import IContact
class Contact(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
=== Added File Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step4/interface.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.
"""
=== Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step4/configure.zcml 1.1 => 1.2 ===
--- Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step4/configure.zcml:1.1 Fri Jun 21 04:48:33 2002
+++ Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step4/configure.zcml Tue Mar 25 03:35:17 2003
@@ -3,48 +3,58 @@
xmlns:browser='http://namespaces.zope.org/browser'>
-
+
+ permission="zope.View"
+ interface=".interface.IContactInfo." />
-
+
-
+
-
+ menu="zmi_views"
+ title="View"
+ permission="zope.View"
+ />
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
+
=== Removed File Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step4/Contact.py ===
=== Removed File Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step4/Contact.zcml ===
=== Removed File Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step4/ContactEditView.py ===
=== Removed File Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step4/IContact.py ===