From cvs-admin at zope.org Wed Dec 3 06:33:09 2003
From: cvs-admin at zope.org (Jim Fulton)
Date: Sun Aug 10 16:40:37 2008
Subject: [Zope-book]
CVS: Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1
- slides.sxi:1.22
Message-ID: <200312031133.hB3BX9EF007211@cvs.zope.org>
Update of /cvs-repository/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1
In directory cvs.zope.org:/tmp/cvs-serv6951
Modified Files:
slides.sxi
Log Message:
Updated to use new addMenuItem directive. Fixed lots of small
bugs and got all of the code examples to run correctly,
=== Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/slides.sxi 1.21 => 1.22 ===
From cvs-admin at zope.org Wed Dec 3 06:33:34 2003
From: cvs-admin at zope.org (Jim Fulton)
Date: Sun Aug 10 16:40:37 2008
Subject: [Zope-book]
CVS: Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step1
- tests.py:1.1 configure.zcml:1.4 contact.py:1.2
Message-ID: <200312031133.hB3BXYlW007257@cvs.zope.org>
Update of /cvs-repository/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step1
In directory cvs.zope.org:/tmp/cvs-serv6951/Step1
Modified Files:
configure.zcml contact.py
Added Files:
tests.py
Log Message:
Updated to use new addMenuItem directive. Fixed lots of small
bugs and got all of the code examples to run correctly,
=== Added File Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step1/tests.py ===
##############################################################################
#
# Copyright (c) 2003 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Test module for contacts example
$Id: tests.py,v 1.1 2003/12/03 11:33:01 jim Exp $
"""
import unittest
import doctest
from zopeproducts.contact.contact import Contact
def test_partial_contact_update():
"""We can use keyword arguments to update selected data
>>> bob = Contact("bob", "smith", "bob@zope.com", "513 Prince Edward",
... "22402")
>>> bob.update(email='bob.smith@zope.com', pc='22401')
>>> bob.first()
'bob'
>>> bob.last()
'smith'
>>> bob.email()
'bob.smith@zope.com'
>>> bob.address()
'513 Prince Edward'
>>> bob.postal_code()
'22401'
"""
def test_suite():
return unittest.TestSuite((
doctest.DocTestSuite(),
doctest.DocTestSuite('zopeproducts.contact.contact'),
))
if __name__ == '__main__': unittest.main()
=== Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step1/configure.zcml 1.3 => 1.4 ===
--- Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step1/configure.zcml:1.3 Fri Nov 21 11:51:39 2003
+++ Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step1/configure.zcml Wed Dec 3 06:33:01 2003
@@ -2,24 +2,10 @@
xmlns='http://namespaces.zope.org/zope'
xmlns:browser='http://namespaces.zope.org/browser'>
-
-
-
-
-
-
-
-
=== Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step1/contact.py 1.1 => 1.2 ===
--- Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step1/contact.py:1.1 Mon Mar 24 12:16:45 2003
+++ Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step1/contact.py Wed Dec 3 06:33:01 2003
@@ -2,13 +2,32 @@
from persistence import Persistent
class Contact(Persistent):
- """Contacts keep track of personal data, such as name, email
- and postal address. All methods are protected."""
+ """Personal Contact Information
+
+ >>> bob = Contact("bob", "smith", "bob@zope.com", "513 Prince Edward",
+ ... "22402")
+ >>> bob.first()
+ 'bob'
+ >>> bob.last()
+ 'smith'
+ >>> bob.email()
+ 'bob@zope.com'
+ >>> bob.address()
+ '513 Prince Edward'
+ >>> bob.postal_code()
+ '22402'
+ """
def __init__(self, first='', last='', email='', address='', pc=''):
self.update(first, last, email, address, pc)
- def name(self):
+ def name(self):
+ """Get the name of a contact, combining the first and last names
+
+ >>> bob = Contact('Bob', 'Smith')
+ >>> bob.name()
+ 'Bob Smith'
+ """
return "%s %s" % (self._first, self._last)
def first(self):
@@ -27,6 +46,25 @@
return self._pc
def update(self, first=None, last=None, email=None, address=None, pc=None):
+ """Update contact information
+
+ We can use the update method to change information:
+
+ >>> bob = Contact("bob", "smith", "bob@zope.com", "513 Prince Edward",
+ ... "22402")
+ >>> bob.update('Bob', 'Smith', 'bob.smith@zope.com',
+ ... '513 Prince Edward St.', '22401')
+ >>> bob.first()
+ 'Bob'
+ >>> bob.last()
+ 'Smith'
+ >>> bob.email()
+ 'bob.smith@zope.com'
+ >>> bob.address()
+ '513 Prince Edward St.'
+ >>> bob.postal_code()
+ '22401'
+ """
if first is not None:
self._first = first
if last is not None:
From cvs-admin at zope.org Wed Dec 3 06:33:34 2003
From: cvs-admin at zope.org (Jim Fulton)
Date: Sun Aug 10 16:40:38 2008
Subject: [Zope-book]
CVS: Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step2
- tests.py:1.1 configure.zcml:1.4 contact.py:1.2
Message-ID: <200312031133.hB3BXYof007263@cvs.zope.org>
Update of /cvs-repository/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step2
In directory cvs.zope.org:/tmp/cvs-serv6951/Step2
Modified Files:
configure.zcml contact.py
Added Files:
tests.py
Log Message:
Updated to use new addMenuItem directive. Fixed lots of small
bugs and got all of the code examples to run correctly,
=== Added File Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step2/tests.py ===
##############################################################################
#
# Copyright (c) 2003 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Test module for contacts example
$Id: tests.py,v 1.1 2003/12/03 11:33:03 jim Exp $
"""
import unittest
import doctest
from zopeproducts.contact.contact import Contact
def test_partial_contact_update():
"""We can use keyword arguments to update selected data
>>> bob = Contact("bob", "smith", "bob@zope.com", "513 Prince Edward",
... "22402")
>>> bob.update(email='bob.smith@zope.com', pc='22401')
>>> bob.first()
'bob'
>>> bob.last()
'smith'
>>> bob.email()
'bob.smith@zope.com'
>>> bob.address()
'513 Prince Edward'
>>> bob.postal_code()
'22401'
"""
def test_suite():
return unittest.TestSuite((
doctest.DocTestSuite(),
doctest.DocTestSuite('zopeproducts.contact.contact'),
))
if __name__ == '__main__': unittest.main()
=== Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step2/configure.zcml 1.3 => 1.4 ===
--- Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step2/configure.zcml:1.3 Fri Nov 21 11:51:39 2003
+++ Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step2/configure.zcml Wed Dec 3 06:33:03 2003
@@ -2,25 +2,17 @@
xmlns='http://namespaces.zope.org/zope'
xmlns:browser='http://namespaces.zope.org/browser'>
-
-
-
+ attributes="name first last email address postal code"
+ />
-
=== Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step2/contact.py 1.1 => 1.2 ===
--- Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step2/contact.py:1.1 Mon Mar 24 12:46:15 2003
+++ Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step2/contact.py Wed Dec 3 06:33:03 2003
@@ -2,13 +2,32 @@
from persistence import Persistent
class Contact(Persistent):
- """Contacts keep track of personal data, such as name, email
- and postal address. All methods are protected."""
+ """Personal Contact Information
+
+ >>> bob = Contact("bob", "smith", "bob@zope.com", "513 Prince Edward",
+ ... "22402")
+ >>> bob.first()
+ 'bob'
+ >>> bob.last()
+ 'smith'
+ >>> bob.email()
+ 'bob@zope.com'
+ >>> bob.address()
+ '513 Prince Edward'
+ >>> bob.postal_code()
+ '22402'
+ """
def __init__(self, first='', last='', email='', address='', pc=''):
self.update(first, last, email, address, pc)
- def name(self):
+ def name(self):
+ """Get the name of a contact, combining the first and last names
+
+ >>> bob = Contact('Bob', 'Smith')
+ >>> bob.name()
+ 'Bob Smith'
+ """
return "%s %s" % (self._first, self._last)
def first(self):
@@ -27,6 +46,25 @@
return self._pc
def update(self, first=None, last=None, email=None, address=None, pc=None):
+ """Update contact information
+
+ We can use the update method to change information:
+
+ >>> bob = Contact("bob", "smith", "bob@zope.com", "513 Prince Edward",
+ ... "22402")
+ >>> bob.update('Bob', 'Smith', 'bob.smith@zope.com',
+ ... '513 Prince Edward St.', '22401')
+ >>> bob.first()
+ 'Bob'
+ >>> bob.last()
+ 'Smith'
+ >>> bob.email()
+ 'bob.smith@zope.com'
+ >>> bob.address()
+ '513 Prince Edward St.'
+ >>> bob.postal_code()
+ '22401'
+ """
if first is not None:
self._first = first
if last is not None:
From cvs-admin at zope.org Wed Dec 3 06:33:36 2003
From: cvs-admin at zope.org (Jim Fulton)
Date: Sun Aug 10 16:40:38 2008
Subject: [Zope-book]
CVS: Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step4
- interfaces.py:1.1 interface.py:NONE
Message-ID: <200312031133.hB3BXa21007295@cvs.zope.org>
Update of /cvs-repository/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step4
In directory cvs.zope.org:/tmp/cvs-serv7249/Step4
Added Files:
interfaces.py
Removed Files:
interface.py
Log Message:
The interface module should have been named interfaces.
=== Added File Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step4/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.
"""
=== Removed File Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step4/interface.py ===
From cvs-admin at zope.org Wed Dec 3 06:33:36 2003
From: cvs-admin at zope.org (Jim Fulton)
Date: Sun Aug 10 16:40:38 2008
Subject: [Zope-book]
CVS: Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step3
- interfaces.py:1.1 interface.py:NONE
Message-ID: <200312031133.hB3BXabc007285@cvs.zope.org>
Update of /cvs-repository/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step3
In directory cvs.zope.org:/tmp/cvs-serv7249/Step3
Added Files:
interfaces.py
Removed Files:
interface.py
Log Message:
The interface module should have been named interfaces.
=== Added File Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step3/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.
"""
=== Removed File Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step3/interface.py ===
From cvs-admin at zope.org Wed Dec 3 06:33:37 2003
From: cvs-admin at zope.org (Jim Fulton)
Date: Sun Aug 10 16:40:38 2008
Subject: [Zope-book]
CVS: Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5
- tests.py:1.1 browser.py:1.2 configure.zcml:1.5
contact.py:1.3 info.pt:1.4
Message-ID: <200312031133.hB3BXbAV007306@cvs.zope.org>
Update of /cvs-repository/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5
In directory cvs.zope.org:/tmp/cvs-serv6951/Step5
Modified Files:
browser.py configure.zcml contact.py info.pt
Added Files:
tests.py
Log Message:
Updated to use new addMenuItem directive. Fixed lots of small
bugs and got all of the code examples to run correctly,
=== Added File Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5/tests.py ===
##############################################################################
#
# Copyright (c) 2003 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Test module for contacts example
$Id: tests.py,v 1.1 2003/12/03 11:33:05 jim Exp $
"""
import unittest
import doctest
from zopeproducts.contact.contact import Contact
def test_partial_contact_update():
"""We can use keyword arguments to update selected data
>>> bob = Contact("bob", "smith", "bob@zope.com", "513 Prince Edward",
... "22402")
>>> bob.update(email='bob.smith@zope.com', pc='22401')
>>> bob.first()
'bob'
>>> bob.last()
'smith'
>>> bob.email()
'bob.smith@zope.com'
>>> bob.address()
'513 Prince Edward'
>>> bob.postal_code()
'22401'
"""
def test_suite():
return unittest.TestSuite((
doctest.DocTestSuite(),
doctest.DocTestSuite('zopeproducts.contact.contact'),
))
if __name__ == '__main__': unittest.main()
=== Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5/browser.py 1.1 => 1.2 ===
--- Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5/browser.py:1.1 Fri Nov 21 11:51:41 2003
+++ Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5/browser.py Wed Dec 3 06:33:05 2003
@@ -1,6 +1,6 @@
from zope.app import zapi
-from interfaces import IContactInfo, IPostalInfo
-from zope.publisher.browser.browserview import BrowserView
+from interfaces import IContactInfo, IContact, IPostalInfo
+from zope.app.publisher.browser import BrowserView
class ContactInfoView:
"""Provide an interface for viewing a contact
=== Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5/configure.zcml 1.4 => 1.5 ===
--- Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5/configure.zcml:1.4 Fri Nov 21 11:51:41 2003
+++ Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5/configure.zcml Wed Dec 3 06:33:05 2003
@@ -1,72 +1,66 @@
+ xmlns="http://namespaces.zope.org/zope"
+ xmlns:browser="http://namespaces.zope.org/browser"
+ xmlns:global_translation="http://namespaces.zope.org/gts"
+ i18n_domain="zopeproducts.contact">
-
+
-
+ interface=".interfaces.IContactInfo" />
-
-
-
-
-
+ />
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
-
+
=== Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5/contact.py 1.2 => 1.3 ===
--- Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5/contact.py:1.2 Mon Nov 24 02:28:04 2003
+++ Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5/contact.py Wed Dec 3 06:33:05 2003
@@ -1,22 +1,39 @@
-import persistence
-from zope.interface import implements
+from persistence import Persistent
+from interfaces import IContact
+import zope.interface
from zope.app import zapi
from interfaces import IContact, IContactInfo, IPostalLookup, IPostalInfo
-class Contact(persistence.Persistent):
- """Personal contact information
+class Contact(Persistent):
+ """Personal Contact Information
- Contacts keep track of personal data, such as name, email
- and postal address. All methods are protected.
+ >>> bob = Contact("bob", "smith", "bob@zope.com", "513 Prince Edward",
+ ... "22402")
+ >>> bob.first()
+ 'bob'
+ >>> bob.last()
+ 'smith'
+ >>> bob.email()
+ 'bob@zope.com'
+ >>> bob.address()
+ '513 Prince Edward'
+ >>> bob.postal_code()
+ '22402'
"""
- implements(IContact)
+ zope.interface.implements(IContact)
def __init__(self, first='', last='', email='', address='', pc=''):
self.update(first, last, email, address, pc)
- def name(self):
+ def name(self):
+ """Get the name of a contact, combining the first and last names
+
+ >>> bob = Contact('Bob', 'Smith')
+ >>> bob.name()
+ 'Bob Smith'
+ """
return "%s %s" % (self._first, self._last)
def first(self):
@@ -35,6 +52,25 @@
return self._pc
def update(self, first=None, last=None, email=None, address=None, pc=None):
+ """Update contact information
+
+ We can use the update method to change information:
+
+ >>> bob = Contact("bob", "smith", "bob@zope.com", "513 Prince Edward",
+ ... "22402")
+ >>> bob.update('Bob', 'Smith', 'bob.smith@zope.com',
+ ... '513 Prince Edward St.', '22401')
+ >>> bob.first()
+ 'Bob'
+ >>> bob.last()
+ 'Smith'
+ >>> bob.email()
+ 'bob.smith@zope.com'
+ >>> bob.address()
+ '513 Prince Edward St.'
+ >>> bob.postal_code()
+ '22401'
+ """
if first is not None:
self._first = first
if last is not None:
@@ -49,7 +85,7 @@
class ContactCityState:
"Provide access to city and state information for a contact"
- implements(IPostalInfo)
+ zope.interface.implements(IPostalInfo)
__used_for__ = IContactInfo
@@ -62,7 +98,9 @@
else:
self._city, self._state = info.city(), info.state()
- def city(self): return self._city
+ def city(self):
+ return self._city
- def state(self): return self._state
+ def state(self):
+ return self._state
=== Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5/info.pt 1.3 => 1.4 ===
--- Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5/info.pt:1.3 Tue Jun 18 11:41:30 2002
+++ Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5/info.pt Wed Dec 3 06:33:05 2003
@@ -1,24 +1,25 @@
-
-
Contact Information
+
+Contact Information
- Contact information
+ Contact information
- Name: |
+
Name: |
First
Last |
- Address: |
+
Address: |
Mailing address here |
- Email: |
+
Email: |
foo@bar.com |
- City: |
+
City: |
City |
- State: |
+
State: |
State |
From cvs-admin at zope.org Wed Dec 3 06:33:37 2003
From: cvs-admin at zope.org (Jim Fulton)
Date: Sun Aug 10 16:40:38 2008
Subject: [Zope-book]
CVS: Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step6
- tests.py:1.1 browser.py:1.2 configure.zcml:1.5
contact.py:1.2 info.pt:1.5
Message-ID: <200312031133.hB3BXbFn007314@cvs.zope.org>
Update of /cvs-repository/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step6
In directory cvs.zope.org:/tmp/cvs-serv6951/Step6
Modified Files:
browser.py configure.zcml contact.py info.pt
Added Files:
tests.py
Log Message:
Updated to use new addMenuItem directive. Fixed lots of small
bugs and got all of the code examples to run correctly,
=== Added File Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step6/tests.py ===
##############################################################################
#
# Copyright (c) 2003 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Test module for contacts example
$Id: tests.py,v 1.1 2003/12/03 11:33:06 jim Exp $
"""
import unittest
import doctest
from zopeproducts.contact.contact import Contact
def test_partial_contact_update():
"""We can use keyword arguments to update selected data
>>> bob = Contact("bob", "smith", "bob@zope.com", "513 Prince Edward",
... "22402")
>>> bob.update(email='bob.smith@zope.com', pc='22401')
>>> bob.first()
'bob'
>>> bob.last()
'smith'
>>> bob.email()
'bob.smith@zope.com'
>>> bob.address()
'513 Prince Edward'
>>> bob.postal_code()
'22401'
"""
def test_suite():
return unittest.TestSuite((
doctest.DocTestSuite(),
doctest.DocTestSuite('zopeproducts.contact.contact'),
))
if __name__ == '__main__': unittest.main()
=== Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step6/browser.py 1.1 => 1.2 ===
--- Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step6/browser.py:1.1 Mon Nov 24 02:28:34 2003
+++ Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step6/browser.py Wed Dec 3 06:33:06 2003
@@ -1,8 +1,8 @@
from zope.app import zapi
-from zope.publisher.browser.browserview import BrowserView
+from zope.app.publisher.browser import BrowserView
from zope.app.interfaces.container import IAdding
from contact import Contact
-from interfaces import IContactInfo, IPostalInfo
+from interfaces import IContactInfo, IContact, IPostalInfo
class ContactInfoView:
"""Provide an interface for viewing a contact
@@ -42,7 +42,6 @@
# 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)
+ a = zapi.getAdapter(self.context, IContactAdd)
+ a.add(first, last, email, address, pc)
self.request.response.redirect(self.context.nextURL())
=== Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step6/configure.zcml 1.4 => 1.5 ===
--- Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step6/configure.zcml:1.4 Mon Nov 24 02:28:34 2003
+++ Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step6/configure.zcml Wed Dec 3 06:33:06 2003
@@ -1,81 +1,85 @@
+ xmlns="http://namespaces.zope.org/zope"
+ xmlns:browser="http://namespaces.zope.org/browser"
+ xmlns:global_translation="http://namespaces.zope.org/gts"
+ i18n_domain="zopeproducts.contact">
-
+
-
+ permission="zope.View"
+ interface=".interfaces.IContactInfo" />
-
+ name="zopeproducts.contact"
+ for="zope.app.interfaces.container.IAdding"
+ class=".browser.ContactAddView"
+ permission="zope.ManageContent"
+ >
-
+
-
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
+ menu="zmi_views"
+ title="View"
+ permission="zope.View"
+ class=".browser.ContactInfoView"
+ />
+
+
+
+
+
+
-
+
+ provides=".interfaces.IPostalLookup"
+ permission="zope.Public" />
+ factory=".contact.ContactCityState"
+ provides=".interfaces.IPostalInfo"
+ for=".interfaces.IContactInfo"
+ permission="zope.Public" />
=== Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step6/contact.py 1.1 => 1.2 ===
--- Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step6/contact.py:1.1 Mon Nov 24 02:28:34 2003
+++ Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step6/contact.py Wed Dec 3 06:33:06 2003
@@ -1,22 +1,37 @@
-
-import persistence
-from zope.interface import implements
+from persistence import Persistent
from zope.app import zapi
from interfaces import IContact, IContactInfo, IPostalLookup, IPostalInfo
+import zope.interface
-class Contact(persistence.Persistent):
- """Personal contact information
+class Contact(Persistent):
+ """Personal Contact Information
- Contacts keep track of personal data, such as name, email
- and postal address. All methods are protected.
+ >>> bob = Contact("bob", "smith", "bob@zope.com", "513 Prince Edward",
+ ... "22402")
+ >>> bob.first()
+ 'bob'
+ >>> bob.last()
+ 'smith'
+ >>> bob.email()
+ 'bob@zope.com'
+ >>> bob.address()
+ '513 Prince Edward'
+ >>> bob.postal_code()
+ '22402'
"""
- implements(IContact)
+ zope.interface.implements(IContact)
def __init__(self, first='', last='', email='', address='', pc=''):
self.update(first, last, email, address, pc)
- def name(self):
+ def name(self):
+ """Get the name of a contact, combining the first and last names
+
+ >>> bob = Contact('Bob', 'Smith')
+ >>> bob.name()
+ 'Bob Smith'
+ """
return "%s %s" % (self._first, self._last)
def first(self):
@@ -35,6 +50,25 @@
return self._pc
def update(self, first=None, last=None, email=None, address=None, pc=None):
+ """Update contact information
+
+ We can use the update method to change information:
+
+ >>> bob = Contact("bob", "smith", "bob@zope.com", "513 Prince Edward",
+ ... "22402")
+ >>> bob.update('Bob', 'Smith', 'bob.smith@zope.com',
+ ... '513 Prince Edward St.', '22401')
+ >>> bob.first()
+ 'Bob'
+ >>> bob.last()
+ 'Smith'
+ >>> bob.email()
+ 'bob.smith@zope.com'
+ >>> bob.address()
+ '513 Prince Edward St.'
+ >>> bob.postal_code()
+ '22401'
+ """
if first is not None:
self._first = first
if last is not None:
@@ -49,7 +83,7 @@
class ContactCityState:
"Provide access to city and state information for a contact"
- implements(IPostalInfo)
+ zope.interface.implements(IPostalInfo)
__used_for__ = IContactInfo
@@ -62,7 +96,9 @@
else:
self._city, self._state = info.city(), info.state()
- def city(self): return self._city
+ def city(self):
+ return self._city
- def state(self): return self._state
+ def state(self):
+ return self._state
=== Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step6/info.pt 1.4 => 1.5 ===
--- Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step6/info.pt:1.4 Thu Jun 20 17:49:28 2002
+++ Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step6/info.pt Wed Dec 3 06:33:06 2003
@@ -1,24 +1,25 @@
-
-Contact Information
+
+Contact Information
- Contact information
+ Contact information
- Name: |
+
Name: |
First
Last |
- Address: |
+
Address: |
Mailing address here |
- Email: |
+
Email: |
foo@bar.com |
- City: |
+
City: |
City |
- State: |
+
State: |
State |
From cvs-admin at zope.org Wed Dec 3 06:33:38 2003
From: cvs-admin at zope.org (Jim Fulton)
Date: Sun Aug 10 16:40:38 2008
Subject: [Zope-book]
CVS: Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step7
- tests.py:1.1 configure.zcml:1.3 contact.py:1.5
Message-ID: <200312031133.hB3BXcQe007322@cvs.zope.org>
Update of /cvs-repository/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step7
In directory cvs.zope.org:/tmp/cvs-serv6951/Step7
Modified Files:
configure.zcml contact.py
Added Files:
tests.py
Log Message:
Updated to use new addMenuItem directive. Fixed lots of small
bugs and got all of the code examples to run correctly,
=== Added File Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step7/tests.py ===
##############################################################################
#
# Copyright (c) 2003 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Test module for contacts example
$Id: tests.py,v 1.1 2003/12/03 11:33:07 jim Exp $
"""
import unittest
import doctest
from zopeproducts.contact.contact import Contact
def test_partial_contact_update():
"""We can use keyword arguments to update selected data
>>> bob = Contact("bob", "smith", "bob@zope.com", "513 Prince Edward",
... "22402")
>>> bob.update(email='bob.smith@zope.com', pc='22401')
>>> bob.first()
'bob'
>>> bob.last()
'smith'
>>> bob.email()
'bob.smith@zope.com'
>>> bob.address()
'513 Prince Edward'
>>> bob.postal_code()
'22401'
"""
def test_suite():
return unittest.TestSuite((
doctest.DocTestSuite(),
doctest.DocTestSuite('zopeproducts.contact.contact'),
))
if __name__ == '__main__': unittest.main()
=== Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step7/configure.zcml 1.2 => 1.3 ===
--- Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step7/configure.zcml:1.2 Tue Dec 31 15:17:52 2002
+++ Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step7/configure.zcml Wed Dec 3 06:33:07 2003
@@ -1,69 +1,79 @@
-
-
-
+
+
+
-
+ interface="zope.app.interfaces.annotation.IAttributeAnnotatable" />
-
-
-
+
-
+
-
+
+
+
-
-
+
+
-
+
@@ -72,14 +82,12 @@
+ permission="zope.Public" />
+ permission="zope.Public" />
-
+
=== Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step7/contact.py 1.4 => 1.5 ===
--- Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step7/contact.py:1.4 Mon Nov 24 02:29:24 2003
+++ Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step7/contact.py Wed Dec 3 06:33:07 2003
@@ -1,25 +1,41 @@
-import persistence
-from zope.interface import implements
+from persistence import Persistent
from zope.app import zapi
+from interfaces import IContact, IContactInfo, IPostalLookup, IPostalInfo
+from interfaces import IContactAdd
from zope.app.interfaces.container import IAdding
from zope.app.event import publish
from zope.app.event.objectevent import ObjectCreatedEvent
+import zope.interface
-from interfaces import IContact, IContactInfo, IContactAdd
-from interfaces import IPostalLookup, IPostalInfo
+class Contact(Persistent):
+ """Personal Contact Information
-class Contact(persistence.Persistent):
- """Personal contact information
-
- Contacts keep track of personal data, such as name, email
- and postal address. All methods are protected.
+ >>> bob = Contact("bob", "smith", "bob@zope.com", "513 Prince Edward",
+ ... "22402")
+ >>> bob.first()
+ 'bob'
+ >>> bob.last()
+ 'smith'
+ >>> bob.email()
+ 'bob@zope.com'
+ >>> bob.address()
+ '513 Prince Edward'
+ >>> bob.postal_code()
+ '22402'
"""
- implements(IContact)
+
+ zope.interface.implements(IContact)
def __init__(self, first='', last='', email='', address='', pc=''):
self.update(first, last, email, address, pc)
- def name(self):
+ def name(self):
+ """Get the name of a contact, combining the first and last names
+
+ >>> bob = Contact('Bob', 'Smith')
+ >>> bob.name()
+ 'Bob Smith'
+ """
return "%s %s" % (self._first, self._last)
def first(self):
@@ -27,7 +43,7 @@
def last(self):
return self._last
-
+
def email(self):
return self._email
@@ -38,6 +54,25 @@
return self._pc
def update(self, first=None, last=None, email=None, address=None, pc=None):
+ """Update contact information
+
+ We can use the update method to change information:
+
+ >>> bob = Contact("bob", "smith", "bob@zope.com", "513 Prince Edward",
+ ... "22402")
+ >>> bob.update('Bob', 'Smith', 'bob.smith@zope.com',
+ ... '513 Prince Edward St.', '22401')
+ >>> bob.first()
+ 'Bob'
+ >>> bob.last()
+ 'Smith'
+ >>> bob.email()
+ 'bob.smith@zope.com'
+ >>> bob.address()
+ '513 Prince Edward St.'
+ >>> bob.postal_code()
+ '22401'
+ """
if first is not None:
self._first = first
if last is not None:
@@ -49,25 +84,10 @@
if pc is not None:
self._pc = pc
-
-class ContactAdd:
- "Provide a user interface for adding a contact"
- implements(IContactAdd)
- __used_for__ = IAdding
-
- def __init__(self, context):
- self.context = context
-
- def add(self, first, last, email, address, pc):
- contact = Contact()
- publish(self.context.context, ObjectCreatedEvent(contact))
- contact.update(first, last, email, address, pc)
- self.context.add(contact)
-
class ContactCityState:
"Provide access to city and state information for a contact"
- implements(IPostalInfo)
+ zope.interface.implements(IPostalInfo)
__used_for__ = IContactInfo
@@ -80,7 +100,21 @@
else:
self._city, self._state = info.city(), info.state()
- def city(self): return self._city
+ def city(self):
+ return self._city
+
+ def state(self):
+ return self._state
+
+class ContactAdd:
+ "Provide a user interface for adding a contact"
+ zope.interface.implements(IContactAdd)
+ __used_for__ = IAdding
- def state(self): return self._state
+ def __init__(self, context):
+ self.context = context
+ def add(self, first, last, email, address, pc):
+ contact = Contact(first, last, email, address, pc)
+ publish(self.context.context, ObjectCreatedEvent(contact))
+ self.context.add(contact)
From cvs-admin at zope.org Wed Dec 3 06:33:44 2003
From: cvs-admin at zope.org (Jim Fulton)
Date: Sun Aug 10 16:40:38 2008
Subject: [Zope-book]
CVS: Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step1
- README.txt:NONE
Message-ID: <200312031133.hB3BXius007350@cvs.zope.org>
Update of /cvs-repository/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step1
In directory cvs.zope.org:/tmp/cvs-serv7328/Step1
Removed Files:
README.txt
Log Message:
The readme files have falled way out of date. I'd like to have these,
but they do more harm than good if they are not up to date
=== Removed File Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step1/README.txt ===
From cvs-admin at zope.org Wed Dec 3 06:33:45 2003
From: cvs-admin at zope.org (Jim Fulton)
Date: Sun Aug 10 16:40:38 2008
Subject: [Zope-book]
CVS: Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step3
- README.txt:NONE
Message-ID: <200312031133.hB3BXjGT007374@cvs.zope.org>
Update of /cvs-repository/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step3
In directory cvs.zope.org:/tmp/cvs-serv7328/Step3
Removed Files:
README.txt
Log Message:
The readme files have falled way out of date. I'd like to have these,
but they do more harm than good if they are not up to date
=== Removed File Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step3/README.txt ===
From cvs-admin at zope.org Wed Dec 3 06:33:44 2003
From: cvs-admin at zope.org (Jim Fulton)
Date: Sun Aug 10 16:40:38 2008
Subject: [Zope-book]
CVS: Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step2
- README.txt:NONE
Message-ID: <200312031133.hB3BXi8l007362@cvs.zope.org>
Update of /cvs-repository/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step2
In directory cvs.zope.org:/tmp/cvs-serv7328/Step2
Removed Files:
README.txt
Log Message:
The readme files have falled way out of date. I'd like to have these,
but they do more harm than good if they are not up to date
=== Removed File Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step2/README.txt ===
From cvs-admin at zope.org Wed Dec 3 06:34:05 2003
From: cvs-admin at zope.org (Jim Fulton)
Date: Sun Aug 10 16:40:38 2008
Subject: [Zope-book]
CVS: Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step3
- tests.py:1.1 configure.zcml:1.5 contact.py:1.3 info.pt:1.2
Message-ID: <200312031134.hB3BY5Ta007555@cvs.zope.org>
Update of /cvs-repository/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step3
In directory cvs.zope.org:/tmp/cvs-serv6951/Step3
Modified Files:
configure.zcml contact.py info.pt
Added Files:
tests.py
Log Message:
Updated to use new addMenuItem directive. Fixed lots of small
bugs and got all of the code examples to run correctly,
=== Added File Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step3/tests.py ===
##############################################################################
#
# Copyright (c) 2003 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Test module for contacts example
$Id: tests.py,v 1.1 2003/12/03 11:33:04 jim Exp $
"""
import unittest
import doctest
from zopeproducts.contact.contact import Contact
def test_partial_contact_update():
"""We can use keyword arguments to update selected data
>>> bob = Contact("bob", "smith", "bob@zope.com", "513 Prince Edward",
... "22402")
>>> bob.update(email='bob.smith@zope.com', pc='22401')
>>> bob.first()
'bob'
>>> bob.last()
'smith'
>>> bob.email()
'bob.smith@zope.com'
>>> bob.address()
'513 Prince Edward'
>>> bob.postal_code()
'22401'
"""
def test_suite():
return unittest.TestSuite((
doctest.DocTestSuite(),
doctest.DocTestSuite('zopeproducts.contact.contact'),
))
if __name__ == '__main__': unittest.main()
=== Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step3/configure.zcml 1.4 => 1.5 ===
--- Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step3/configure.zcml:1.4 Fri Nov 21 11:51:40 2003
+++ Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step3/configure.zcml Wed Dec 3 06:33:04 2003
@@ -1,35 +1,26 @@
+ xmlns="http://namespaces.zope.org/zope"
+ xmlns:browser="http://namespaces.zope.org/browser"
+ xmlns:global_translation="http://namespaces.zope.org/gts">
-
+
-
-
+
+ interface=".interfaces.IContactInfo" />
-
-
-
+ class=".contact.Contact"
+ permission="zope.ManageContent"
+ />
=== Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step3/contact.py 1.2 => 1.3 ===
--- Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step3/contact.py:1.2 Fri Nov 21 11:51:40 2003
+++ Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step3/contact.py Wed Dec 3 06:33:04 2003
@@ -1,21 +1,37 @@
-import persistence
-from zope.interface import implements
-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.
+from persistence import Persistent
+from interfaces import IContact
+import zope.interface
+
+class Contact(Persistent):
+ """Personal Contact Information
+
+ >>> bob = Contact("bob", "smith", "bob@zope.com", "513 Prince Edward",
+ ... "22402")
+ >>> bob.first()
+ 'bob'
+ >>> bob.last()
+ 'smith'
+ >>> bob.email()
+ 'bob@zope.com'
+ >>> bob.address()
+ '513 Prince Edward'
+ >>> bob.postal_code()
+ '22402'
"""
- implements(IContact)
+ zope.interface.implements(IContact)
def __init__(self, first='', last='', email='', address='', pc=''):
self.update(first, last, email, address, pc)
- def name(self):
+ def name(self):
+ """Get the name of a contact, combining the first and last names
+
+ >>> bob = Contact('Bob', 'Smith')
+ >>> bob.name()
+ 'Bob Smith'
+ """
return "%s %s" % (self._first, self._last)
def first(self):
@@ -34,6 +50,25 @@
return self._pc
def update(self, first=None, last=None, email=None, address=None, pc=None):
+ """Update contact information
+
+ We can use the update method to change information:
+
+ >>> bob = Contact("bob", "smith", "bob@zope.com", "513 Prince Edward",
+ ... "22402")
+ >>> bob.update('Bob', 'Smith', 'bob.smith@zope.com',
+ ... '513 Prince Edward St.', '22401')
+ >>> bob.first()
+ 'Bob'
+ >>> bob.last()
+ 'Smith'
+ >>> bob.email()
+ 'bob.smith@zope.com'
+ >>> bob.address()
+ '513 Prince Edward St.'
+ >>> bob.postal_code()
+ '22401'
+ """
if first is not None:
self._first = first
if last is not None:
=== Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step3/info.pt 1.1 => 1.2 ===
--- Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step3/info.pt:1.1 Thu Jun 20 19:11:36 2002
+++ Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step3/info.pt Wed Dec 3 06:33:04 2003
@@ -1,18 +1,19 @@
-
-Contact Information
+
+Contact Information
- Contact information
+ Contact information
- Name: |
+
Name: |
First
Last |
- Address: |
+
Address: |
Mailing address here |
- Email |
+
Email |
foo@bar.com |
From cvs-admin at zope.org Wed Dec 3 06:34:06 2003
From: cvs-admin at zope.org (Jim Fulton)
Date: Sun Aug 10 16:40:38 2008
Subject: [Zope-book]
CVS: Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step4
- tests.py:1.1 browser.py:1.3 configure.zcml:1.4
contact.py:1.3 info.pt:1.2
Message-ID: <200312031134.hB3BY6fu007563@cvs.zope.org>
Update of /cvs-repository/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step4
In directory cvs.zope.org:/tmp/cvs-serv6951/Step4
Modified Files:
browser.py configure.zcml contact.py info.pt
Added Files:
tests.py
Log Message:
Updated to use new addMenuItem directive. Fixed lots of small
bugs and got all of the code examples to run correctly,
=== Added File Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step4/tests.py ===
##############################################################################
#
# Copyright (c) 2003 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Test module for contacts example
$Id: tests.py,v 1.1 2003/12/03 11:33:05 jim Exp $
"""
import unittest
import doctest
from zopeproducts.contact.contact import Contact
def test_partial_contact_update():
"""We can use keyword arguments to update selected data
>>> bob = Contact("bob", "smith", "bob@zope.com", "513 Prince Edward",
... "22402")
>>> bob.update(email='bob.smith@zope.com', pc='22401')
>>> bob.first()
'bob'
>>> bob.last()
'smith'
>>> bob.email()
'bob.smith@zope.com'
>>> bob.address()
'513 Prince Edward'
>>> bob.postal_code()
'22401'
"""
def test_suite():
return unittest.TestSuite((
doctest.DocTestSuite(),
doctest.DocTestSuite('zopeproducts.contact.contact'),
))
if __name__ == '__main__': unittest.main()
=== Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step4/browser.py 1.2 => 1.3 ===
--- Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step4/browser.py:1.2 Sat Jun 21 23:20:49 2003
+++ Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step4/browser.py Wed Dec 3 06:33:05 2003
@@ -1,5 +1,5 @@
from zope.publisher.browser import BrowserView
-from interface import IContact
+from interfaces import IContact
class ContactEditView(BrowserView):
"Provide a user interface for editing a contact"
=== Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step4/configure.zcml 1.3 => 1.4 ===
--- Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step4/configure.zcml:1.3 Fri Nov 21 11:51:40 2003
+++ Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step4/configure.zcml Wed Dec 3 06:33:05 2003
@@ -1,38 +1,29 @@
+ xmlns="http://namespaces.zope.org/zope"
+ xmlns:browser="http://namespaces.zope.org/browser"
+ xmlns:global_translation="http://namespaces.zope.org/gts"
+ i18n_domain="zopeproducts.contact">
-
+
-
+ interface=".interfaces.IContactInfo" />
-
-
-
=== Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step4/contact.py 1.2 => 1.3 ===
--- Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step4/contact.py:1.2 Fri Nov 21 11:51:40 2003
+++ Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step4/contact.py Wed Dec 3 06:33:05 2003
@@ -1,21 +1,37 @@
from persistence import Persistent
-from zope.interface import implements
-from interface import IContact
+from interfaces import IContact
+import zope.interface
class Contact(Persistent):
- """Personal contact information
+ """Personal Contact Information
- Contacts keep track of personal data, such as name, email
- and postal address. All methods are protected.
+ >>> bob = Contact("bob", "smith", "bob@zope.com", "513 Prince Edward",
+ ... "22402")
+ >>> bob.first()
+ 'bob'
+ >>> bob.last()
+ 'smith'
+ >>> bob.email()
+ 'bob@zope.com'
+ >>> bob.address()
+ '513 Prince Edward'
+ >>> bob.postal_code()
+ '22402'
"""
- implements(IContact)
+ zope.interface.implements(IContact)
def __init__(self, first='', last='', email='', address='', pc=''):
self.update(first, last, email, address, pc)
- def name(self):
+ def name(self):
+ """Get the name of a contact, combining the first and last names
+
+ >>> bob = Contact('Bob', 'Smith')
+ >>> bob.name()
+ 'Bob Smith'
+ """
return "%s %s" % (self._first, self._last)
def first(self):
@@ -34,6 +50,25 @@
return self._pc
def update(self, first=None, last=None, email=None, address=None, pc=None):
+ """Update contact information
+
+ We can use the update method to change information:
+
+ >>> bob = Contact("bob", "smith", "bob@zope.com", "513 Prince Edward",
+ ... "22402")
+ >>> bob.update('Bob', 'Smith', 'bob.smith@zope.com',
+ ... '513 Prince Edward St.', '22401')
+ >>> bob.first()
+ 'Bob'
+ >>> bob.last()
+ 'Smith'
+ >>> bob.email()
+ 'bob.smith@zope.com'
+ >>> bob.address()
+ '513 Prince Edward St.'
+ >>> bob.postal_code()
+ '22401'
+ """
if first is not None:
self._first = first
if last is not None:
=== Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step4/info.pt 1.1 => 1.2 ===
--- Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step4/info.pt:1.1 Fri Jun 21 04:48:33 2002
+++ Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step4/info.pt Wed Dec 3 06:33:05 2003
@@ -1,18 +1,19 @@
-
-Contact Information
+
+Contact Information
- Contact information
+ Contact information
- Name: |
+
Name: |
First
Last |
- Address: |
+
Address: |
Mailing address here |
- Email |
+
Email |
foo@bar.com |
From cvs-admin at zope.org Wed Dec 3 06:33:46 2003
From: cvs-admin at zope.org (Jim Fulton)
Date: Sun Aug 10 16:40:38 2008
Subject: [Zope-book]
CVS: Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5
- README.txt:NONE
Message-ID: <200312031133.hB3BXkIA007395@cvs.zope.org>
Update of /cvs-repository/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5
In directory cvs.zope.org:/tmp/cvs-serv7328/Step5
Removed Files:
README.txt
Log Message:
The readme files have falled way out of date. I'd like to have these,
but they do more harm than good if they are not up to date
=== Removed File Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5/README.txt ===
From cvs-admin at zope.org Wed Dec 3 06:33:46 2003
From: cvs-admin at zope.org (Jim Fulton)
Date: Sun Aug 10 16:40:38 2008
Subject: [Zope-book]
CVS: Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step4
- README.txt:NONE
Message-ID: <200312031133.hB3BXk48007386@cvs.zope.org>
Update of /cvs-repository/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step4
In directory cvs.zope.org:/tmp/cvs-serv7328/Step4
Removed Files:
README.txt
Log Message:
The readme files have falled way out of date. I'd like to have these,
but they do more harm than good if they are not up to date
=== Removed File Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step4/README.txt ===
From cvs-admin at zope.org Wed Dec 3 07:35:42 2003
From: cvs-admin at zope.org (Jim Fulton)
Date: Sun Aug 10 16:40:38 2008
Subject: [Zope-book]
CVS: Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1
- slides.sxi:1.23
Message-ID: <200312031235.hB3CZgZQ016728@cvs.zope.org>
Update of /cvs-repository/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1
In directory cvs.zope.org:/tmp/cvs-serv16685
Modified Files:
slides.sxi
Log Message:
Added a hand-on page for last step
=== Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/slides.sxi 1.22 => 1.23 ===
From cvs-admin at zope.org Wed Dec 3 09:25:43 2003
From: cvs-admin at zope.org (Jim Fulton)
Date: Sun Aug 10 16:40:38 2008
Subject: [Zope-book]
CVS: Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step3/translation_files
Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step3/translation_files
- New directory
Message-ID: <200312031425.hB3EPhJG001576@cvs.zope.org>
Update of /cvs-repository/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step3/translation_files
In directory cvs.zope.org:/tmp/cvs-serv1558/translation_files
Log Message:
Directory /cvs-repository/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step3/translation_files added to the repository
=== Added directory Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step3/translation_files ===
From cvs-admin at zope.org Wed Dec 3 09:43:52 2003
From: cvs-admin at zope.org (Jim Fulton)
Date: Sun Aug 10 16:40:38 2008
Subject: [Zope-book]
CVS: Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step7/translation_files
Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step7/translation_files
- New directory
Message-ID: <200312031443.hB3Ehqwt004751@cvs.zope.org>
Update of /cvs-repository/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step7/translation_files
In directory cvs.zope.org:/tmp/cvs-serv4735/translation_files
Log Message:
Directory /cvs-repository/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step7/translation_files added to the repository
=== Added directory Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step7/translation_files ===
From cvs-admin at zope.org Wed Dec 3 09:44:11 2003
From: cvs-admin at zope.org (Jim Fulton)
Date: Sun Aug 10 16:40:38 2008
Subject: [Zope-book]
CVS: Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step6/translation_files
Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step6/translation_files
- New directory
Message-ID: <200312031444.hB3EiBan004917@cvs.zope.org>
Update of /cvs-repository/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step6/translation_files
In directory cvs.zope.org:/tmp/cvs-serv4901/translation_files
Log Message:
Directory /cvs-repository/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step6/translation_files added to the repository
=== Added directory Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step6/translation_files ===
From cvs-admin at zope.org Wed Dec 3 09:44:52 2003
From: cvs-admin at zope.org (Jim Fulton)
Date: Sun Aug 10 16:40:38 2008
Subject: [Zope-book]
CVS: Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5/translation_files
Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5/translation_files
- New directory
Message-ID: <200312031444.hB3Eiq2h004962@cvs.zope.org>
Update of /cvs-repository/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5/translation_files
In directory cvs.zope.org:/tmp/cvs-serv4946/translation_files
Log Message:
Directory /cvs-repository/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5/translation_files added to the repository
=== Added directory Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5/translation_files ===
From cvs-admin at zope.org Wed Dec 3 09:45:06 2003
From: cvs-admin at zope.org (Jim Fulton)
Date: Sun Aug 10 16:40:38 2008
Subject: [Zope-book]
CVS: Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step4/translation_files
Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step4/translation_files
- New directory
Message-ID: <200312031445.hB3Ej6Em005095@cvs.zope.org>
Update of /cvs-repository/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step4/translation_files
In directory cvs.zope.org:/tmp/cvs-serv5037/translation_files
Log Message:
Directory /cvs-repository/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step4/translation_files added to the repository
=== Added directory Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step4/translation_files ===
From cvs-admin at zope.org Wed Dec 3 09:55:49 2003
From: cvs-admin at zope.org (Jim Fulton)
Date: Sun Aug 10 16:40:38 2008
Subject: [Zope-book]
CVS: Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1
- slides.sxi:1.24
Message-ID: <200312031455.hB3Etnv2006642@cvs.zope.org>
Update of /cvs-repository/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1
In directory cvs.zope.org:/tmp/cvs-serv6623
Modified Files:
slides.sxi
Log Message:
Added (very terse) instructions for running the extraction tool when
localizing a product.
=== Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/slides.sxi 1.23 => 1.24 ===
From cvs-admin at zope.org Wed Dec 3 09:56:26 2003
From: cvs-admin at zope.org (Jim Fulton)
Date: Sun Aug 10 16:40:38 2008
Subject: [Zope-book]
CVS: Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step4/translation_files
- zopeproducts.contact.pot:1.1
Message-ID: <200312031456.hB3EuQvZ006867@cvs.zope.org>
Update of /cvs-repository/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step4/translation_files
In directory cvs.zope.org:/tmp/cvs-serv6842/Step4/translation_files
Added Files:
zopeproducts.contact.pot
Log Message:
Ran the extraction tool, so we can turn on use of the translation
files.
It would be good to get some translations now. :)
=== Added File Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step4/translation_files/zopeproducts.contact.pot ===
##############################################################################
#
# Copyright (c) 2003 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
msgid ""
msgstr ""
"Project-Id-Version: Zope X3 Pre-M4\n"
"POT-Creation-Date: Wed Dec 3 09:40:46 2003\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME \n"
"Language-Team: Zope 3 Developers \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: ENCODING\n"
"Generated-By: zope/app/translation_files/extract.py\n"
#: src/zopeproducts/contact/configure.zcml:24
msgid "View"
msgstr ""
#: src/zopeproducts/contact/configure.zcml:39
msgid "Edit"
msgstr ""
#: src/zopeproducts/contact/info.pt:13
msgid "Address:"
msgstr ""
#: src/zopeproducts/contact/info.pt:16
msgid "Email"
msgstr ""
#: src/zopeproducts/contact/info.pt:3
msgid "Contact Information"
msgstr ""
#: src/zopeproducts/contact/info.pt:7
msgid "Contact information"
msgstr ""
#: src/zopeproducts/contact/info.pt:9
msgid "Name:"
msgstr ""
From cvs-admin at zope.org Wed Dec 3 09:56:28 2003
From: cvs-admin at zope.org (Jim Fulton)
Date: Sun Aug 10 16:40:38 2008
Subject: [Zope-book]
CVS: Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step3/translation_files
- zopeproducts.contact.pot:1.1
Message-ID: <200312031456.hB3EuSJ0006929@cvs.zope.org>
Update of /cvs-repository/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step3/translation_files
In directory cvs.zope.org:/tmp/cvs-serv6842/Step3/translation_files
Added Files:
zopeproducts.contact.pot
Log Message:
Ran the extraction tool, so we can turn on use of the translation
files.
It would be good to get some translations now. :)
=== Added File Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step3/translation_files/zopeproducts.contact.pot ===
##############################################################################
#
# Copyright (c) 2003 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
msgid ""
msgstr ""
"Project-Id-Version: Zope X3 Pre-M4\n"
"POT-Creation-Date: Wed Dec 3 09:13:48 2003\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME \n"
"Language-Team: Zope 3 Developers \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: ENCODING\n"
"Generated-By: zope/app/translation_files/extract.py\n"
#: src/zopeproducts/contact/info.pt:13
msgid "Address:"
msgstr ""
#: src/zopeproducts/contact/info.pt:16
msgid "Email"
msgstr ""
#: src/zopeproducts/contact/info.pt:3
msgid "Contact Information"
msgstr ""
#: src/zopeproducts/contact/info.pt:7
msgid "Contact information"
msgstr ""
#: src/zopeproducts/contact/info.pt:9
msgid "Name:"
msgstr ""
From cvs-admin at zope.org Wed Dec 3 09:56:27 2003
From: cvs-admin at zope.org (Jim Fulton)
Date: Sun Aug 10 16:40:38 2008
Subject: [Zope-book]
CVS: Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step7/translation_files
- zopeproducts.contact.pot:1.1
Message-ID: <200312031456.hB3EuRxC006906@cvs.zope.org>
Update of /cvs-repository/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step7/translation_files
In directory cvs.zope.org:/tmp/cvs-serv6842/Step7/translation_files
Added Files:
zopeproducts.contact.pot
Log Message:
Ran the extraction tool, so we can turn on use of the translation
files.
It would be good to get some translations now. :)
=== Added File Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step7/translation_files/zopeproducts.contact.pot ===
##############################################################################
#
# Copyright (c) 2003 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
msgid ""
msgstr ""
"Project-Id-Version: Zope X3 Pre-M4\n"
"POT-Creation-Date: Wed Dec 3 09:43:12 2003\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME \n"
"Language-Team: Zope 3 Developers \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: ENCODING\n"
"Generated-By: zope/app/translation_files/extract.py\n"
#: src/zopeproducts/contact/configure.zcml:45
msgid "View"
msgstr ""
#: src/zopeproducts/contact/configure.zcml:61
msgid "Edit"
msgstr ""
#: src/zopeproducts/contact/info.pt:13
msgid "Address:"
msgstr ""
#: src/zopeproducts/contact/info.pt:16
msgid "Email:"
msgstr ""
#: src/zopeproducts/contact/info.pt:19
msgid "City:"
msgstr ""
#: src/zopeproducts/contact/info.pt:22
msgid "State:"
msgstr ""
#: src/zopeproducts/contact/info.pt:3
msgid "Contact Information"
msgstr ""
#: src/zopeproducts/contact/info.pt:7
msgid "Contact information"
msgstr ""
#: src/zopeproducts/contact/info.pt:9
msgid "Name:"
msgstr ""
From cvs-admin at zope.org Wed Dec 3 09:56:37 2003
From: cvs-admin at zope.org (Jim Fulton)
Date: Sun Aug 10 16:40:38 2008
Subject: [Zope-book]
CVS: Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step7
- info.pt:1.2
Message-ID: <200312031456.hB3EubX1007013@cvs.zope.org>
Update of /cvs-repository/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step7
In directory cvs.zope.org:/tmp/cvs-serv6994/Step7
Modified Files:
info.pt
Log Message:
Copied from step 6
=== Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step7/info.pt 1.1 => 1.2 ===
--- Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step7/info.pt:1.1 Sun Dec 8 03:44:31 2002
+++ Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step7/info.pt Wed Dec 3 09:56:36 2003
@@ -1,24 +1,25 @@
-
-Contact Information
+
+Contact Information
- Contact information
+ Contact information
- Name: |
+
Name: |
First
Last |
- Address: |
+
Address: |
Mailing address here |
- Email: |
+
Email: |
foo@bar.com |
- City: |
+
City: |
City |
- State: |
+
State: |
State |
From cvs-admin at zope.org Wed Dec 3 09:56:58 2003
From: cvs-admin at zope.org (Jim Fulton)
Date: Sun Aug 10 16:40:38 2008
Subject: [Zope-book]
CVS: Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step3
- configure.zcml:1.6
Message-ID: <200312031456.hB3EuwZ9007032@cvs.zope.org>
Update of /cvs-repository/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step3
In directory cvs.zope.org:/tmp/cvs-serv6842/Step3
Modified Files:
configure.zcml
Log Message:
Ran the extraction tool, so we can turn on use of the translation
files.
It would be good to get some translations now. :)
=== Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step3/configure.zcml 1.5 => 1.6 ===
--- Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step3/configure.zcml:1.5 Wed Dec 3 06:33:04 2003
+++ Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step3/configure.zcml Wed Dec 3 09:56:27 2003
@@ -3,7 +3,7 @@
xmlns:browser="http://namespaces.zope.org/browser"
xmlns:global_translation="http://namespaces.zope.org/gts">
-
+
Update of /cvs-repository/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step4
In directory cvs.zope.org:/tmp/cvs-serv6842/Step4
Modified Files:
configure.zcml
Log Message:
Ran the extraction tool, so we can turn on use of the translation
files.
It would be good to get some translations now. :)
=== Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step4/configure.zcml 1.4 => 1.5 ===
--- Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step4/configure.zcml:1.4 Wed Dec 3 06:33:05 2003
+++ Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step4/configure.zcml Wed Dec 3 09:56:28 2003
@@ -4,7 +4,7 @@
xmlns:global_translation="http://namespaces.zope.org/gts"
i18n_domain="zopeproducts.contact">
-
+
Update of /cvs-repository/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5
In directory cvs.zope.org:/tmp/cvs-serv6842/Step5
Modified Files:
configure.zcml
Log Message:
Ran the extraction tool, so we can turn on use of the translation
files.
It would be good to get some translations now. :)
=== Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5/configure.zcml 1.5 => 1.6 ===
--- Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5/configure.zcml:1.5 Wed Dec 3 06:33:05 2003
+++ Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5/configure.zcml Wed Dec 3 09:56:28 2003
@@ -4,7 +4,7 @@
xmlns:global_translation="http://namespaces.zope.org/gts"
i18n_domain="zopeproducts.contact">
-
+
Update of /cvs-repository/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step6
In directory cvs.zope.org:/tmp/cvs-serv6842/Step6
Modified Files:
configure.zcml
Log Message:
Ran the extraction tool, so we can turn on use of the translation
files.
It would be good to get some translations now. :)
=== Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step6/configure.zcml 1.5 => 1.6 ===
--- Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step6/configure.zcml:1.5 Wed Dec 3 06:33:06 2003
+++ Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step6/configure.zcml Wed Dec 3 09:56:29 2003
@@ -4,7 +4,7 @@
xmlns:global_translation="http://namespaces.zope.org/gts"
i18n_domain="zopeproducts.contact">
-
+
Update of /cvs-repository/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step7
In directory cvs.zope.org:/tmp/cvs-serv6842/Step7
Modified Files:
configure.zcml
Log Message:
Ran the extraction tool, so we can turn on use of the translation
files.
It would be good to get some translations now. :)
=== Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step7/configure.zcml 1.3 => 1.4 ===
--- Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step7/configure.zcml:1.3 Wed Dec 3 06:33:07 2003
+++ Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step7/configure.zcml Wed Dec 3 09:56:29 2003
@@ -4,7 +4,7 @@
xmlns:global_translation="http://namespaces.zope.org/gts"
i18n_domain="zopeproducts.contact">
-
+
Update of /cvs-repository/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5/translation_files
In directory cvs.zope.org:/tmp/cvs-serv6842/Step5/translation_files
Added Files:
zopeproducts.contact.pot
Log Message:
Ran the extraction tool, so we can turn on use of the translation
files.
It would be good to get some translations now. :)
=== Added File Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5/translation_files/zopeproducts.contact.pot ===
##############################################################################
#
# Copyright (c) 2003 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
msgid ""
msgstr ""
"Project-Id-Version: Zope X3 Pre-M4\n"
"POT-Creation-Date: Wed Dec 3 09:41:50 2003\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME \n"
"Language-Team: Zope 3 Developers \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: ENCODING\n"
"Generated-By: zope/app/translation_files/extract.py\n"
#: src/zopeproducts/contact/configure.zcml:18
msgid "View"
msgstr ""
#: src/zopeproducts/contact/configure.zcml:34
msgid "Edit"
msgstr ""
#: src/zopeproducts/contact/info.pt:13
msgid "Address:"
msgstr ""
#: src/zopeproducts/contact/info.pt:16
msgid "Email:"
msgstr ""
#: src/zopeproducts/contact/info.pt:19
msgid "City:"
msgstr ""
#: src/zopeproducts/contact/info.pt:22
msgid "State:"
msgstr ""
#: src/zopeproducts/contact/info.pt:3
msgid "Contact Information"
msgstr ""
#: src/zopeproducts/contact/info.pt:7
msgid "Contact information"
msgstr ""
#: src/zopeproducts/contact/info.pt:9
msgid "Name:"
msgstr ""
From cvs-admin at zope.org Wed Dec 3 09:56:27 2003
From: cvs-admin at zope.org (Jim Fulton)
Date: Sun Aug 10 16:40:38 2008
Subject: [Zope-book]
CVS: Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step6/translation_files
- zopeproducts.contact.pot:1.1
Message-ID: <200312031456.hB3EuRMu006893@cvs.zope.org>
Update of /cvs-repository/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step6/translation_files
In directory cvs.zope.org:/tmp/cvs-serv6842/Step6/translation_files
Added Files:
zopeproducts.contact.pot
Log Message:
Ran the extraction tool, so we can turn on use of the translation
files.
It would be good to get some translations now. :)
=== Added File Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step6/translation_files/zopeproducts.contact.pot ===
##############################################################################
#
# Copyright (c) 2003 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
msgid ""
msgstr ""
"Project-Id-Version: Zope X3 Pre-M4\n"
"POT-Creation-Date: Wed Dec 3 09:42:26 2003\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME \n"
"Language-Team: Zope 3 Developers \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: ENCODING\n"
"Generated-By: zope/app/translation_files/extract.py\n"
#: src/zopeproducts/contact/configure.zcml:37
msgid "View"
msgstr ""
#: src/zopeproducts/contact/configure.zcml:53
msgid "Edit"
msgstr ""
#: src/zopeproducts/contact/info.pt:13
msgid "Address:"
msgstr ""
#: src/zopeproducts/contact/info.pt:16
msgid "Email:"
msgstr ""
#: src/zopeproducts/contact/info.pt:19
msgid "City:"
msgstr ""
#: src/zopeproducts/contact/info.pt:22
msgid "State:"
msgstr ""
#: src/zopeproducts/contact/info.pt:3
msgid "Contact Information"
msgstr ""
#: src/zopeproducts/contact/info.pt:7
msgid "Contact information"
msgstr ""
#: src/zopeproducts/contact/info.pt:9
msgid "Name:"
msgstr ""
From cvs-admin at zope.org Fri Dec 5 01:06:22 2003
From: cvs-admin at zope.org (Jim Fulton)
Date: Sun Aug 10 16:40:38 2008
Subject: [Zope-book]
CVS: Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step9
Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step9
- New directory
Message-ID: <200312050606.hB566MQn009700@cvs.zope.org>
Update of /cvs-repository/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step9
In directory cvs.zope.org:/tmp/cvs-serv9675/Step9
Log Message:
Directory /cvs-repository/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step9 added to the repository
=== Added directory Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step9 ===
From cvs-admin at zope.org Fri Dec 5 01:21:17 2003
From: cvs-admin at zope.org (Jim Fulton)
Date: Sun Aug 10 16:40:38 2008
Subject: [Zope-book]
CVS: Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step9
- __init__.py:1.1 browser.py:1.1 configure.zcml:1.1
contact.gif:1.1 contact.py:1.1 folder.py:1.1 info.pt:1.1
interfaces.py:1.1 stubpostal.py:1.1 tests.py:1.1
Message-ID: <200312050621.hB56LHcK012320@cvs.zope.org>
Update of /cvs-repository/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step9
In directory cvs.zope.org:/tmp/cvs-serv12283/Step9
Added Files:
__init__.py browser.py configure.zcml contact.gif contact.py
folder.py info.pt interfaces.py stubpostal.py tests.py
Log Message:
Added a step 9 on creating containers.
Note that I'm going to merge the existing chapter 2
into chapter 1 as step 8 after the current sprints.
=== Added File Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step9/__init__.py ===
=== Added File Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step9/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/Chapter1/Step9/configure.zcml ===
=== Added File Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step9/contact.gif ===
=== Added File Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step9/contact.py ===
import persistence
from zope.interface import implements
from interfaces import IContact, IContactContained
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, IContactContained)
__parent__ = __name__ = None
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):
"""Get the name of a contact, combining the first and last names
>>> bob = Contact('Bob', 'Smith', '', '', '')
>>> bob.name()
'Bob Smith'
"""
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/Chapter1/Step9/folder.py ===
##############################################################################
#
# Copyright (c) 2003 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Contact lists
$Id: folder.py,v 1.1 2003/12/05 06:21:16 jim Exp $
"""
import zope.app.container.btree
import zope.interface
from interfaces import IContactFolder
class ContactFolder(zope.app.container.btree.BTreeContainer):
zope.interface.implements(IContactFolder)
=== Added File Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step9/info.pt ===
Contact Information
Contact information
Name: |
First
Last |
Address: |
Mailing address here |
Email: |
foo@bar.com |
City: |
City |
State: |
State |
=== Added File Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step9/interfaces.py ===
import re
from zope.interface import Interface
from zope.schema import Text, TextLine, Field
from zope.app.interfaces.container import IContained
import zope.app.interfaces.container
from zope.app.container.constraints import ContainerTypesConstraint
from zope.app.container.constraints import ItemTypePrecondition
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.
"""
class IContactFolder(zope.app.interfaces.container.IContainer):
def __setitem__(name, object):
"""Add a contact"""
__setitem__.precondition = ItemTypePrecondition(IContact)
class IContactContained(IContained):
__parent__ = Field(constraint = ContainerTypesConstraint(IContactFolder))
=== Added File Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step9/stubpostal.py ===
# Stub postal utility implemantation
from zope.interface import implements
from interfaces import IPostalLookup, IPostalInfo
class Info:
implements(IPostalInfo)
def __init__(self, city, state):
self._city, self._state = city, state
def city(self): return self._city
def state(self): return self._state
class Lookup:
implements(IPostalLookup)
_data = {
'22401': ('Fredericksburg', 'Virginia'),
'44870': ('Sandusky', 'Ohio'),
'90051': ('Los Angeles', 'California'),
}
def lookup(self, postal_code):
data = self._data.get(postal_code)
if data: return Info(*data)
=== Added File Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step9/tests.py ===
##############################################################################
#
# Copyright (c) 2003 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Test module for contacts example
$Id: tests.py,v 1.1 2003/12/05 06:21:16 jim Exp $
"""
import unittest
import doctest
from zopeproducts.contact.contact import Contact
def test_partial_contact_update():
"""We can use keyword arguments to update selected data
>>> bob = Contact("bob", "smith", "bob@zope.com", "513 Prince Edward",
... "22402")
>>> bob.update(email='bob.smith@zope.com', pc='22401')
>>> bob.first()
'bob'
>>> bob.last()
'smith'
>>> bob.email()
'bob.smith@zope.com'
>>> bob.address()
'513 Prince Edward'
>>> bob.postal_code()
'22401'
"""
def test_suite():
return unittest.TestSuite((
doctest.DocTestSuite(),
doctest.DocTestSuite('zopeproducts.contact.contact'),
))
if __name__ == '__main__': unittest.main()
From cvs-admin at zope.org Fri Dec 5 01:21:26 2003
From: cvs-admin at zope.org (Jim Fulton)
Date: Sun Aug 10 16:40:38 2008
Subject: [Zope-book]
CVS: Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1
- container.sxi:1.1
Message-ID: <200312050621.hB56LQas012347@cvs.zope.org>
Update of /cvs-repository/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1
In directory cvs.zope.org:/tmp/cvs-serv12328
Added Files:
container.sxi
Log Message:
Slides on creating containers. These will eventually be merged into
slides.sxi.
=== Added File Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/container.sxi ===
From cvs-admin at zope.org Fri Dec 5 06:10:29 2003
From: cvs-admin at zope.org (Jim Fulton)
Date: Sun Aug 10 16:40:38 2008
Subject: [Zope-book]
CVS: Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step9
- contact.py:1.2 tests.py:1.2
Message-ID: <200312051110.hB5BATcG012385@cvs.zope.org>
Update of /cvs-repository/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step9
In directory cvs.zope.org:/tmp/cvs-serv12170
Modified Files:
contact.py tests.py
Log Message:
Fixed name method and tests to reflect schema-based implementation.
=== Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step9/contact.py 1.1 => 1.2 ===
--- Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step9/contact.py:1.1 Fri Dec 5 01:21:16 2003
+++ Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step9/contact.py Fri Dec 5 06:10:28 2003
@@ -29,7 +29,7 @@
>>> bob.name()
'Bob Smith'
"""
- return "%s %s" % (self._first, self._last)
+ return "%s %s" % (self.first, self.last)
class ContactCityState:
"Provide access to city and state information for a contact"
=== Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step9/tests.py 1.1 => 1.2 ===
--- Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step9/tests.py:1.1 Fri Dec 5 01:21:16 2003
+++ Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step9/tests.py Fri Dec 5 06:10:28 2003
@@ -19,27 +19,8 @@
import doctest
from zopeproducts.contact.contact import Contact
-def test_partial_contact_update():
- """We can use keyword arguments to update selected data
-
- >>> bob = Contact("bob", "smith", "bob@zope.com", "513 Prince Edward",
- ... "22402")
- >>> bob.update(email='bob.smith@zope.com', pc='22401')
- >>> bob.first()
- 'bob'
- >>> bob.last()
- 'smith'
- >>> bob.email()
- 'bob.smith@zope.com'
- >>> bob.address()
- '513 Prince Edward'
- >>> bob.postal_code()
- '22401'
- """
-
def test_suite():
return unittest.TestSuite((
- doctest.DocTestSuite(),
doctest.DocTestSuite('zopeproducts.contact.contact'),
))
From cvs-admin at zope.org Mon Dec 8 00:25:28 2003
From: cvs-admin at zope.org (Jim Fulton)
Date: Sun Aug 10 16:40:38 2008
Subject: [Zope-book]
CVS: Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1
- slides.sxi:1.25 container.sxi:NONE
Message-ID: <200312080525.hB85PSR7006695@cvs.zope.org>
Update of /cvs-repository/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1
In directory cvs.zope.org:/tmp/cvs-serv6673
Modified Files:
slides.sxi
Removed Files:
container.sxi
Log Message:
Merged the schema/forms and container slides into the chapter 1
slides.
=== Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/slides.sxi 1.24 => 1.25 ===
=== Removed File Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/container.sxi ===
From cvs-admin at zope.org Mon Dec 8 07:12:41 2003
From: cvs-admin at zope.org (Jim Fulton)
Date: Sun Aug 10 16:40:38 2008
Subject: [Zope-book]
CVS: Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1
- slides.sxi:1.26
Message-ID: <200312081212.hB8CCftr032063@cvs.zope.org>
Update of /cvs-repository/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1
In directory cvs.zope.org:/tmp/cvs-serv32035
Modified Files:
slides.sxi
Log Message:
Saved again with password turned off. Sheesh.
=== Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/slides.sxi 1.25 => 1.26 ===
From jim at zope.com Wed Dec 10 04:00:04 2003
From: jim at zope.com (Jim Fulton)
Date: Sun Aug 10 16:40:38 2008
Subject: [Zope-book]
CVS: Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1
- slides.sxi:1.27
Message-ID: <200312100900.hBA904hH022850@cvs.zope.org>
Update of /cvs-repository/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1
In directory cvs.zope.org:/tmp/cvs-serv22694
Modified Files:
slides.sxi
Log Message:
Fixed some broken images. I hope they remain fixed. :/
=== Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/slides.sxi 1.26 => 1.27 ===
From jim at zope.com Wed Dec 10 04:59:01 2003
From: jim at zope.com (Jim Fulton)
Date: Sun Aug 10 16:40:38 2008
Subject: [Zope-book]
CVS: Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5
- contact.py:1.4
Message-ID: <200312100959.hBA9x1Ji032384@cvs.zope.org>
Update of /cvs-repository/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5
In directory cvs.zope.org:/tmp/cvs-serv32365
Modified Files:
contact.py
Log Message:
Added adapter test.
=== Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5/contact.py 1.3 => 1.4 ===
--- Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5/contact.py:1.3 Wed Dec 3 06:33:05 2003
+++ Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/Step5/contact.py Wed Dec 10 04:59:00 2003
@@ -83,7 +83,50 @@
self._pc = pc
class ContactCityState:
- "Provide access to city and state information for a contact"
+ """Provide access to city and state information for a contact
+
+ The adapter depends on the existence of a postal-lookup utility.
+ We'll register out stub utility. To do that, we'll use the Zope
+ Testing API, ztapi, which makes setting up a utility pretty easy.
+ Before we canm do that, we have to set up the standard component
+ services. There is a standard setUp function that does that for
+ us:
+
+ >>> from zope.app.tests.placelesssetup import setUp
+ >>> setUp()
+
+ Now we can set up the utility:
+
+ >>> from zope.app.tests import ztapi
+ >>> from zopeproducts.contact.stubpostal import Lookup
+ >>> ztapi.provideUtility(IPostalLookup, Lookup())
+
+ Now, we'll create a contact without a postal code:
+
+ >>> contact = Contact()
+
+ The city and state from the adapter are blank:
+
+ >>> adapter = ContactCityState(contact)
+ >>> adapter.city(), adapter.state()
+ ('', '')
+
+ If we give a known postal code (e.g. Fredericksburg):
+
+ >>> contact.update(pc='22401')
+
+ Then we'll get a city and state values from the adapter:
+
+ >>> adapter = ContactCityState(contact)
+ >>> adapter.city(), adapter.state()
+ ('Fredericksburg', 'Virginia')
+
+ We always need to tear down anything we set up:
+
+ >>> from zope.app.tests.placelesssetup import tearDown
+ >>> tearDown()
+
+ """
zope.interface.implements(IPostalInfo)
From jim at zope.com Wed Dec 10 06:18:41 2003
From: jim at zope.com (Jim Fulton)
Date: Sun Aug 10 16:40:38 2008
Subject: [Zope-book]
CVS: Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1
- slides.sxi:1.28
Message-ID: <200312101118.hBABIflu012341@cvs.zope.org>
Update of /cvs-repository/Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1
In directory cvs.zope.org:/tmp/cvs-serv12168
Modified Files:
slides.sxi
Log Message:
Added slides on doing setup in (doctest) unit tests.
Fixed some slides to mek them more visible on projectors that
don't show gray well.
=== Docs/ZopeComponentArchitecture/PythonProgrammerTutorial/Chapter1/slides.sxi 1.27 => 1.28 ===